35@phan-var-force string $dateformatinput
36@phan-var-force string $dateformat
37@phan-var-force string $datehourformat
38@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
39@phan-var-force array{} $task_dependencies
43<!-- ganttchart.inc.php::begin -->
44<div
id=
"principal_content" style=
"margin-left: 0;">
45 <div style=
"margin-left: 0; position: relative;" class=
"gantt" id=
"GanttChartDIV"></div>
47 <script
type=
"text/javascript">
49function DisplayHideRessources(boxName) {
50 graphFormat = g.getFormat();
51 if(boxName.checked ==
true) {
52 booShowRessources = 1;
55 booShowRessources = 0;
60function DisplayHideDurations(boxName) {
61 graphFormat = g.getFormat();
62 if(boxName.checked ==
true) {
71function DisplayHideComplete(boxName) {
72 graphFormat = g.getFormat();
73 if(boxName.checked ==
true) {
82function selectBarText(value) {
83 graphFormat = g.getFormat();
84 id=value.options[value.selectedIndex].value;
89function reloadGraph() {
90 g.setShowRes(booShowRessources);
91 g.setShowComp(booShowComplete);
92 g.setShowDur(booShowDurations);
93 g.setCaptionType(barText);
94 g.setFormat(graphFormat);
95 g.Draw(jQuery(
"#tabs").width()-40);
100var g =
new JSGantt.GanttChart(document.getElementById(
'GanttChartDIV'),
'day');
102if (g.getDivId() !=
null)
105 var booShowRessources = 1;
106 var booShowDurations = 1;
107 var booShowComplete = 1;
108 var barText =
"Resource";
109 var graphFormat =
"day";
111 g.setDateInputFormat(
'<?php echo $dateformatinput; ?>');
112 g.setDateTaskTableDisplayFormat(
'<?php echo $dateformat; ?>');
113 g.setDateTaskDisplayFormat(
'<?php echo $datehourformat; ?>');
114 g.setDayMajorDateDisplayFormat(
'dd mon');
118 g.setShowStartDate(1);
120 g.setShowTaskInfoLink(1);
121 g.setFormatArr(
"day",
"week",
"month")
122 g.setCaptionType(
'Caption');
124 g.setDayColWidth(20);
126 g.addLang(
'<?php print $langs->getDefaultLang(1); ?>', vLangs[
'<?php print $langs->getDefaultLang(1); ?>']);
127 g.setLang(
'<?php print $langs->getDefaultLang(1); ?>');
132 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";
135 $tnums = count($tasks);
137 for ($tcursor = 0; $tcursor < $tnums; $tcursor++) {
138 $t = $tasks[$tcursor];
140 if (empty($old_project_id) || $old_project_id != $t[
'task_project_id']) {
143 $projecttmp->fetch($t[
'task_project_id']);
145 'task_id' => (
int) -$t[
'task_project_id'],
146 'task_alternate_id' => (
int) -$t[
'task_project_id'],
147 'task_name' => $projecttmp->ref.
' '.$projecttmp->title,
148 'task_resources' =>
'',
149 'task_start_date' => $projecttmp->date_start,
150 'task_end_date' => (!empty($projecttmp->date_end) ? $projecttmp->date_end : 0),
151 'task_is_group' => 1,
'task_position' => 0,
'task_css' =>
'ggroupblack',
'task_milestone' => 0,
'task_parent' => 0,
'task_parent_alternate_id' => 0,
153 'task_planned_workload' => 0
156 $old_project_id = $t[
'task_project_id'];
159 if ($t[
"task_parent"] <= 0) {
168 g.Draw(jQuery(
"#tabs").width()-40);
169 setTimeout(
'g.DrawDependencies()',100);
173 alert(
"<?php echo $langs->trans("FailedToDefinGraph
"); ?>");
177<!-- ganttchart.inc.php::end -->
195 global $dateformatinput2;
200 $start_date = $task[
"task_start_date"];
201 $end_date = $task[
"task_end_date"];
203 $end_date = $start_date;
208 $resources = $task[
"task_resources"];
213 foreach ($task_dependencies as $value) {
215 if ($value[0] == $task[
'task_id']) {
216 $depend .= ($count > 0 ?
"," :
"").$value[1];
222 if ($project_id && $level < 0) {
223 $parent =
'-'.$project_id;
225 $parent = $task[
"task_parent_alternate_id"];
229 $percent = empty($task[
'task_percent_complete']) ? 0 : $task[
'task_percent_complete'];
232 if ($task[
"task_id"] < 0) {
233 $link=DOL_URL_ROOT.
'/projet/card.php?id='.abs($task[
"task_id"]);
234 $fetchresult = $projectstatic->fetch(abs($task[
"task_id"]));
235 if ($fetchresult > 0) {
236 $tmpname = $projectstatic->getNomUrl(0,
'withproject', 1);
237 $name =
'<span style="font-size: 1.2em; font-weight: bold;">' . $tmpname .
'</span>';
239 $name = $task[
'task_name'];
243 $link = DOL_URL_ROOT.
'/projet/tasks/contact.php?withproject=1&id='.$task[
"task_id"];
244 $fetchresult = $taskstatic->fetch($task[
"task_id"]);
245 if ($fetchresult > 0) {
246 $name = $taskstatic->getNomUrl(0,
'withproject',
'task', 1);
248 $name = $task[
'task_name'];
281 $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";
286 $css = $task[
'task_css'];
287 $line_is_auto_group = $task[
"task_is_group"];
294 $taskid = $task[
"task_alternate_id"];
297 $note = empty($task[
'note']) ?
'' : $task[
'note'];
299 $note =
dol_concatdesc($note, $langs->trans(
"Workload").
' : '.(empty($task[
'task_planned_workload']) ?
'' :
convertSecondToTime($task[
'task_planned_workload'],
'allhourmin')));
301 $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));";
319 for ($x = 0; $x < $n; $x++) {
320 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]]]',...