30@phan-var-force string $dateformatinput
31@phan-var-force string $dateformat
32@phan-var-force string $datehourformat
33@phan-var-force array<int,array{task_id:int,task_alternate_id:int,task_project_id:int,task_parent:int,task_is_group:int<0,1>,task_css:string,task_position:int,task_planned_workload:int,task_milestone:int,task_percent_complete:float,task_name:string,task_start_date:int,task_end_date:int,task_color:string,task_resources:string,note:string,task_parent_alternate_id:int}> $tasks
34@phan-var-force array{} $task_dependencies
38<div
id=
"principal_content" style=
"margin-left: 0;">
39 <div style=
"margin-left: 0; position: relative;" class=
"gantt" id=
"GanttChartDIV"></div>
41 <script
type=
"text/javascript">
43function DisplayHideRessources(boxName) {
44 graphFormat = g.getFormat();
45 if(boxName.checked ==
true) {
46 booShowRessources = 1;
49 booShowRessources = 0;
54function DisplayHideDurations(boxName) {
55 graphFormat = g.getFormat();
56 if(boxName.checked ==
true) {
65function DisplayHideComplete(boxName) {
66 graphFormat = g.getFormat();
67 if(boxName.checked ==
true) {
76function selectBarText(value) {
77 graphFormat = g.getFormat();
78 id=value.options[value.selectedIndex].value;
83function reloadGraph() {
84 g.setShowRes(booShowRessources);
85 g.setShowComp(booShowComplete);
86 g.setShowDur(booShowDurations);
87 g.setCaptionType(barText);
88 g.setFormat(graphFormat);
89 g.Draw(jQuery(
"#tabs").width()-40);
94var g =
new JSGantt.GanttChart(document.getElementById(
'GanttChartDIV'),
'day');
96if (g.getDivId() !=
null)
99 var booShowRessources = 1;
100 var booShowDurations = 1;
101 var booShowComplete = 1;
102 var barText =
"Resource";
103 var graphFormat =
"day";
105 g.setDateInputFormat(
'<?php echo $dateformatinput; ?>');
106 g.setDateTaskTableDisplayFormat(
'<?php echo $dateformat; ?>');
107 g.setDateTaskDisplayFormat(
'<?php echo $datehourformat; ?>');
108 g.setDayMajorDateDisplayFormat(
'dd mon');
112 g.setShowStartDate(1);
114 g.setShowTaskInfoLink(1);
115 g.setFormatArr(
"day",
"week",
"month")
116 g.setCaptionType(
'Caption');
118 g.setDayColWidth(20);
120 g.addLang(
'<?php print $langs->getDefaultLang(1); ?>', vLangs[
'<?php print $langs->getDefaultLang(1); ?>']);
121 g.setLang(
'<?php print $langs->getDefaultLang(1); ?>');
126 echo
"/* g.AddTaskItem(new JSGantt.TaskItem(task_id, 'label', 'start_date', 'end_date', 'css', 'link', milestone, 'Resources', Compl%, Group, Parent, Open, 'Dependency', 'label','note', g)); */\n";
129 $tnums = count($tasks);
131 for ($tcursor = 0; $tcursor < $tnums; $tcursor++) {
132 $t = $tasks[$tcursor];
134 if (empty($old_project_id) || $old_project_id != $t[
'task_project_id']) {
136 $projecttmp =
new Project($db);
137 $projecttmp->fetch($t[
'task_project_id']);
139 'task_id' => (
int) -$t[
'task_project_id'],
140 'task_alternate_id' => (
int) -$t[
'task_project_id'],
141 'task_name' => $projecttmp->ref.
' '.$projecttmp->title,
142 'task_resources' =>
'',
143 'task_start_date' => $projecttmp->date_start,
144 'task_end_date' => (!empty($projecttmp->date_end) ? $projecttmp->date_end : 0),
145 'task_is_group' => 1,
'task_position' => 0,
'task_css' =>
'ggroupblack',
'task_milestone' => 0,
'task_parent' => 0,
'task_parent_alternate_id' => 0,
147 'task_planned_workload' => 0
150 $old_project_id = $t[
'task_project_id'];
153 if ($t[
"task_parent"] <= 0) {
162 g.Draw(jQuery(
"#tabs").width()-40);
163 setTimeout(
'g.DrawDependencies()',100);
167 alert(
"<?php echo $langs->trans("FailedToDefinGraph
"); ?>");
188 global $dateformatinput2;
190 $start_date = $task[
"task_start_date"];
191 $end_date = $task[
"task_end_date"];
193 $end_date = $start_date;
198 $resources = $task[
"task_resources"];
203 foreach ($task_dependencies as $value) {
205 if ($value[0] == $task[
'task_id']) {
206 $depend .= ($count > 0 ?
"," :
"").$value[1];
212 if ($project_id && $level < 0) {
213 $parent =
'-'.$project_id;
215 $parent = $task[
"task_parent_alternate_id"];
219 $percent = empty($task[
'task_percent_complete']) ? 0 : $task[
'task_percent_complete'];
221 if ($task[
"task_id"] < 0) {
225 $link = DOL_URL_ROOT.
'/projet/tasks/contact.php?withproject=1&id='.$task[
"task_id"];
230 $name = $task[
'task_name'];
263 $s =
"\n// Add task level = ".$level.
" id=".$task[
"task_id"].
" parent_id=".$task[
"task_parent"].
" aternate_id=".$task[
"task_alternate_id"].
" parent_aternate_id=".$task[
"task_parent_alternate_id"].
"\n";
268 $css = $task[
'task_css'];
269 $line_is_auto_group = $task[
"task_is_group"];
276 $taskid = $task[
"task_alternate_id"];
279 $note = empty($task[
'note']) ?
'' : $task[
'note'];
281 $note =
dol_concatdesc($note, $langs->trans(
"Workload").
' : '.(empty($task[
'task_planned_workload']) ?
'' :
convertSecondToTime($task[
'task_planned_workload'],
'allhourmin')));
283 $s .=
"g.AddTaskItem(new JSGantt.TaskItem('".$taskid.
"', '".
dol_escape_js(trim($name)).
"', '".$start_date.
"', '".$end_date.
"', '".$css.
"', '".$link.
"', ".$task[
'task_milestone'].
", '".
dol_escape_js($resources).
"', ".($percent >= 0 ? $percent : 0).
", ".$line_is_auto_group.
", '".$parent.
"', 1, '".$dependency.
"', '".(empty($task[
"task_is_group"]) ? (($percent >= 0 && $percent !=
'') ? $percent.
'%' :
'') :
'').
"', '".
dol_escape_js($note).
"', g));";
301 for ($x = 0; $x < $n; $x++) {
302 if ($tarr[$x][
"task_parent"] == $parent && $tarr[$x][
"task_parent"] != $tarr[$x][
"task_id"]) {
Class to manage projects.
convertSecondToTime($iSecond, $format='all', $lengthOfDay=86400, $lengthOfWeek=7)
Return, in clear text, value of a number of seconds in days, hours and minutes.
dol_escape_js($stringtoescape, $mode=0, $noescapebackslashn=0)
Returns text escaped for inclusion into javascript code.
dol_concatdesc($text1, $text2, $forxml=false, $invert=false)
Concat 2 descriptions with a new line between them (second operand after first one with appropriate n...
dol_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false, $decorate=0)
Output date in a string format according to outputlangs (or langs if not defined).
findChildGanttLine($tarr, $parent, $task_dependencies, $level)
Find child Gantt line.
constructGanttLine($tarr, $task, $task_dependencies, $level=0, $project_id=null)
Add a gantt chart line.
if(preg_match('/(crypted|dolcrypt):/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type
'integer', 'integer:ObjectClass:PathToClass[:AddCreateButtonOrNot[:Filter[:Sortfield]]]',...