本文整理汇总了PHP中FusionCharts::addGanttMilestone方法的典型用法代码示例。如果您正苦于以下问题:PHP FusionCharts::addGanttMilestone方法的具体用法?PHP FusionCharts::addGanttMilestone怎么用?PHP FusionCharts::addGanttMilestone使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FusionCharts
的用法示例。
在下文中一共展示了FusionCharts::addGanttMilestone方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getChart
function getChart()
{
// Include PHP Class
include(JPATH_SITE.DS.'components'.DS.'com_fabrik'.DS.'plugins'.DS.'visualization'.DS.'fusion_gantt_chart'.DS.'lib'.DS.'FCclass'.DS.'FusionCharts_Gen.php');
// Add JS to page header
$document = JFactory::getDocument();
$document->addScript($this->srcBase."fusion_gantt_chart/lib/FCCharts/FusionCharts.js");
$params = $this->getParams();
$w = $params->get('fusion_gantt_chart_width');
$h = $params->get('fusion_gantt_chart_height');
// Create new chart
$FC = new FusionCharts("GANTT","$w","$h");
// Define path to FC's SWF
$FC->setSWFPath($this->srcBase."fusion_gantt_chart/lib/FCCharts/");
$FC->setChartParam('dateFormat', 'yyyy-mm-dd');
$FC->setChartParam('showTaskNames', 1);
$FC->setChartParams('ganttWidthPercent=70;gridBorderAlpha=100;canvasBorderColor=333333;canvasBorderThickness=0;hoverCapBgColor=FFFFFF;hoverCapBorderColor=333333;extendcategoryBg=0;ganttLineColor=99cc00;ganttLineAlpha=20;baseFontColor=333333;gridBorderColor=99cc00');
// ------------------- Setting Param string
$listid = $params->get('fusion_gantt_chart_table');
$listModel = JModel::getInstance('list', 'FabrikFEModel');
$listModel->setId($listid);
$db = $listModel->getDB();
$table = $listModel->getTable()->db_table_name;
$process = $params->get('fusion_gantt_chart_process');
$processraw = $process.'_raw';
$start = $params->get('fusion_gantt_chart_startdate');
$startraw = $start .'_raw';
$end = $params->get('fusion_gantt_chart_enddate');
$endraw = $end . '_raw';
$label = $params->get('fusion_gantt_chart_label');
$hover = $params->get('fusion_gantt_chart_hover');
$milestone = $params->get('fusion_gantt_chart_milestone');
$milestoneraw = $milestone."_raw";
$connector = $params->get('fusion_gantt_chart_connector');
$connectorraw = $connector."_raw";
$fields = array();
$fields[] = FabrikString::safeColName($process)." AS " . $db->nameQuote($process);
$fields[] = FabrikString::safeColName($start)." AS " . $db->nameQuote($start);
$fields[] = FabrikString::safeColName($end)." AS " . $db->nameQuote($end);
$fields[] = FabrikString::safeColName($label)." AS " . $db->nameQuote($label);
if ($hover !== '') {
$fields[] = FabrikString::safeColName($hover)." AS " . $db->nameQuote($hover);
}
if ($milestone !== '') {
$fields[] = FabrikString::safeColName($milestone)." AS " . $db->nameQuote($milestone);
}
if ($connector !== '') {
$fields[] = FabrikString::safeColName($connector)." AS " . $db->nameQuote($connector);
}
$listModel->asfields = $fields;
$nav = $listModel->getPagination(0, 0, 0);
$data = $listModel->getData();
$data = $data[0];
$mindate = null;
$maxdate = null;
$usedProcesses = array();
$milestones = array();
$connectors = array();
$processLabel = $params->get('fusion_gantt_chart_process_label');
$FC->setGanttProcessesParams("positionInGrid=right;align=center;headerText=$processLabel;fontColor=333333;fontSize=11;isBold=1;isAnimated=1;bgColor=99cc00;headerbgColor=333333;headerFontColor=99cc00;headerFontSize=16;bgAlpha=40");
foreach ($data as $d) {
$hovertext = $hover == '' ? '' : $d->$hover;
$processid = $d->$processraw;
$startdate = JFactory::getDate($d->$startraw);
$enddate = JFactory::getDate($d->$endraw);
$strParam = "start=".$startdate->toFormat('%Y/%m/%d').";end=".$enddate->toFormat('%Y/%m/%d').";processId={$processid};id={$d->__pk_val};color=99cc00;alpha=60;topPadding=19;hoverText={$hovertext};";
$strParam .="link={$d->fabrik_view_url};";
$FC->addGanttTask($FC->encodeSpecialChars($d->$label), $strParam);
if ($milestone !== '' && $d->$milestoneraw == 1) {
$FC->addGanttMilestone($d->__pk_val, "date=".$enddate->toFormat('%Y/%m/%d').";radius=10;color=333333;shape=Star;numSides=5;borderThickness=1");
}
if ($connector !== '' && $d->$connectorraw !== '') {
$FC->addGanttConnector($d->$connectorraw, $d->__pk_val, "color=99cc00;thickness=2;");
}
#apply processes
if (!in_array($processid, $usedProcesses)) {
$usedProcesses[] = $processid;
$FC->addGanttProcess($FC->encodeSpecialChars($d->$process), "id={$processid};");
}
#increaes max/min date range
if (is_null($mindate)) {
$mindate = $startdate;
$maxdate = $enddate;
} else {
if (JFactory::getDate($d->$startraw)->toUnix() < $mindate->toUnix()) {
$mindate = JFactory::getDate($d->$startraw);
//.........这里部分代码省略.........
示例2: fs_gantt_chart
//.........这里部分代码省略.........
}
$chart->addGanttCategory(date('F', mktime(0, 0, 0, $j, 1)), ';start=' . $start . ';end=' . $end . ';align=center;isBold=1');
}
}
// Days
if ($time_span < 2592000) {
$chart->addGanttCategorySet();
for ($i = $start_year; $i <= $end_year; $i++) {
for ($j = 1; $j <= 12; $j++) {
if ($i == $start_year && $j < $start_month) {
continue;
} else {
if ($i == $end_year && $j > $end_month) {
break;
}
}
$num_days = cal_days_in_month(CAL_GREGORIAN, $j, $i);
for ($k = 1; $k <= $num_days; $k++) {
if ($i == $start_year && $j == $start_month && $k < $start_day) {
continue;
} else {
if ($i == $end_year && $j == $end_month && $k > $end_day) {
break;
}
}
$start = sprintf('%02d/%02d/%04d', $k, $j, $i);
$end = sprintf('%02d/%02d/%04d', $k, $j, $i);
$chart->addGanttCategory($k, ';start=' . $start . ';end=' . $end . ';fontSize=8;isBold=0');
}
}
}
} else {
if ($time_span < 10368000) {
$chart->addGanttCategorySet();
for ($i = $start_year; $i <= $end_year; $i++) {
for ($j = 1; $j <= 12; $j++) {
if ($i == $start_year && $j < $start_month) {
continue;
} else {
if ($i == $end_year && $j > $end_month) {
break;
}
}
$num_days = cal_days_in_month(CAL_GREGORIAN, $j, $i);
for ($k = 1, $l = 1; $k <= $num_days; $k += 8, $l++) {
if ($i == $start_year && $j == $start_month && $k + 7 < $start_day) {
continue;
}
if ($i == $end_year && $j == $end_month && $k > $end_day) {
break;
}
if ($i == $start_year && $j == $start_month && $k < $start_day) {
$start = sprintf('%02d/%02d/%04d', $start_day, $j, $i);
} else {
$start = sprintf('%02d/%02d/%04d', $k, $j, $i);
}
if ($i == $end_year && $j == $end_month && $k + 7 > $end_day) {
$end = sprintf('%02d/%02d/%04d', $end_day, $j, $i);
} else {
if ($k + 7 > $num_days) {
$end = sprintf('%02d/%02d/%04d', $num_days, $j, $i);
} else {
$end = sprintf('%02d/%02d/%04d', $k + 7, $j, $i);
}
}
$chart->addGanttCategory(__('Week') . " {$l}", ';start=' . $start . ';end=' . $end . ';fontSize=8;isBold=0');
}
}
}
}
}
// Tasks
foreach ($tasks as $task) {
$chart->addGanttProcess(clean_flash_string($task['name']), 'id=' . $task['id'] . ';link=' . urlencode($task['link']));
$chart->addGanttTask(__('Planned'), 'start=' . $task['start'] . ';end=' . $task['end'] . ';id=' . $task['id'] . ';processId=' . $task['id'] . ';color=4b3cff;height=5;topPadding=10;animation=0');
if ($task['real_start'] !== false && $task['real_end']) {
$chart->addGanttTask(__('Actual'), 'start=' . $task['real_start'] . ';end=' . $task['real_end'] . ';processId=' . $task['id'] . ';color=ff3c4b;alpha=100;topPadding=15;height=5');
}
if ($task['completion'] != 0) {
$task_span = date_to_epoch($task['end']) - date_to_epoch($task['start']);
$end = date('d/m/Y', date_to_epoch($task['start']) + $task_span * $task['completion'] / 100.0);
$chart->addGanttTask(__('Completion') . " (" . $task['completion'] . ")", 'start=' . $task['start'] . ';end=' . $end . ';processId=' . $task['id'] . ';color=32cd32;alpha=100;topPadding=20;height=5');
}
if ($task['parent'] != 0) {
$chart->addGanttConnector($task['parent'], $task['id'], 'color=2179b1;thickness=2;fromTaskConnectStart=1');
}
}
// Milestones
if ($milestones !== '') {
$chart->addGanttProcess(__('Milestones'), 'id=0');
foreach ($milestones as $milestone) {
$chart->addGanttTask(clean_flash_string($milestone['name']), 'start=' . $milestone['date'] . ';end=' . $milestone['date'] . ';id=ms-' . $milestone['id'] . ';processId=0;color=ffffff;alpha=0;height=60;topPadding=0;animation=0');
$chart->addGanttMilestone('ms-' . $milestone['id'], 'date=' . $milestone['date'] . ';radius=8;color=efbb07;shape=star;numSides=3;borderThickness=1');
}
}
// Today
$chart->addTrendLine('start=' . date('d/m/Y') . ';displayValue=' . __('Today') . ';color=666666;isTrendZone=1;alpha=20');
// Return the code
return get_chart_code($chart, $width, $height, 'include/graphs/FusionCharts/FCF_Gantt.swf');
}