示例#1
0
<?php

// content="text/plain; charset=utf-8"
require_once "jpgraph/jpgraph.php";
require_once "jpgraph/jpgraph_gantt.php";
$graph = new GanttGraph(0, 0);
$graph->SetShadow();
// Add title and subtitle
$graph->title->Set("Main title");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
// Show day, week and month scale
//$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
$graph->ShowHeaders(GANTT_HWEEK);
// Instead of week number show the date for the first day in the week
// on the week scale
$graph->scale->week->SetStyle(WEEKSTYLE_WNBR);
// Make the week scale font smaller than the default
$graph->scale->week->SetFont(FF_FONT0);
// Use the short name of the month together with a 2 digit year
// on the month scale
$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
$graph->scale->month->SetFontColor("white");
$graph->scale->month->SetBackgroundColor("blue");
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity = new GanttBar(0, "Project", "2001-12-21", "2002-02-20");
// Yellow diagonal line pattern on a red background
$activity->SetPattern(BAND_RDIAG, "yellow");
$activity->SetFillColor("red");
// Finally add the bar to the graph
$graph->Add($activity);
示例#2
0
<?php

include "../jpgraph.php";
include "../jpgraph_gantt.php";
$graph = new GanttGraph(0, 0, "auto");
$graph->SetShadow();
// Add title and subtitle
$graph->title->Set("A nice main title");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph->subtitle->Set("(Draft version)");
// Show day, week and month scale
$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
// Instead of week number show the date for the first day in the week
// on the week scale
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
// Make the week scale font smaller than the default
$graph->scale->week->SetFont(FF_FONT0);
// Use the short name of the month together with a 2 digit year
// on the month scale
$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
$graph->scale->month->SetFontColor("white");
$graph->scale->month->SetBackgroundColor("blue");
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity = new GanttBar(0, "Project", "2001-12-21", "2002-01-20");
// Yellow diagonal line pattern on a red background
$activity->SetPattern(BAND_RDIAG, "yellow");
$activity->SetFillColor("red");
// Add a right marker
$activity->rightMark->Show();
$activity->rightMark->SetType(MARK_FILLEDCIRCLE);
示例#3
0
}
if ($showInactive != '1') {
    $q->addWhere('project_status != 7');
}
$pjobj->setAllowedSQL($AppUI->user_id, $q, null, 'p');
$q->addGroup('p.project_id');
$q->addOrder('project_name, task_end_date DESC');
$projects = $q->loadList();
$q->clear();
// Don't push the width higher than about 1200 pixels, otherwise it may not display.
$width = min(dPgetParam($_GET, 'width', 600), 1400);
$start_date = dPgetParam($_GET, 'start_date', 0);
$end_date = dPgetParam($_GET, 'end_date', 0);
$showAllGantt = dPgetParam($_REQUEST, 'showAllGantt', '0');
//$showTaskGantt = dPgetParam($_GET, 'showTaskGantt', '0');
$graph = new GanttGraph($width);
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->SetFrame(false);
$graph->SetBox(true, array(0, 0, 0), 2);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$pLocale = setlocale(LC_TIME, 0);
// get current locale for LC_TIME
$res = @setlocale(LC_TIME, $AppUI->user_lang[0]);
if ($res) {
    // Setting locale doesn't fail
    $graph->scale->SetDateLocale($AppUI->user_lang[0]);
}
setlocale(LC_TIME, $pLocale);
if ($start_date && $end_date) {
    $graph->SetDateRange($start_date, $end_date);
}
示例#4
0
<?php

// Gantt example to create CSIM
include "../jpgraph.php";
include "../jpgraph_gantt.php";
$bar1 = new GanttBar(0, "Activity 1", "2001-12-21", "2002-01-20");
$bar1->SetCSIMTarget('#', 'Go back 1');
$bar1->title->SetCSIMTarget('#', 'Go back 1 (title)');
$bar2 = new GanttBar(1, "Activity 2", "2002-01-03", "2002-01-25");
$bar2->SetCSIMTarget('#', 'Go back 2');
$bar2->title->SetCSIMTarget('#', 'Go back 2 (title)');
$graph = new GanttGraph(500);
$graph->title->Set("Example with image map");
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT1);
$graph->Add(array($bar1, $bar2));
// And stroke
$graph->StrokeCSIM();
?>


示例#5
0
#Application name: PhpCollab
#Status page: 0
$checkSession = "true";
include "../includes/library.php";
include "../includes/jpgraph/jpgraph.php";
include "../includes/jpgraph/jpgraph_gantt.php";
$tmpquery = "WHERE tas.id = '" . $task . "'";
$taskDetail = new request();
$taskDetail->openTasks($tmpquery);
$tmpquery = "WHERE pro.id = '" . $taskDetail->tas_project[0] . "'";
$projectDetail = new request();
$projectDetail->openProjects($tmpquery);
$projectDetail->pro_created[0] = createDate($projectDetail->pro_created[0], $timezoneSession);
$projectDetail->pro_name[0] = str_replace('&quot;', '"', $projectDetail->pro_name[0]);
$projectDetail->pro_name[0] = str_replace("&#39;", "'", $projectDetail->pro_name[0]);
$graph = new GanttGraph();
$graph->SetBox();
$graph->SetMarginColor("white");
$graph->SetColor("white");
$graph->title->Set($strings["task"] . " " . $taskDetail->tas_name[0]);
$graph->subtitle->Set("(" . $strings["created"] . ": " . $taskDetail->tas_created[0] . ")");
$graph->title->SetFont(FF_FONT1);
$graph->SetColor("white");
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT0);
$graph->scale->year->SetFont(FF_FONT1);
$tmpquery = "WHERE subtas.task = '{$task}' AND subtas.start_date != '--' AND subtas.due_date != '--' AND tas.published != '1' ORDER BY subtas.due_date";
$listTasks = new request();
$listTasks->openSubtasks($tmpquery);
$comptListTasks = count($listTasks->subtas_id);
示例#6
0
}
unset($proTasks);
//consider critical (concerning end date) tasks as well
if ($caller != 'todo') {
    $start_min = $projects[$project_id]['project_start_date'];
    $end_max = $projects[$project_id]['project_end_date'] > $criticalTasks[0]['task_end_date'] ? $projects[$project_id]['project_end_date'] : $criticalTasks[0]['task_end_date'];
}
$start_date = dPgetParam($_GET, 'start_date', $start_min);
$end_date = dPgetParam($_GET, 'end_date', $end_max);
$count = 0;
$width = min(dPgetParam($_GET, 'width', 600), 1400);
// If hyperlinks are to be added then the graph is of a set width///////
if ($addLinksToGantt == '1') {
    $width = 950;
}
$graph = new GanttGraph($width);
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
//$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY);
$graph->SetFrame(false);
$graph->SetBox(true, array(0, 0, 0), 2);
$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]);
$res = @setlocale(LC_TIME, $AppUI->user_lang[0]);
示例#7
0
function graph_schedule($data, $title, $show_day)
{
    require_once "jpgraph/jpgraph.php";
    require_once "jpgraph/jpgraph_gantt.php";
    // Some sample Gantt data
    /*
    	$data = array(
    		array(0, " Bryce", "2009-08-28 11:00","2009-08-28 15:30"),
    		array(1, " Kyla", "2009-08-28 08:00","2009-08-28 15:30"),
    		array(2, " Nathan", "2009-08-28 08:00","2009-08-28 17:00")
    	);
    */
    // Basic graph parameters
    $graph = new GanttGraph(700);
    $graph->SetMarginColor('darkgreen@0.8');
    $graph->SetColor('white');
    $graph->title->Set("{$title}'s Schedule");
    $graph->title->SetColor('darkgray');
    // We want to display day, hour and minute scales
    if ($show_day) {
        $graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);
    } else {
        $graph->ShowHeaders(GANTT_HHOUR);
    }
    #$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);
    #$graph->ShowHeaders(GANTT_HHOUR);
    // Setup day format
    $graph->scale->day->SetBackgroundColor('lightyellow:1.5');
    $graph->scale->day->SetStyle(DAYSTYLE_LONG);
    $graph->scale->day->SetFont(FF_FONT1, FS_NORMAL, 16);
    // Setup hour format
    $graph->scale->hour->SetIntervall(1);
    $graph->scale->hour->SetBackgroundColor('lightyellow:1.5');
    $graph->scale->hour->SetStyle(HOURSTYLE_HAMPM);
    $graph->scale->hour->grid->SetColor('gray:0.8');
    $graph->scale->hour->SetFont(FF_FONT1, FS_NORMAL, 13);
    for ($i = 0; $i < count($data); ++$i) {
        $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], $data[$i][4]);
        $bar->SetPattern(BAND_RDIAG, "yellow");
        $bar->SetFillColor("gray");
        $graph->Add($bar);
    }
    // Draw graph
    $graph->Stroke();
}
示例#8
0
<?php

