view.ctp 3.16 KB

<div class="sites view">
	<h2>Détail site</h2>
	<table style="margin-bottom: 30px;">

		<tr>
			<th style="width: 250px;"></th>
			<th></th>
		</tr>
    	
    	<?php
    if (in_array($role, [
        'Administration Plus',
        'Super Administrateur'
    ])) {
        echo $this->Html->link(__('<i class="icon-pencil"></i> Editer ce site'), [
            'action' => 'edit',
            $site->id
        ], [
            'style' => 'margin-right: 40px; display: inline-block',
            'escape' => false,
            'onclick' => 'return true;'
        ]);
    }
    
    if (in_array($role, [
        'Super Administrateur'
    ])) {
        echo $this->Form->postLink(__('<i class="icon-trash"></i> Supprimer ce site'), [
            'action' => 'delete',
            $site->id
        ], [
            'style' => 'display: inline-block',
            'escape' => false,
            'confirm' => __('Êtes-vous sur de vouloir supprimer # {0}?', $site->id)
        ]);
    }
    
    $displayElement(__('Nom'), h($site->nom));
    ?>


    </table>

	<h3 id="t_suivis" style="cursor: pointer;">
		<i class="icon-chevron-down" style="font-size: 14px;" id="i_suivis"></i>
		<span style="text-decoration: underline;">Emprunts associées (<?= $emprunts->count()?>)</span>
	</h3>
	<div id="suivis" style="margin-bottom: 20px;">

        <?php if (!empty($emprunts)) { ?>
        <table>
			<tr>
				<th><?= __('Nom') ?></th>
				<th style="width: 50px;"><?= __('Détail') ?></th>
			</tr> 	
		<?php foreach ($emprunts as $emprunt): ?>
		<tr>

				<td><?= $this->Html->link('Emprunt '.h($emprunt->id), ['controller' => 'Emprunts', 'action' => 'view', h($emprunt->id)]); ?></td>

				<td class="actions">
                <?= $this->Html->link(__('<i class="icon-search"></i>'), ['controller' => 'Emprunts', 'action' => 'view', $emprunt->id], ['escape' => false, 'style' => 'margin:0']) ?>
			</td>
			</tr>
		<?php endforeach; ?> 
		</table> 
        <?php }else { echo 'Aucun emprunt lié à ce site.'; } ?>
    </div>

	<h3 id="t_suivis" style="cursor: pointer;">
		<i class="icon-chevron-down" style="font-size: 14px;" id="i_suivis"></i>
		<span style="text-decoration: underline;">Materiels associées (<?= $materiels->count()?>)</span>
	</h3>
	<div id="suivis" style="margin-bottom: 20px;">

        <?php if (!empty($materiels)) { ?>
        <table>
			<tr>
				<th><?= __('Désignation') ?></th>
				<th style="width: 50px;"><?= __('Détail') ?></th>
			</tr> 	
		<?php foreach ($materiels as $materiel): ?>
		<tr>

				<td><?= $this->Html->link(h($materiel->designation), ['controller' => 'Materiels', 'action' => 'view', h($materiel->id)]); ?></td>

				<td class="actions">
                <?= $this->Html->link(__('<i class="icon-search"></i>'), ['controller' => 'Materiels', 'action' => 'view', $materiel->id], ['escape' => false, 'style' => 'margin:0']) ?>
			</td>
			</tr>
		<?php endforeach; ?> 
		</table> 
        <?php }else { echo 'Aucun matériel lié à ce site.'; } ?>
    </div>

</div>


<!--
<div class="actions">
			<php echo $this->element('menu') ?>
			<php

echo $this->element('menu_view', [
    'pluralHumanName' => 'Sites',
    'singularHumanName' => 'Site',
    'lien' => $site->id
])?>
		</div>
-->