From 2819e720843a4466a20ab937ea4d82c2986756c9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 9 Mar 2012 09:38:31 +0100 Subject: [PATCH] Doxygen --- htdocs/projet/ganttchart.php | 125 ++++++++++++++++---------- htdocs/user/class/usergroup.class.php | 4 +- 2 files changed, 78 insertions(+), 51 deletions(-) diff --git a/htdocs/projet/ganttchart.php b/htdocs/projet/ganttchart.php index 20617b9f1f6..258ba415ebc 100644 --- a/htdocs/projet/ganttchart.php +++ b/htdocs/projet/ganttchart.php @@ -1,5 +1,5 @@ +/* Copyright (C) 2010-2012 Laurent Destailleur * * 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 @@ -24,9 +24,10 @@ ?>
-
+
-
+ + + 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?withproject=1&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=".$task["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"; +/** + * Add a gant chart line + * + * @param string $tarr tarr + * @param Task $task Task object + * @param Project $project_dependencies Project object + * @param int $level Level + * @param int $project_id Id of project + * @return void + */ +function constructGanttLine($tarr,$task,$project_dependencies,$level=0,$project_id=null) +{ + $start_date = $task["task_start_date"]; + $end_date = $task["task_end_date"]; + if (!$end_date) $end_date = $start_date; + $start_date = dol_print_date($start_date,"%m/%d/%Y"); + $end_date = dol_print_date($end_date,"%m/%d/%Y"); + // Resources + $resources = $task["task_resources"]; + // Define depend (ex: "", "4,13", ...) + $depend = "\""; + $count = 0; + foreach ($project_dependencies as $value) { + // Not yet used project_dependencies = array(array(0=>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?withproject=1&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=".$task["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); - } - } +/** + * Find child Gantt line + * + * @param string $tarr tarr + * @param int $parent Parent + * @param Project $project_dependencies Project object + * @param int $level Level + * @return void + */ +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); + } + } } ?> diff --git a/htdocs/user/class/usergroup.class.php b/htdocs/user/class/usergroup.class.php index 9162dc04e39..64e458f21cc 100644 --- a/htdocs/user/class/usergroup.class.php +++ b/htdocs/user/class/usergroup.class.php @@ -417,8 +417,8 @@ class UserGroup extends CommonObject /** * Charge dans l'objet group, la liste des permissions auquels le groupe a droit * - * @param string $module Nom du module dont il faut recuperer les droits ('' par defaut signifie tous les droits) - * @return int <0 if KO, >0 if OK + * @param string $moduletag Name of module we want permissions ('' means all) + * @return int <0 if KO, >0 if OK */ function getrights($moduletag='') {