/
checklist.php
120 lines (78 loc) · 2.18 KB
/
checklist.php
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
require 'config.php';
dol_include_once('/checklist/class/checklist.class.php');
$langs->load('checklist@checklist');
$type_object = GETPOST('type_object');
$fk_object = GETPOST('fk_object');
$action =GETPOST('action');
$PDOdb=new TPDOdb;
$c = new TChecklist;
$c->loadBy($PDOdb, $type_object, $fk_object);
switch ($action) {
case 'yesido':
//$PDOdb->debug=true;
$c->iDoIt(GETPOST('k'));
$c->setCheck();
$c->save($PDOdb);
break;
default:
break;
}
_fiche($c);
function _fiche(&$c) {
global $db,$conf,$langs,$user;
llxHeader('','Checklist');
$PDOdb=new TPDOdb;
if($c->type_object == 'project') {
dol_include_once('/projet/class/project.class.php');
dol_include_once('/core/lib/project.lib.php');
$object = new Project($db);
$object->fetch($c->fk_object);
$head=project_prepare_head($object);
dol_fiche_head($head, 'checklist', $langs->trans("Project"),0,($object->public?'projectpub':'project'));
}
?>
<table class="border" >
<tr class="liste_titre">
<td class="liste_titre"><?php echo $langs->trans('Label'); ?></td>
<?php
for($ii = 0; $ii<$c->levelAnswer; $ii++) {
echo '<td class="liste_titre"> </td>'; // '.($ii+1).'
}
if($user->rights->checklist->write) {
?>
<td class="liste_titre"><?php echo $langs->trans('YesIDo') ?></td>
<?php
}
?>
</tr>
<?php
foreach($c->TCheck as $k=>&$check) {
echo '<tr>';
echo '<td>'.$check['label'].'</td>';
$Tab = $check['answers'];
for($ii = 0; $ii<$c->levelAnswer; $ii++) {
$a = each($Tab);
echo '<td>';
if(!empty($a)) {
$date = $a['key'];
$value = $a['value'];
if($value['value'] === true) {
$u=new User($db);
$u->fetch($value['fk_user']);
echo dol_print_date($date).img_info($u->login);
}
}
echo '</td>';
}
if($user->rights->checklist->write) {
echo '<td><a href="?action=yesido&k='.$k.'&type_object='.$c->type_object.'&fk_object='.$c->fk_object.'">'.img_picto($langs->trans('YesIDo'),'history.png').'</a></td>';
}
echo '</tr>';
}
?>
</table>
<?php
dol_fiche_end();
llxFooter();
}