本文整理汇总了PHP中GanttBar::SetBreakStyle方法的典型用法代码示例。如果您正苦于以下问题:PHP GanttBar::SetBreakStyle方法的具体用法?PHP GanttBar::SetBreakStyle怎么用?PHP GanttBar::SetBreakStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GanttBar
的用法示例。
在下文中一共展示了GanttBar::SetBreakStyle方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getGanttGraph
/**
* @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;
}
示例2: GanttBar
$graph->scale->month->SetStyle(MONTHSTYLE_SHORTNAMEYEAR4);
$graph->scale->month->SetFontColor("white");
$graph->scale->month->SetBackgroundColor("blue");
// 0 % vertical label margin
$graph->SetLabelVMarginFactor(1);
// 1=default value
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$activity1 = new GanttBar(0, "Activity 1", "2001-12-21", "2001-12-26", "");
// Yellow diagonal line pattern on a red background
$activity1->SetPattern(BAND_RDIAG, "yellow");
$activity1->SetFillColor("red");
// Format the bar for the first activity
// ($row,$title,$startdate,$enddate)
$break1 = new GanttBar(0, '', "2001-12-27", "2001-12-30", "");
$break1->SetBreakStyle(true, 'dotted', 2);
$break1->SetColor('red');
$graph->Add($break1);
// Format the bar for the second activity
// ($row,$title,$startdate,$enddate)
$activity2 = new GanttBar(0, "", "2001-12-31", "2002-01-2", "[BO]");
// 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");
// Finally add the bar to the graph
$graph->Add($activity1);
$graph->Add($activity2);
// ... and display it