Exemplo n.º 1
0
            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 CDate();
    $gantt->addBar($AppUI, ' ' . $AppUI->_('No projects found'), '', $d->getDate(), $d->getDate(), ' ', 0.6, 'red');
} else {
    foreach ($projects as $p) {
        if ($locale_char_set == 'utf-8' && function_exists('utf8_decode')) {
            $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_decode
            $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'] > '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 CDate($end_date);
        $end = $end_date->getDate();
        $start = new CDate($start);
        $start = $start->getDate();