add_edit.ctp
3.92 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\Projet $projet
*/
// add or edit mode ? true=add ; false=edit
$IS_ADD = $IS_ADD;
$IS_EDIT = !$IS_ADD;
$entity = $entity;
$entity_name = 'projet';
$groupes_thematiques = $groupes_thematiques;
$pis = $pis;
$pms = $pms;
//debug($entity);
//debug($pis);
// ADD only
if ($IS_ADD) {
$verb = 'Ajouter';
$icon = 'icon-plus';
$redirect_action = 'index';
}
// EDIT only
else {
$verb = 'Éditer';
$icon = 'icon-edit';
$redirect_action = 'view';
}
?>
<!--
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><S= __('Actions') ?></li>
<li><S= $this->Html->link(__('List Projets'), ['action' => 'index']) ?></li>
<li><S= $this->Html->link(__('List Groupes Thematiques'), ['controller' => 'GroupesThematiques', 'action' => 'index']) ?></li>
<li><S= $this->Html->link(__('New Groupes Thematique'), ['controller' => 'GroupesThematiques', 'action' => 'add']) ?></li>
<li><S= $this->Html->link(__('List Users'), ['controller' => 'Users', 'action' => 'index']) ?></li>
<li><S= $this->Html->link(__('New User'), ['controller' => 'Users', 'action' => 'add']) ?></li>
<li><S= $this->Html->link(__('List Materiels'), ['controller' => 'Materiels', 'action' => 'index']) ?></li>
<li><S= $this->Html->link(__('New Materiel'), ['controller' => 'Materiels', 'action' => 'add']) ?></li>
</ul>
</nav>
-->
<div class="projets form large-9 medium-8 columns content">
<?= $this->Form->create($entity) ?>
<fieldset>
<legend><?= __("$verb $entity_name") ?></legend>
<?php
echo $this->Form->control('nom');
echo $this->Form->control('description');
echo $this->Form->control('groupes_thematique_id', ['label'=>'Groupe thématique', 'options' => $groupes_thematiques, 'empty' => true]);
echo $this->Form->control('chef_science_id', ['label' => 'Responsable scientifique', 'options' => $pis, 'empty' => true]);
echo $this->Form->control('chef_projet_id', ['label' => 'Chef de projet', 'options' => $pms, 'empty' => true]);
$comment = 'Entrez une date (JJ/MM/AAAA)';
echo $this->Form->control('date_start', [
//'empty' => true,
'type' => 'text',
'label' => 'Date début projet',
'class' => 'datepicker',
'placeholder' => $comment,
// ADD only
'default' => date("d/m/Y"),
// A CAUSE DE CE FICHU PHP5 ET VIEUX MYSQL !!!, INUTILE EN PHP7 !!
// Affichage dd/mm/yy
//'value' => $materiel->date_acquisition->format('d/m/y'),
'value' => $IS_ADD ? null : ($entity->date_start ? $entity->date_start->format('d/m/Y') : null),
// EDIT only
//'disabled' => $IS_ADD ? false : $isReadonlyField('date_acquisition', $myReadonlyFields)
]);
echo $this->Form->control('date_stop', [
//'empty' => true,
'type' => 'text',
'label' => 'Date fin projet',
'class' => 'datepicker',
'placeholder' => $comment,
// ADD only
//'default' => date("d/m/Y"),
// A CAUSE DE CE FICHU PHP5 ET VIEUX MYSQL !!!, INUTILE EN PHP7 !!
// Affichage dd/mm/yy
//'value' => $materiel->date_acquisition->format('d/m/y'),
'value' => $IS_ADD ? null : ($entity->date_stop ? $entity->date_stop->format('d/m/Y') : null),
// EDIT only
//'disabled' => $IS_ADD ? false : $isReadonlyField('date_acquisition', $myReadonlyFields)
]);
?>
</fieldset>
<?= $this->Form->submit(__('Valider')) ?>
<?php //= $this->Form->button(__('Submit')) ?>
<?= $this->Form->end() ?>
</div>