$max_d_end = $d_end; $start_date = $start; $end_date = $end; } else { if (Date::compare($min_d_start, $d_start) > 0) { $min_d_start = $d_start; $start_date = $start; } if (Date::compare($max_d_end, $d_end) < 0) { $max_d_end = $d_end; $end_date = $end; } } } } $gantt->setDateRange($start_date, $end_date); $row = 0; if (!is_array($projects) || 0 == count($projects)) { $d = new w2p_Utilities_Date(); $columnValues = array('project_name' => $AppUI->_('No projects found'), 'start_date' => $d->getDate(), 'end_date' => $d->getDate(), 'actual_end' => ''); $gantt->addBar($columnValues, ' ', 0.6, 'red'); } else { foreach ($projects as $p) { $pname = $p['project_name']; $pname = mb_strlen($pname) > 30 ? mb_substr($pname, 0, 25) . '...' : $pname; //using new jpGraph determines using Date object instead of string $start = $p['project_start_date'] > '1969-12-31 19:00:00' ? $p['project_start_date'] : ''; $end_date = $p['project_end_date'] > '1969-12-31 19:00:00' ? $p['project_end_date'] : $p['project_actual_end_date']; $end_date = new w2p_Utilities_Date($end_date); $end = $end_date->getDate(); $start = new w2p_Utilities_Date($start);
$field = $showWork == '1' ? 'Work' : 'Dur'; if ($showTaskNameOnly == '1') { $columnNames = array('Task name'); $columnSizes = array(600); } else { if ($caller == 'todo') { $columnNames = array('Task name', 'Project name', $field, 'Start', 'Finish'); $columnSizes = array(180, 135, 40, 75, 75); } else { $columnNames = array('Task name', $field, 'Start', 'Finish'); $columnSizes = array(250, 60, 90, 90); } } $gantt->setColumnHeaders($columnNames, $columnSizes); $gantt->setProperties(array('showhgrid' => true)); $gantt->setDateRange($gantt_start_date, $gantt_end_date); reset($projects); foreach ($projects as $p) { $parents = array(); $tnums = count($p['tasks']); for ($i = 0; $i < $tnums; $i++) { $t = $p['tasks'][$i]; if (!isset($parents[$t['task_parent']])) { $parents[$t['task_parent']] = false; } if ($t['task_parent'] == $t['task_id']) { $parents[$t['task_parent']] = true; showgtask($t); findchild_gantt($p['tasks'], $t['task_id']); } }