31<div
id=
"principal_content" style=
"margin-left: 0;">
32 <div style=
"margin-left: 0; position: relative;" class=
"gantt" id=
"GanttChartDIV"></div>
34 <script
type=
"text/javascript">
36function DisplayHideRessources(boxName) {
37 graphFormat = g.getFormat();
38 if(boxName.checked ==
true) {
39 booShowRessources = 1;
42 booShowRessources = 0;
47function DisplayHideDurations(boxName) {
48 graphFormat = g.getFormat();
49 if(boxName.checked ==
true) {
58function DisplayHideComplete(boxName) {
59 graphFormat = g.getFormat();
60 if(boxName.checked ==
true) {
69function selectBarText(value) {
70 graphFormat = g.getFormat();
71 id=value.options[value.selectedIndex].value;
76function reloadGraph() {
77 g.setShowRes(booShowRessources);
78 g.setShowComp(booShowComplete);
79 g.setShowDur(booShowDurations);
80 g.setCaptionType(barText);
81 g.setFormat(graphFormat);
82 g.Draw(jQuery(
"#tabs").width()-40);
87var g =
new JSGantt.GanttChart(document.getElementById(
'GanttChartDIV'),
'day');
89if (g.getDivId() !=
null)
92 var booShowRessources = 1;
93 var booShowDurations = 1;
94 var booShowComplete = 1;
95 var barText =
"Resource";
96 var graphFormat =
"day";
98 g.setDateInputFormat(
'<?php echo $dateformatinput; ?>');
99 g.setDateTaskTableDisplayFormat(
'<?php echo $dateformat; ?>');
100 g.setDateTaskDisplayFormat(
'<?php echo $datehourformat; ?>');
101 g.setDayMajorDateDisplayFormat(
'dd mon');
105 g.setShowStartDate(1);
107 g.setShowTaskInfoLink(1);
108 g.setFormatArr(
"day",
"week",
"month")
109 g.setCaptionType(
'Caption');
111 g.setDayColWidth(20);
113 g.addLang(
'<?php print $langs->getDefaultLang(1); ?>', vLangs[
'<?php print $langs->getDefaultLang(1); ?>']);
114 g.setLang(
'<?php print $langs->getDefaultLang(1); ?>');
119 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";
122 $tnums = count($tasks);
124 for ($tcursor = 0; $tcursor < $tnums; $tcursor++) {
125 $t = $tasks[$tcursor];
127 if (empty($old_project_id) || $old_project_id != $t[
'task_project_id']) {
129 $projecttmp =
new Project($db);
130 $projecttmp->fetch($t[
'task_project_id']);
132 'task_id' =>
'-'.$t[
'task_project_id'],
133 'task_alternate_id' =>
'-'.$t[
'task_project_id'],
134 'task_name' => $projecttmp->ref.
' '.$projecttmp->title,
135 'task_resources' =>
'',
136 'task_start_date' =>
'',
137 'task_end_date' =>
'',
138 'task_is_group' => 1,
'task_position' => 0,
'task_css' =>
'ggroupblack',
'task_milestone' => 0,
'task_parent' => 0,
'task_parent_alternate_id' => 0,
140 'task_planned_workload' => 0
143 $old_project_id = $t[
'task_project_id'];
146 if ($t[
"task_parent"] <= 0) {
155 g.Draw(jQuery(
"#tabs").width()-40);
156 setTimeout(
'g.DrawDependencies()',100);
160 alert(
"<?php echo $langs->trans("FailedToDefinGraph
"); ?>");
181 global $dateformatinput2;
183 $start_date = $task[
"task_start_date"];
184 $end_date = $task[
"task_end_date"];
186 $end_date = $start_date;
191 $resources = $task[
"task_resources"];
196 foreach ($task_dependencies as $value) {
198 if ($value[0] == $task[
'task_id']) {
199 $depend .= ($count > 0 ?
"," :
"").$value[1];
205 if ($project_id && $level < 0) {
206 $parent =
'-'.$project_id;
208 $parent = $task[
"task_parent_alternate_id"];
212 $percent = empty($task[
'task_percent_complete']) ? 0 : $task[
'task_percent_complete'];
214 if ($task[
"task_id"] < 0) {
218 $link = DOL_URL_ROOT.
'/projet/tasks/contact.php?withproject=1&id='.$task[
"task_id"];
223 $name = $task[
'task_name'];
256 $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";
261 $css = $task[
'task_css'];
262 $line_is_auto_group = $task[
"task_is_group"];
269 $taskid = $task[
"task_alternate_id"];
272 $note = empty($task[
'note']) ?
'' : $task[
'note'];
274 $note =
dol_concatdesc($note, $langs->trans(
"Workload").
' : '.(empty($task[
'task_planned_workload']) ?
'' :
convertSecondToTime($task[
'task_planned_workload'],
'allhourmin')));
276 $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));";
294 for ($x = 0; $x < $n; $x++) {
295 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_print_date($time, $format='', $tzoutput='auto', $outputlangs=null, $encodetooutput=false)
Output date in a string format according to outputlangs (or langs if not defined).
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...
findChildGanttLine($tarr, $parent, $task_dependencies, $level)
Find child Gantt line.
constructGanttLine($tarr, $task, $task_dependencies, $level=0, $project_id=null)
Add a gant chart line.
if(preg_match('/crypted:/i', $dolibarr_main_db_pass)||!empty($dolibarr_main_db_encrypted_pass)) $conf db type