// Gantt example
include "../jpgraph.php";
include "../jpgraph_gantt.php";
// Create the basic graph
$graph = new GanttGraph();
$graph->title->Set("Example with multiple constrains");
$bar1 = new GanttBar(0, "Label 1", "2003-06-08", "2003-06-12");
$bar2 = new GanttBar(1, "Label 2", "2003-06-16", "2003-06-19");
$bar3 = new GanttBar(2, "Label 3", "2003-06-15", "2003-06-21");
//create constraints
$bar1->SetConstrain(1, CONSTRAIN_ENDSTART);
$bar1->SetConstrain(2, CONSTRAIN_ENDSTART);
// Setup scale
$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
// Add the specified activities
$graph->Add($bar1);
$graph->Add($bar2);
$graph->Add($bar3);
// .. and stroke the graph
$graph->Stroke();
示例#9
0
function grafica($fecha_max, $fecha_min, $datos)
{
    $graph = new GanttGraph();
    $graph->title->Set("");
    // Rango de fechas a presentar
    $graph->SetDateRange($fecha_min, $fecha_max);
    // linea de espaciado vertical entre los elementos
    $graph->SetVMarginFactor(2);
    // configuracion de colores
    $graph->SetMarginColor('lightgreen@0.8');
    //  color del fondo
    $graph->SetBox(true, 'yellow:0.6', 2);
    //  contorno del marco interior
    $graph->SetFrame(true, 'darkgreen', 4);
    // contorno  del marco exterior
    $graph->scale->divider->SetColor('yellow:0.6');
    // linea divisora de datos y grafico
    $graph->scale->dividerh->SetColor('red:0.6');
    //liena que divide el tiempo con las barras de la grafica
    // Ponemos la medida de tiempo que queremos usar, por ejemplo años, meses, dias, hors o minutos
    //por ejemplo, si queremos solamente la division por meses y semanas en lugar de tener
    //GANTT_HWEEK | GANTT_HMONTH | GANTT_HYEAR | GANTT_HDAY
    //dejamos
    //GANTT_HWEEK | GANTT_HMONTH
    // para mas opciones de division de tiempo ver comentarios abajo
    $graph->ShowHeaders(GANTT_HWEEK | GANTT_HMONTH | GANTT_HYEAR | GANTT_HDAY);
    $graph->scale->month->grid->SetColor('gray');
    //lineas verticales que dividen los meses
    $graph->scale->month->grid->Show(true);
    $graph->scale->year->grid->SetColor('gray');
    // linea verticales que dividen los años
    $graph->scale->year->grid->Show(true);
    $graph->scale->actinfo->SetColTitles(array('Acción', 'Duracion', 'Inicio', 'Final', 'Porcentaje'), array(30, 100));
    $graph->scale->actinfo->SetBackgroundColor('blue:0.5@0.5');
    //color de fondo de los titulos de la tabla
    $graph->scale->actinfo->SetFont(FF_ARIAL, FS_NORMAL, 12);
    //tipografia
    // division vertical de los datos a la izquierda, posibles valores 'solid', 'dotted', 'dashed'
    $graph->scale->actinfo->vgrid->SetStyle('solid');
    $graph->scale->actinfo->vgrid->SetColor('red');
    // color de las divisiones puestas en el renglon anterior
    // Configuración de los iconos que queremos usar
    //para poner algun icono no definido podemos usarlo de la siguiente manera
    //$icon = new IconImage("imagen.png",0.7);
    //en el ejemplo estoy usando una omagen desde blogspot
    //el numero que es el segundo parametro de IconImage es el porcentaje de la imagen, en este caso esta al 20%
    $erricon = new IconImage("logo-copia.png", 0.2);
    $startconicon = new IconImage(GICON_FOLDEROPEN, 0.6);
    $endconicon = new IconImage(GICON_TEXTIMPORTANT, 0.5);
    //ahora ponemos los datos de la tabla e iniciamos los datos de las barras
    //    $data = array(
    //        //valores del arreglo:
    //        //indice del arreglo, arreglo de datos para la informacion a la izquierda, fecha de inicio de la barra, fecha final de la barra, tipografia, estilo,tamaño tipografia,% de progreso en la barra
    //        array(0,array("Pre-study","17 days","1 Nov '2011","1 Mar '2012")
    //              , "2011-11-01","2012-01-1",FF_ARIAL,FS_NORMAL,8, 0.5),//el 0.5 indica el 50%, que ocuparemos en la linea 74, dando su posicion en el arreglo
    //        array(1,array("Prototype","10 days","26 Oct '2011","16 Nov '2011"),
    //              "2011-10-26","2011-11-01",FF_ARIAL,FS_NORMAL,8, 0.12),
    //        array(2,array("Report","12 days","1 Mar '2012","13 Mar '2012"),
    //              "2012-03-01","2012-03-13",FF_ARIAL,FS_NORMAL,8, 1)
    //    );
    $data = $datos;
    // Crea las barras y las añade a la grafica gantt
    for ($i = 0; $i < count($data); ++$i) {
        $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], '', 10);
        if (count($data[$i]) > 4) {
            $bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
        }
        $bar->SetPattern(BAND_RDIAG, "yellow");
        $bar->SetFillColor("gray");
        $bar->progress->Set($data[$i][7]);
        // ocupamos el % de adelanto en la actividad
        $bar->progress->SetPattern(GANTT_SOLID, "darkgreen");
        //$bar->title->SetCSIMTarget(array('#1'.$i,'#2'.$i,'#3'.$i,'#4'.$i,'#5'.$i),array('11'.$i,'22'.$i,'33'.$i));
        $graph->Add($bar);
        //echo "<br>--> ".$data[$i][7];
    }
    // Creamos la imagen y le damos nombre, la imagen se guarda donde estan estos archivos
    $graph->Stroke('imagenprueba.jpg');
}
示例#10
0
<?php

// Gantt example to create CSIM using CreateSimple()
include "../jpgraph.php";
include "../jpgraph_gantt.php";
$data = array(array(0, ACTYPE_GROUP, "Phase 1", "2001-10-26", "2001-11-23", '', '#1', 'Go home'), array(1, ACTYPE_NORMAL, "  Label 2", "2001-10-26", "2001-11-16", 'ab,cd', '#2', 'Go home'), array(2, ACTYPE_NORMAL, "  Label 3", "2001-11-20", "2001-11-22", 'ek', '#3', 'Go home'), array(3, ACTYPE_MILESTONE, "  Phase 1 Done", "2001-11-23", 'M2', '#4', 'Go home'));
// The constrains between the activities
$constrains = array(array(1, 2, CONSTRAIN_ENDSTART), array(2, 3, CONSTRAIN_STARTSTART));
$progress = array(array(1, 0.4));
$graph = new GanttGraph(500);
$graph->title->Set("Example with image map");
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT1);
$graph->CreateSimple($data, $constrains, $progress);
// Add the specified activities
//SetupSimpleGantt($graph,$data,$constrains,$progress);
// And stroke
$graph->StrokeCSIM('ganttcsimex02.php');
?>


