function CreateSimple($data, $constrains = array(), $progress = array()) { $num = count($data); for ($i = 0; $i < $num; ++$i) { switch ($data[$i][1]) { case ACTYPE_GROUP: // Create a slightly smaller height bar since the // "wings" at the end will make it look taller $a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 8); $a->title->SetFont($this->iSimpleFont, FS_BOLD, $this->iSimpleFontSize); $a->rightMark->Show(); $a->rightMark->SetType(MARK_RIGHTTRIANGLE); $a->rightMark->SetWidth(8); $a->rightMark->SetColor('black'); $a->rightMark->SetFillColor('black'); $a->leftMark->Show(); $a->leftMark->SetType(MARK_LEFTTRIANGLE); $a->leftMark->SetWidth(8); $a->leftMark->SetColor('black'); $a->leftMark->SetFillColor('black'); $a->SetPattern(BAND_SOLID, 'black'); $csimpos = 6; break; case ACTYPE_NORMAL: $a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 10); $a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize); $a->SetPattern($this->iSimpleStyle, $this->iSimpleColor); $a->SetFillColor($this->iSimpleBkgColor); // Check if this activity should have a constrain line $n = count($constrains); for ($j = 0; $j < $n; ++$j) { if (empty($constrains[$j]) || count($constrains[$j]) != 3) { JpGraphError::RaiseL(6003, $j); //("Invalid format for Constrain parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Constrain-To,Constrain-Type)"); } if ($constrains[$j][0] == $data[$i][0]) { $a->SetConstrain($constrains[$j][1], $constrains[$j][2], 'black', ARROW_S2, ARROWT_SOLID); } } // Check if this activity have a progress bar $n = count($progress); for ($j = 0; $j < $n; ++$j) { if (empty($progress[$j]) || count($progress[$j]) != 2) { JpGraphError::RaiseL(6004, $j); //("Invalid format for Progress parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Progress)"); } if ($progress[$j][0] == $data[$i][0]) { $a->progress->Set($progress[$j][1]); $a->progress->SetPattern($this->iSimpleProgressStyle, $this->iSimpleProgressColor); $a->progress->SetFillColor($this->iSimpleProgressBkgColor); //$a->progress->SetPattern($progress[$j][2],$progress[$j][3]); break; } } $csimpos = 6; break; case ACTYPE_MILESTONE: $a = new MileStone($data[$i][0], $data[$i][2], $data[$i][3]); $a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize); $a->caption->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize); $csimpos = 5; break; default: die('Unknown activity type'); break; } // Setup caption $a->caption->Set($data[$i][$csimpos - 1]); // Check if this activity should have a CSIM target�? if (!empty($data[$i][$csimpos])) { $a->SetCSIMTarget($data[$i][$csimpos]); $a->SetCSIMAlt($data[$i][$csimpos + 1]); } if (!empty($data[$i][$csimpos + 2])) { $a->title->SetCSIMTarget($data[$i][$csimpos + 2]); $a->title->SetCSIMAlt($data[$i][$csimpos + 3]); } $this->Add($a); } }
function CreateSimple($data, $constrains = array(), $progress = array()) { $num = count($data); for ($i = 0; $i < $num; ++$i) { switch ($data[$i][1]) { case ACTYPE_GROUP: $a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 8); $a->title->SetFont($this->iSimpleFont, FS_BOLD, $this->iSimpleFontSize); $a->rightMark->Show(); $a->rightMark->SetType(MARK_RIGHTTRIANGLE); $a->rightMark->SetWidth(8); $a->rightMark->SetColor('black'); $a->rightMark->SetFillColor('black'); $a->leftMark->Show(); $a->leftMark->SetType(MARK_LEFTTRIANGLE); $a->leftMark->SetWidth(8); $a->leftMark->SetColor('black'); $a->leftMark->SetFillColor('black'); $a->SetPattern(BAND_SOLID, 'black'); $csimpos = 6; break; case ACTYPE_NORMAL: $a = new GanttBar($data[$i][0], $data[$i][2], $data[$i][3], $data[$i][4], '', 10); $a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize); $a->SetPattern($this->iSimpleStyle, $this->iSimpleColor); $a->SetFillColor($this->iSimpleBkgColor); $n = count($constrains); for ($j = 0; $j < $n; ++$j) { if (empty($constrains[$j]) || count($constrains[$j]) != 3) { JpGraphError::RaiseL(6003, $j); } if ($constrains[$j][0] == $data[$i][0]) { $a->SetConstrain($constrains[$j][1], $constrains[$j][2], 'black', ARROW_S2, ARROWT_SOLID); } } $n = count($progress); for ($j = 0; $j < $n; ++$j) { if (empty($progress[$j]) || count($progress[$j]) != 2) { JpGraphError::RaiseL(6004, $j); } if ($progress[$j][0] == $data[$i][0]) { $a->progress->Set($progress[$j][1]); $a->progress->SetHeight(0.5); $a->progress->SetPattern($this->iSimpleProgressStyle, $this->iSimpleProgressColor); $a->progress->SetFillColor($this->iSimpleProgressBkgColor); break; } } $csimpos = 6; break; case ACTYPE_MILESTONE: $a = new MileStone($data[$i][0], $data[$i][2], $data[$i][3]); $a->title->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize); $a->caption->SetFont($this->iSimpleFont, FS_NORMAL, $this->iSimpleFontSize); $csimpos = 5; break; default: die('Unknown activity type'); break; } $a->caption->Set($data[$i][$csimpos - 1]); if (!empty($data[$i][$csimpos])) { $a->SetCSIMTarget($data[$i][$csimpos]); $a->SetCSIMAlt($data[$i][$csimpos + 1]); } if (!empty($data[$i][$csimpos + 2])) { $a->title->SetCSIMTarget($data[$i][$csimpos + 2]); $a->title->SetCSIMAlt($data[$i][$csimpos + 3]); } $this->Add($a); } }