*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
/**
* \file htdocs/projet/ganttview.php
* \ingroup projet
* \brief Gantt diagrame of a project
* \version $Id: ganttchart.php,v 1.7 2011/07/31 23:23:36 eldy Exp $
*/
?>
idtask,1=>idtasktofinishfisrt))
if ($value[0] == $task['task_id']) {
$depend.=($count>0?",":"").$value[1];
$count ++;
}
}
$depend .= "\"";
// Define parent
if ($project_id && $level < 0)
$parent = 'p'.$project_id;
else
$parent = $task["task_parent"];
// Define percent
$percent = $task['task_percent_complete']?$task['task_percent_complete']:0;
// Link
$link=DOL_URL_ROOT.'/projet/tasks/task.php?id='.$task["task_id"];
// Name
$name=$task['task_name'];
for($i=0; $i < $level; $i++) { $name=' '.$name; }
// Add line to gantt
$s = "// Add taks id=".$tasks["task_id"]." level = ".$level."\n";
//$s.= "g.AddElementItem(new JSGantt.ElementItem('task',".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", ".$parent.", 1".($depend?", ".$depend:"")."));";
$s = "g.AddTaskItem(new JSGantt.TaskItem(".$task['task_id'].",'".$name."','".$start_date."', '".$end_date."', '".$task['task_color']."', '".$link."', ".$task['task_milestone'].", '".$resources."', ".$percent.", ".($task["task_is_group"]>0?1:0).", '".$parent."', 1, '".($depend?$depend:"")."'));";
echo $s."\n";
}
function findChildGanttLine($tarr,$parent,$project_dependencies,$level) {
$n=count( $tarr );
for ($x=0; $x < $n; $x++) {
if($tarr[$x]["task_parent"] == $parent && $tarr[$x]["task_parent"] != $tarr[$x]["task_id"])
{
constructGanttLine($tarr,$tarr[$x],$project_dependencies,$level,null);
findChildGanttLine($tarr,$tarr[$x]["task_id"],$project_dependencies,$level+1);
}
}
}
?>