} unset($query); $q->clear(); $graph->Add($bar); } unset($gantt_arr); $today = date('y-m-d'); $vline = new GanttVLine($today, $AppUI->_('Today', UI_OUTPUT_RAW)); //if ($monospacefont) { // $vline->title->SetFont(FF_DEJAVUMONO, FS_BOLD, 10); //specify the use of VeraMono //} else { $vline->title->SetFont(FF_DEJAVU, FS_BOLD, 10); //} $graph->Add($vline); if ($addLinksToGantt == 1) { $graph->SetMargin(5, 5, 15, 20); $graph->Stroke((dPgetConfig('overlay_dir') == '' ? DP_BASE_DIR : dPgetConfig('overlay_dir')) . "/files/temp/gantt" . $filedate . ".png"); $ganttMap = $graph->GetHTMLImageMap("csimap"); $ganttSource = "<img src=\"./files/temp/gantt" . $filedate . ".png\" ISMAP USEMAP=\"#csimap\" border=0>"; $ganttMap = dPgetParam($_POST, 'ganttMap'); $ganttSource = dPgetParam($_POST, 'ganttSource'); echo $graph->GetHTMLImageMap("csimap"); echo "<img src=\"./files/temp/gantt" . $filedate . ".png\" ISMAP USEMAP=\"#csimap\" border=0>"; /* $gantt_file = '/files/temp/gantt2.png'; // $bar = new MileStone($row++, $gantt_file, $today, $s); $graph->StrokeCSIM(basename(__FILE__)); //$graph->StrokeCSIM(auto); //$graph->StrokeCSIM('gant.php', 'gantt_map', 0); //$gantt_map = $graph->GetHTMLImageMap ('gantt_map'); //echo "<img src=\"./files/temp/gantt.png\" ISMAP USEMAP=\"#gantt_map\" border=0>";
require_once '../includes/jpgraph/jpgraph.php'; require_once '../includes/jpgraph/jpgraph_gantt.php'; $tmpquery = "WHERE pha.project_id = '" . $project . "' AND pha.order_num = '" . $phase . "'"; $phaseDetail = new request(); $phaseDetail->openPhases($tmpquery); $phaseDetail->pha_name[0] = str_replace('"', '"', $phaseDetail->pha_name[0]); $phaseDetail->pha_name[0] = str_replace("'", "'", $phaseDetail->pha_name[0]); $tmpquery = "WHERE pro.id = '{$project}'"; $projectDetail = new request(); $projectDetail->openProjects($tmpquery); // set up the graph $graph = new GanttGraph(0, 0, 'auto'); $graph->SetBox(); $graph->SetShadow(); $graph->SetMarginColor('gainsboro'); $graph->SetMargin(10, 30, 25, 25); // Set the Locale if you get errors with your environment //$graph->scale->SetDateLocale('C'); // Add title $graph->title->Set($projectDetail->pro_name[0] . ' : ' . $phaseDetail->pha_name[0] . ' ' . $strings['phase']); $graph->title->SetFont(FF_FONT1, FS_BOLD, 12); $graph->title->SetMargin(10); $graph->title->SetBox('linen'); $graph->title->SetShadow(); // month and week scales are always displayed $graph->scale->month->Show(true); $graph->scale->week->Show(true); // Condensed Gantt or not? if ($_GET['base'] == true) { $graph->scale->year->Show(true); $graph->scale->day->Show(false);
//////////////////////////////////////////////////////////////////////////////////////////// // Gantt chart loop foreach ($gtask_sliced as $gts) { //print "<pre> gts = "; //print_r ($gts); //print "</pre>"; //die; //$graph = new GanttGraph(765); $graph = new GanttGraph($printpdfhr == '1' ? 1530 : 765); //double size to improve resolution //$graph = new GanttGraph($width); //$graph->img->SetAntiAliasing(TRUE); $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK); $graph->SetFrame(false); $graph->SetBox(true, array(0, 0, 0), 2); $graph->SetMargin(0, 0, 15, $printpdfhr == '1' ? 40 : 20); $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY); //$graph->scale->day->SetStyle(DAYSTYLE_SHORTDATE2); //Check whether to show horizontal grid or not //////////////////////////////////////////////////// if ($showhgrid == '1') { $graph->hgrid->Show(); $graph->hgrid->SetRowFillColor('darkblue@0.95'); } $pLocale = setlocale(LC_TIME, 0); // get current locale for LC_TIME $res = @setlocale(LC_TIME, $AppUI->user_lang[2]); if ($res) { // Setting locale doesn't fail $graph->scale->SetDateLocale($AppUI->user_lang[2]); } setlocale(LC_TIME, $pLocale);
$item['count'] = $count; //hold all of the items in an array $temp_items[] = $item; } //--------------------------------------------------------------- // Gantt view //--------------------------------------------------------------- include 'jpgraph/jpgraph.php'; include 'jpgraph/jpgraph_gantt.php'; //graph code found in loan_sched.html in /cts $graph = new GanttGraph(900); $graph->SetFrame(true, 'darkblue', 2); $graph->scale->day->SetLabelFormatString('%a %m/%e'); $graph->scale->day->SetStyle(DAYSTYLE_CUSTOM); $graph->scale->day->SetFont(FF_FONT1, FS_BOLD, 12); $graph->SetMargin(-1, -1, -1, -1); $graph->ShowHeaders(GANTT_HDAY); $graph->hgrid->Show(); //$graph->scale->day->SetFont(15); $graph->hgrid->SetRowFillColor('#B5BD88@0.5'); $graph->SetDateRange($start_date, $end_date); $equipment_reservations = CTSDatabaseAPI::equipment_by_date($dates); foreach ($glpi_ids as $id) { //iterate through the ids and check to see if they are in the equipment array if ($equipment_reservations[$id]) { //put the information in a new array $gantt_data[$id] = $equipment_reservations[$id]['reservations']; } else { $gantt_data[$id][] = array('reservation_idx' => NULL, 'start_date' => '0000-00-00', 'end_date' => '0000-00-00'); } }
} $pt_arr =& $ptf->getTasks(); if ($ptf->isError()) { exit_error('Error', $ptf->getErrorMessage()); } if ($_size == 640) { $graph = new GanttGraph(640, 480, "auto"); } elseif ($_size == 1024) { $graph = new GanttGraph(1024, 768, "auto"); } elseif ($_size == 1600) { $graph = new GanttGraph(1600, 1200, "auto"); } else { $graph = new GanttGraph(800, 600, "auto"); } //$graph->SetShadow(); $graph->SetMargin(10, 10, 25, 10); // Add title and subtitle $graph->title->Set($pg->getName()); if (isset($gantt_title_font_family)) { $graph->title->SetFont(constant($gantt_title_font_family), constant($gantt_title_font_style), $gantt_title_font_size); } //$graph->subtitle-> Set("(Draft version)"); // Show day, week and month scale if ($_resolution == 'Days') { $graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH); } elseif ($_resolution == 'Weeks') { $graph->ShowHeaders(GANTT_HWEEK | GANTT_HMONTH); } else { $graph->ShowHeaders(GANTT_HMONTH); } // Instead of week number show the date for the first day in the week