예제 #1
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));
예제 #2
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);
for ($i = 0; $i < $comptListTasks; $i++) {
    $listTasks->subtas_name[$i] = str_replace('&quot;', '"', $listTasks->subtas_name[$i]);
예제 #3
0
// content="text/plain; charset=utf-8"
// Gantt example
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_gantt.php';
// Basic Gantt graph
$graph = new GanttGraph();
$graph->title->Set("Gantt chart with title columns and icons");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$graph->title->SetMargin(10);
// Explicitely set the date range
// (Autoscaling will of course also work)
$graph->SetDateRange('2001-10-06', '2002-4-10');
// 1.5 line spacing to make more room
$graph->SetVMarginFactor(1.5);
// Setup some nonstandard colors
$graph->SetMarginColor('darkgreen@0.95');
$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');
// 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);
// For the titles we also add a minimum width of 100 pixels for the Task name column
$graph->scale->actinfo->SetColTitles(array('Note', 'Task', 'Duration', 'Start', 'Finish'), array(30, 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');
예제 #4
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();
예제 #5
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();
}
예제 #6
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");
예제 #7
0
        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);
$graph->scale->day->SetFont(FF_FONT1, FS_BOLD);
예제 #8
0
파일: grafica.php 프로젝트: giovanny751/sst
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');
}
예제 #9
0
// 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);
// Condensed Gantt or not?
if ($_GET['base'] == true) {
    $graph->scale->year->Show(true);
예제 #10
0
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 ...
$graph->scale->UseWeekendBackground(false);
$graph->scale->day->SetWeekendColor($styles->val('image.session.header.bgcolor', 'lightyellow:1.5', true));
$graph->scale->day->SetFontColor($styles->val('image.session.header.color', 'black', true));
$graph->scale->day->SetSundayFontColor($styles->val('image.session.header.color', 'black', true));
// match the weekend settings ...
$graph->scale->hour->SetFontColor($styles->val('image.session.header.color', 'black', true));
$graph->scale->hour->SetBackgroundColor($styles->val('image.session.header.bgcolor', 'lightyellow:1.5', true));
$graph->scale->hour->SetFont(constant($styles->val('image.session.font', 'FF_FONT0', true)));
$graph->scale->hour->SetIntervall($styles->val('image.session.interval', 2, true));
예제 #11
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
예제 #12
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);
 }
예제 #13
0
} 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');
    $graph->scale->year->grid->Show(true);
예제 #14
0
function ganttPDF($reportName, $listTasks)
{
    include "../includes/jpgraph/jpgraph.php";
    include "../includes/jpgraph/jpgraph_gantt.php";
    $graph = new GanttGraph();
    $graph->SetBox();
    $graph->SetMarginColor("white");
    $graph->SetColor("white");
    $graph->title->Set($strings["project"] . " " . $reportName);
    //    $graph->subtitle->Set("(".$strings["created"].": "..")");
    $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);
    $comptListTasks = count($listTasks->tas_id);
    $posGantt = 0;
    for ($i = 0; $i < $comptListTasks; $i++) {
        $listTasks->tas_name[$i] = str_replace('&quot;', '"', $listTasks->tas_name[$i]);
        $listTasks->tas_name[$i] = str_replace("&#39;", "'", $listTasks->tas_name[$i]);
        $progress = round($listTasks->tas_completion[$i] / 10, 2);
        $printProgress = $listTasks->tas_completion[$i] * 10;
        $activity = new GanttBar($posGantt, $listTasks->tas_pro_name[$i] . " / " . $listTasks->tas_name[$i], $listTasks->tas_start_date[$i], $listTasks->tas_due_date[$i]);
        $activity->SetPattern(BAND_LDIAG, "yellow");
        $activity->caption->Set($listTasks->tas_mem_login[$i] . " (" . $printProgress . "%)");
        $activity->SetFillColor("gray");
        if ($listTasks->tas_priority[$i] == "4" || $listTasks->tas_priority[$i] == "5") {
            $activity->progress->SetPattern(BAND_SOLID, "#BB0000");
        } else {
            $activity->progress->SetPattern(BAND_SOLID, "#0000BB");
        }
        $activity->progress->Set($progress);
        $graph->Add($activity);
        // begin if subtask
        $tmpquery = "WHERE task = " . $listTasks->tas_id[$i];
        $listSubTasks = new request();
        $listSubTasks->openSubtasks($tmpquery);
        $comptListSubTasks = count($listSubTasks->subtas_id);
        if ($comptListSubTasks >= 1) {
            // list subtasks
            for ($j = 0; $j < $comptListSubTasks; $j++) {
                $listSubTasks->subtas_name[$j] = str_replace('&quot;', '"', $listSubTasks->subtas_name[$j]);
                $listSubTasks->subtas_name[$j] = str_replace("&#39;", "'", $listSubTasks->subtas_name[$j]);
                $progress = round($listSubTasks->subtas_completion[$j] / 10, 2);
                $printProgress = $listSubTasks->subtas_completion[$j] * 10;
                $posGantt += 1;
                // $activity = new GanttBar($posGantt,$listTasks->tas_pro_name[$i]." / ".$listSubTasks->subtas_name[$j],$listSubTasks->subtas_start_date[$j],$listSubTasks->subtas_due_date[$j]);
                // change name of project for name of parent task
                $activity = new GanttBar($posGantt, $listSubTasks->subtas_tas_name[$j] . " / " . $listSubTasks->subtas_name[$j], $listSubTasks->subtas_start_date[$j], $listSubTasks->subtas_due_date[$j]);
                //$activity = new GanttBar($j,$strings["project"].": ".$listSubTasks->subtas_pro_name[$j]." / ".$strings["task"].": ".$listSubTasks->subtas_name[$j],$listSubTasks->subtas_start_date[$j],$listSubTasks->subtas_due_date[$j]);
                $activity->SetPattern(BAND_LDIAG, "yellow");
                $activity->caption->Set($listSubTasks->subtas_mem_login[$j] . " (" . $printProgress . "%)");
                $activity->SetFillColor("gray");
                if ($listSubTasks->subtas_priority[$j] == "4" || $listSubTasks->subtas_priority[$j] == "5") {
                    $activity->progress->SetPattern(BAND_SOLID, "#BB0000");
                } else {
                    $activity->progress->SetPattern(BAND_SOLID, "#0000BB");
                }
                $activity->progress->Set($progress);
                $graph->Add($activity);
            }
            // end for comptListSubTasks
        }
        // end if subtask
        $posGantt += 1;
    }
    // end for complisttask
    $tmpGantt = "../files/" . md5(uniqid(rand()));
    $graph->Stroke($tmpGantt);
    return $tmpGantt;
}