本文整理汇总了PHP中GanttBar::SetPattern方法的典型用法代码示例。如果您正苦于以下问题:PHP GanttBar::SetPattern方法的具体用法?PHP GanttBar::SetPattern怎么用?PHP GanttBar::SetPattern使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GanttBar
的用法示例。
在下文中一共展示了GanttBar::SetPattern方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getJPGraphBar
public function getJPGraphBar($issueActivityMapping)
{
$user = UserCache::getInstance()->getUser($this->userid);
$issue = IssueCache::getInstance()->getIssue($this->bugid);
if (NULL != $issue->getTcId()) {
$formatedActivityName = substr($this->bugid . " [" . $issue->getTcId() . "] - " . $issue->getSummary(), 0, 50);
} else {
$formatedActivityName = substr($this->bugid . " - " . $issue->getSummary(), 0, 50);
}
$formatedActivityInfo = $user->getName();
if ($issue->getCurrentStatus() < $issue->getBugResolvedStatusThreshold()) {
$formatedActivityInfo .= " (" . Constants::$statusNames[$issue->getCurrentStatus()] . ")";
}
$bar = new GanttBar($this->activityIdx, utf8_decode($formatedActivityName), date('Y-m-d', $this->startTimestamp), date('Y-m-d', $this->endTimestamp), $formatedActivityInfo, 10);
// --- colors
$bar->SetPattern(GANTT_SOLID, $this->color);
$bar->progress->Set($this->progress);
$bar->progress->SetPattern(GANTT_SOLID, 'slateblue');
// --- add constrains
$relationships = $issue->getRelationships();
$relationships = $relationships['' . Constants::$relationship_constrains];
if (is_array($relationships)) {
foreach ($relationships as $bugid) {
// Add a constrain from the end of this activity to the start of the activity $bugid
$bar->SetConstrain($issueActivityMapping[$bugid], CONSTRAIN_ENDSTART);
}
}
if (self::$logger->isDebugEnabled()) {
self::$logger->debug("JPGraphBar bugid={$this->bugid} prj=" . $issue->getProjectId() . " activityIdx={$this->activityIdx}" . " progress={$this->progress} [" . date('Y-m-d', $this->startTimestamp) . " -> " . date('Y-m-d', $this->endTimestamp) . "]");
self::$logger->debug("JPGraphBar bugid={$this->bugid} GanttBar = " . var_export($bar, TRUE));
}
return $bar;
}
示例2: parse
function parse($input, $parser)
{
foreach (split("\n", $input) as $line) {
// skip empty line or comments
if (preg_match("/^(\\s*)#.*\$|^(\\s*)\$/", $line)) {
continue;
}
# 1ID>, 2P%, 3DEP, 4TASKNAME ,5DATE>, 6DATE, 7Tag
if (preg_match("/(\\d+),(\\d+)%,([\\d:]*),([^,]+),([\\d\\s\\-]+),([\\d\\s\\-]+),?([^,]+)?/", $line, $parse_result)) {
# $bar = new GanttBar(ID, Comment, start, end, tag, height);
$bar = new GanttBar($parse_result[1], $parse_result[4], $parse_result[5], $parse_result[6]);
foreach (split(",", $parse_result[3]) as $dep) {
if (!$dep) {
continue;
}
$bar->SetConstrain($dep, CONSTRAIN_STARTEND);
}
if ($this->min_date) {
if (strtotime($parse_result[5]) < strtotime($this->min_date)) {
$this->min_date = $parse_result[5];
}
} else {
$this->min_date = $parse_result[5];
}
if ($this->max_date) {
if (strtotime($parse_result[6]) > strtotime($this->max_date)) {
$this->max_date = $parse_result[6];
}
} else {
$this->max_date = $parse_result[6];
}
$bar->SetPattern(BAND_RDIAG, "yellow");
$bar->SetFillColor("gray");
//$bar->progress->Set($parse_result[2]/100);
$bar->progress->SetPattern(GANTT_SOLID, "darkgreen");
$this->graph->Add($bar);
} else {
throw new Exception("Error while parsing line '{$line}': expected 'ID,PURCENT%,DEPENDENCY,TASK NAME,DATE,DATE'");
}
}
}
示例3: prj_drawGanttBar
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);
}
}
}
示例4: CDate
if ($showLabels) {
$caption .= $AppUI->_($projectStatus[$p['project_status']]) . ', ';
$caption .= $p['project_status'] != 7 ? $AppUI->_('active') : $AppUI->_('archived');
}
$enddate = new CDate($end);
$startdate = new CDate($start);
$actual_end = $p['project_actual_end_date'] ? $p['project_actual_end_date'] : $end;
$actual_enddate = new CDate($actual_end);
$actual_enddate = $actual_enddate->after($startdate) ? $actual_enddate : $enddate;
$bar = new GanttBar($row++, array($name, $startdate->format($df), $enddate->format($df), $actual_enddate->format($df)), $start, $actual_end, $cap, 0.6);
$bar->progress->Set(min($progress / 100, 1));
if (is_file(TTF_DIR . "FreeSans.ttf")) {
$bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
}
$bar->SetFillColor('#' . $p['project_color_identifier']);
$bar->SetPattern(BAND_SOLID, '#' . $p['project_color_identifier']);
//adding captions
$bar->caption = new TextProperty($caption);
$bar->caption->Align('left', 'center');
$bar->caption->SetFont(FF_CUSTOM, FS_NORMAL, 8);
// gray out templates, completes, on ice, on hold
if ($p['project_status'] != '3' || $p['project_status'] == '7') {
$bar->caption->SetColor('darkgray');
$bar->title->SetColor('darkgray');
$bar->SetColor('darkgray');
$bar->SetFillColor('gray');
//$bar->SetPattern(BAND_SOLID,'gray');
$bar->progress->SetFillColor('darkgray');
$bar->progress->SetPattern(BAND_SOLID, 'darkgray', 98);
}
$graph->Add($bar);
示例5: TextProperty
}
if ($a['task_dynamic'] == 1) {
if (is_file(TTF_DIR . 'FreeSans.ttf')) {
$bar->title->SetFont(FF_CUSTOM, FS_BOLD, 8);
}
$bar->rightMark->Show();
$bar->rightMark->SetType(MARK_RIGHTTRIANGLE);
$bar->rightMark->SetWidth(3);
$bar->rightMark->SetColor('black');
$bar->rightMark->SetFillColor('black');
$bar->leftMark->Show();
$bar->leftMark->SetType(MARK_LEFTTRIANGLE);
$bar->leftMark->SetWidth(3);
$bar->leftMark->SetColor('black');
$bar->leftMark->SetFillColor('black');
$bar->SetPattern(BAND_SOLID, 'black');
}
}
//adding captions
$bar->caption = new TextProperty($caption);
$bar->caption->Align('left', 'center');
if (is_file(TTF_DIR . 'FreeSans.ttf')) {
$bar->caption->SetFont(FF_CUSTOM, FS_NORMAL, 8);
}
// show tasks which are both finished and past in (dark)gray
if ($progress >= 100 && $end_date->isPast() && get_class($bar) == 'ganttbar') {
$bar->caption->SetColor('darkgray');
$bar->title->SetColor('darkgray');
$bar->setColor('darkgray');
$bar->SetFillColor('darkgray');
$bar->SetPattern(BAND_SOLID, 'gray');
示例6: request
$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('"', '"', $listTasks->subtas_name[$i]);
$listTasks->subtas_name[$i] = str_replace("'", "'", $listTasks->subtas_name[$i]);
$progress = round($listTasks->subtas_completion[$i] / 10, 2);
$printProgress = $listTasks->subtas_completion[$i] * 10;
$activity = new GanttBar($i, $listTasks->subtas_name[$i], $listTasks->subtas_start_date[$i], $listTasks->subtas_due_date[$i]);
$activity->SetPattern(BAND_LDIAG, "yellow");
$activity->caption->Set($listTasks->subtas_mem_login[$i] . " (" . $printProgress . "%)");
$activity->SetFillColor("gray");
if ($listTasks->subtas_priority[$i] == "4" || $listTasks->subtas_priority[$i] == "5") {
$activity->progress->SetPattern(BAND_SOLID, "#BB0000");
} else {
$activity->progress->SetPattern(BAND_SOLID, "#0000BB");
}
$activity->progress->Set($progress);
$graph->Add($activity);
}
$graph->Stroke();
示例7: count
// 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();
$bar->rightMark->SetType(MARK_RIGHTTRIANGLE);
$bar->rightMark->Show();
$bar->SetFillColor('black');
$bar->SetPattern(BAND_SOLID, 'black');
} else {
// Format the activity bars
$bar = new GanttBar($data[$i][0], array($data[$i][1], $data[$i][2], $data[$i][3]), $data[$i][2], $data[$i][3], '', 0.45);
$bar->SetPattern(BAND_RDIAG, 'black');
$bar->SetFillColor('orange');
}
// Default font
$bar->title->SetFont(FF_ARIAL, FS_NORMAL, 10);
$graph->Add($bar);
}
// Send back the graph to the client
$graph->Stroke();
?>
示例8: addSubBar
public function addSubBar($label, $start, $end, $caption = '', $height = '0.6', $barcolor = 'FFFFFF', $progress = 0)
{
$startDate = new CDate($start);
$endDate = new CDate($end);
$bar = new GanttBar($this->rowCount++, array($label, $startDate->format($this->df), $endDate->format($this->df), ' '), $start, $end, $caption, $height);
$bar->progress->Set(min($progress / 100, 1));
$bar->title->SetFont(FF_CUSTOM, FS_NORMAL, 9);
$bar->title->SetColor(bestColor('#ffffff', '#' . $barcolor, '#000000'));
$bar->SetFillColor('#' . $barcolor);
$bar->SetPattern(BAND_SOLID, '#' . $barcolor);
//adding captions
$bar->caption = new TextProperty($caption);
$bar->caption->Align('left', 'center');
$this->graph->Add($bar);
}
示例9: GanttBar
// 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));
$graph->scale->hour->SetStyle(constant($styles->val('image.session.header.hourstyle', 'HOURSTYLE_H24', true)));
/**
$graph->scale->actinfo->SetBackgroundColor('lightyellow:1.5');
$graph->scale->actinfo->SetFont(FF_FONT0);
$graph->scale->actinfo->SetColTitles(array(""));
/**/
$show = (bool) $styles->val('image.session.hgrid.show', true, true);
$graph->hgrid->Show($show);
if ($show) {
$graph->hgrid->SetRowFillColor($styles->val('image.session.hgrid.color1', 'whitesmoke@0.9', true), $styles->val('image.session.hgrid.color2', 'darkblue@0.9', true));
}
for ($i = 0; $i < count($data); ++$i) {
$bar = new GanttBar($data[$i][0], $data[$i][1], $data[$i][2], $data[$i][3]);
$bar->SetPattern(constant($styles->val('image.session.bar.pattern', 'BAND_RDIAG', true)), $styles->val('image.session.bar.patternfill', 'lightblue', true));
$bar->SetFillColor($styles->val('image.session.bar.fill', 'BAND_SOLID', true));
$shadow = $styles->val('image.session.bar.shadow', '', true);
if ($shadow) {
$bar->SetShadow(true, $shadow);
}
$graph->Add($bar);
}
$graph->SetVMarginFactor($styles->val('image.session.bar.vmargin', 0.4, true));
if ($styles->val('image.session.showfooter', 'image.common.footer.show')) {
stdImgFooter($graph);
}
$graph->Stroke();
示例10: graficar
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);
}
示例11: makeGroup
/**
* @param $task Task
* @param $start_date string
* @param $end_date string
* @param $position
* @return GanttBar
*
* Create a Gantt bar that represents a task with subtasks, this gives it 'wings' at each end to
* represent it spanning the subtasks.
* $start_date and $end_date should be YYYY-MM-DD formatted dates
*/
private function makeGroup(Task $task, $start_date, $end_date, $position)
{
$bar = new GanttBar($position, $task->name, $start_date, $end_date, $task->getField('duration')->formatted, 8);
$bar->rightMark->Show();
$bar->rightMark->SetType(MARK_RIGHTTRIANGLE);
$bar->rightMark->SetWidth(8);
$bar->rightMark->SetColor('#0077BD');
$bar->rightMark->SetFillColor('#0077BD');
$bar->leftMark->Show();
$bar->leftMark->SetType(MARK_LEFTTRIANGLE);
$bar->leftMark->SetWidth(8);
$bar->leftMark->SetColor('#0077BD');
$bar->leftMark->SetFillColor('#0077BD');
$bar->setColor('#0077BD');
$bar->SetPattern(BAND_SOLID, '#0077BD');
return $bar;
}
示例12: prj_drawProjectTasksGanttBar
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 {
//.........这里部分代码省略.........
示例13: ganttPDF
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('"', '"', $listTasks->tas_name[$i]);
$listTasks->tas_name[$i] = str_replace("'", "'", $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('"', '"', $listSubTasks->subtas_name[$j]);
$listSubTasks->subtas_name[$j] = str_replace("'", "'", $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;
}
示例14: GanttGraph
<?php
// content="text/plain; charset=utf-8"
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_gantt.php';
$graph = new GanttGraph();
$graph->SetShadow();
// Add title and subtitle
$graph->title->Set('A 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_SHORTNAMEYEAR2);
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity = new GanttBar(0, 'Activity 1', '2001-12-21', '2002-01-18');
// Yellow diagonal line pattern on a red background
$activity->SetPattern(BAND_LDIAG, 'yellow');
$activity->SetFillColor('red');
// Finally add the bar to the graph
$graph->Add($activity);
// ... and display it
$graph->Stroke();
示例15: executeGanttChart
/**
* Executes ganttChart action
*
*/
public function executeGanttChart()
{
//@todo change color according to status, and add a legend
$this->forward404Unless($project = ProjectPeer::retrieveBySlug($this->getRequestParameter('project')));
$w = 450;
$graph = new sfJpGraph('gantt', 0, 0);
$graph = $graph->getJpGraph();
$graph->SetShadow();
// Add title and subtitle
$graph->title->Set($project->getTitle());
//$graph->title-> SetFont( FF_ARIAL, FS_BOLD,12);
$graph->subtitle->Set("(Gantt Chart)");
// 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_SHORTNAMEYEAR2);
// Use the short name of the month together with a 4 digit year
// on the month scale
$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
//$graph->scale-> month-> SetTextColor( "white");
$graph->scale->month->SetBackgroundColor("blue");
$row = 0;
foreach ($project->getTasks() as $task) {
$activity = new GanttBar($row, $task->getName(), $task->getBegin('Y-m-d'), $task->getFinish('Y-m-d'));
$activity->SetPattern(BAND_RDIAG, "red");
$activity->setFillColor("blue");
// Finally add the bar to the graph
$graph->Add($activity);
$row++;
}
// ... and display it
$graph->Stroke();
}