Ejemplo n.º 1
0
    $max_d_end = new CDate($end_date);
} else {
    // find out DateRange from gant_arr
    $min_d_start = new CDate();
    $max_d_end = new CDate();
    $d_start = new CDate();
    $d_end = new CDate();
    for ($i = 0, $i_cmp = count($gantt_arr); $i < $i_cmp; $i++) {
        $a = $gantt_arr[$i][0];
        $start = substr($a['task_start_date'], 0, 10);
        $end = substr($a['task_end_date'], 0, 10);
        $d_start->Date($start);
        $d_end->Date($end);
        if ($i == 0) {
            $min_d_start = $d_start->duplicate();
            $max_d_end = $d_end->duplicate();
        } else {
            if (Date::compare($min_d_start, $d_start) > 0) {
                $min_d_start = $d_start->duplicate();
            }
            if (Date::compare($max_d_end, $d_end) < 0) {
                $max_d_end = $d_end->duplicate();
            }
        }
    }
}
// check day_diff and modify Headers
$day_diff = $min_d_start->dateDiff($max_d_end);
if ($day_diff > 240) {
    //more than 240 days
    $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);