index.ctp 2.74 KB

<div class="categories index">
<?php echo '<h2><i class="icon-list"></i> Liste des catégories</h2>'; ?>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
            	<th class="actions"><?= __('') ?></th>
                <th><?= $this->Paginator->sort('nom', 'Nom') ?></th>
                <th><?= $this->Paginator->sort('sur_categorie_id', 'Domaine') ?></th>
                
            </tr>
        </thead>
        <tbody>
            <?php foreach ($categories as $category): ?>
            <tr>
                <td class="actions" style="padding: 6px 0; text-align: left;">
                    <?= $this->Html->link(__('<i class="icon-eye-open"></i>'), ['action' => 'view', $category->id], ['title' => 'Visualiser', 'style' => 'margin: 0 2px', 'escape' => false ]) ?>
                    
                    <?php if (in_array($role, ['Administration Plus', 'Super Administrateur'])) { ?>
                    <?= $this->Html->link(__('<i class="icon-pencil"></i>'), ['action' => 'edit', $category->id], ['title' => 'Editer', 'style' => 'margin: 0 2px', 'escape' => false ]) ?>
                   	<?php } ?>
                   	
                    <?php if (in_array($role, ['Super Administrateur'])) { ?>
                    <?= $this->Form->postLink(__('<i class="icon-trash"></i>'), ['action' => 'delete', $category->id], ['title' => 'Supprimer', 'style' => 'margin: 0 2px', 'escape' => false, 'confirm' => __('Êtes-vous sur de vouloir supprimer # {0}?', $category->id)]) ?>
               		<?php } ?>
                </td>
            
                <td class="smallText"><?= $this->Html->link($category->nom, ['action' => 'view', $category->id]) ?></td>
                <td class="smallText"><?= $category->has('sur_category') ? $this->Html->link($category->sur_category->nom, ['controller' => 'SurCategories', 'action' => 'view', $category->sur_category->id]) : '' ?></td>
                

                
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>
    
    <p><?= $this->Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?></p>
    
    <div class="paging" style="color: black;">
    		<?= $this->Paginator->first('<< ' . __(''), ['class' => 'prev']) ?>
            <?= $this->Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?>
            <?= $this->Paginator->numbers(['separator' => '']) ?>
            <?= $this->Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?>
            <?= $this->Paginator->last(__('') . ' >>', ['class' => 'next']) ?>
    </div>
</div>

    	<div class="actions">
			<?php echo $this->element('menu') ?>
			<?php echo $this->element('menu_index', 
			[ 'pluralHumanName' => 'Catégories',
			'singularHumanName' => 'Catégorie' ]) ?>
		</div>