示例#11
0
            }
            $data[] = array($d[$d2] - 1, date("Y-m-d", $end), "00:00", date("H:i", $end), $start);
        }
        if (!$d[$d1]) {
            $d[$d1] = $idx++;
        }
        $data[] = array($d[$d1] - 1, date("Y-m-d", $start), date("H:i", $start), $d2 <= $d1 ? date("H:i", $end) : "23:59", $start);
    }
}
if (!$data) {
    // fake 1 record so the chart doesn't error
    $data[] = array(0, date("Y-m-d"), '00:00', '00:00', time());
}
// remove any and all output buffers
$ps->ob_clean();
$graph = new GanttGraph(0, 0, $imgfilename, CACHE_TIMEOUT);
$showfooter = (bool) $styles->val('image.session.showfooter', 'image.common.footer.show');
$top = intval($styles->val('image.session.margin.top', 'image.common.margin.top', true));
$right = intval($styles->val('image.session.margin.right', 'image.common.margin.right', true));
$bottom = intval($styles->val('image.session.margin.bottom', 'image.common.margin.bottom', true));
$left = intval($styles->val('image.session.margin.left', 'image.common.margin.left', true));
$graph->setMargin($left, $right, $top, ($showfooter and $bottom < 14) ? 14 : $bottom);
$graph->ShowHeaders(GANTT_HHOUR);
//$graph->SetBackgroundGradient('gray','whitesmoke',GRAD_LEFT_REFLECTION,BGRAD_MARGIN);
$graph->SetMarginColor($styles->val('image.session.frame.margin', '#C4C4C4', true));
$graph->SetFrame(true, $styles->val('image.session.frame.color', 'gray', true), $styles->val('image.session.frame.width', 1, true));
//if (!$noname) $graph->title->Set($plrname);
//$graph->title->SetColor('blue');
//$graph->subtitle->Set(imgdef($s['frame']['title'], 'Player Sessions'));
//$graph->subtitle->SetFont(constant(imgdef($s['@frame']['font'], 'FF_FONT0')));
// must override the weekend settings ...
示例#12
0
  /**
   *Make Gantt
   *@return image png & die
   */        
  function MakeGanttChart(){
      // is logged ?     
      if (!logged_user()->isProjectUser(active_project())) {
        die; 
      } // if
      // is user can view this project ??
      if (!ProjectFile::canView(logged_user(), active_project())) {
        die;
      } //if

      /*
      * Init gantt graph
      */
      $width = 850;      
      $graph = new GanttGraph($width);
      /*
      * here header must be set at end and during process catch all date to determine the difference max between start and end 
      * to present HDAY or not depend on information volume
      */
      //graph header
      $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK | GANTT_HDAY);
      // Instead of week number show the date for the first day in the week
      // on the week scale
      $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
      $graph->SetMarginColor('blue:1.7');
      $graph->SetColor('white');
      $graph->SetBackgroundGradient('#60A2BA','white',GRAD_HOR,BGRAD_MARGIN);
      //$graph->SetBackgroundGradient('#A01010','white',GRAD_HOR,BGRAD_MARGIN);
      $graph->title->SetColor('white');
      $graph->title->SetFont(FF_FONT2,FS_BOLD,18);
      //$graph->scale->actinfo->SetColTitles(array('Act','Duration','Start','Finish','Resp'));
      $graph->scale->actinfo->SetStyle(ACTINFO_3D);
      $graph->scale->actinfo->SetFont(FF_ARIAL,FS_NORMAL,10);
      $graph->scale->actinfo->vgrid->SetColor('gray');
      $graph->scale->actinfo->SetColor('darkgray');
      $locale_char_set = 'utf-8';
      //For french support
      //Localization::instance()->getLocale();
      //if (preg_match('/' . Localization::instance()->getLocale() . '/i', 'fr_fr')) $graph->scale->SetDateLocale("fr_FR.utf8");

      /*
      * data jpgraph construction gantt type for project
      */    
      $project = active_project();
      //Project title
      $project_name = $project->getName();
      $graph->title->Set(lang('project') . ': ' . substr(utf8_decode($project_name),0,40) );

      $rows = $this->displayProjectGantt($project, $graph, 0);
      $subprojects = $project->getSubprojects();
      if (is_array($subprojects)) {
        foreach($subprojects as $subproject) {
          $rows = $this->displayProjectGantt($subproject, $graph, $rows++);
        }
      }

      //send data
      $type = "image/png";
      $name = "projectpiergantt.png";
      header("Content-Type: $type");
      header("pragma: no-cache");
      header("Content-Disposition: attachment; filename=\"$name\"");
      $graph->Stroke();
      die(); //end process do not send other informations
  }  //MakeGantt
示例#13
0
 public function graficar($filename)
 {
     $graph = new GanttGraph();
     $graph->SetShadow();
     $graph->SetBox();
     // Only show part of the Gantt
     $graph = new GanttGraph(1000);
     /*
     $graph->title->Set('Proceso '.$this->dataSource->getParameter('desc_proceso_macro')."\n".
     																			'Seguimiento de Solicitud '.$this->dataSource->getParameter('numero')."\n".
     																			'Unidad '.$this->dataSource->getParameter('desc_uo'));
     $graph->title->SetFont(FF_ARIAL,FS_BOLD,6);
     */
     define('UTF-8', $locale_char_set);
     // Setup some "very" nonstandard colors
     $graph->SetMarginColor('lightgreen@0.8');
     $graph->SetBox(true, 'yellow:0.6', 2);
     $graph->SetFrame(true, 'darkgreen', 4);
     $graph->scale->divider->SetColor('yellow:0.6');
     $graph->scale->dividerh->SetColor('yellow:0.6');
     // Explicitely set the date range
     // (Autoscaling will of course also work)
     // Display month and year scale with the gridlines
     $graph->ShowHeaders(GANTT_HMONTH | GANTT_HYEAR | GANTT_HDAY);
     $graph->scale->month->grid->SetColor('gray');
     $graph->scale->month->grid->Show(true);
     $graph->scale->year->grid->SetColor('gray');
     $graph->scale->year->grid->Show(true);
     // Setup a horizontal grid
     $graph->hgrid->Show();
     $graph->hgrid->SetRowFillColor('darkblue@0.9');
     // Setup activity info
     // For the titles we also add a minimum width of 100 pixels for the Task name column
     $graph->scale->actinfo->SetColTitles(array('Tipo', 'Estado', 'Responsable', 'Duracion', 'Inicio', 'Fin'), array(40, 100));
     $graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5');
     $graph->scale->actinfo->SetFont(FF_ARIAL, FS_NORMAL, 10);
     $data = array();
     $dataset = $this->dataSource->getDataset();
     $tamanioDataset = count($dataset);
     $fechaInicio = 0;
     $fechaFin = 0;
     for ($i = 0; $i < $tamanioDataset; $i++) {
         if ($i == 0) {
             $fechaInicio = $dataset[$i]['fecha_reg'];
         }
         /*
         if($dataset[$i]['nombre_estado']=='En_Proceso'||$dataset[$i]['nombre_estado']=='Habilitado para pagar'||$dataset[$i]['nombre_estado']=='En Pago'){
         		$milestone = new MileStone($i,$dataset[$i]['nombre_estado'],$dataset[$i]['fecha_reg'],$dataset[$i]['fecha_reg']);
         		$milestone->title->SetColor("black");
         		$milestone->title->SetFont(FF_FONT1,FS_BOLD);
         		$graph->Add($milestone);
         		continue;
         }
         */
         $actividad = array();
         array_push($actividad, $i);
         if ($i == $tamanioDataset - 1) {
             $fechaFin = $dataset[$i]['fecha_reg'];
         } else {
             $fechaFin = $dataset[$i + 1]['fecha_reg'];
         }
         $startLiteral = new DateTime($dataset[$i]['fecha_reg']);
         $endLiteral = new DateTime($fechaFin);
         $start = strtotime($dataset[$i]['fecha_reg']);
         $end = strtotime($fechaFin);
         $days_between = round(($end - $start) / 86400);
         $cabecera = array($dataset[$i]['proceso'], $dataset[$i]['estado'], $dataset[$i]['funcionario'] != '-' ? $dataset[$i]['func'] : $dataset[$i]['depto'], "{$days_between}" . ' dias', $startLiteral->format('d M Y'), $endLiteral->format('d M Y'));
         array_push($actividad, $cabecera);
         array_push($actividad, $dataset[$i]['fecha_reg']);
         array_push($actividad, $fechaFin);
         array_push($actividad, FF_ARIAL);
         array_push($actividad, FS_NORMAL);
         array_push($actividad, 8);
         array_push($data, $actividad);
     }
     // Create the bars and add them to the gantt chart
     for ($i = 0; $i < count($data); $i++) {
         $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[100%]", 10);
         if (count($data[$i]) > 4) {
             $bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
         }
         $bar->SetPattern(BAND_RDIAG, "yellow");
         $bar->SetFillColor("gray");
         $bar->progress->Set(1);
         $bar->progress->SetPattern(GANTT_SOLID, "darkgreen");
         $graph->Add($bar);
     }
     //$graph->SetDateRange($fechaInicio,$fechaFin);
     $archivo = dirname(__FILE__) . '/../../../reportes_generados/' . $filename;
     //$graph->StrokeCSIM();
     //exit;
     $graph->Stroke($archivo);
 }
示例#14
0
     //iterate through each item, grab the count and add it to the item
     $glpi_id = $item['psu_name'];
     $glpi_ids[] = $glpi_id;
     //get the list of just the glpi_ids for the gannt view
     $count = CTSDatabaseAPI::count($glpi_id);
     $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
示例#15
0
<?php

