26<div
id=
"principal_content" style=
"margin-left: 0;">
27 <div style=
"margin-left: 0; position: relative;" class=
"gantt" id=
"GanttChartDIV"></div>
29 <script
type=
"text/javascript">
31function DisplayHideRessources(boxName) {
32 graphFormat = g.getFormat();
33 if(boxName.checked ==
true) {
34 booShowRessources = 1;
37 booShowRessources = 0;
42function DisplayHideDurations(boxName) {
43 graphFormat = g.getFormat();
44 if(boxName.checked ==
true) {
53function DisplayHideComplete(boxName) {
54 graphFormat = g.getFormat();
55 if(boxName.checked ==
true) {
64function selectBarText(value) {
65 graphFormat = g.getFormat();
66 id=value.options[value.selectedIndex].value;
71function reloadGraph() {
72 g.setShowRes(booShowRessources);
73 g.setShowComp(booShowComplete);
74 g.setShowDur(booShowDurations);
75 g.setCaptionType(barText);
76 g.setFormat(graphFormat);
77 g.Draw(jQuery(
"#tabs").width()-40);
82var g =
new JSGantt.GanttChart(document.getElementById(
'GanttChartDIV'),
'day');
84if (g.getDivId() !=
null)
87 var booShowRessources = 1;
88 var booShowDurations = 1;
89 var booShowComplete = 1;
90 var barText =
"Resource";
91 var graphFormat =
"day";
93 g.setDateInputFormat(
'<?php echo $dateformatinput; ?>');
94 g.setDateTaskTableDisplayFormat(
'<?php echo $dateformat; ?>');
95 g.setDateTaskDisplayFormat(
'<?php echo $datehourformat; ?>');
96 g.setDayMajorDateDisplayFormat(
'dd mon');
100 g.setShowStartDate(1);
102 g.setShowTaskInfoLink(1);
103 g.setFormatArr(
"day",
"week",
"month")
104 g.setCaptionType(
'Caption');
106 g.setDayColWidth(20);
108 g.addLang(
'<?php print $langs->getDefaultLang(1); ?>', vLangs[
'<?php print $langs->getDefaultLang(1); ?>']);
109 g.setLang(
'<?php print $langs->getDefaultLang(1); ?>');
114 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";
117 $tnums = count($tasks);
119 for ($tcursor = 0; $tcursor < $tnums; $tcursor++) {
120 $t = $tasks[$tcursor];
122 if (empty($old_project_id) || $old_project_id != $t[
'task_project_id']) {
124 $projecttmp =
new Project($db);
125 $projecttmp->fetch($t[
'task_project_id']);
127 'task_id'=>
'-'.$t[
'task_project_id'],
128 'task_alternate_id'=>
'-'.$t[
'task_project_id'],
129 'task_name'=>$projecttmp->ref.
' '.$projecttmp->title,
130 'task_resources'=>
'',
131 'task_start_date'=>
'',
133 'task_is_group'=>1,
'task_position'=>0,
'task_css'=>
'ggroupblack',
'task_milestone'=> 0,
'task_parent'=>0,
'task_parent_alternate_id'=>0,
135 'task_planned_workload'=>0
138 $old_project_id = $t[
'task_project_id'];
141 if ($t[
"task_parent"] <= 0) {
150 g.Draw(jQuery(
"#tabs").width()-40);
151 setTimeout(
'g.DrawDependencies()',100);
155 alert(
"<?php echo $langs->trans("FailedToDefinGraph
"); ?>");
176 global $dateformatinput2;
178 $start_date = $task[
"task_start_date"];
179 $end_date = $task[
"task_end_date"];
181 $end_date = $start_date;
186 $resources = $task[
"task_resources"];
191 foreach ($task_dependencies as $value) {
193 if ($value[0] == $task[
'task_id']) {
194 $depend .= ($count > 0 ?
"," :
"").$value[1];
200 if ($project_id && $level < 0) {
201 $parent =
'-'.$project_id;
203 $parent = $task[
"task_parent_alternate_id"];
207 $percent = empty($task[
'task_percent_complete']) ? 0 : $task[
'task_percent_complete'];
209 if ($task[
"task_id"] < 0) {
213 $link = DOL_URL_ROOT.
'/projet/tasks/contact.php?withproject=1&id='.$task[
"task_id"];
218 $name = $task[
'task_name'];
251 $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";
256 $css = $task[
'task_css'];
257 $line_is_auto_group = $task[
"task_is_group"];
264 $taskid = $task[
"task_alternate_id"];
267 $note = empty($task[
'note']) ?
'' : $task[
'note'];
269 $note =
dol_concatdesc($note, $langs->trans(
"Workload").
' : '.(empty($task[
'task_planned_workload']) ?
'' :
convertSecondToTime($task[
'task_planned_workload'],
'allhourmin')));
271 $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));";
289 for ($x = 0; $x < $n; $x++) {
290 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