Exemplo n.º 1
0
// 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
// ($row,$title,$startdate,$enddate)
$activity2 = new GanttBar(1, "Project", "2001-12-21", "2002-01-02", "[30%]");
// Yellow diagonal line pattern on a red background
$activity2->SetPattern(BAND_RDIAG, "yellow");
$activity2->SetFillColor("red");
// Set absolute height
$activity2->SetHeight(10);
// Specify progress to 30%
$activity2->progress->Set(0.3);
// Finally add the bar to the graph
$graph->Add($activity);
$graph->Add($activity2);
// Add a vertical line
$vline = new GanttVLine("2001-12-24", "Phase 1");
$vline->SetDayOffset(0.5);
//$graph->Add($vline);
// ... and display it
$graph->Stroke();
Exemplo n.º 2
0
$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);
$activity->rightMark->SetWidth(13);
$activity->rightMark->SetColor("red");
$activity->rightMark->SetFillColor("red");
$activity->rightMark->title->Set("M5");
$activity->rightMark->title->SetFont(FF_ARIAL, FS_BOLD, 12);
$activity->rightMark->title->SetColor("white");
// Set absolute height
$activity->SetHeight(8);
// Finally add the bar to the graph
$graph->Add($activity);
// Create a miletone
$milestone = new MileStone(2, "Milestone", "2002-01-15", "2002-01-15");
$milestone->title->SetColor("black");
$milestone->title->SetFont(FF_FONT1, FS_BOLD);
$graph->Add($milestone);
// Add a vertical line
$vline = new GanttVLine("2001-12-24", "Phase 1");
$vline->SetDayOffset(0.5);
$graph->Add($vline);
// ... and display it
$graph->Stroke();
Exemplo n.º 3
0
function prj_drawProjectTasksGanttBar(&$graph, &$row, &$count, $pid = 0, $nameIndent = '', $tid = 0, $sampleCounting = 0, $sm, $stm)
{
    global $_TABLES, $_CONF, $showMonitor, $showTeamMember, $userid, $_PRJCONF, $filterCSV;
    $sql = 'SELECT tid,name,start_date, estimated_end_date,parent_task, progress, progress_id ';
    $sql .= "FROM {$_TABLES['prj_tasks']} ";
    if ($pid == 0) {
        $sql .= 'WHERE pid=0 ';
    } else {
        $sql .= "WHERE pid='{$pid}' ";
    }
    $sql .= "and parent_task={$tid} ";
    if ($filterCSV != '') {
        $sql .= "AND  {$_TABLES['prj_tasks']}.pid  in ({$filterCSV}) ";
    }
    $sql .= ' ORDER BY lhs ASC';
    $result = DB_query($sql, true);
    $testnumrows = DB_numRows($result);
    if ($testnumrows == 0) {
        //this is to help overcome any COOKIE issues with the filtercsv
        $sql = 'SELECT tid,name,start_date, estimated_end_date,parent_task, progress, progress_id ';
        $sql .= "FROM {$_TABLES['prj_tasks']} ";
        if ($pid == 0) {
            $sql .= 'WHERE pid=0 ';
        } else {
            $sql .= "WHERE pid='{$pid}' ";
        }
        $sql .= "and parent_task={$tid} ";
        $sql .= ' ORDER BY lhs ASC';
        $result = DB_query($sql);
    }
    for ($j = 0; $j < DB_numrows($result); $j++) {
        list($tid, $name, $startdate, $enddate, $parent_task, $progress, $status) = DB_fetchArray($result);
        $permsArray = prj_getProjectPermissions($pid, $userid, $tid);
        $ownertoken = getTaskToken($tid, $userid, "{$_TABLES['prj_task_users']}", "{$_TABLES['prj_tasks']}");
        if ($sm == '1' && $stm == '1') {
            // all projects
            if ($permsArray['monitor'] == '1' || $permsArray['teammember'] == '1' || $ownertoken != 0) {
                $name = html_entity_decode($name);
                $strdate = strftime("%Y/%m/%d", $startdate);
                $edate = strftime("%Y/%m/%d", $enddate);
                $sql = "SELECT c.fullname ";
                $sql .= "FROM {$_TABLES['prj_task_users']} a ";
                $sql .= "INNER JOIN {$_TABLES['prj_tasks']} b on a.tid=b.tid ";
                $sql .= "INNER JOIN {$_TABLES['users']} c on a.uid=c.uid ";
                $sql .= "WHERE a.role='o' AND a.tid={$tid} ";
                $result2 = DB_query($sql);
                list($owner) = DB_fetchArray($result2);
                $link = $_CONF['site_url'] . "/nexproject/viewproject.php?mode=view&id=" . $tid;
                $count = $count + 1;
                if (strlen($name) > $_PRJCONF['project_name_length']) {
                    $name = substr($name, 0, $_PRJCONF['project_name_length']);
                    $name .= "...";
                }
                $name = $nameIndent . $name;
                if ($strdate == $edate) {
                    $milestone = new Milestone($row, $name, $strdate);
                    $milestone->mark->SetType(MARK_DIAMOND);
                    $graph->Add($milestone);
                } else {
                    $taskActivity = new GanttBar($count, $name, "{$strdate}", "{$edate}", "");
                    if ($status == 0) {
                        // Yellow diagonal line pattern on a red background
                        $taskActivity->SetPattern(BAND_RDIAG, "green");
                        $taskActivity->progress->SetPattern(GANTT_RDIAG, "black");
                        $taskActivity->progress->SetFillColor("white");
                    } elseif ($status == 1) {
                        $taskActivity->SetPattern(BAND_RDIAG, "yellow");
                        $taskActivity->progress->SetPattern(GANTT_RDIAG, "black");
                        $taskActivity->progress->SetFillColor("white");
                    } else {
                        $taskActivity->SetPattern(BAND_RDIAG, "red");
                        $taskActivity->progress->SetPattern(GANTT_RDIAG, "black");
                        $taskActivity->progress->SetFillColor("white");
                    }
                    $taskActivity->caption->SetFont(FF_FONT1, FS_NORMAL, 10);
                    $taskActivity->caption->SetColor('black');
                    $taskActivity->caption->Set($name);
                    // Set absolute height
                    $taskActivity->SetHeight(10);
                    $taskActivity->progress->Set($progress / 100);
                    // Specify progress
                    $taskActivity->SetCSIMTarget("{$link}");
                    $taskActivity->SetCSIMAlt($progress . "% completed");
                    $tempval = $_GET['expanded'];
                    $tempval2 = $_SERVER['PHP_SELF'];
                    $taskActivity->title->SetCSIMTarget("");
                    $taskActivity->title->SetCSIMAlt($progress . "% completed");
                    $qconstraints = DB_query("SELECT tid FROM {$_TABLES['prj_tasks']} WHERE parent_task='{$tid}' ORDER BY lhs ASC");
                    $numconstraints = DB_numRows($qconstraints);
                    for ($c = 1; $c <= $numconstraints; $c++) {
                        //$taskActivity->SetConstrain($row+$c,CONSTRAIN_STARTSTART,"maroon4");
                    }
                    // Add line to Gantt Chart
                    if (!$sampleCounting) {
                        $graph->Add($taskActivity);
                    }
                }
                $row++;
            }
        } else {
            // my projects
            if ($ownertoken != 0) {
                $name = html_entity_decode($name);
                $strdate = strftime("%Y/%m/%d", $startdate);
                $edate = strftime("%Y/%m/%d", $enddate);
                $sql = "SELECT c.fullname ";
                $sql .= "FROM {$_TABLES['prj_task_users']} a ";
                $sql .= "INNER JOIN {$_TABLES['prj_tasks']} b on a.tid=b.tid ";
                $sql .= "INNER JOIN {$_TABLES['users']} c on a.uid=c.uid ";
                $sql .= "WHERE a.role='o' AND a.tid={$tid}";
                $result2 = DB_query($sql);
                list($owner) = DB_fetchArray($result2);
                $link = $_CONF['site_url'] . "/nexproject/viewproject.php?mode=view&id=" . $tid;
                $count = $count + 1;
                if (strlen($name) > $_PRJCONF['project_name_length']) {
                    $name = substr($name, 0, $_PRJCONF['project_name_length']);
                    $name .= "...";
                }
                $name = $nameIndent . $name;
                if ($strdate == $edate) {
                    $milestone = new Milestone($row, $name, $strdate);
                    $milestone->mark->SetType(MARK_DIAMOND);
                    $graph->Add($milestone);
                } else {
                    $taskActivity = new GanttBar($count, $name, "{$strdate}", "{$edate}", "");
                    if ($status == 0) {
                        // Yellow diagonal line pattern on a red background
                        $taskActivity->SetPattern(BAND_RDIAG, "green");
                        $taskActivity->progress->SetPattern(GANTT_RDIAG, "black");
                        $taskActivity->progress->SetFillColor("white");
                    } elseif ($status == 1) {
                        $taskActivity->SetPattern(BAND_RDIAG, "yellow");
                        $taskActivity->progress->SetPattern(GANTT_RDIAG, "black");
                        $taskActivity->progress->SetFillColor("white");
                    } else {
                        $taskActivity->SetPattern(BAND_RDIAG, "red");
                        $taskActivity->progress->SetPattern(GANTT_RDIAG, "black");
                        $taskActivity->progress->SetFillColor("white");
                    }
                    $taskActivity->caption->SetFont(FF_FONT1, FS_NORMAL, 10);
                    $taskActivity->caption->SetColor('black');
                    $taskActivity->caption->Set($name);
                    // Set absolute height
                    $taskActivity->SetHeight(10);
                    $taskActivity->progress->Set($progress / 100);
                    // Specify progress
                    $taskActivity->SetCSIMTarget("{$link}");
                    $taskActivity->SetCSIMAlt($progress . "% completed");
                    $tempval = $_GET['expanded'];
                    $tempval2 = $_SERVER['PHP_SELF'];
                    $taskActivity->title->SetCSIMTarget("");
                    $taskActivity->title->SetCSIMAlt($progress . "% completed");
                    $qconstraints = DB_query("SELECT tid FROM {$_TABLES['prj_tasks']} WHERE parent_task='{$tid}' ORDER BY lhs ASC");
                    $numconstraints = DB_numRows($qconstraints);
                    for ($c = 1; $c <= $numconstraints; $c++) {
                        //$taskActivity->SetConstrain($row+$c,CONSTRAIN_STARTSTART,"maroon4");
                    }
                    // Add line to Gantt Chart
                    if (!$sampleCounting) {
                        $graph->Add($taskActivity);
                    }
                }
                $row++;
            }
        }
        if (DB_count($_TABLES['prj_tasks'], 'parent_task', $tid) > 0) {
            prj_drawProjectTasksGanttBar($graph, $row, $count, $pid, $nameIndent . " ", $tid, $sampleCounting, $sm, $stm);
        }
    }
    //end for
}
Exemplo n.º 4
0
$graph->scale->month->SetFontColor("white");
$graph->scale->month->SetBackgroundColor("blue");
// 0 % vertical label margin
$graph->SetLabelVMarginFactor(1.0);
// 1=default value
// Set zoom factor
$graph->SetZoomFactor(1.5);
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity1 = new GanttBar(0, "Activity 1", "2001-12-21", "2002-01-07", "[ER,TR]");
// Yellow diagonal line pattern on a red background
$activity1->SetPattern(BAND_RDIAG, "yellow");
$activity1->SetFillColor("red");
// Set absolute height of activity
$activity1->SetHeight(16);
// Format the bar for the second activity
// ($row,$title,$startdate,$enddate)
$activity2 = new GanttBar(1, "Activity 2", "2001-12-21", "2002-01-01", "[BO,SW,JC]");
// ADjust font for caption
$activity2->caption->SetFont(FF_ARIAL, FS_BOLD);
$activity2->caption->SetColor("darkred");
// Yellow diagonal line pattern on a red background
$activity2->SetPattern(BAND_RDIAG, "yellow");
$activity2->SetFillColor("red");
// Set absolute height of activity
$activity2->SetHeight(16);
// Finally add the bar to the graph
$graph->Add($activity1);
$graph->Add($activity2);
// ... and display it
$graph->Stroke();
Exemplo n.º 5
0
function prj_drawGanttBar(&$graph, $pid, $tid = 0, &$row, &$count)
{
    global $_TABLES, $_CONF, $_PRJCONF;
    $sql = "SELECT tid,name,start_date, estimated_end_date,parent_task, progress, progress_id ";
    $sql .= "FROM {$_TABLES['prj_tasks']} ";
    if ($tid == 0) {
        $sql .= "WHERE pid={$pid} AND parent_task=0 ORDER BY lhs ASC";
    } else {
        $sql .= "WHERE parent_task='{$tid}' ORDER BY lhs ASC";
    }
    $result = DB_query($sql);
    for ($j = 0; $j < DB_numrows($result); $j++) {
        list($tid, $name, $startdate, $enddate, $parent_task, $progress, $status) = DB_fetchArray($result);
        $name = html_entity_decode($name);
        $strdate = strftime("%Y/%m/%d", $startdate);
        $edate = strftime("%Y/%m/%d", $enddate);
        $sql = "SELECT fullname FROM {$_TABLES['users']}, {$_TABLES['prj_task_users']} ";
        $sql .= "WHERE {$_TABLES['prj_task_users']}.tid={$tid} AND {$_TABLES['prj_task_users']}.uid={$_TABLES['users']}.uid";
        $result2 = DB_query($sql);
        list($owner) = DB_fetchArray($result2);
        $link = $_CONF['site_url'] . "/nexproject/viewproject.php?mode=view&id=" . $tid;
        $count = $count + 1;
        //echo "<br>Count:$count, row:$row";
        //$constrains[$j]=array($count, $parentcount, "CONSTRAIN_STARTEND");
        if (strlen($name) > $_PRJCONF['project_name_length']) {
            $name = substr($name, 0, $_PRJCONF['project_name_length']);
            $name .= "...";
        }
        if ($strdate == $edate) {
            $milestone = new Milestone($row, $name, $strdate);
            $milestone->mark->SetType(MARK_DIAMOND);
            $graph->Add($milestone);
        } else {
            $activity = new GanttBar($count, "{$name}", "{$strdate}", "{$edate}", "{$owner}");
            if ($status == 0) {
                // Yellow diagonal line pattern on a red background
                $activity->SetPattern(GANTT_SOLID, "darkgreen");
                $activity->progress->SetPattern(GANTT_RDIAG, "black");
                $activity->progress->SetFillColor("white");
            } elseif ($status == 1) {
                $activity->SetPattern(GANTT_SOLID, "yellow");
                $activity->progress->SetPattern(GANTT_RDIAG, "black");
                $activity->progress->SetFillColor("white");
            } else {
                $activity->SetPattern(GANTT_SOLID, "red");
                $activity->progress->SetPattern(GANTT_RDIAG, "black");
                $activity->progress->SetFillColor("white");
            }
            // Set absolute height
            $activity->SetHeight(10);
            $activity->progress->Set($progress / 100);
            // Specify progress
            $activity->SetCSIMTarget("{$link}");
            $activity->SetCSIMAlt($progress . "% completed");
            $activity->title->SetCSIMTarget("{$link}");
            $activity->title->SetCSIMAlt($progress . "% completed");
            $qconstraints = DB_query("SELECT tid FROM {$_TABLES['prj_tasks']} WHERE parent_task='{$tid}' ORDER BY lhs ASC");
            $numconstraints = DB_numRows($qconstraints);
            for ($c = 1; $c <= $numconstraints; $c++) {
                $activity->SetConstrain($row + $c, CONSTRAIN_STARTSTART, "maroon4");
            }
            // Add line to Gnatt Chart
            $graph->Add($activity);
        }
        $row++;
        if (DB_count($_TABLES['prj_tasks'], 'parent_task', $tid) > 0) {
            prj_drawGanttBar($graph, $pid, $tid, $row, $count);
        }
    }
}