index.ctp
3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<div class="documents index">
<?php echo '<h2><i class="icon-list"></i> Liste des documents</h2>'; ?>
<table style="border-collapse: separate; border-spacing: 0; width: 270px;">
<thead>
<tr>
<th class="actions"><?= __('') ?></th>
<th><?= $this->Paginator->sort('nom', 'Nom') ?></th>
<th><?= $this->Paginator->sort('materiel_id', 'Materiel') ?></th>
<th><?= $this->Paginator->sort('suivi_id', 'Suivi') ?></th>
<th><?= $this->Paginator->sort('type_document_id', 'Type') ?></th>
<th><?= $this->Paginator->sort('type_doc', 'Extension fichier') ?></th>
<th><?= $this->Paginator->sort('photo', 'Miniature') ?></th>
</tr>
</thead>
<tbody>
<?php
foreach ($documents as $document) :
if ($document->photo) {
$p = 'Oui';
} else {
$p = '';
}
?>
<tr>
<td class="actions" style="padding: 6px 0; text-align: left;">
<?php
if ($document->photo) {
echo $this->Form->postLink(__('<i class="icon-download-alt"></i>'), '/webroot/img/photos/' . $document->id . '.' . $document->type_doc, [
'title' => 'Télécharger',
'style' => 'margin: 0 2px',
'escape' => false
]);
} else {
echo $this->Form->postLink(__('<i class="icon-download-alt"></i>'), '/webroot/files/' . $document->id . '.' . $document->type_doc, [
'title' => 'Télécharger',
'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->nom)]) ?>
</td>
<td class="smallText"><?= $this->Html->link($document->nom, ['action' => 'view', $document->id]) ?></td>
<?php if(!empty($document->materiel_id)) { ?>
<td class="smallText"><?= $this->Html->link($materiel->find()->where(['id =' => $document->materiel_id])->first()['designation'], ['controller' => 'Materiels', 'action' => 'view', $document->materiel_id]) ?></td>
<td class="smallText"></td>
<?php } else {?>
<td class="smallText"></td>
<td class="smallText"><?= $this->Html->link('Suivi '.$document->suivi_id, ['controller' => 'Suivis', 'action' => 'view', $document->suivi_id]) ?></td>
<?php } ?>
<td class="smallText"><?= $document->has('type_document') ? h($document->type_document->nom) : '' ?></td>
<td class="smallText"><?= h($document->type_doc) ?></td>
<td class="smallText"><?= $p ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<?php echo $this->element('pagination'); ?>
</div>
<!--
<div class="actions">
<php echo $this->element('menu') ?>
</div>
-->