function findchild_gantt(&$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']);
            findchild_gantt($tarr, $tarr[$x]['task_id'], $tarr[$x]['project_id'], $level);
        }
    }
}
         }
         $rec['task_end_date'] = __extract_from_projects_gantt4($rec);
         $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;
     }
     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']);
                 findchild_gantt($p['tasks'], $task['task_id'], 0);
             }
         }
     }
 }
 foreach ($projects as $p) {
     $name = strlen(utf8_decode($p['project_name'])) > 25 ? substr(utf8_decode($p['project_name']), 0, 22) . '...' : utf8_decode($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();
     $end_date = $p['project_end_date'];
     $end_date = new w2p_Utilities_Date($end_date);
     $end = $end_date->getDate();
     $progress = (int) $p['project_percent_complete'];
     $caption = ' ';
Example #3
0
            if (Date::compare($max_d_end, $d_end) < 0) {
                $max_d_end = $d_end;
                $end_date = $end;
            }
        }
    }
}
$gantt->setDateRange($start_date, $end_date);
reset($projects);
foreach ($projects as $p) {
    $tnums = count($p['tasks']);
    for ($i = 0; $i < $tnums; $i++) {
        $t = $p['tasks'][$i];
        if ($t['task_parent'] == $t['task_id']) {
            showgtask($t);
            findchild_gantt($p['tasks'], $t['task_id']);
        }
    }
}
$hide_task_groups = false;
if ($hide_task_groups) {
    for ($i = 0, $i_cmp = count($gantt_arr); $i < $i_cmp; $i++) {
        // remove task groups
        if ($i != count($gantt_arr) - 1 && $gantt_arr[$i + 1][1] > $gantt_arr[$i][1]) {
            // it's not a leaf => remove
            array_splice($gantt_arr, $i, 1);
            continue;
        }
    }
}
$gantt->loadTaskArray($gantt_arr);
         }
         $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']);
                 findchild_gantt($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();