// content="text/plain; charset=utf-8"
// Gantt column font array example
require_once '../jpgraph.php';
require_once '../jpgraph_gantt.php';
// Setup a basic Gantt graph
$graph = new GanttGraph();
$graph->SetMarginColor('gray:1.7');
$graph->SetColor('white');
// Setup the graph title and title font
$graph->title->Set("Example of column fonts");
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 14);
// Show three headers
$graph->ShowHeaders(GANTT_HDAY | GANTT_HMONTH | GANTT_HYEAR);
// Set the column headers and font
$graph->scale->actinfo->SetColTitles(array('Name', 'Start', 'End'), array(100));
$graph->scale->actinfo->SetFont(FF_ARIAL, FS_BOLD, 11);
// Some "dummy" data to be dsiplayed
$data = array(array(0, 'Group 1', '2001-11-27', '2001-12-05'), array(1, '  Activity 1', '2001-11-27', '2001-11-29'), array(2, '  Activity 2', '2001-11-28', '2001-12-05'), array(3, 'Group 2', '2001-11-29', '2001-12-10'), array(4, '  Activity 1', '2001-11-29', '2001-12-03'), array(5, '  Activity 2', '2001-12-01', '2001-12-10'));
// Format and add the Gantt bars to the chart
$n = count($data);
for ($i = 0; $i < $n; ++$i) {
    if ($i === 0 || $i === 3) {
        // Format the group bars
        $bar = new GanttBar($data[$i][0], array($data[$i][1], $data[$i][2], $data[$i][3]), $data[$i][2], $data[$i][3], '', 0.35);
        // For each group make the name bold but keep the dates as the default font
        $bar->title->SetColumnFonts(array(array(FF_ARIAL, FS_BOLD, 11)));
        // Add group markers
        $bar->leftMark->SetType(MARK_LEFTTRIANGLE);
        $bar->leftMark->Show();
 /**
  * creates the image for the gantt chart
  *
  * @param $_params	array containing projectdata, start- and enddate
  * @param $_filename	filename for the image, if empty image gets printed to browser
  * @author	Lars Kneschke / Bettina Gille
  * @returns	nothing - writes image to disk
  */
 function show_graph($params, $_filename = '')
 {
     $modernJPGraph = false;
     // no gd support
     if (!function_exists('imagecopyresampled')) {
         return false;
     }
     DEFINE("TTF_DIR", PHPGW_SERVER_ROOT . "/projects/ttf-bitstream-vera-1.10/");
     if (file_exists(PHPGW_SERVER_ROOT . '/../jpgraph/src/jpgraph.php')) {
         include PHPGW_SERVER_ROOT . '/../jpgraph/src/jpgraph.php';
         include PHPGW_SERVER_ROOT . '/../jpgraph/src/jpgraph_gantt.php';
     } else {
         include PHPGW_SERVER_ROOT . '/projects/inc/jpgraph-1.5.2/src/jpgraph.php';
         include PHPGW_SERVER_ROOT . '/projects/inc/jpgraph-1.5.2/src/jpgraph_gantt.php';
     }
     //_debug_array($params);
     $project_array = $params['project_array'];
     $sdate = $params['sdate'];
     $edate = $params['edate'];
     $showMilestones = $params['showMilestones'];
     $showResources = $params['showResources'];
     $bocalendar = CreateObject('calendar.bocalendar');
     $this->graph = CreateObject('phpgwapi.gdgraph', $this->debug);
     $bolink = CreateObject('infolog.bolink');
     //$this->boprojects->order = 'parent';
     $this->boprojects->limit = False;
     $this->boprojects->html_output = False;
     if (is_array($project_array)) {
         $projects = array();
         foreach ($project_array as $pro) {
             $project = $this->boprojects->list_projects(array('action' => 'mainsubsorted', 'project_id' => $pro, 'mstones_stat' => True));
             if (is_array($project)) {
                 $i = count($projects);
                 for ($k = 0; $k < count($project); $k++) {
                     $projects[$i + $k] = $project[$k];
                 }
             }
         }
     }
     if (is_array($projects)) {
         $modernJPGraph = version_compare('1.13', JPG_VERSION);
         $sdate = $sdate + 60 * 60 * $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
         $sdateout = $GLOBALS['phpgw']->common->show_date($sdate, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
         $edate = $edate + 60 * 60 * $GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
         $edateout = $GLOBALS['phpgw']->common->show_date($edate, $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
         #				$this->graph->title = lang('Gantt chart from %1 to %2',$sdateout,$edateout);
         // Standard calls to create a new graph
         if ($modernJPGraph) {
             $graph = new GanttGraph(940, -1, "auto");
         } else {
             $graph = new GanttGraph(-1, -1, "auto");
         }
         $graph->SetShadow();
         $graph->SetBox();
         $duration = $edate - $sdate;
         if ($duration < 5958000) {
             $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
             if ($modernJPGraph) {
                 $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
             } else {
                 $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
             }
         } elseif ($duration < 13820400) {
             $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
             $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK);
         } else {
             $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
         }
         // For the week we choose to show the start date of the week
         // the default is to show week number (according to ISO 8601)
         #$graph->scale->SetDateLocale('de_DE');
         // Change the scale font
         $graph->scale->week->SetFont(FF_VERA, FS_NORMAL, 8);
         $graph->scale->year->SetFont(FF_VERA, FS_BOLD, 10);
         // Titles for chart
         $graph->title->Set(lang('project overview'));
         $graph->subtitle->Set(lang('from %1 to %2', $sdateout, $edateout));
         $graph->title->SetFont(FF_VERA, FS_BOLD, 12);
         $graph->subtitle->SetFont(FF_VERA, FS_BOLD, 10);
         // set the start and end date
         // add one day to the end is needed internaly by jpgraph
         $graph->SetDateRange(date('Y-m-d 00:00:00', $sdate), date('Y-m-d', $edate + 86400));
         foreach ($projects as $pro) {
             $ptime_pro = $this->boprojects->return_value('ptime', $pro[project_id]);
             $acc = $this->boprojects->get_budget(array('project_id' => $pro[project_id], 'ptime' => $ptime_pro));
             if ($ptime_pro > 0) {
                 $finnishedPercent = 100 / $ptime_pro * $acc[uhours_jobs_wminutes];
             } else {
                 $finnishedPercent = 0;
             }
             $previous = '';
             if ($pro['previous'] > 0) {
                 $previous = $this->boprojects->read_single_project($pro['previous']);
                 $spro[] = array('title' => str_repeat(' ', $spro['level']) . '[!]' . $previous['title'], 'extracolor' => 'darkorange', 'sdate' => $previous['sdate'], 'edate' => $previous['edate'], 'pro_id' => $previous['project_id'], 'f_sdate' => $pro['sdate']);
                 $color_legend['previous'] = array('title' => '[!]' . lang('previous project'), 'extracolor' => 'darkorange');
             }
             // add a empty row before new project
             if ($pro['level'] == 0 && $counter > 0) {
                 $counter++;
             }
             $spro = array('title' => $pro['title'], 'sdate' => $pro['sdate'], 'edate' => $pro['edate'] ? $pro['edate'] : mktime(0, 0, 0, date('m'), date('d'), date('Y')), 'color' => $pro['level'], 'pro_id' => $pro['project_id'], 'previous' => $pro['previous']);
             // convert title to iso-8859-1
             $spro[title] = $this->botranslation->convert($spro[title], $this->displayCharset, 'iso-8859-1');
             if ($spro[edate] < $sdate) {
                 continue;
             }
             if ($spro[edate] > $edate) {
                 $spro[edate] = $edate;
             }
             if ($spro[sdate] < $sdate) {
                 $spro[sdate] = $sdate;
             }
             $bar = new GanttBar($counter, $spro[title], date('Y-m-d', $spro[sdate]), date('Y-m-d', $spro[edate]), round($finnishedPercent) . '%', 0.5);
             // mark beginn of new project bold
             if ($pro['level'] == 0) {
                 $bar->title->SetFont(FF_VERA, FS_BOLD, 9);
                 #$bar->title->SetColor("#9999FF");
                 $bar->SetPattern(BAND_SOLID, "#9999FF");
             } else {
                 // For illustration lets make each bar be red with yellow diagonal stripes
                 $bar->SetPattern(BAND_SOLID, "#ccccFF");
                 #$bar->title->SetColor("#ccccFF");
             }
             // To indicate progress each bar can have a smaller bar within
             // For illustrative purpose just set the progress to 50% for each bar
             $bar->progress->SetHeight(0.2);
             $bar->SetColor('#777777');
             if ($finnishedPercent > 100) {
                 $bar->progress->Set(1);
                 #$bar->progress->SetPattern(GANTT_SOLID,"darkred",98);
                 $bar->caption->SetColor("red");
             } else {
                 $bar->progress->Set($finnishedPercent / 100);
                 #$bar->progress->SetPattern(GANTT_SOLID,"darkgreen",98);
             }
             $bar->caption->SetFont(FF_VERA, FS_NORMAL, 8);
             // ... and add the bar to the gantt chart
             $graphs['bars'][] = $bar;
             #$graph->Add($bar);
             $counter++;
             // check for Resources
             if ($showResources == 'true') {
                 $linkedObjects = $bolink->get_links('projects', $pro[project_id]);
                 $projectACL = $this->boprojects->get_acl_for_project($pro[project_id]);
                 if (is_array($projectACL)) {
                     // if beginn
                     foreach ($projectACL as $accountID) {
                         #_debug_array($projectData);
                         $accountData = CreateObject('phpgwapi.accounts', $accountID);
                         $accountData->read_repository();
                         $accountName = $GLOBALS['phpgw']->common->display_fullname($accountData->data['account_lid'], $accountData->data['firstname'], $accountData->data['lastname']);
                         $calData = array('syear' => date('Y', $sdate), 'smonth' => date('m', $sdate), 'sday' => date('d', $sdate), 'eyear' => date('Y', $edate), 'emonth' => date('m', $edate), 'eday' => date('d', $edate), 'owner' => array($accountID));
                         $calEntries = $bocalendar->store_to_cache($calData);
                         $bocalendar->remove_doubles_in_cache(date('Y', $sdate) . date('m', $sdate) . date('d', $sdate), date('Y', $edate) . date('m', $edate) . date('d', $edate));
                         $calEntries = $bocalendar->cached_events;
                         #_debug_array($calEntries);
                         if (is_array($calEntries) && count($calEntries)) {
                             #_debug_array($calEntries);
                             foreach ($calEntries as $calDayDate => $calDayEntries) {
                                 foreach ($calDayEntries as $calDayEntry) {
                                     if ($calDayEntry['recur_type']) {
                                         $bocalendar->set_recur_date($calDayEntry, $calDayDate);
                                     }
                                     #_debug_array($calDayEntry);
                                     if (!$bocalendar->rejected_no_show($calDayEntry)) {
                                         $startDate = date('Y-m-d H:i:s', mktime($calDayEntry['start']['hour'], $calDayEntry['start']['min'], $calDayEntry['start']['sec'], $calDayEntry['start']['month'], $calDayEntry['start']['mday'], $calDayEntry['start']['year']));
                                         $endDate = date('Y-m-d H:i:s', mktime($calDayEntry['end']['hour'], $calDayEntry['end']['min'], $calDayEntry['end']['sec'], $calDayEntry['end']['month'], $calDayEntry['end']['mday'], $calDayEntry['end']['year']));
                                         #$endDate = $startDate+1000;
                                         #_debug_array($startDate);
                                         $bar = new GanttBar($counter, str_repeat(' ', $pro['level'] + 1) . $accountName, $startDate, $endDate, '', 0.5);
                                         $bar->SetPattern(BAND_SOLID, "#DDDDDD");
                                         $bar->SetColor('#CCCCCC');
                                         #$bar->SetShadow(true,"darkgray");
                                         if (count($projectLinks = $bolink->get_links('calendar', $calDayEntry['id'], 'projects'))) {
                                             $projectLinks = array_flip($projectLinks);
                                             #_debug_array($projectLinks);
                                             if (isset($projectLinks[$pro[project_id]])) {
                                                 $bar->SetPattern(BAND_SOLID, "#33FF33");
                                                 $bar->SetColor('#33FF33');
                                             }
                                         }
                                         $graphs['bars'][] = $bar;
                                         #$graph->Add($bar);
                                     } else {
                                         print "rejected<br>";
                                     }
                                 }
                             }
                             $counter++;
                         }
                     }
                 }
                 // if end
             }
             // check for milstones
             if (is_array($pro['mstones']) && $showMilestones == 'true') {
                 $msColor = "#999999";
                 foreach ($pro['mstones'] as $ms) {
                     if ($sdate < $ms['edate'] && $ms['edate'] <= $edate) {
                         $ms[title] = $this->botranslation->convert($ms[title], $this->displayCharset, 'iso-8859-1');
                         $msData = array('title' => $ms['title'], 'extracolor' => 'yellow', 'edate' => $ms['edate'], 'pro_id' => $pro['project_id']);
                         // Create a milestone mark
                         $ms = new MileStone($counter, str_repeat(' ', $pro['level'] + 1) . lang('Milestone'), date('Y-m-d', $msData['edate']), $msData['title']);
                         $ms->caption->SetFont(FF_VERA, FS_NORMAL, 8);
                         $ms->title->SetFont(FF_VERA, FS_NORMAL, 8);
                         $ms->mark->SetColor($msColor);
                         $ms->mark->SetFillColor('#EEEEEE');
                         $graphs['ms'][$counter] = $ms;
                         // Create a vertical line to emphasize the milestone
                         $vl = new GanttVLine(date('Y-m-d', $msData[edate]), '', $msColor, 2);
                         $vl->SetDayOffset(0.5);
                         // Center the line in the day
                         $graphs['vl'][$counter] = $vl;
                         $counter++;
                     }
                 }
             }
         }
         // add the vertical lines
         if (is_array($graphs['vl'])) {
             foreach ($graphs['vl'] as $graphCounter => $graphPointer) {
                 $graph->Add($graphPointer);
             }
         }
         // add the milestones
         if (is_array($graphs['ms'])) {
             foreach ($graphs['ms'] as $graphCounter => $graphPointer) {
                 $graph->Add($graphPointer);
             }
         }
         // add the resources
         if (is_array($graphs['bars'])) {
             foreach ($graphs['bars'] as $graphCounter => $graphPointer) {
                 $graph->Add($graphPointer);
             }
         }
         #$graph->Stroke(PHPGW_SERVER_ROOT . SEP . 'phpgwapi' . SEP . 'images' . SEP . 'draw_tmp.png');
         $graph->Stroke($_filename);
     }
 }
示例#17
0
<?php

// Gantt hour + minute example
include "../jpgraph.php";
include "../jpgraph_gantt.php";
// Some sample Gantt data
$data = array(array(0, array("Group 1", "345 days", "2004-03-01", "2004-05-05"), "2001-11-27 10:00", "2001-11-27 14:00", FF_FONT2, FS_NORMAL, 0), array(1, array("  Label one", ' 122,5 days', ' 2004-03-01', ' 2003-05-05', 'MJ'), "2001-11-27 16:00", "2001-11-27 18:00"), array(2, "  Label two", "2001-11-27", "2001-11-27 10:00"), array(3, "  Label three", "2001-11-27", "2001-11-27 08:00"));
// Basic graph parameters
$graph = new GanttGraph();
$graph->SetMarginColor('darkgreen@0.8');
$graph->SetColor('white');
// We want to display day, hour and minute scales
$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR | GANTT_HMIN);
// We want to have the following titles in our columns
// describing each activity
$graph->scale->actinfo->SetColTitles(array('Act', 'Duration', 'Start', 'Finish', 'Resp'));
//,array(100,70,70,70));
// Uncomment the following line if you don't want the 3D look
// in the columns headers
//$graph->scale->actinfo->SetStyle(ACTINFO_2D);
$graph->scale->actinfo->SetFont(FF_ARIAL, FS_NORMAL, 10);
//These are the default values for use in the columns
//$graph->scale->actinfo->SetFontColor('black');
//$graph->scale->actinfo->SetBackgroundColor('lightgray');
//$graph->scale->actinfo->vgrid->SetStyle('solid');
$graph->scale->actinfo->vgrid->SetColor('gray');
$graph->scale->actinfo->SetColor('darkgray');
// Setup day format
$graph->scale->day->SetBackgroundColor('lightyellow:1.5');
$graph->scale->day->SetFont(FF_ARIAL);
$graph->scale->day->SetStyle(DAYSTYLE_SHORTDAYDATE1);
示例#18
0
<?php

include "../jpgraph.php";
include "../jpgraph_gantt.php";
// A new graph with automatic size
$graph = new GanttGraph(0, 0, "auto");
//  A new activity on row '0'
$activity = new GanttBar(0, "Project", "2001-12-21", "2002-02-20");
$graph->Add($activity);
// Display the Gantt chart
$graph->Stroke();
示例#19
0
<?php

// content="text/plain; charset=utf-8"
// Gantt horizontal grid example
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_gantt.php';
// Some dummy data for some activities
$data = array(array(0, "Group 1  Johan", "2001-10-23", "2001-11-06", FF_FONT1, FS_BOLD, 8), array(1, "  Label 2", "2001-10-26", "2001-11-04"), array(3, "Group 2", "2001-11-20", "2001-11-28", FF_FONT1, FS_BOLD, 8), array(4, "  Label 1", "2001-11-20", "2001-12-1"));
// New Gantt Graph
$graph = new GanttGraph(500);
// Setup a title
$graph->title->Set("Grid example");
$graph->subtitle->Set("(Horizontal grid)");
$graph->title->SetFont(FF_VERDANA, FS_NORMAL, 14);
// Specify what headers to show
$graph->ShowHeaders(GANTT_HMONTH | GANTT_HDAY);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT0);
// Setup a horizontal grid
$graph->hgrid->Show();
$graph->hgrid->SetRowFillColor('darkblue@0.9');
for ($i = 0; $i < count($data); ++$i) {
    $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[5%]", 10);
    if (count($data[$i]) > 4) {
        $bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
    }
    $bar->SetPattern(BAND_RDIAG, "yellow");
    $bar->SetFillColor("red");
    $graph->Add($bar);
}
// Setup a vertical marker line
 */
$checkSession = true;
require_once '../includes/library.php';
// load the jpgraph classes
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('&quot;', '"', $phaseDetail->pha_name[0]);
$phaseDetail->pha_name[0] = str_replace("&#39;", "'", $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);
示例#21
0
<?php

// content="text/plain; charset=utf-8"
// $Id: ganttex_slice.php,v 1.2 2002/07/11 23:27:28 aditus Exp $
// Gantt example with sunday week start and only shows a partial graph
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_gantt.php';
// Setup Gantt graph
$graph = new GanttGraph(0, 0, 'auto');
$graph->SetShadow();
$graph->SetBox();
// Only show part of the Gantt
$graph->SetDateRange('2001-11-22', '2002-1-24');
// Weeks start on Sunday
$graph->scale->SetWeekStart(0);
$graph->title->Set("General conversion plan");
$graph->subtitle->Set("(Slice between 2001-11-22 to 2002-01-24)");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 20);
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT1);
$data = array(array(0, "Group 1\tJohan", "2002-1-23", "2002-01-28", FF_FONT1, FS_BOLD, 8), array(1, "  Label 2", "2001-10-26", "2001-11-16"), array(2, "  Label 3", "2001-11-30", "2001-12-01"), array(4, "Group 2", "2001-11-30", "2001-12-22", FF_FONT1, FS_BOLD, 8), array(5, "  Label 4", "2001-11-30", "2001-12-1"), array(6, "  Label 5", "2001-12-6", "2001-12-8"), array(8, "    Label 8", "2001-11-30", "2002-01-02"));
// make up some fictionary activity bars
for ($i = 0; $i < count($data); ++$i) {
    $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[5%]", 10);
    if (count($data[$i]) > 4) {
        $bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
    }
    $bar->rightMark->Show();
    $bar->rightMark->SetType(MARK_FILLEDCIRCLE);
    $bar->rightMark->SetWidth(8);
示例#22
0
<?php

// content="text/plain; charset=utf-8"
// Gantt hour example
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_gantt.php';
$graph = new GanttGraph();
$graph->SetMarginColor('blue:1.7');
$graph->SetColor('white');
$graph->SetBackgroundGradient('navy', 'white', GRAD_HOR, BGRAD_MARGIN);
$graph->scale->hour->SetBackgroundColor('lightyellow:1.5');
$graph->scale->hour->SetFont(FF_FONT1);
$graph->scale->day->SetBackgroundColor('lightyellow:1.5');
$graph->scale->day->SetFont(FF_FONT1, FS_BOLD);
$graph->title->Set("Example of hours in scale");
$graph->title->SetColor('white');
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 14);
$graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
$graph->scale->week->SetFont(FF_FONT1);
$graph->scale->hour->SetIntervall(4);
$graph->scale->hour->SetStyle(HOURSTYLE_HM24);
$graph->scale->day->SetStyle(DAYSTYLE_SHORTDAYDATE3);
$data = array(array(0, "  Label 1", "2001-01-26 04:00", "2001-01-26 14:00"), array(1, "  Label 2", "2001-01-26 10:00", "2001-01-26 18:00"), array(2, "  Label 3", "2001-01-26", "2001-01-27 10:00"));
for ($i = 0; $i < count($data); ++$i) {
    $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[5%]", 10);
    if (count($data[$i]) > 4) {
        $bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
    }
    $bar->SetPattern(BAND_RDIAG, "yellow");
    $bar->SetFillColor("red");
示例#23
0
<?php

// content="text/plain; charset=utf-8"
// Gantt example 30
// $Id: ganttex30.php,v 1.4 2003/05/30 20:12:43 aditus Exp $
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_gantt.php';
// Standard calls to create a new Graph\Graph
$graph = new GanttGraph();
$graph->SetShadow();
$graph->SetBox();
// Titles for chart
$graph->title->Set("General conversion plan");
$graph->subtitle->Set("(Revision: 2001-11-18)");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
// For illustration we enable all headers.
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
// For the week we choose to show the start date of the week
// the default is to show week number (according to ISO 8601)
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAY);
// Change the scale font
$graph->scale->week->SetFont(FF_FONT0);
$graph->scale->year->SetFont(FF_ARIAL, FS_BOLD, 12);
// Setup some data for the gantt bars
$data = array(array(0, "Group 1", "2001-10-29", "2001-11-27", FF_FONT1, FS_BOLD, 8), array(1, "  Label 2", "2001-11-8", "2001-12-14"), array(2, "  Label 3", "2001-11-01", "2001-11-8"), array(4, "Group 2", "2001-11-07", "2001-12-19", FF_FONT1, FS_BOLD, 8), array(5, "  Label 4", "2001-11-8", "2001-12-19"), array(6, "  Label 5", "2001-11-01", "2001-11-8"));
for ($i = 0; $i < count($data); ++$i) {
    $bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3], "[50%]", 0.5);
    if (count($data[$i]) > 4) {
        $bar->title->SetFont($data[$i][4], $data[$i][5], $data[$i][6]);
    }
    // If you like each bar can have a shadow
