index.ctp 2.53 KB

<div class="sites index">
	
	<!--  TITRE  -->
	<?php echo '<h2><i class="icon-list"></i> Liste des sites</h2>'; ?>
	
	<!-- Bouton "Ajouter" pour ajouter un nouvel élément (ssi autorisé) -->
	<?=$this->element('button_add'); ?>
	<!-- 
	<=$this->element('button_add', ['singularHumanName' => 'Site']); ?>
	<div id="boutons" class="actions" style="margin-bottom:5px; width:100%; float:none; padding:5px 0;">
	<php
	    //$entity = $this->request->controller; // controller name (Sites, Suivis, Organismes, ...)
	    $bStyle = 'margin-right: 10px';
	    $CAN_ADD = false;
	    if (
            in_array($role, ['Administration Plus','Super Administrateur'])
	        ||
	        in_array($singularHumanName, ['Matériel','Suivi','Emprunt','Fournisseur'])
	    ) $CAN_ADD = true;
	    if ($CAN_ADD) $echoActionButton($this->Html, 'icon-plus', $bStyle, ' Ajouter', $this->request->controller, 'add', null);
    ?>
    </div>
	-->
	
    <table style="border-collapse: separate; border-spacing: 0; width: 270px;">
    
		<thead>
			<tr>
				<th class="actions"><?= __('') ?></th>
				<th><?= $this->Paginator->sort('nom', 'Nom') ?></th>
			</tr>
		</thead>
		
		<tbody>
			<?php
			foreach ($sites as $site) {
                if ($site->id != 9) {
            ?>
                    <tr>
        				<td class="actions" style="padding: 6px 0; text-align: left;">             
                            <?php 
                            if (in_array($role, ['Administration Plus', 'Super Administrateur']))
                                echo $this->Html->link(__('<i class="icon-pencil"></i>'), ['action' => 'edit', $site->id], ['title' => 'Editer', 'style' => 'margin: 0 2px', 'escape' => false ]);
                            if (in_array($role, ['Super Administrateur']))
                                echo $this->Form->postLink(__('<i class="icon-trash"></i>'), ['action' => 'delete', $site->id], ['title' => 'Supprimer', 'style' => 'margin: 0 2px', 'escape' => false, 'confirm' => __('Êtes-vous sur de vouloir supprimer # {0}?', $site->id)]);
                        	?>
                        </td>
        				<td class="smallText"><?= $this->Html->link($site->nom, ['action' => 'view', $site->id]) ?></td>
        			</tr>
            <?php
                } // if
    		} // foreach
            ?>
		</tbody>

	</table>

	<?php echo $this->element('pagination'); ?> 
    
</div>

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

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