index.ctp 2.73 KB

<div class="documents index">
<?php echo '<h2><i class="icon-list"></i> Liste des documents</h2>'; ?>
    <table cellpadding="0" cellspacing="0">
        <thead>
            <tr>
                <th><?= $this->Paginator->sort('id', 'N°') ?></th>
                <th><?= $this->Paginator->sort('materiel_id', 'Materiel') ?></th>
                <th><?= $this->Paginator->sort('suivi_id', 'Suivi') ?></th>
                <th><?= $this->Paginator->sort('type_doc', 'Type') ?></th>
                <th class="actions"><?= __('') ?></th>
            </tr>
        </thead>
        <tbody>
            <?php foreach ($documents as $document): ?>
            <tr>
                <td><?= $this->Html->link('Fichier '.$this->Number->format($document->id), ['action' => 'view', $document->id]) ?></td>
                
                <?php if(!empty($document->materiel_id)) { ?>           
                	<td><?= $this->Html->link($materiel->find()->where(['id =' => $document->materiel_id])->first()['designation'], ['controller' => 'Materiels', 'action' => 'view', $document->materiel_id]) ?></td>
                	<td></td>
                <?php } else {?>
                	<td></td>
                	<td><?= $this->Html->link('Suivi '.$document->suivi_id, ['controller' => 'Suivis', 'action' => 'view', $document->suivi_id]) ?></td>
				<?php }  ?>
				<td><?= h($document->type_doc) ?></td>

                <td class="actions" style="padding: 6px 0;">
                    <?= $this->Html->link(__('<i class="icon-eye-open"></i>'), ['action' => 'view', $document->id], ['title' => 'Visualiser', 'style' => 'margin: 0 2px', 'escape' => false ]) ?>
                    <?= $this->Html->link(__('<i class="icon-pencil"></i>'), ['action' => 'edit', $document->id], ['title' => 'Editer', 'style' => 'margin: 0 2px', 'escape' => false ]) ?>
                    <?= $this->Form->postLink(__('<i class="icon-trash"></i>'), ['action' => 'delete', $document->id], ['title' => 'Supprimer', 'style' => 'margin: 0 2px', 'escape' => false, 'confirm' => __('Êtes-vous sur de vouloir supprimer # {0}?', $document->id)]) ?>
                </td>
            </tr>
            <?php endforeach; ?>
        </tbody>
    </table>

    <p><?= $this->Paginator->counter(['format' => 'Page {{page}} sur {{pages}}']) ?></p>
      	
   	<div class="paging">
            <?= $this->Paginator->prev('< ' . __(''), ['class' => 'prev disabled']) ?>
            <?= $this->Paginator->numbers(['separator' => '']) ?>
            <?= $this->Paginator->next(__('') . ' >', ['class' => 'next disabled']) ?>
    </div>

</div>

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