示例#24
0
 public function graficar($filename)
 {
     $graph = new GanttGraph();
     $graph->SetShadow();
     $graph->SetBox();
     $dataset = $this->dataSource->getDataset();
     define('UTF-8', $locale_char_set);
     $tamanioDataset = count($dataset);
     $fecha_reg_ini = new DateTime();
     $fecha_reg_fin = new DateTime();
     $fechaInicio = new DateTime();
     $fechaFin = new DateTime();
     $data = array();
     $constrains = array();
     for ($i = 0; $i < $tamanioDataset; $i++) {
         //echo date_format(new DateTime($dataset[$i]['fecha_ini']),'Y-m-d H:i:s');
         //exit;
         if ($i == 0) {
             $fechaInicio = new DateTime($dataset[$i]['fecha_ini']);
             $fechaFin = new DateTime($dataset[$i]['fecha_fin']);
         }
         if ($fechaFin < new DateTime($dataset[$i]['fecha_ini']) && $dataset[$i]['tipo'] == 'estado_final') {
             $fechaFin = new DateTime($dataset[$i]['fecha_ini']);
         }
         $actividad = array();
         array_push($actividad, $dataset[$i]['id']);
         $prefijo = '';
         if ($dataset[$i]['tipo'] == 'proceso') {
             $tipo = ACTYPE_GROUP;
         }
         if ($dataset[$i]['tipo'] == 'estado') {
             $tipo = ACTYPE_NORMAL;
             $prefijo = '  ';
         }
         if ($dataset[$i]['tipo'] == 'obs') {
             $tipo = ACTYPE_NORMAL;
             $prefijo = '  ';
         }
         if ($dataset[$i]['tipo'] == 'estado_final') {
             $tipo = ACTYPE_MILESTONE;
             $prefijo = '  ';
         }
         //arma cabecera
         $fecha_reg_ini = new DateTime($dataset[$i]['fecha_ini']);
         $fecha_reg_fin = new DateTime($dataset[$i]['fecha_fin']);
         $resp = $dataset[$i]['funcionario'] != '' ? $dataset[$i]['funcionario'] : $dataset[$i]['depto'];
         $resp = $resp == '' ? $dataset[$i]['cuenta'] : $resp;
         //$resp = $dataset[$i]['depto'].'('.$dataset[$i]['cuenta'].") ->".$dataset[$i]['funcionario'];
         //$resp = $dataset[$i]['depto'].'('.$dataset[$i]['cuenta'].");
         $fini = $fecha_reg_ini->format('d M H:i:s');
         $ffin = $fecha_reg_fin->format('d M H:i:s');
         $start = strtotime($dataset[$i]['fecha_ini']);
         $end = strtotime($dataset[$i]['fecha_fin']);
         $days_between = round(($end - $start) / 86400);
         if ($dataset[$i]['tipo'] == 'obs') {
             $desc_principal = utf8_decode($prefijo . '  -> OBS: ' . $dataset[$i]['nombre']);
         } else {
             $desc_principal = utf8_decode($prefijo . $dataset[$i]['nombre']);
         }
         if ($dataset[$i]['tipo'] == 'estado' || $dataset[$i]['tipo'] == 'obs') {
             $tiempo = $days_between . ' dias';
         } else {
             if ($dataset[$i]['tipo'] == 'estado_final') {
                 $tiempo = '--';
                 $ffin = $fini;
             } else {
                 $resp = '--';
                 $tiempo = $days_between . ' dias';
                 $desc_principal = $desc_principal . "\n" . $dataset[$i]['descripcion'];
             }
         }
         // si el estado tiene configurado el nombre de estapa damos preferencia a este campo
         if (isset($dataset[$i]['etapa']) && $dataset[$i]['etapa'] != '') {
             $desc_principal = '  ' . $dataset[$i]['etapa'] . ' [' . trim($desc_principal) . ']';
         }
         //mostramos cuenta de usuario si existe
         if ($dataset[$i]['nombre_usuario_ai'] != '' && $dataset[$i]['nombre_usuario_ai'] != 'NULL') {
             $desc_principal = $desc_principal . ' (por AI: ' . $dataset[$i]['nombre_usuario_ai'] . ")";
         } elseif ($dataset[$i]['cuenta'] != '') {
             $desc_principal = $desc_principal . ' (por: ' . $dataset[$i]['cuenta'] . ")";
         }
         if ($dataset[$i]['disparador'] == 'no' && $dataset[$i]['estado_reg'] == 'activo' || $dataset[$i]['tipo'] == 'estado_final') {
             $desc_principal = $desc_principal . ' *****';
         }
         $cabecera = array(utf8_decode($desc_principal), utf8_decode($resp), $tiempo, $fini, $ffin);
         array_push($actividad, $tipo);
         array_push($actividad, $cabecera);
         array_push($actividad, $fecha_reg_ini->format('Y-m-d H:i:s'));
         if ($dataset[$i]['tipo'] != 'estado_final') {
             array_push($actividad, $fecha_reg_fin->format('Y-m-d H:i:s'));
         }
         array_push($actividad, utf8_decode($dataset[$i]['descripcion']));
         array_push($actividad, '#' . $dataset[$i]['id']);
         array_push($actividad, $fecha_reg_ini->format('Y-m-d H:i:s'));
         //prepara las relaciones entre tipos
         if ($dataset[$i]['tipo'] == 'estado' && $dataset[$i]['id_siguiente'] != 0) {
             array_push($constrains, array($dataset[$i]['id'], $dataset[$i]['id_siguiente'], CONSTRAIN_ENDSTART));
         }
         array_push($data, $actividad);
     }
     //definir scala en funcion al dia inicial y dia final
     $diferencia = $fechaInicio->diff($fechaFin);
     if ($diferencia->format('%m') >= 24) {
         //escala de meses
         $graph->ShowHeaders(GANTT_HYEAR);
         $sw = 1;
         $fechaFin = $fechaFin->add(new DateInterval('PT9000H'));
     } elseif ($diferencia->format('%m') >= 7) {
         //escala de meses
         $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
         $sw = 1;
         $fechaFin = $fechaFin->add(new DateInterval('PT29000H'));
     } elseif ($diferencia->format('%m') > 6) {
         //escala de meses
         $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
         $graph->scale->week->SetStyle(HOURSTYLE_HM24);
         $sw = 1;
         $fechaFin = $fechaFin->add(new DateInterval('PT6000H'));
     } elseif ($diferencia->format('%m') > 1) {
         //escala de semanas
         $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK);
         $graph->scale->week->SetStyle(HOURSTYLE_HM24);
         $sw = 2;
         $fechaFin = $fechaFin->add(new DateInterval('PT7000H'));
     } elseif ($diferencia->format('%m') > 0) {
         //escala de dias
         $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HWEEK | GANTT_HDAY);
         $graph->scale->week->SetStyle(HOURSTYLE_HM24);
         $sw = 3;
         $fechaFin = $fechaFin->add(new DateInterval('PT4600H'));
     } elseif ($diferencia->format('%m') == 0 && $diferencia->format('%d') > 1) {
         //escala de dias
         $graph->ShowHeaders(GANTT_HMONTH | GANTT_HWEEK | GANTT_HDAY | GANTT_HHOUR);
         $graph->scale->week->SetStyle(HOURSTYLE_HM24);
         $graph->scale->hour->SetInterval(12);
         $sw = 4;
         $fechaFin = $fechaFin->add(new DateInterval('PT400H'));
     } else {
         //escala de horas
         $graph->ShowHeaders(GANTT_HDAY | GANTT_HHOUR);
         $graph->scale->week->SetStyle(HOURSTYLE_HM24);
         $fechaFin = $fechaFin->add(new DateInterval('PT250H'));
         $sw = 5;
     }
     $graph->scale->actinfo->SetColTitles(array('Tipo', 'Responsable', 'Duracion', 'Inicio', 'Fin'), array(40, 100));
     // Setup a horizontal grid
     $graph->hgrid->Show();
     $graph->hgrid->SetRowFillColor('darkblue@0.9');
     $graph->SetDateRange($fechaInicio->format('Y-m-d H:i:s'), $fechaFin->format('Y-m-d H:i:s'));
     //$graph->SetDateRange('2013-06-04','2013-08-04');
     $graph->title->Set("Diagrama Gant Work Flow");
     //$graph->scale->week->SetStyle(MINUTESTYLE_MM);
     $graph->scale->week->SetFont(FF_FONT1);
     $progress = array();
     $graph->CreateSimple($data, $constrains, $progress);
     $archivo = dirname(__FILE__) . '/../../../reportes_generados/' . $filename;
     //$graph->StrokeCSIM();
     $graph->Stroke($archivo);
     /*
             
             echo ('<pre>');
             var_dump($sw);
             var_dump($fechaInicio->format('Y-m-d H:i:s'));
             var_dump($fechaFin->format('Y-m-d H:i:s'));
             
             var_dump($data);
             echo ('</pre>');
             
             echo ('<pre>');
             print_r($constrains);
             echo ('</pre>');*/
 }
