function findgchild(&$tarr, $parent, $level = 0) { global $projects; $level = $level + 1; $n = count($tarr); for ($x = 0; $x < $n; $x++) { if ($tarr[$x]['task_parent'] == $parent && $tarr[$x]['task_parent'] != $tarr[$x]['task_id']) { showgtask($tarr[$x], $level, $tarr[$x]['project_id']); findgchild($tarr, $tarr[$x]['task_id'], $tarr[$x]['project_id'], $level); } } }
} $ted = new w2p_Utilities_Date($rec['task_end_date']); if ($ted->after(new w2p_Utilities_Date($end_max))) { $end_max = $rec['task_end_date']; } $projects[$rec['task_project']]['tasks'][] = $rec; } $q->clear(); reset($projects); foreach ($projects as $p) { $tnums = count($p['tasks']); for ($i = 0; $i < $tnums; $i++) { $task = $p['tasks'][$i]; if ($task['task_parent'] == $task['task_id']) { showgtask($task, 0, $p['project_id']); findgchild($p['tasks'], $task['task_id'], 0, $p['project_id']); } } } } foreach ($projects as $p) { if ($locale_char_set == 'utf-8') { $name = strlen(utf8_decode($p['project_name'])) > 25 ? substr(utf8_decode($p['project_name']), 0, 22) . '...' : utf8_decode($p['project_name']); } else { //while using charset different than UTF-8 we need not to use utf8_deocde $name = strlen($p['project_name']) > 25 ? substr($p['project_name'], 0, 22) : $p['project_name']; } //using new jpGraph determines using Date object instead of string $start = $p['project_start_date'] > '0000-00-00 00:00:00' ? $p['project_start_date'] : date('Y-m-d H:i:s'); $start = new w2p_Utilities_Date($start); $start = $start->getDate();
$tnums = count($p['tasks']); for ($i = 0; $i < $tnums; $i++) { $t = $p['tasks'][$i]; if ($caller == 'todo') { if ($showDynTasks) { if ($t['task_parent'] == $t['task_id']) { showgtask($t); findgchild($p['tasks'], $t['task_id']); } } else { showgtask($t); } } else { if ($t['task_parent'] == $t['task_id']) { showgtask($t); findgchild($p['tasks'], $t['task_id']); } } } } $gantt->loadTaskArray($gantt_arr); $row = 0; for ($i = 0, $i_cmp = count($gantt_arr); $i < $i_cmp; $i++) { $a = $gantt_arr[$i][0]; $level = $gantt_arr[$i][1]; $caption = ''; $canAccess = canTaskAccess($a['task_id'], $a['task_access'], $a['task_owner']); if ($canAccess) { $name = $a['task_name']; $name = mb_strlen($name) > 35 ? mb_substr($name, 0, 30) . '...' : $name; $name = str_repeat(' ', $level) . $name;