示例#25
0
<?php

// content="text/plain; charset=utf-8"
// Gantt example
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_gantt.php';
//
// The data for the graphs
//
$data = array(array(0, ACTYPE_GROUP, "Phase 1", "2001-10-26", "2001-11-23", ''), array(1, ACTYPE_NORMAL, "  Label 2", "2001-10-26", "2001-11-16", ''), array(2, ACTYPE_NORMAL, "  Label 3", "2001-11-20", "2001-11-22", ''), array(3, ACTYPE_NORMAL, "  Label 4", "2001-11-20", "2001-11-22", ''), array(4, ACTYPE_MILESTONE, "  Phase 1 Done", "2001-11-23", 'M2'));
// The constrains between the activities
$constrains = array(array(1, 2, CONSTRAIN_ENDEND), array(2, 3, CONSTRAIN_STARTEND), array(3, 4, CONSTRAIN_ENDSTART));
$progress = array(array(1, 0.4));
// Create the basic graph
$graph = new GanttGraph();
$graph->title->Set("Example with grouping and constrains");
// Setup scale
$graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
$graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
// Add the specified activities
$graph->CreateSimple($data, $constrains, $progress);
// .. and stroke the graph
$graph->Stroke();
?>


    if ($d2 > $d1) {
        if (!$d[$d2]) {
            $d[$d2] = $idx++;
        }
        $data[] = array($d[$d2] - 1, date("Y-m-d", $end), "00:00", date("H:i", $end), $start);
    }
    if (!$d[$d1]) {
        $d[$d1] = $idx++;
    }
    $data[] = array($d[$d1] - 1, date("Y-m-d", $start), date("H:i", $start), $d2 <= $d1 ? date("H:i", $end) : "23:59", $start);
    $suma += $row['gone'] - $row['came'];
}
include "lib/jpgraph/jpgraph.php";
include "lib/jpgraph/jpgraph_gantt.php";
$imgfilename = 'auto';
$graph = new GanttGraph($main_width - 10, 0, $imgfilename, 1);
$graph->SetMarginColor('#C4C4C4');
$graph->SetColor('white');
$graph->SetFrame(true, 'gray', 1);
$graph->ShowHeaders(GANTT_HHOUR);
$graph->scale->UseWeekendBackground(false);
$graph->scale->hour->SetBackgroundColor('lightyellow:1.5');
$graph->scale->hour->SetSundayFontColor('black');
$graph->scale->day->SetBackgroundColor('lightyellow:1.5');
$graph->scale->day->SetSundayFontColor('black');
$graph->scale->hour->SetFont(FF_FONT1);
$graph->scale->hour->SetIntervall(1);
$graph->scale->hour->SetStyle(HOURSTYLE_H24);
$graph->hgrid->SetRowFillColor('whitesmoke@0.9', 'darkblue@0.9');
$graph->setMargin(0, 0, 0, 20);
$graph->scale->hour->SetFont(FF_FONT1);
示例#27
0
<?php

include "../jpgraph.php";
include "../jpgraph_gantt.php";
$graph = new GanttGraph(0, 0, "auto");
$graph->SetBox();
$graph->SetShadow();
// Add title and subtitle
$graph->title->Set("Example of captions");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph->subtitle->Set("(ganttex14.php)");
// Show day, week and month scale
$graph->ShowHeaders(GANTT_HDAY | GANTT_HWEEK | GANTT_HMONTH);
// Use the short name of the month together with a 2 digit year
// on the month scale
$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR2);
$graph->scale->month->SetFontColor("white");
$graph->scale->month->SetBackgroundColor("blue");
// 0 % vertical label margin
$graph->SetLabelVMarginFactor(1);
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity = new GanttBar(0, "Project", "2001-12-21", "2002-01-07", "[50%]");
// Yellow diagonal line pattern on a red background
$activity->SetPattern(BAND_RDIAG, "yellow");
$activity->SetFillColor("red");
// Set absolute height
$activity->SetHeight(10);
// Specify progress to 60%
$activity->progress->Set(0.6);
// Format the bar for the second activity
示例#28
0
 /**
  * @param int $teamid
  * @param int $startTimestamp
  * @param int $endTimestamp
  * @param int[] $projectIds
  * @return GanttGraph
  */
 private function getGanttGraph($teamid, $startTimestamp, $endTimestamp, array $projectIds)
 {
     $graph = new GanttGraph();
     // set graph title
     $team = TeamCache::getInstance()->getTeam($teamid);
     if (0 != count($projectIds)) {
         $pnameList = "";
         foreach ($projectIds as $pid) {
             if ("" != $pnameList) {
                 $pnameList .= ",";
             }
             $project = ProjectCache::getInstance()->getProject($pid);
             $pnameList .= $project->getName();
         }
         $graph->title->Set(T_('Team') . ' ' . $team->getName() . '    ' . T_('Project(s)') . ': ' . $pnameList);
     } else {
         $graph->title->Set(T_('Team') . ' ' . $team->getName() . '    (' . T_('All projects') . ')');
     }
     // Setup scale
     $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH | GANTT_HDAY | GANTT_HWEEK);
     $graph->scale->week->SetStyle(WEEKSTYLE_FIRSTDAYWNBR);
     $gantManager = new GanttManager($teamid, $startTimestamp, $endTimestamp);
     $teamActivities = $gantManager->getTeamActivities();
     // mapping to ease constrains building
     // Note: $issueActivityMapping must be completed before calling $a->getJPGraphBar()
     $issueActivityMapping = array();
     $activityIdx = 0;
     foreach ($teamActivities as $a) {
         $a->setActivityIdx($activityIdx);
         $issueActivityMapping[$a->bugid] = $activityIdx;
         ++$activityIdx;
     }
     // Add the specified activities
     foreach ($teamActivities as $a) {
         // FILTER on projects
         if (NULL != $projectIds && 0 != sizeof($projectIds)) {
             $issue = IssueCache::getInstance()->getIssue($a->bugid);
             if (!in_array($issue->getProjectId(), $projectIds)) {
                 // skip activity indexing
                 continue;
             }
         }
         $filterTeamActivities[] = $a;
         // Shorten bar depending on gantt startDate
         if (NULL != $startTimestamp && $a->startTimestamp < $startTimestamp) {
             // leave one day to insert prefixBar
             $newStartTimestamp = $startTimestamp + 60 * 60 * 24;
             if ($newStartTimestamp > $a->endTimestamp) {
                 // there is not enough space for a prefixBar
                 $newStartTimestamp = $startTimestamp;
                 self::$logger->debug("bugid=" . $a->bugid . ": Shorten bar to Gantt start date");
             } else {
                 $formattedStartDate = date('Y-m-d', $startTimestamp);
                 $prefixBar = new GanttBar($a->activityIdx, "", $formattedStartDate, $formattedStartDate, "", 10);
                 $prefixBar->SetBreakStyle(true, 'dotted', 1);
                 $graph->Add($prefixBar);
                 self::$logger->debug("bugid=" . $a->bugid . ": Shorten bar & add prefixBar");
             }
             self::$logger->debug("bugid=" . $a->bugid . ": Shorten bar from " . date('Y-m-d', $a->startTimestamp) . " to " . date('Y-m-d', $newStartTimestamp));
             $a->startTimestamp = $newStartTimestamp;
         }
         $bar = $a->getJPGraphBar($issueActivityMapping);
         $graph->Add($bar);
     }
     return $graph;
 }
示例#29
0
<?php

// Gantt example
include "../jpgraph.php";
include "../jpgraph_gantt.php";
$graph = new GanttGraph();
$graph->title->Set("Only month & year scale");
// Setup some "very" nonstandard colors
$graph->SetMarginColor('lightgreen@0.8');
$graph->SetBox(true, 'yellow:0.6', 2);
$graph->SetFrame(true, 'darkgreen', 4);
$graph->scale->divider->SetColor('yellow:0.6');
$graph->scale->dividerh->SetColor('yellow:0.6');
// Explicitely set the date range
// (Autoscaling will of course also work)
$graph->SetDateRange('2001-10-06', '2002-4-10');
// Display month and year scale with the gridlines
$graph->ShowHeaders(GANTT_HMONTH | GANTT_HYEAR);
$graph->scale->month->grid->SetColor('gray');
$graph->scale->month->grid->Show(true);
$graph->scale->year->grid->SetColor('gray');
$graph->scale->year->grid->Show(true);
// Setup activity info
// For the titles we also add a minimum width of 100 pixels for the Task name column
$graph->scale->actinfo->SetColTitles(array('Name', 'Duration', 'Start', 'Finish'), array(100));
$graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5');
$graph->scale->actinfo->SetFont(FF_ARIAL, FS_NORMAL, 10);
$graph->scale->actinfo->vgrid->SetStyle('solid');
$graph->scale->actinfo->vgrid->SetColor('gray');
// Data for our example activities
$data = array(array(0, array("Pre-study", "102 days", "23 Nov '01", "1 Mar '02"), "2001-11-23", "2002-03-1", FF_ARIAL, FS_NORMAL, 8), array(1, array("Prototype", "21 days", "26 Oct '01", "16 Nov '01"), "2001-10-26", "2001-11-16", FF_ARIAL, FS_NORMAL, 8), array(2, array("Report", "12 days", "1 Mar '02", "13 Mar '02"), "2002-03-01", "2002-03-13", FF_ARIAL, FS_NORMAL, 8));
示例#30
0
    $gdate2 = $_COOKIE['gdate2'];
} else {
    if (isset($_POST['gdate2']) and $_POST['gdate2'] != '') {
        $gdate2 = $_POST['gdate2'];
    } elseif (isset($_GET['gdate2']) and $_GET['gdate2'] != '') {
        $gdate2 = $_GET['gdate2'];
    } else {
        $gdate2 = strftime('%Y/%m/%d', strtotime('+2 weeks'));
    }
}
$count = 0;
$adate1 = explode('/', $gdate1);
$epocdate1 = mktime(0, 0, 0, $adate1['1'], $adate1['2'], $adate1['0']);
$adate2 = explode('/', $gdate2);
$epocdate2 = mktime(0, 0, 0, $adate2['1'], $adate2['2'], $adate2['0']);
$graph = new GanttGraph($graphWidth);
$graph->SetMarginColor('lightskyblue3@0.5');
$graph->SetBox(true, 'blue@0.8', 2);
$graph->SetFrame(true, 'darkgreen', 4);
$graph->scale->divider->SetColor('yellow:0.6');
$graph->scale->dividerh->SetColor('yellow:0.6');
$graph->scale->actinfo->SetColTitles(array('Projects'), array(100));
$graph->scale->actinfo->SetBackgroundColor('green:0.5@0.5');
$graph->scale->actinfo->SetFont(FF_VERA, FS_NORMAL, 10);
$graph->scale->actinfo->vgrid->SetStyle('solid');
$graph->scale->actinfo->vgrid->SetColor('gray');
if ($epocdate2 - $epocdate1 > 12000000) {
    $graph->ShowHeaders(GANTT_HYEAR | GANTT_HMONTH);
    $graph->scale->month->grid->SetColor('gray');
    $graph->scale->month->grid->Show(true);
    $graph->scale->year->grid->SetColor('gray');