PageRenderTime 77ms CodeModel.GetById 7ms RepoModel.GetById 0ms app.codeStats 1ms

/fb/cuentas/php-jpgraph/jpgraph_gantt.php

https://bitbucket.org/sergiohzlz/reportaprod
PHP | 3803 lines | 2788 code | 460 blank | 555 comment | 395 complexity | ccdb6de3d2450e9c5f0dbebb5fa67b40 MD5 | raw file
Possible License(s): GPL-2.0, GPL-3.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /*=======================================================================
  3. // File: JPGRAPH_GANTT.PHP
  4. // Description: JpGraph Gantt plot extension
  5. // Created: 2001-11-12
  6. // Ver: $Id: jpgraph_gantt.php 956 2007-11-17 13:19:20Z ljp $
  7. //
  8. // Copyright (c) Aditus Consulting. All rights reserved.
  9. //========================================================================
  10. */
  11. require_once('jpgraph_plotband.php');
  12. require_once('jpgraph_iconplot.php');
  13. require_once('jpgraph_plotmark.inc.php');
  14. // Maximum size for Automatic Gantt chart
  15. DEFINE('MAX_GANTTIMG_SIZE_W',4000);
  16. DEFINE('MAX_GANTTIMG_SIZE_H',5000);
  17. // Scale Header types
  18. DEFINE("GANTT_HDAY",1);
  19. DEFINE("GANTT_HWEEK",2);
  20. DEFINE("GANTT_HMONTH",4);
  21. DEFINE("GANTT_HYEAR",8);
  22. DEFINE("GANTT_HHOUR",16);
  23. DEFINE("GANTT_HMIN",32);
  24. // Bar patterns
  25. DEFINE("GANTT_RDIAG",BAND_RDIAG); // Right diagonal lines
  26. DEFINE("GANTT_LDIAG",BAND_LDIAG); // Left diagonal lines
  27. DEFINE("GANTT_SOLID",BAND_SOLID); // Solid one color
  28. DEFINE("GANTT_VLINE",BAND_VLINE); // Vertical lines
  29. DEFINE("GANTT_HLINE",BAND_HLINE); // Horizontal lines
  30. DEFINE("GANTT_3DPLANE",BAND_3DPLANE); // "3D" Plane
  31. DEFINE("GANTT_HVCROSS",BAND_HVCROSS); // Vertical/Hor crosses
  32. DEFINE("GANTT_DIAGCROSS",BAND_DIAGCROSS); // Diagonal crosses
  33. // Conversion constant
  34. DEFINE("SECPERDAY",3600*24);
  35. // Locales. ONLY KEPT FOR BACKWARDS COMPATIBILITY
  36. // You should use the proper locale strings directly
  37. // from now on.
  38. DEFINE("LOCALE_EN","en_UK");
  39. DEFINE("LOCALE_SV","sv_SE");
  40. // Layout of bars
  41. DEFINE("GANTT_EVEN",1);
  42. DEFINE("GANTT_FROMTOP",2);
  43. // Style for minute header
  44. DEFINE("MINUTESTYLE_MM",0); // 15
  45. DEFINE("MINUTESTYLE_CUSTOM",2); // Custom format
  46. // Style for hour header
  47. DEFINE("HOURSTYLE_HM24",0); // 13:10
  48. DEFINE("HOURSTYLE_HMAMPM",1); // 1:10pm
  49. DEFINE("HOURSTYLE_H24",2); // 13
  50. DEFINE("HOURSTYLE_HAMPM",3); // 1pm
  51. DEFINE("HOURSTYLE_CUSTOM",4); // User defined
  52. // Style for day header
  53. DEFINE("DAYSTYLE_ONELETTER",0); // "M"
  54. DEFINE("DAYSTYLE_LONG",1); // "Monday"
  55. DEFINE("DAYSTYLE_LONGDAYDATE1",2); // "Monday 23 Jun"
  56. DEFINE("DAYSTYLE_LONGDAYDATE2",3); // "Monday 23 Jun 2003"
  57. DEFINE("DAYSTYLE_SHORT",4); // "Mon"
  58. DEFINE("DAYSTYLE_SHORTDAYDATE1",5); // "Mon 23/6"
  59. DEFINE("DAYSTYLE_SHORTDAYDATE2",6); // "Mon 23 Jun"
  60. DEFINE("DAYSTYLE_SHORTDAYDATE3",7); // "Mon 23"
  61. DEFINE("DAYSTYLE_SHORTDATE1",8); // "23/6"
  62. DEFINE("DAYSTYLE_SHORTDATE2",9); // "23 Jun"
  63. DEFINE("DAYSTYLE_SHORTDATE3",10); // "Mon 23"
  64. DEFINE("DAYSTYLE_SHORTDATE4",11); // "23"
  65. DEFINE("DAYSTYLE_CUSTOM",12); // "M"
  66. // Styles for week header
  67. DEFINE("WEEKSTYLE_WNBR",0);
  68. DEFINE("WEEKSTYLE_FIRSTDAY",1);
  69. DEFINE("WEEKSTYLE_FIRSTDAY2",2);
  70. DEFINE("WEEKSTYLE_FIRSTDAYWNBR",3);
  71. DEFINE("WEEKSTYLE_FIRSTDAY2WNBR",4);
  72. // Styles for month header
  73. DEFINE("MONTHSTYLE_SHORTNAME",0);
  74. DEFINE("MONTHSTYLE_LONGNAME",1);
  75. DEFINE("MONTHSTYLE_LONGNAMEYEAR2",2);
  76. DEFINE("MONTHSTYLE_SHORTNAMEYEAR2",3);
  77. DEFINE("MONTHSTYLE_LONGNAMEYEAR4",4);
  78. DEFINE("MONTHSTYLE_SHORTNAMEYEAR4",5);
  79. DEFINE("MONTHSTYLE_FIRSTLETTER",6);
  80. // Types of constrain links
  81. DEFINE('CONSTRAIN_STARTSTART',0);
  82. DEFINE('CONSTRAIN_STARTEND',1);
  83. DEFINE('CONSTRAIN_ENDSTART',2);
  84. DEFINE('CONSTRAIN_ENDEND',3);
  85. // Arrow direction for constrain links
  86. DEFINE('ARROW_DOWN',0);
  87. DEFINE('ARROW_UP',1);
  88. DEFINE('ARROW_LEFT',2);
  89. DEFINE('ARROW_RIGHT',3);
  90. // Arrow type for constrain type
  91. DEFINE('ARROWT_SOLID',0);
  92. DEFINE('ARROWT_OPEN',1);
  93. // Arrow size for constrain lines
  94. DEFINE('ARROW_S1',0);
  95. DEFINE('ARROW_S2',1);
  96. DEFINE('ARROW_S3',2);
  97. DEFINE('ARROW_S4',3);
  98. DEFINE('ARROW_S5',4);
  99. // Activity types for use with utility method CreateSimple()
  100. DEFINE('ACTYPE_NORMAL',0);
  101. DEFINE('ACTYPE_GROUP',1);
  102. DEFINE('ACTYPE_MILESTONE',2);
  103. DEFINE('ACTINFO_3D',1);
  104. DEFINE('ACTINFO_2D',0);
  105. // Check if array_fill() exists
  106. if (!function_exists('array_fill')) {
  107. function array_fill($iStart, $iLen, $vValue) {
  108. $aResult = array();
  109. for ($iCount = $iStart; $iCount < $iLen + $iStart; $iCount++) {
  110. $aResult[$iCount] = $vValue;
  111. }
  112. return $aResult;
  113. }
  114. }
  115. //===================================================
  116. // CLASS GanttActivityInfo
  117. // Description:
  118. //===================================================
  119. class GanttActivityInfo {
  120. public $iShow=true;
  121. public $iLeftColMargin=4,$iRightColMargin=1,$iTopColMargin=1,$iBottomColMargin=3;
  122. public $vgrid = null;
  123. private $iColor='black';
  124. private $iBackgroundColor='lightgray';
  125. private $iFFamily=FF_FONT1,$iFStyle=FS_NORMAL,$iFSize=10,$iFontColor='black';
  126. private $iTitles=array();
  127. private $iWidth=array(),$iHeight=-1;
  128. private $iTopHeaderMargin = 4;
  129. private $iStyle=1;
  130. private $iHeaderAlign='center';
  131. function GanttActivityInfo() {
  132. $this->vgrid = new LineProperty();
  133. }
  134. function Hide($aF=true) {
  135. $this->iShow=!$aF;
  136. }
  137. function Show($aF=true) {
  138. $this->iShow=$aF;
  139. }
  140. // Specify font
  141. function SetFont($aFFamily,$aFStyle=FS_NORMAL,$aFSize=10) {
  142. $this->iFFamily = $aFFamily;
  143. $this->iFStyle = $aFStyle;
  144. $this->iFSize = $aFSize;
  145. }
  146. function SetStyle($aStyle) {
  147. $this->iStyle = $aStyle;
  148. }
  149. function SetColumnMargin($aLeft,$aRight) {
  150. $this->iLeftColMargin = $aLeft;
  151. $this->iRightColMargin = $aRight;
  152. }
  153. function SetFontColor($aFontColor) {
  154. $this->iFontColor = $aFontColor;
  155. }
  156. function SetColor($aColor) {
  157. $this->iColor = $aColor;
  158. }
  159. function SetBackgroundColor($aColor) {
  160. $this->iBackgroundColor = $aColor;
  161. }
  162. function SetColTitles($aTitles,$aWidth=null) {
  163. $this->iTitles = $aTitles;
  164. $this->iWidth = $aWidth;
  165. }
  166. function SetMinColWidth($aWidths) {
  167. $n = min(count($this->iTitles),count($aWidths));
  168. for($i=0; $i < $n; ++$i ) {
  169. if( !empty($aWidths[$i]) ) {
  170. if( empty($this->iWidth[$i]) ) {
  171. $this->iWidth[$i] = $aWidths[$i];
  172. }
  173. else {
  174. $this->iWidth[$i] = max($this->iWidth[$i],$aWidths[$i]);
  175. }
  176. }
  177. }
  178. }
  179. function GetWidth($aImg) {
  180. $txt = new TextProperty();
  181. $txt->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  182. $n = count($this->iTitles) ;
  183. $rm=$this->iRightColMargin;
  184. $w = 0;
  185. for($h=0, $i=0; $i < $n; ++$i ) {
  186. $w += $this->iLeftColMargin;
  187. $txt->Set($this->iTitles[$i]);
  188. if( !empty($this->iWidth[$i]) ) {
  189. $w1 = max($txt->GetWidth($aImg)+$rm,$this->iWidth[$i]);
  190. }
  191. else {
  192. $w1 = $txt->GetWidth($aImg)+$rm;
  193. }
  194. $this->iWidth[$i] = $w1;
  195. $w += $w1;
  196. $h = max($h,$txt->GetHeight($aImg));
  197. }
  198. $this->iHeight = $h+$this->iTopHeaderMargin;
  199. $txt='';
  200. return $w;
  201. }
  202. function GetColStart($aImg,&$aStart,$aAddLeftMargin=false) {
  203. $n = count($this->iTitles) ;
  204. $adj = $aAddLeftMargin ? $this->iLeftColMargin : 0;
  205. $aStart=array($aImg->left_margin+$adj);
  206. for( $i=1; $i < $n; ++$i ) {
  207. $aStart[$i] = $aStart[$i-1]+$this->iLeftColMargin+$this->iWidth[$i-1];
  208. }
  209. }
  210. // Adjust headers left, right or centered
  211. function SetHeaderAlign($aAlign) {
  212. $this->iHeaderAlign=$aAlign;
  213. }
  214. function Stroke($aImg,$aXLeft,$aYTop,$aXRight,$aYBottom,$aUseTextHeight=false) {
  215. if( !$this->iShow ) return;
  216. $txt = new TextProperty();
  217. $txt->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  218. $txt->SetColor($this->iFontColor);
  219. $txt->SetAlign($this->iHeaderAlign,'top');
  220. $n=count($this->iTitles);
  221. if( $n == 0 )
  222. return;
  223. $x = $aXLeft;
  224. $h = $this->iHeight;
  225. $yTop = $aUseTextHeight ? $aYBottom-$h-$this->iTopColMargin-$this->iBottomColMargin : $aYTop ;
  226. if( $h < 0 ) {
  227. JpGraphError::RaiseL(6001);
  228. //('Internal error. Height for ActivityTitles is < 0');
  229. }
  230. $aImg->SetLineWeight(1);
  231. // Set background color
  232. $aImg->SetColor($this->iBackgroundColor);
  233. $aImg->FilledRectangle($aXLeft,$yTop,$aXRight,$aYBottom-1);
  234. if( $this->iStyle == 1 ) {
  235. // Make a 3D effect
  236. $aImg->SetColor('white');
  237. $aImg->Line($aXLeft,$yTop+1,
  238. $aXRight,$yTop+1);
  239. }
  240. for($i=0; $i < $n; ++$i ) {
  241. if( $this->iStyle == 1 ) {
  242. // Make a 3D effect
  243. $aImg->SetColor('white');
  244. $aImg->Line($x+1,$yTop,$x+1,$aYBottom);
  245. }
  246. $x += $this->iLeftColMargin;
  247. $txt->Set($this->iTitles[$i]);
  248. // Adjust the text anchor position according to the choosen alignment
  249. $xp = $x;
  250. if( $this->iHeaderAlign == 'center' ) {
  251. $xp = (($x-$this->iLeftColMargin)+($x+$this->iWidth[$i]))/2;
  252. }
  253. elseif( $this->iHeaderAlign == 'right' ) {
  254. $xp = $x +$this->iWidth[$i]-$this->iRightColMargin;
  255. }
  256. $txt->Stroke($aImg,$xp,$yTop+$this->iTopHeaderMargin);
  257. $x += $this->iWidth[$i];
  258. if( $i < $n-1 ) {
  259. $aImg->SetColor($this->iColor);
  260. $aImg->Line($x,$yTop,$x,$aYBottom);
  261. }
  262. }
  263. $aImg->SetColor($this->iColor);
  264. $aImg->Line($aXLeft,$yTop, $aXRight,$yTop);
  265. // Stroke vertical column dividers
  266. $cols=array();
  267. $this->GetColStart($aImg,$cols);
  268. $n=count($cols);
  269. for( $i=1; $i < $n; ++$i ) {
  270. $this->vgrid->Stroke($aImg,$cols[$i],$aYBottom,$cols[$i],
  271. $aImg->height - $aImg->bottom_margin);
  272. }
  273. }
  274. }
  275. //===================================================
  276. // CLASS GanttGraph
  277. // Description: Main class to handle gantt graphs
  278. //===================================================
  279. class GanttGraph extends Graph {
  280. public $scale; // Public accessible
  281. public $hgrid=null;
  282. private $iObj=array(); // Gantt objects
  283. private $iLabelHMarginFactor=0.2; // 10% margin on each side of the labels
  284. private $iLabelVMarginFactor=0.4; // 40% margin on top and bottom of label
  285. private $iLayout=GANTT_FROMTOP; // Could also be GANTT_EVEN
  286. private $iSimpleFont = FF_FONT1,$iSimpleFontSize=11;
  287. private $iSimpleStyle=GANTT_RDIAG,$iSimpleColor='yellow',$iSimpleBkgColor='red';
  288. private $iSimpleProgressBkgColor='gray',$iSimpleProgressColor='darkgreen';
  289. private $iSimpleProgressStyle=GANTT_SOLID;
  290. //---------------
  291. // CONSTRUCTOR
  292. // Create a new gantt graph
  293. function GanttGraph($aWidth=0,$aHeight=0,$aCachedName="",$aTimeOut=0,$aInline=true) {
  294. // Backward compatibility
  295. if( $aWidth == -1 ) $aWidth=0;
  296. if( $aHeight == -1 ) $aHeight=0;
  297. if( $aWidth< 0 || $aHeight < 0 ) {
  298. JpgraphError::RaiseL(6002);
  299. //("You can't specify negative sizes for Gantt graph dimensions. Use 0 to indicate that you want the library to automatically determine a dimension.");
  300. }
  301. Graph::Graph($aWidth,$aHeight,$aCachedName,$aTimeOut,$aInline);
  302. $this->scale = new GanttScale($this->img);
  303. // Default margins
  304. $this->img->SetMargin(15,17,25,15);
  305. $this->hgrid = new HorizontalGridLine();
  306. $this->scale->ShowHeaders(GANTT_HWEEK|GANTT_HDAY);
  307. $this->SetBox();
  308. }
  309. //---------------
  310. // PUBLIC METHODS
  311. //
  312. function SetSimpleFont($aFont,$aSize) {
  313. $this->iSimpleFont = $aFont;
  314. $this->iSimpleFontSize = $aSize;
  315. }
  316. function SetSimpleStyle($aBand,$aColor,$aBkgColor) {
  317. $this->iSimpleStyle = $aBand;
  318. $this->iSimpleColor = $aColor;
  319. $this->iSimpleBkgColor = $aBkgColor;
  320. }
  321. // A utility function to help create basic Gantt charts
  322. function CreateSimple($data,$constrains=array(),$progress=array()) {
  323. $num = count($data);
  324. for( $i=0; $i < $num; ++$i) {
  325. switch( $data[$i][1] ) {
  326. case ACTYPE_GROUP:
  327. // Create a slightly smaller height bar since the
  328. // "wings" at the end will make it look taller
  329. $a = new GanttBar($data[$i][0],$data[$i][2],$data[$i][3],$data[$i][4],'',8);
  330. $a->title->SetFont($this->iSimpleFont,FS_BOLD,$this->iSimpleFontSize);
  331. $a->rightMark->Show();
  332. $a->rightMark->SetType(MARK_RIGHTTRIANGLE);
  333. $a->rightMark->SetWidth(8);
  334. $a->rightMark->SetColor('black');
  335. $a->rightMark->SetFillColor('black');
  336. $a->leftMark->Show();
  337. $a->leftMark->SetType(MARK_LEFTTRIANGLE);
  338. $a->leftMark->SetWidth(8);
  339. $a->leftMark->SetColor('black');
  340. $a->leftMark->SetFillColor('black');
  341. $a->SetPattern(BAND_SOLID,'black');
  342. $csimpos = 6;
  343. break;
  344. case ACTYPE_NORMAL:
  345. $a = new GanttBar($data[$i][0],$data[$i][2],$data[$i][3],$data[$i][4],'',10);
  346. $a->title->SetFont($this->iSimpleFont,FS_NORMAL,$this->iSimpleFontSize);
  347. $a->SetPattern($this->iSimpleStyle,$this->iSimpleColor);
  348. $a->SetFillColor($this->iSimpleBkgColor);
  349. // Check if this activity should have a constrain line
  350. $n = count($constrains);
  351. for( $j=0; $j < $n; ++$j ) {
  352. if( empty($constrains[$j]) || (count($constrains[$j]) != 3) ) {
  353. JpGraphError::RaiseL(6003,$j);
  354. //("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)");
  355. }
  356. if( $constrains[$j][0]==$data[$i][0] ) {
  357. $a->SetConstrain($constrains[$j][1],$constrains[$j][2],'black',ARROW_S2,ARROWT_SOLID);
  358. }
  359. }
  360. // Check if this activity have a progress bar
  361. $n = count($progress);
  362. for( $j=0; $j < $n; ++$j ) {
  363. if( empty($progress[$j]) || (count($progress[$j]) != 2) ) {
  364. JpGraphError::RaiseL(6004,$j);
  365. //("Invalid format for Progress parameter at index=$j in CreateSimple(). Parameter must start with index 0 and contain arrays of (Row,Progress)");
  366. }
  367. if( $progress[$j][0]==$data[$i][0] ) {
  368. $a->progress->Set($progress[$j][1]);
  369. $a->progress->SetPattern($this->iSimpleProgressStyle,
  370. $this->iSimpleProgressColor);
  371. $a->progress->SetFillColor($this->iSimpleProgressBkgColor);
  372. //$a->progress->SetPattern($progress[$j][2],$progress[$j][3]);
  373. break;
  374. }
  375. }
  376. $csimpos = 6;
  377. break;
  378. case ACTYPE_MILESTONE:
  379. $a = new MileStone($data[$i][0],$data[$i][2],$data[$i][3]);
  380. $a->title->SetFont($this->iSimpleFont,FS_NORMAL,$this->iSimpleFontSize);
  381. $a->caption->SetFont($this->iSimpleFont,FS_NORMAL,$this->iSimpleFontSize);
  382. $csimpos = 5;
  383. break;
  384. default:
  385. die('Unknown activity type');
  386. break;
  387. }
  388. // Setup caption
  389. $a->caption->Set($data[$i][$csimpos-1]);
  390. // Check if this activity should have a CSIM target ?
  391. if( !empty($data[$i][$csimpos]) ) {
  392. $a->SetCSIMTarget($data[$i][$csimpos]);
  393. $a->SetCSIMAlt($data[$i][$csimpos+1]);
  394. }
  395. if( !empty($data[$i][$csimpos+2]) ) {
  396. $a->title->SetCSIMTarget($data[$i][$csimpos+2]);
  397. $a->title->SetCSIMAlt($data[$i][$csimpos+3]);
  398. }
  399. $this->Add($a);
  400. }
  401. }
  402. // Set what headers should be shown
  403. function ShowHeaders($aFlg) {
  404. $this->scale->ShowHeaders($aFlg);
  405. }
  406. // Specify the fraction of the font height that should be added
  407. // as vertical margin
  408. function SetLabelVMarginFactor($aVal) {
  409. $this->iLabelVMarginFactor = $aVal;
  410. }
  411. // Synonym to the method above
  412. function SetVMarginFactor($aVal) {
  413. $this->iLabelVMarginFactor = $aVal;
  414. }
  415. // Add a new Gantt object
  416. function Add($aObject) {
  417. if( is_array($aObject) && count($aObject) > 0 ) {
  418. $cl = $aObject[0];
  419. if( class_exists('IconPlot',false) && ($cl instanceof IconPlot) ) {
  420. $this->AddIcon($aObject);
  421. }
  422. else {
  423. $n = count($aObject);
  424. for($i=0; $i < $n; ++$i)
  425. $this->iObj[] = $aObject[$i];
  426. }
  427. }
  428. else {
  429. if( class_exists('IconPlot',false) && ($aObject instanceof IconPlot) ) {
  430. $this->AddIcon($aObject);
  431. }
  432. else {
  433. $this->iObj[] = $aObject;
  434. }
  435. }
  436. }
  437. // Override inherit method from Graph and give a warning message
  438. function SetScale($aAxisType,$aYMin=1,$aYMax=1,$aXMin=1,$aXMax=1) {
  439. JpGraphError::RaiseL(6005);
  440. //("SetScale() is not meaningfull with Gantt charts.");
  441. }
  442. // Specify the date range for Gantt graphs (if this is not set it will be
  443. // automtically determined from the input data)
  444. function SetDateRange($aStart,$aEnd) {
  445. // Adjust the start and end so that the indicate the
  446. // begining and end of respective start and end days
  447. if( strpos($aStart,':') === false )
  448. $aStart = date('Y-m-d 00:00',strtotime($aStart));
  449. if( strpos($aEnd,':') === false )
  450. $aEnd = date('Y-m-d 23:59',strtotime($aEnd));
  451. $this->scale->SetRange($aStart,$aEnd);
  452. }
  453. // Get the maximum width of the activity titles columns for the bars
  454. // The name is lightly misleading since we from now on can have
  455. // multiple columns in the label section. When this was first written
  456. // it only supported a single label, hence the name.
  457. function GetMaxLabelWidth() {
  458. $m=10;
  459. if( $this->iObj != null ) {
  460. $marg = $this->scale->actinfo->iLeftColMargin+$this->scale->actinfo->iRightColMargin;
  461. $n = count($this->iObj);
  462. for($i=0; $i < $n; ++$i) {
  463. if( !empty($this->iObj[$i]->title) ) {
  464. if( $this->iObj[$i]->title->HasTabs() ) {
  465. list($tot,$w) = $this->iObj[$i]->title->GetWidth($this->img,true);
  466. $m=max($m,$tot);
  467. }
  468. else
  469. $m=max($m,$this->iObj[$i]->title->GetWidth($this->img));
  470. }
  471. }
  472. }
  473. return $m;
  474. }
  475. // Get the maximum height of the titles for the bars
  476. function GetMaxLabelHeight() {
  477. $m=10;
  478. if( $this->iObj != null ) {
  479. $n = count($this->iObj);
  480. for($i=0; $i < $n; ++$i) {
  481. if( !empty($this->iObj[$i]->title) ) {
  482. $m=max($m,$this->iObj[$i]->title->GetHeight($this->img));
  483. }
  484. }
  485. }
  486. return $m;
  487. }
  488. function GetMaxBarAbsHeight() {
  489. $m=0;
  490. if( $this->iObj != null ) {
  491. $m = $this->iObj[0]->GetAbsHeight($this->img);
  492. $n = count($this->iObj);
  493. for($i=1; $i < $n; ++$i) {
  494. $m=max($m,$this->iObj[$i]->GetAbsHeight($this->img));
  495. }
  496. }
  497. return $m;
  498. }
  499. // Get the maximum used line number (vertical position) for bars
  500. function GetBarMaxLineNumber() {
  501. $m=1;
  502. if( $this->iObj != null ) {
  503. $m = $this->iObj[0]->GetLineNbr();
  504. $n = count($this->iObj);
  505. for($i=1; $i < $n; ++$i) {
  506. $m=max($m,$this->iObj[$i]->GetLineNbr());
  507. }
  508. }
  509. return $m;
  510. }
  511. // Get the minumum and maximum used dates for all bars
  512. function GetBarMinMax() {
  513. $start = 0 ;
  514. $n = count($this->iObj);
  515. while( $start < $n && $this->iObj[$start]->GetMaxDate() === false )
  516. ++$start;
  517. if( $start >= $n ) {
  518. JpgraphError::RaiseL(6006);
  519. //('Cannot autoscale Gantt chart. No dated activities exist. [GetBarMinMax() start >= n]');
  520. }
  521. $max=$this->scale->NormalizeDate($this->iObj[$start]->GetMaxDate());
  522. $min=$this->scale->NormalizeDate($this->iObj[$start]->GetMinDate());
  523. for($i=$start+1; $i < $n; ++$i) {
  524. $rmax = $this->scale->NormalizeDate($this->iObj[$i]->GetMaxDate());
  525. if( $rmax != false )
  526. $max=Max($max,$rmax);
  527. $rmin = $this->scale->NormalizeDate($this->iObj[$i]->GetMinDate());
  528. if( $rmin != false )
  529. $min=Min($min,$rmin);
  530. }
  531. $minDate = date("Y-m-d",$min);
  532. $min = strtotime($minDate);
  533. $maxDate = date("Y-m-d 23:59",$max);
  534. $max = strtotime($maxDate);
  535. return array($min,$max);
  536. }
  537. // Create a new auto sized canvas if the user hasn't specified a size
  538. // The size is determined by what scale the user has choosen and hence
  539. // the minimum width needed to display the headers. Some margins are
  540. // also added to make it better looking.
  541. function AutoSize() {
  542. if( $this->img->img == null ) {
  543. // The predefined left, right, top, bottom margins.
  544. // Note that the top margin might incease depending on
  545. // the title.
  546. $lm = $this->img->left_margin;
  547. $rm = $this->img->right_margin;
  548. $rm += 2 ;
  549. $tm = $this->img->top_margin;
  550. $bm = $this->img->bottom_margin;
  551. $bm += 1;
  552. if( BRAND_TIMING ) $bm += 10;
  553. // First find out the height
  554. $n=$this->GetBarMaxLineNumber()+1;
  555. $m=max($this->GetMaxLabelHeight(),$this->GetMaxBarAbsHeight());
  556. $height=$n*((1+$this->iLabelVMarginFactor)*$m);
  557. // Add the height of the scale titles
  558. $h=$this->scale->GetHeaderHeight();
  559. $height += $h;
  560. // Calculate the top margin needed for title and subtitle
  561. if( $this->title->t != "" ) {
  562. $tm += $this->title->GetFontHeight($this->img);
  563. }
  564. if( $this->subtitle->t != "" ) {
  565. $tm += $this->subtitle->GetFontHeight($this->img);
  566. }
  567. // ...and then take the bottom and top plot margins into account
  568. $height += $tm + $bm + $this->scale->iTopPlotMargin + $this->scale->iBottomPlotMargin;
  569. // Now find the minimum width for the chart required
  570. // If day scale or smaller is shown then we use the day font width
  571. // as the base size unit.
  572. // If only weeks or above is displayed we use a modified unit to
  573. // get a smaller image.
  574. if( $this->scale->IsDisplayHour() || $this->scale->IsDisplayMinute() ) {
  575. // Add 2 pixel margin on each side
  576. $fw=$this->scale->day->GetFontWidth($this->img)+4;
  577. }
  578. elseif( $this->scale->IsDisplayWeek() ) {
  579. $fw = 8;
  580. }
  581. elseif( $this->scale->IsDisplayMonth() ) {
  582. $fw = 4;
  583. }
  584. else {
  585. $fw = 2;
  586. }
  587. $nd=$this->scale->GetNumberOfDays();
  588. if( $this->scale->IsDisplayDay() ) {
  589. // If the days are displayed we also need to figure out
  590. // how much space each day's title will require.
  591. switch( $this->scale->day->iStyle ) {
  592. case DAYSTYLE_LONG :
  593. $txt = "Monday";
  594. break;
  595. case DAYSTYLE_LONGDAYDATE1 :
  596. $txt = "Monday 23 Jun";
  597. break;
  598. case DAYSTYLE_LONGDAYDATE2 :
  599. $txt = "Monday 23 Jun 2003";
  600. break;
  601. case DAYSTYLE_SHORT :
  602. $txt = "Mon";
  603. break;
  604. case DAYSTYLE_SHORTDAYDATE1 :
  605. $txt = "Mon 23/6";
  606. break;
  607. case DAYSTYLE_SHORTDAYDATE2 :
  608. $txt = "Mon 23 Jun";
  609. break;
  610. case DAYSTYLE_SHORTDAYDATE3 :
  611. $txt = "Mon 23";
  612. break;
  613. case DAYSTYLE_SHORTDATE1 :
  614. $txt = "23/6";
  615. break;
  616. case DAYSTYLE_SHORTDATE2 :
  617. $txt = "23 Jun";
  618. break;
  619. case DAYSTYLE_SHORTDATE3 :
  620. $txt = "Mon 23";
  621. break;
  622. case DAYSTYLE_SHORTDATE4 :
  623. $txt = "88";
  624. break;
  625. case DAYSTYLE_CUSTOM :
  626. $txt = date($this->scale->day->iLabelFormStr,
  627. strtotime('2003-12-20 18:00'));
  628. break;
  629. case DAYSTYLE_ONELETTER :
  630. default:
  631. $txt = "M";
  632. break;
  633. }
  634. $fw = $this->scale->day->GetStrWidth($this->img,$txt)+6;
  635. }
  636. // If we have hours enabled we must make sure that each day has enough
  637. // space to fit the number of hours to be displayed.
  638. if( $this->scale->IsDisplayHour() ) {
  639. // Depending on what format the user has choose we need different amount
  640. // of space. We therefore create a typical string for the choosen format
  641. // and determine the length of that string.
  642. switch( $this->scale->hour->iStyle ) {
  643. case HOURSTYLE_HMAMPM:
  644. $txt = '12:00pm';
  645. break;
  646. case HOURSTYLE_H24:
  647. // 13
  648. $txt = '24';
  649. break;
  650. case HOURSTYLE_HAMPM:
  651. $txt = '12pm';
  652. break;
  653. case HOURSTYLE_CUSTOM:
  654. $txt = date($this->scale->hour->iLabelFormStr,strtotime('2003-12-20 18:00'));
  655. break;
  656. case HOURSTYLE_HM24:
  657. default:
  658. $txt = '24:00';
  659. break;
  660. }
  661. $hfw = $this->scale->hour->GetStrWidth($this->img,$txt)+6;
  662. $mw = $hfw;
  663. if( $this->scale->IsDisplayMinute() ) {
  664. // Depending on what format the user has choose we need different amount
  665. // of space. We therefore create a typical string for the choosen format
  666. // and determine the length of that string.
  667. switch( $this->scale->minute->iStyle ) {
  668. case HOURSTYLE_CUSTOM:
  669. $txt2 = date($this->scale->minute->iLabelFormStr,strtotime('2005-05-15 18:55'));
  670. break;
  671. case MINUTESTYLE_MM:
  672. default:
  673. $txt2 = '15';
  674. break;
  675. }
  676. $mfw = $this->scale->minute->GetStrWidth($this->img,$txt2)+6;
  677. $n2 = ceil(60 / $this->scale->minute->GetIntervall() );
  678. $mw = $n2 * $mfw;
  679. }
  680. $hfw = $hfw < $mw ? $mw : $hfw ;
  681. $n = ceil(24*60 / $this->scale->TimeToMinutes($this->scale->hour->GetIntervall()) );
  682. $hw = $n * $hfw;
  683. $fw = $fw < $hw ? $hw : $fw ;
  684. }
  685. // We need to repeat this code block here as well.
  686. // THIS iS NOT A MISTAKE !
  687. // We really need it since we need to adjust for minutes both in the case
  688. // where hour scale is shown and when it is not shown.
  689. if( $this->scale->IsDisplayMinute() ) {
  690. // Depending on what format the user has choose we need different amount
  691. // of space. We therefore create a typical string for the choosen format
  692. // and determine the length of that string.
  693. switch( $this->scale->minute->iStyle ) {
  694. case HOURSTYLE_CUSTOM:
  695. $txt = date($this->scale->minute->iLabelFormStr,strtotime('2005-05-15 18:55'));
  696. break;
  697. case MINUTESTYLE_MM:
  698. default:
  699. $txt = '15';
  700. break;
  701. }
  702. $mfw = $this->scale->minute->GetStrWidth($this->img,$txt)+6;
  703. $n = ceil(60 / $this->scale->TimeToMinutes($this->scale->minute->GetIntervall()) );
  704. $mw = $n * $mfw;
  705. $fw = $fw < $mw ? $mw : $fw ;
  706. }
  707. // If we display week we must make sure that 7*$fw is enough
  708. // to fit up to 10 characters of the week font (if the week is enabled)
  709. if( $this->scale->IsDisplayWeek() ) {
  710. // Depending on what format the user has choose we need different amount
  711. // of space
  712. $fsw = strlen($this->scale->week->iLabelFormStr);
  713. if( $this->scale->week->iStyle==WEEKSTYLE_FIRSTDAY2WNBR ) {
  714. $fsw += 8;
  715. }
  716. elseif( $this->scale->week->iStyle==WEEKSTYLE_FIRSTDAYWNBR ) {
  717. $fsw += 7;
  718. }
  719. else {
  720. $fsw += 4;
  721. }
  722. $ww = $fsw*$this->scale->week->GetFontWidth($this->img);
  723. if( 7*$fw < $ww ) {
  724. $fw = ceil($ww/7);
  725. }
  726. }
  727. if( !$this->scale->IsDisplayDay() && !$this->scale->IsDisplayHour() &&
  728. !( ($this->scale->week->iStyle==WEEKSTYLE_FIRSTDAYWNBR ||
  729. $this->scale->week->iStyle==WEEKSTYLE_FIRSTDAY2WNBR) && $this->scale->IsDisplayWeek() ) ) {
  730. // If we don't display the individual days we can shrink the
  731. // scale a little bit. This is a little bit pragmatic at the
  732. // moment and should be re-written to take into account
  733. // a) What scales exactly are shown and
  734. // b) what format do they use so we know how wide we need to
  735. // make each scale text space at minimum.
  736. $fw /= 2;
  737. if( !$this->scale->IsDisplayWeek() ) {
  738. $fw /= 1.8;
  739. }
  740. }
  741. $cw = $this->GetMaxActInfoColWidth() ;
  742. $this->scale->actinfo->SetMinColWidth($cw);
  743. if( $this->img->width <= 0 ) {
  744. // Now determine the width for the activity titles column
  745. // Firdst find out the maximum width of each object column
  746. $titlewidth = max(max($this->GetMaxLabelWidth(),
  747. $this->scale->tableTitle->GetWidth($this->img)),
  748. $this->scale->actinfo->GetWidth($this->img));
  749. // Add the width of the vertivcal divider line
  750. $titlewidth += $this->scale->divider->iWeight*2;
  751. // Now get the total width taking
  752. // titlewidth, left and rigt margin, dayfont size
  753. // into account
  754. $width = $titlewidth + $nd*$fw + $lm+$rm;
  755. }
  756. else {
  757. $width = $this->img->width;
  758. }
  759. $width = round($width);
  760. $height = round($height);
  761. // Make a sanity check on image size
  762. if( $width > MAX_GANTTIMG_SIZE_W || $height > MAX_GANTTIMG_SIZE_H ) {
  763. JpgraphError::RaiseL(6007,$width,$height);
  764. //("Sanity check for automatic Gantt chart size failed. Either the width (=$width) or height (=$height) is larger than MAX_GANTTIMG_SIZE. This could potentially be caused by a wrong date in one of the activities.");
  765. }
  766. $this->img->CreateImgCanvas($width,$height);
  767. $this->img->SetMargin($lm,$rm,$tm,$bm);
  768. }
  769. }
  770. // Return an array width the maximum width for each activity
  771. // column. This is used when we autosize the columns where we need
  772. // to find out the maximum width of each column. In order to do that we
  773. // must walk through all the objects, sigh...
  774. function GetMaxActInfoColWidth() {
  775. $n = count($this->iObj);
  776. if( $n == 0 ) return;
  777. $w = array();
  778. $m = $this->scale->actinfo->iLeftColMargin + $this->scale->actinfo->iRightColMargin;
  779. for( $i=0; $i < $n; ++$i ) {
  780. $tmp = $this->iObj[$i]->title->GetColWidth($this->img,$m);
  781. $nn = count($tmp);
  782. for( $j=0; $j < $nn; ++$j ) {
  783. if( empty($w[$j]) )
  784. $w[$j] = $tmp[$j];
  785. else
  786. $w[$j] = max($w[$j],$tmp[$j]);
  787. }
  788. }
  789. return $w;
  790. }
  791. // Stroke the gantt chart
  792. function Stroke($aStrokeFileName="") {
  793. // If the filename is the predefined value = '_csim_special_'
  794. // we assume that the call to stroke only needs to do enough
  795. // to correctly generate the CSIM maps.
  796. // We use this variable to skip things we don't strictly need
  797. // to do to generate the image map to improve performance
  798. // a best we can. Therefor you will see a lot of tests !$_csim in the
  799. // code below.
  800. $_csim = ($aStrokeFileName===_CSIM_SPECIALFILE);
  801. // Should we autoscale dates?
  802. if( !$this->scale->IsRangeSet() ) {
  803. list($min,$max) = $this->GetBarMinMax();
  804. $this->scale->SetRange($min,$max);
  805. }
  806. $this->scale->AdjustStartEndDay();
  807. // Check if we should autoscale the image
  808. $this->AutoSize();
  809. // Should we start from the top or just spread the bars out even over the
  810. // available height
  811. $this->scale->SetVertLayout($this->iLayout);
  812. if( $this->iLayout == GANTT_FROMTOP ) {
  813. $maxheight=max($this->GetMaxLabelHeight(),$this->GetMaxBarAbsHeight());
  814. $this->scale->SetVertSpacing($maxheight*(1+$this->iLabelVMarginFactor));
  815. }
  816. // If it hasn't been set find out the maximum line number
  817. if( $this->scale->iVertLines == -1 )
  818. $this->scale->iVertLines = $this->GetBarMaxLineNumber()+1;
  819. $maxwidth=max($this->scale->actinfo->GetWidth($this->img),
  820. max($this->GetMaxLabelWidth(),
  821. $this->scale->tableTitle->GetWidth($this->img)));
  822. $this->scale->SetLabelWidth($maxwidth+$this->scale->divider->iWeight);//*(1+$this->iLabelHMarginFactor));
  823. if( !$_csim ) {
  824. $this->StrokePlotArea();
  825. if( $this->iIconDepth == DEPTH_BACK ) {
  826. $this->StrokeIcons();
  827. }
  828. }
  829. $this->scale->Stroke();
  830. if( !$_csim ) {
  831. // Due to a minor off by 1 bug we need to temporarily adjust the margin
  832. $this->img->right_margin--;
  833. $this->StrokePlotBox();
  834. $this->img->right_margin++;
  835. }
  836. // Stroke Grid line
  837. $this->hgrid->Stroke($this->img,$this->scale);
  838. $n = count($this->iObj);
  839. for($i=0; $i < $n; ++$i) {
  840. //$this->iObj[$i]->SetLabelLeftMargin(round($maxwidth*$this->iLabelHMarginFactor/2));
  841. $this->iObj[$i]->Stroke($this->img,$this->scale);
  842. }
  843. $this->StrokeTitles();
  844. if( !$_csim ) {
  845. $this->StrokeConstrains();
  846. $this->footer->Stroke($this->img);
  847. if( $this->iIconDepth == DEPTH_FRONT) {
  848. $this->StrokeIcons();
  849. }
  850. // Should we do any final image transformation
  851. if( $this->iImgTrans ) {
  852. if( !class_exists('ImgTrans',false) ) {
  853. require_once('jpgraph_imgtrans.php');
  854. }
  855. $tform = new ImgTrans($this->img->img);
  856. $this->img->img = $tform->Skew3D($this->iImgTransHorizon,$this->iImgTransSkewDist,
  857. $this->iImgTransDirection,$this->iImgTransHighQ,
  858. $this->iImgTransMinSize,$this->iImgTransFillColor,
  859. $this->iImgTransBorder);
  860. }
  861. // If the filename is given as the special "__handle"
  862. // then the image handler is returned and the image is NOT
  863. // streamed back
  864. if( $aStrokeFileName == _IMG_HANDLER ) {
  865. return $this->img->img;
  866. }
  867. else {
  868. // Finally stream the generated picture
  869. $this->cache->PutAndStream($this->img,$this->cache_name,$this->inline,
  870. $aStrokeFileName);
  871. }
  872. }
  873. }
  874. function StrokeConstrains() {
  875. $n = count($this->iObj);
  876. // Stroke all constrains
  877. for($i=0; $i < $n; ++$i) {
  878. // Some gantt objects may not have constraints associated with them
  879. // for example we can add IconPlots which doesn't have this property.
  880. if( empty($this->iObj[$i]->constraints) ) continue;
  881. $numConstrains = count($this->iObj[$i]->constraints);
  882. for( $k = 0; $k < $numConstrains; $k++ ) {
  883. $vpos = $this->iObj[$i]->constraints[$k]->iConstrainRow;
  884. if( $vpos >= 0 ) {
  885. $c1 = $this->iObj[$i]->iConstrainPos;
  886. // Find out which object is on the target row
  887. $targetobj = -1;
  888. for( $j=0; $j < $n && $targetobj == -1; ++$j ) {
  889. if( $this->iObj[$j]->iVPos == $vpos ) {
  890. $targetobj = $j;
  891. }
  892. }
  893. if( $targetobj == -1 ) {
  894. JpGraphError::RaiseL(6008,$this->iObj[$i]->iVPos,$vpos);
  895. //('You have specifed a constrain from row='.$this->iObj[$i]->iVPos.' to row='.$vpos.' which does not have any activity.');
  896. }
  897. $c2 = $this->iObj[$targetobj]->iConstrainPos;
  898. if( count($c1) == 4 && count($c2 ) == 4) {
  899. switch( $this->iObj[$i]->constraints[$k]->iConstrainType ) {
  900. case CONSTRAIN_ENDSTART:
  901. if( $c1[1] < $c2[1] ) {
  902. $link = new GanttLink($c1[2],$c1[3],$c2[0],$c2[1]);
  903. }
  904. else {
  905. $link = new GanttLink($c1[2],$c1[1],$c2[0],$c2[3]);
  906. }
  907. $link->SetPath(3);
  908. break;
  909. case CONSTRAIN_STARTEND:
  910. if( $c1[1] < $c2[1] ) {
  911. $link = new GanttLink($c1[0],$c1[3],$c2[2],$c2[1]);
  912. }
  913. else {
  914. $link = new GanttLink($c1[0],$c1[1],$c2[2],$c2[3]);
  915. }
  916. $link->SetPath(0);
  917. break;
  918. case CONSTRAIN_ENDEND:
  919. if( $c1[1] < $c2[1] ) {
  920. $link = new GanttLink($c1[2],$c1[3],$c2[2],$c2[1]);
  921. }
  922. else {
  923. $link = new GanttLink($c1[2],$c1[1],$c2[2],$c2[3]);
  924. }
  925. $link->SetPath(1);
  926. break;
  927. case CONSTRAIN_STARTSTART:
  928. if( $c1[1] < $c2[1] ) {
  929. $link = new GanttLink($c1[0],$c1[3],$c2[0],$c2[1]);
  930. }
  931. else {
  932. $link = new GanttLink($c1[0],$c1[1],$c2[0],$c2[3]);
  933. }
  934. $link->SetPath(3);
  935. break;
  936. default:
  937. JpGraphError::RaiseL(6009,$this->iObj[$i]->iVPos,$vpos);
  938. //('Unknown constrain type specified from row='.$this->iObj[$i]->iVPos.' to row='.$vpos);
  939. break;
  940. }
  941. $link->SetColor($this->iObj[$i]->constraints[$k]->iConstrainColor);
  942. $link->SetArrow($this->iObj[$i]->constraints[$k]->iConstrainArrowSize,
  943. $this->iObj[$i]->constraints[$k]->iConstrainArrowType);
  944. $link->Stroke($this->img);
  945. }
  946. }
  947. }
  948. }
  949. }
  950. function GetCSIMAreas() {
  951. if( !$this->iHasStroked )
  952. $this->Stroke(_CSIM_SPECIALFILE);
  953. $csim = $this->title->GetCSIMAreas();
  954. $csim .= $this->subtitle->GetCSIMAreas();
  955. $csim .= $this->subsubtitle->GetCSIMAreas();
  956. $n = count($this->iObj);
  957. for( $i=$n-1; $i >= 0; --$i )
  958. $csim .= $this->iObj[$i]->GetCSIMArea();
  959. return $csim;
  960. }
  961. }
  962. //===================================================
  963. // CLASS PredefIcons
  964. // Description: Predefined icons for use with Gantt charts
  965. //===================================================
  966. DEFINE('GICON_WARNINGRED',0);
  967. DEFINE('GICON_TEXT',1);
  968. DEFINE('GICON_ENDCONS',2);
  969. DEFINE('GICON_MAIL',3);
  970. DEFINE('GICON_STARTCONS',4);
  971. DEFINE('GICON_CALC',5);
  972. DEFINE('GICON_MAGNIFIER',6);
  973. DEFINE('GICON_LOCK',7);
  974. DEFINE('GICON_STOP',8);
  975. DEFINE('GICON_WARNINGYELLOW',9);
  976. DEFINE('GICON_FOLDEROPEN',10);
  977. DEFINE('GICON_FOLDER',11);
  978. DEFINE('GICON_TEXTIMPORTANT',12);
  979. class PredefIcons {
  980. private $iBuiltinIcon = null, $iLen = -1 ;
  981. function GetLen() {
  982. return $this->iLen ;
  983. }
  984. function GetImg($aIdx) {
  985. if( $aIdx < 0 || $aIdx >= $this->iLen ) {
  986. JpGraphError::RaiseL(6010,$aIdx);
  987. //('Illegal icon index for Gantt builtin icon ['.$aIdx.']');
  988. }
  989. return Image::CreateFromString(base64_decode($this->iBuiltinIcon[$aIdx][1]));
  990. }
  991. function PredefIcons() {
  992. //==========================================================
  993. // warning.png
  994. //==========================================================
  995. $this->iBuiltinIcon[0][0]= 1043 ;
  996. $this->iBuiltinIcon[0][1]=
  997. 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsSAAALEgHS3X78AAAA'.
  998. 'B3RJTUUH0wgKFSgilWPhUQAAA6BJREFUeNrtl91rHFUYh5/3zMx+Z5JNUoOamCZNaqTZ6IWIkqRiQWmi1IDetHfeiCiltgXBP8AL'.
  999. '0SIUxf/AvfRSBS9EKILFFqyIH9CEmFZtPqrBJLs7c+b1YneT3WTTbNsUFPLCcAbmzPt73o9zzgzs2Z793231UOdv3w9k9Z2uzOdA'.
  1000. '5+2+79yNeL7Hl7hw7oeixRMZ6PJM26W18DNAm/Vh7lR8fqh97NmMF11es1iFpMATqdirwMNA/J4DpIzkr5YsAF1PO6gIMYHRdPwl'.
  1001. 'oO2elmB+qH3sm7XozbkgYvy8SzYnZPtcblyM6I+5z3jQ+0vJfgpEu56BfI9vUkbyi2HZd1QJoeWRiAjBd4SDCW8SSAOy6wBHMzF7'.
  1002. 'YdV2A+ROuvRPLfHoiSU0EMY/cDAIhxJeGngKaN1VgHyPL7NBxI1K9P4QxBzw3K1zJ/zkG8B9uwaQ7/HNsRZv9kohBGD0o7JqMYS/'.
  1003. '/ynPidQw/LrBiPBcS/yFCT95DvB2BWAy4575PaQbQKW+tPd3GCItu2odKI++YxiKu0d26oWmAD7paZU/rLz37VqIijD2YbnzNBBE'.
  1004. 'IBHf8K8qjL7vYhCGErEU8CTg3xXAeMp96GrJEqkyXkm9Bhui1xfsunjdGhcYLq+IzjsGmBt5YH/cmJkFq6gIqlon3u4LxdKGuCIo'.
  1005. 'Qu41g0E41po+2R33Xt5uz9kRIB2UTle7PnfKrROP1HD4sRjZlq0lzhwoZ6rDNeTi3nEg1si/7FT7kYQbXS6E5E65tA5uRF9tutq0'.
  1006. 'K/VwAF+/FbIYWt6+tjQM/AqUms7A4Wy6d7YSfSNxgMmzi0ycWWworio4QJvj4LpuL5BqugTnXzzqJsJwurrlNhJXFaavW67NRw3F'.
  1007. 'q+aJcCQVe9fzvJGmAY7/dPH0gi0f64OveGxa+usCuQMeZ0+kt8BVrX+qPO9Bzx0MgqBvs+a2PfDdYIf+WAjXU1ub4tqNaPPzRs8A'.
  1008. 'blrli+WVn79cXn0cWKl+tGx7HLc7pu3CSmnfitL+l1UihAhwjFkPQev4K/fSABjBM8JCaFuurJU+rgW41SroA8aNMVNAFtgHJCsn'.
  1009. 'XGy/58QVxAC9MccJtZ5kIzNlW440WrJ2ea4YPA9cAooA7i0A/gS+iqLoOpB1HOegqrYB3UBmJrAtQAJwpwPr1Ry92wVlgZsiYlW1'.
  1010. 'uX1gU36dymgqYxJIJJNJT1W9QqHgNwFQBGYqo94OwHZQUuPD7ACglSvc+5n5T9m/wfJJX4U9qzEAAAAASUVORK5CYII=' ;
  1011. //==========================================================
  1012. // edit.png
  1013. //==========================================================
  1014. $this->iBuiltinIcon[1][0]= 959 ;
  1015. $this->iBuiltinIcon[1][1]=
  1016. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAFgAWABY9j+ZuwAAAAlwSFlz'.
  1017. 'AAALEAAACxABrSO9dQAAAAd0SU1FB9AKDAwbIEXOA6AAAAM8SURBVHicpdRPaBxlHMbx76ZvsmOTmm1dsEqQSIIsEmGVBAQjivEQ'.
  1018. 'PAUJngpWsAWlBw8egpQepKwplN4ULEG9CjkEyUFKlSJrWTG0IU51pCsdYW2ncUPjdtp9Z+f3vuNhu8nKbmhaf5cZeGc+PO8zf1Lc'.
  1019. 'm0KhkACICCKCMeaBjiLC0tLSnjNvPmuOHRpH0TZTU1M8zBi9wakzn7OFTs5sw8YYACYmJrre7HkeuVyu69qPF77hlT1XmZ0eQ03O'.
  1020. 'wOLJTvhBx1rLz18VmJ0eY+jVd2FxDkKXnvYLHgb97OgLzE4ON9Hzc1B1QaQzsed5O0Lta3Ec89OnR5h5McfQ+Mw2qgQUnfBOPbZ3'.
  1021. 'bK3l+xOvMT0+3ERLp5FNF6UEjcL32+DdVmGt5WLhDYYPZrbRqreFumXwql0S3w9tnDvLWD5PZigPpdOwuYpSCo3C8wU3UHxQdHbf'.
  1022. 'cZIkNM6dxcnlUM4k1eUFMlUPpUADbpkttFarHe6oYqeOr6yt4RzMQHYUcUsQVtGicHDwKprViuLDkkOtVnsHCHZVRVy/zcj1i5Af'.
  1023. 'h8AjdIts+hUcGcYPK3iBtKM3gD/uAzf/AdY2mmmVgy6X8YNNKmGIvyloPcB8SUin07RQ4EZHFdsdG0wkJEnEaHAJxvKEpSLeaokV'.
  1024. 'r4zWmhUZYLlY4b1D03y5eIEWCtS7vsciAgiIxkQRabWOrlQor66y4pUphoJb1jiO4uO5o0S3q6RSqVbiOmC7VCEgAhLSaDQ48dH7'.
  1025. 'vD46REY0iysegSjKQciRt99ib7qXwX0O+pG4teM6YKHLB9JMq4mTmF9/+AKA4wvLZByH7OgYL7+UY2qvw/7Bfg5kHiXjJFyv3CGO'.
  1026. 'Y1rof+BW4t/XLiPG0DCGr79d4XzRxRnIMn98huXSTYyJ6et1UNYQhRvcinpJq86H3wGPPPM0iBDd+QffD1g4eZjLvuG7S1Wef26E'.
  1027. 'J7L7eSx7gAHVg7V3MSbi6m/r93baBd6qQjerAJg/9Ql/XrvG0ON1+vv7GH3qSfY5fahUnSTpwZgIEQesaVXRPbHRG/xyJSAxMYlp'.
  1028. 'EOm71HUINiY7mGb95l/8jZCyQmJjMDGJjUmsdCROtZ0n/P/Z8v4Fs2MTUUf7vYoAAAAASUVORK5CYII=' ;
  1029. //==========================================================
  1030. // endconstrain.png
  1031. //==========================================================
  1032. $this->iBuiltinIcon[2][0]= 666 ;
  1033. $this->iBuiltinIcon[2][1]=
  1034. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlz'.
  1035. 'AAALDwAACw8BkvkDpQAAAAd0SU1FB9ALEREILkh0+eQAAAIXSURBVHictZU9aFNRFMd/N81HX77aptJUWmp1LHRpIcWhg5sIDlUQ'.
  1036. 'LAXB4t7RRUpwEhy7iQ46CCIoSHcl0CFaoVARU2MFMYktadLXJNok7x2HtCExvuYFmnO4w/3gx+Gc/z1HKRTdMEdXqHbB/sgc/sic'.
  1037. 'nDoYAI8XwDa8o1RMLT+2hAsigtTvbIGVqhX46szUifBGswUeCPgAGB7QeLk0X4Ork+HOxo1VgSqGASjMqkn8W4r4vVtEgI/RRQEL'.
  1038. 'vaoGD85cl5V3nySR/S1mxWxab7f35PnntNyMJeRr9kCMqiHTy09EoeToLwggx6ymiMOD/VwcD7Oa/MHkcIiQx026WGYto5P/U+ZZ'.
  1039. '7gD0QwDuT5z9N3LrVPi0Xs543eQPKkRzaS54eviJIp4tMFQFMllAWN2qcRZHBnixNM8NYD162xq8u7ePSQ+GX2Pjwxc2dB2cLtB8'.
  1040. '7GgamCb0anBYBeChMtl8855CarclxU1gvViiUK4w2OMkNDnGeJ8bt9fH90yOnOkCwLFTwhzykhvtYzOWoBBbY//R3dbaNTYhf2RO'.
  1041. 'QpeuUMzv188MlwuHy0H13HnE48UzMcL0WAtUHX8OxZHoG1URiFw7rnLLCswuSPD1ulze/iWjT2PSf+dBXRFtVVGIvzqph0pQL7VE'.
  1042. 'avXYaXXxPwsnt0imdttCocMmZBdK7YU9D8wuNOW0nXc6QWzPsSa5naZ1beb9BbGB6dxGtMnXAAAAAElFTkSuQmCC' ;
  1043. //==========================================================
  1044. // mail.png
  1045. //==========================================================
  1046. $this->iBuiltinIcon[3][0]= 1122 ;
  1047. $this->iBuiltinIcon[3][1]=
  1048. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlz'.
  1049. 'AAALEAAACxABrSO9dQAAAAd0SU1FB9AJHAMfFvL9OU8AAAPfSURBVHictZRdaBRXFMd/987H7tbNx8aYtGCrEexDsOBDaKHFxirb'.
  1050. 'h0qhsiY0ykppKq1osI99C4H2WSiFFMHWUhXBrjRi0uCmtSEUGgP1QWqhWjGkoW7M1kTX3WRn5p4+TJJNGolQ6IXDnDtz+N0z/3PP'.
  1051. 'UWBIpdpYa23b9g09PZ2kUrOrvmUyGVKp1Ao/mUyi56YnVgWfO/P1CihAd/dJMpmaNROIRq8BkM1m0bH6TasC3j6QXgFdXI+DR6PR'.
  1052. 'JX/Pno8B+KLnMKqlpUU8z8MYs2RBEDzWf9J+0RcRbMdxGBsbw/fmCXwPMUEYID4iAVp8wIRmDIHMo4yHSIBSASKC+CWE0C/PF9jU'.
  1053. '3B6Cp+4M07C5FUtKGNvGwQJctPgIsgD2wRhEIqAMGB+UQYkHJgYYZD7P1HwVlmWhHcfhyk83KeRGUW4t6CgoG5SNUS4KBWgQDUov'.
  1054. '7AGlwYASBVqH0Bk49dXpCviVV3dw/tI1Bvr7kMIIlh0NYUpjlF0BAYvcxSXmEVLKceHSCJm+PnbueBHbtkNwTXUNBzo6aGpq4sSZ'.
  1055. 'GwT5H7BsF6Wdf1GWHQAoM0upeI9PT1yioS7B7tdaSdSuw7KsUGMAy7HYsmUztTW1nMwM0txssX1rlHjjS5jy/Uq2YkK/eJuLl6/z'.
  1056. 'x+1xkslW6mrixGIODx8EFSlEBC0+tmXT0NhA2763iEUjnLv4C8XpUbSbAB1mKkGJ3J83Od77HW5EszvZSqK2iljMIeJaRGNuJePF'.
  1057. '6mspY7BJ1DXwQnCd2fxGRq5OUCz8xt72dyhMZcn++Cu3xu9SKhdp2b4ZHWnAtTSxmIWlhcIjlksR3lNBYzlxZsb7+f7ne+xtSzOd'.
  1058. 'u83szH1OnThOPp/n+a0beeP1l4mvq+PU2Qyd+5PY1RuwlAqLYFaBfbTbyPSdfgaH77A//QF4f1O/vpr6RJyq+C5Kc/M8FbFxXItY'.
  1059. 'xOHDrvfo/fxLDnbsJBp5BowBReVWYAzabeTh5ABDw7cWoNNL3YYYNtSv57lnn6Z+Qx01VeuIuBa2DV1HD3H63BAPZu4u1WGpeLHq'.
  1060. 'Rh7+NcjA0O+0p4+CNwXigwnbWlQQdpuEpli+n+PIkcOc//YKuckJJFh2K2anrjFw+QZt6S6kPImIF/b+cqAJD1LihWAxC61twBTo'.
  1061. 'fPcQF/oGsVW5ovHQlavs2/8+uYnRVSOUgHAmmAClBIOBwKC0gPjhIRgEIX2wg7NnwpZW3d3d4vs+vu8TBMGK51rvPM9b8hdteZxd'.
  1062. 'LBbVR8feJDs0Rlv6GFKeXJ21rNRXESxMPR+CBUl0nN7PjtO+dye7Up/8v1I88bf/ixT/AO1/hZsqW+C6AAAAAElFTkSuQmCC' ;
  1063. //==========================================================
  1064. // startconstrain.png
  1065. //==========================================================
  1066. $this->iBuiltinIcon[4][0]= 725 ;
  1067. $this->iBuiltinIcon[4][1]=
  1068. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlz'.
  1069. 'AAALDgAACw4BQL7hQQAAAAd0SU1FB9ALEREICJp5fBkAAAJSSURBVHic3dS9a1NRGMfx77kxtS+xqS9FG6p1ER3qVJpBQUUc3CRU'.
  1070. 'BwURVLB1EAuKIP0THJQiiNRJBK3iJl18AyeltRZa0bbaJMbUNmlNSm5e7s25j0NqpSSmyag/OMM9POdzDuflwn8djz8gClVRrVEV'.
  1071. 'ur4Bl1FTNSzLrSS6vbml0jUUwSXj8Qfk3PkLtLW2AeBIybmrgz3+gFzpucjlE4f4btuFTuWuCF5XDr3a3UPf6cM8GQvxzbsRAJdh'.
  1072. 'ScfxSywml5j7mVypN0eGEJ0tebIre+zxB6Tv7jPReS2hREpOvpmUXU+H5eC913JnNCSRVE60pUVbWoZjprR39Yq70bdqj4pW7PEH'.
  1073. '5FpvL9e79jOTTHM7ssDL6CJZ08LbvAGnrpZg2mI2Z/MlZfN8IkxuSwu4V9+WIrj7zFlOHfXzKrLIi2SGh5ECKjnNVNxkQEc55vOw'.
  1074. 'rb6O8JLFdHyJ+ayFElUeHvjwkfteL/V7fKTSkFvIQE4DoLI2Mz/muTkTApcBKIwaN8pwIUrKw+ajWwDknAO0d/r4zFaMuRS63sWm'.
  1075. 'RoOdm+vRIriUYjKexrQV+t1o0YEVwfZSVJmD/dIABJuO0LG3lRFx0GOfiAELE9OgCrfU0XnIp5FwGLEy5WEAOxlR5uN+ARhP7GN3'.
  1076. '5w7Gv4bQI2+xpt4jjv2nWBmIlcExE2vDAHYioszBZXw6CPE4ADoWVHmd/tuwlZR9eXYyoszBfpiNQqaAOU5+TXRN+DeeenADPT9b'.
  1077. 'EVgKVsutKPl0TGWGhwofoquaoKK4apsq/tH/e/kFwBMXLgAEKK4AAAAASUVORK5CYII=' ;
  1078. //==========================================================
  1079. // calc.png
  1080. //==========================================================
  1081. $this->iBuiltinIcon[5][0]= 589 ;
  1082. $this->iBuiltinIcon[5][1]=
  1083. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAA4AIwBbgMF12wAAAAlwSFlz'.
  1084. 'AAALEQAACxEBf2RfkQAAAAd0SU1FB9AHBxQeFsqn0wQAAAHKSURBVHicnZWff+RAGIef3U/gcOEgUAgUCgcLhYXCwsHBQeGgUDgs'.
  1085. 'FgMHB4VA/4Bg4XChWFgIFIqBwkJhsRAYeOGF+TQHmWSTTbKd9pU37/x45jvfTDITXEynAbdWKVQB0NazcVm0alcL4rJaRVzm+w/e'.
  1086. '3iwAkzbYRcnnYgI04GCvsxxSPabYaEdt2Ra6D0atcvvvDmyrMWBX1zPq2ircP/Tk98DiJtjV/fim6ziOCL6dDHZNhxQ3arIMsox4'.
  1087. 'vejleL2Ay9+jaw6A+4OSICG2cacGKhsGxg+CxeqAQS0Y7BYJvowq7iGMOhXHEfzpvpQkA9bLKgOgWKt+4Lo1mM9hs9m17QNsJ70P'.
  1088. 'Fjc/O52joogoX8MZKiBiAFxd9Z1vcj9wfSpUlDRNMcYQxzFpmnJ0FPH8nDe1MQaWSz9woQpWSZKEojDkeaWoKAyr1tlu+s48wfVx'.
  1089. 'u7n5i7jthmGIiEGcT+36PP+gFeJrxWLhb0UA/lb4ggGs1T0rZs0zwM/ZjNfilcIY5tutPxgOW3F6dUX464LrKILLiw+A7WErrl+2'.
  1090. 'rABG1EL/BilZP8DjU2uR4U+2E49P1Z8QJmNXUzl24A9GBT0IruCfi86d9x+D12RGzt+pNAAAAABJRU5ErkJggg==' ;
  1091. //==========================================================
  1092. // mag.png
  1093. //==========================================================
  1094. $this->iBuiltinIcon[6][0]= 1415 ;
  1095. $this->iBuiltinIcon[6][1]=
  1096. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlz'.
  1097. 'AAALDAAACwwBP0AiyAAAAAd0SU1FB9ALDxEWDY6Ul+UAAAUESURBVHicdZVrbFRFGIafsyyF0nalV1R6WiggaAptlzsr1OgEogmC'.
  1098. '0IgoBAsBgkIrBAPEhBj/AP6xRTCUFEwRI4jcgsitXMrFCJptJWvBNpXYbbXtbtttt6e7e86ec/yxadlCfZPJZDIz73zzzjfvR2VL'.
  1099. 'F7U+hf0HD2JduIzTFy6SlJRkPtkcDgdCCE65OxFC8NPV6wghyM7OptankJ2dzbSC5QghEEIgCSHog9PpNAF27dlN6miZuPgElB4/'.
  1100. 'nmY3O7ZtByA1NVUCkGWZweD1eklJScESTbqxuIjrd+/x6uIl5M19hSy7nfGOeUxf+g7VjU1sKi7C4/GYsiyz7tAJAD4/cRaA1tZW'.
  1101. 'AHIPnECUVGD1+/3U19ebG4uLeHf1akamjsIwoVnVCOvQEdLoVILYYmMo3PIxSBJflpSaDX5FAmju1QAYv/8k/s8+wLVxOU0jR2LZ'.
  1102. '8sMFAApWrCApbRRDrRZirBYSLBKaoRPQw3SFernf2sav7T0Ubt4KwL4FMwF4Vu8FoHBCKgCzDhwHwLIhZ7y5a89u4m2JhA0wTdDC'.
  1103. 'OrphEjJMNElCHxKDEjaobmvlfo/Krj27CQQCJsCGJW8C0KXqAMxMiosQA8hZWcTFx9OsaniDKh1qmG7VoFsL0x0K06kbeAMhWpRe'.
  1104. '/KpG+gwHAKUnz7Dz3BUMw6DK18nuw99wt0Nh6VdHI8RJicmETQgFg7SFwjSrGv+oKp6ghldV6dZ0ugJBlF6FmCESQ2w2AIqXLsan'.
  1105. 'BrFYLJTnTCBrdBqveeopWZiPFaBHUegJhegMqGgxEkHDwB/UaQ9rdIV06v0+TD2EEQjQFtAY0dsNgNvt5sialQAIIXh7wQKuVf6J'.
  1106. 'gTsSccPDWlQstClBGjr9eHpVWvUQncEwdYEedF8noQ4vmYmpZMTH0nTvDn25vLbrNmu7bvfnsYEbAMnhcPDgwQPzUo2LJusw/mhp'.
  1107. 'QwlHNO0KBAnoIfxtrcQMT2De1Mm891wyUzNlUlJSpIyMDBobGzlzr5rFM/Koq6vrP8ASGxsLwPmKcvIShjPGZiPOakE3VFB8hHwd'.
  1108. 'vJAxhrk5L7Ly+RQuH/sWgPdXrwFg/6HDFBUsIj09nehfbAWwPWOT9n5RYhqGwarNWxkRM5TRCfF4U1PQsDDJFk9uYhwXvzvKjm3b'.
  1109. 'KSsro3DJInNW5RXp7u2bAKSlpeH1esnPz6eqqgqLpmmcr3Fht9ulfaV7mZk1Bs+lM6T1djM9fhg5egDPpTNMy5TZsW07kydPYdWM'.
  1110. 'aXx96ixOp9O8cfUa80srmDpjOgAulytiQqZpMnvObLbt/JTtHxXj9/tRVdU0DGOAufRpevPDTeac0hJyc3NxOOawfv161lVWS6eX'.
  1111. 'z+9/UOCxu1VWVvaTRGv16NFfjB2bNeAQp9NpTpmSM4DcbrdL0WsGDKLRR+52uwe1yP8jb2lpYfikyY9t80n03UCWZeaXVjw1f+zs'.
  1112. 'Oen+/d+pqanhzp2fKSsrw+l0mi6XiyPl5ZGITdN8fAVJwjRNJEmi1qfw1kw7siyTnJxMe3s71dXV3GpoZO64DG41NPJylvxU5D/e'.
  1113. 'qJKsfWQD9IkaZ2RmUvr9aV4aGYcQgjfO3aWoYBF5eXm4ewIsu/CbdPz1aWb0/p1bNoOrQxlUiuiaFo3c3FyEEOx9+C9CCD6paaTW'.
  1114. 'p/TXyYkTJ0Xe59jf7QOyAKDWp/QXxcFQ61P4pT3ShBBcvnUHIQTjxmX19/8BCeVg+/GPpskAAAAASUVORK5CYII=' ;
  1115. //==========================================================
  1116. // lock.png
  1117. //==========================================================
  1118. $this->iBuiltinIcon[7][0]= 963 ;
  1119. $this->iBuiltinIcon[7][1]=
  1120. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlz'.
  1121. 'AAALCwAACwsBbQSEtwAAAAd0SU1FB9AKAw0XDmwMOwIAAANASURBVHic7ZXfS1t3GMY/3+PprI7aisvo2YU6h6ATA8JW4rrlsF4U'.
  1122. 'qiAsF9mhl0N2cYTRy9G/wptAYWPD9iJtRy5asDe7cYFmyjaXOLaMImOrmkRrjL9yTmIS3120JybWQgfb3R74wuc8Lzw858vLOUpE'.
  1123. 'OK6pqSm2trbY39+nu7tbPHYch7m5OcLhMIA67kWj0aMQEWk6tm17rNm2LSIie3t7ksvlJJ1OSyqVkls3Z8SyLMnlcqTTaVKpFLdu'.
  1124. 'zmBZVj1HeY2VUti2TSQSQSml2bZdi0QirK2tMT09zerqKtlslqGhISYnJ4nHv2N+foFsNquOe9FotLlxOBwmk8lgWRbhcFgymYxY'.
  1125. 'liUi0mqaJoAuIi2macrdO7fFsizx3to0Te7euV1vrXtXEgqFmJmZYWVlhXK5LB4/U9kwDL784kYV0A3DYHd3m4sXRymXywKoRi8U'.
  1126. 'Ch01DgQCJBIJLMsiEAhIIpHw2uLz+eqtYrEYIqKZpimxWEyCwaCMjY01zYPBIJpXqVQqsby8TLVabWKA/v5+RkZGMAyDrq4ulFKH'.
  1127. 'HsfjcWZnZ+ns7KTRqwcnk0mKxSKFQqGJlVKtruuSTCYB6O3trW9UI/v9/iZPB/j8s2HOnX0FgHfeXpeffnzK+fWf+fijvhLs0PtG'.
  1128. 'D/n1OJ9+MsrlSwb3733DwMCAt1EyPj6uACYmJp56168NU6nUqFSE9nZdPE7+WqC/r4NKTagcCJVqDaUUB5VDAA4Pa9x7sMLlSwan'.
  1129. 'WjRmv13D7/erpaWlo604qOp88OF7LC48rPNosMq5Th+Dgxd4/XyA1rbzADi7j8jnf2P++wdcvSr8MJ/i8eomAKlUqn41OsDAQDeD'.
  1130. 'g++yuPCwzm/2vU8+n2a7sMFfj79mp7BBuVzioFSiXHJx3SKuW2Rzy0Up9dxnQVvODALQerqNRn4ZKe0Mvtc6TpzpmqbxalcY9Ato'.
  1131. '2v06t515C73YQftZB9GLnDrt4LoujuPgOA4Ui+C6yOpXJwZrJ7r/gv4P/u+D9W7fLxTz+1ScQxrZ3atRLaVxdjbY2d184R6/sLHe'.
  1132. 'opHP7/Do90Ua+WWUyezzZHObP/7cfX54/dowE1d66s8TV3oE+Mfn+L/zb4XmHPjRG9YjAAAAAElFTkSuQmCC' ;
  1133. //==========================================================
  1134. // stop.png
  1135. //==========================================================
  1136. $this->iBuiltinIcon[8][0]= 889 ;
  1137. $this->iBuiltinIcon[8][1]=
  1138. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlz'.
  1139. 'AAALDwAACw8BkvkDpQAAAAd0SU1FB9AJDwEvNyD6M/0AAAL2SURBVHic1ZTLaxVnGIefb2bO5OScHJN4oWrFNqcUJYoUEgU3/Qf6'.
  1140. 'F7gwCkIrvdBLUtqqiLhSg9bgBduFSHZdiG5ctkJ3xRDbUFwUmghNzBDanPGMkzOX79LFJGPMOSd204U/+Bbzvd/78F4H/ieJdoad'.
  1141. 'pZKxRFszAI/DcP0HazXY22v+HB01kee1PA/v3zfnjx4xgGnHcNZe7OvuNj+cOEF1ZATv5nUA4jhBSgmADCVWo8Ge2Of9wb18P/G7'.
  1142. 'oUXmYi30zqlTVEdGWLh1g2D6MYlKkXGE0Vl8aa2GEB149+4xXSzyoOIw/mimiZV/DPb25pFOj13A9gOMEChhUEqhVYqWKUk9QAUp'.
  1143. 'sT/P4s8PmKlUmNhQaIJbkDVqBbpw6wZ2zUc4Nm+ePku5p4eOrgpueQOFUoVCVxcD4+N07dpF9+5tVJeWGPBjhvr7WF1zC8ASgtcP'.
  1144. 'H8a7eZ1odh4sh50nzwCw9ZNh3M4Stutiu0X2nB/LyjZ6lcIbVTpdQU/jWVPzLADM8+ZGBRdtC7wrF/O7bR99iu26VL86iU4SAH4b'.
  1145. 'Po5d6AQhstMSvGyI4wS5FJBKSRwnzF8byx/u+PjzzMF1mfryQ1K/jnCahqp1xEopjFLoNEFJSRJHzF799gWHqa+/QKcSUXBI609f'.
  1146. 'Al5W4teQSiHDOipNUKnMI13RvnOXAIEKQixvGWya98SC560MFwPiqEG86JM8q79Q06lvhnOndy5/B6GPCUOMUu3BQgg8z0M3GmBZ'.
  1147. 'iGJn3v2VmsqnfzNx7FDueODuj8ROCFpjtG5TCmOYv32bJ09msP0ISydMfnAUgF8/O45RAA6WTPjlvXcB+Gn7FuRf/zAnNX6x3ARe'.
  1148. 'PSdmqL+P/YHkwMGDOGWDZTlQcNBRhPEComgB/YeHfq2InF1kLlXUOkpMbio1bd7aATRD/X0M1lPeSlM2vt2X1XBZjZnpLG2tmZO6'.
  1149. 'LbQVOIcP+HG2UauH3xgwBqOz9Cc3l1tC24Fz+MvUDroeGNb5if9H/1dM/wLPCYMw9fryKgAAAABJRU5ErkJggg==' ;
  1150. //==========================================================
  1151. // error.png
  1152. //==========================================================
  1153. $this->iBuiltinIcon[9][0]= 541 ;
  1154. $this->iBuiltinIcon[9][1]=
  1155. 'iVBORw0KGgoAAAANSUhEUgAAACgAAAAoCAMAAAC7IEhfAAAAaVBMVEX//////2Xy8mLl5V/Z2VvMzFi/v1WyslKlpU+ZmUyMjEh/'.
  1156. 'f0VyckJlZT9YWDxMTDjAwMDy8sLl5bnY2K/MzKW/v5yyspKlpYiYmH+MjHY/PzV/f2xycmJlZVlZWU9MTEXY2Ms/PzwyMjLFTjea'.
  1157. 'AAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxIAAAsSAdLdfvwAAAAHdElNRQfTCAkUMSj9wWSOAAABLUlEQVR4'.
  1158. '2s2U3ZKCMAxGjfzJanFAXFkUle/9H9JUKA1gKTN7Yy6YMjl+kNPK5rlZVSuxf1ZRnlZxFYAm93NnIKvR+MEHUgqBXx93wZGIUrSe'.
  1159. 'h+ctEgbpiMo3iQ4kioHCGxir/ZYUbr7AgPXs9bX0BCYM8vN/cPe8oQYzom3tVsSBMVHEoOJ5dm5F1RsIe9CtqGgRacCAkUvRtevT'.
  1160. 'e2pd6vOWF+gCuc/brcuhyARakBU9FgK5bUBWdHEH8tHpDsZnRTZQGzdLVvQ3CzyYZiTAmSIODEwzFCAdJopuvbpeZDisJ4pKEcjD'.
  1161. 'ijWPJhU1MjCo9dkYfiUVjQNTDKY6CVbR6A0niUSZjRwFanR0l9i/TyvGnFdqwStq5axMfDbyBksld/FUumvxS/Bd9VyJvQDWiiMx'.
  1162. 'iOsCHgAAAABJRU5ErkJggg==' ;
  1163. //==========================================================
  1164. // openfolder.png
  1165. //==========================================================
  1166. $this->iBuiltinIcon[10][0]= 2040 ;
  1167. $this->iBuiltinIcon[10][1]=
  1168. 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEANAAtwClFht71AAAAAlwSFlz'.
  1169. 'AAALEAAACxABrSO9dQAAAAd0SU1FB9AKDQ4RIXMeaLcAAAd1SURBVHicxZd7jBXVHcc/58zcvTNzH8vusqw8FsTsKiCUUh5WBZXG'.
  1170. 'GkOptmqwNWsWLKXFGlEpzZI0AWNKSy0WhDS22gJKtWlTsSRqzYIuLGB2WVvDIwQMZQMsy2OFfdzde+/OnHP6x907vJaFpjb9JZM5'.
  1171. 'c85Mfp/f9/s7Jxn4P4e41gtSyp78WGvtfdEAcqDFYUOH9HS0NhGk9tPb/ilSyp789UUB2AMuqhQy3Uzm7HGkE6W3dTNZMRI3EcWO'.
  1172. 'jf9ClLmWBT3dzW8jUsevWHCG3UpWl+IkHSxnbDh/Mcz12NevBcuWXTmf6TjnXvJ88gDmVB3pw3+nt3UzHa1NqMzBS2zqPLGFjtMN'.
  1173. 'ZNr3XdW+qyqwZcFk76HX/tHWfuQvyO4W7qhaHwL8efkMRlRUpPv7rqD0RrJ+FgAjLy1a20OIxZJEEuNCRfIApj+om4bGM3u2/sYU'.
  1174. '9J41d8973f3Dhg1pISTV1dXXBRNJxPGFCzhou+DCQrScZOkktNaeDZjamgeZ9MgiYmVDccvHhjAzJw0NTh8/alyZMaVJicp0iTHj'.
  1175. 'JpgNv38tjWUhhGROdbUL9W5/MH5XCkjlcibi+KIop5LVHLKEu8A/f4r286doa9pGrGwYAAsfqbbH3b8MgO/Nqgy6WvdbbXHMkEFJ'.
  1176. '4xUOMVEvaTZu3BgmvF4Yk4hz9rO/Ulr5cE9owae/rcGxohSOuiWkC2IjcIqKyPZm+OmCH7GhoZEF077EEzVVweAbJ+riEeO0Ey8y'.
  1177. 'UubqOHn0AOgMwvf59txnBrSp9dgxKmf/+kIP1NY8SFk0jh5ajmNHAWg5b2E5EexojGHjbiVRMoRMNs0LC+Yz46vTuH3enN7BI8fr'.
  1178. 'qFdo0BoVZNC9aVSQ4fNjBzEmQJiARxb+/AqYPMAVB5FsPU5v37g9OxgLhe14ZM5/ju052E6MNZvf5pmHHuLmmWOkEysxUtpGAtme'.
  1179. 'dtHTflJkezqQto3jFRnLssyf1jydxiiM7zNnye/c3ZsqLu2BN5fcMfzrv/hby1tPzmRUoihcTJ87CwQI2yLtDcIqsIjYUf51qBlf'.
  1180. 'OnScOSrdQUOMURkiXsLUzJnvbGhoBGDHH5cGyZLhOpYoNl5hqYnYEXOu5fDl9eYAHntx98n8hFHZcPHUuTSxSASAeK/CGIOxJJ0f'.
  1181. 'bOGNPU280dgkq6Y2yu8vfjCIlwwzr+/ZQ/PHO0gOLuO5qsftDQ2NbN+4OCgqG6WTxWVaq6zpF+DiSHWnicdylp3r6aZTWthIOrNp'.
  1182. 'ktHcvBu0sHX1Sm6ozB3B42d90zZA9bQp7PvgPSzXZfnqX/HS4DKKK2+x69Y/HURs26iBAN5ccsfw7774UcumF37C6f07KSt2OHji'.
  1183. 'DEUJD0tISjyPrrSPlAKvN0JP/U4O1NfjuhG2rvklN1SOpfXwftpbTqAyKRrff5fb7rs9V1R7m4wlz2ihA3HpmXflUWyOH2umpLiY'.
  1184. 'ui3v8M+6bWzfsRNbSgqkxaCkiy0simMuEWEhpcRzIhQWOIAh6tiAwS4owInFiTou5dOnMnl2NR++ujBwXEc9terD6M43nrj6LgAB'.
  1185. 'QnDPA9/irtkP8JRS7Hr/3T6YekDQ1pEiEXOwpUVJzCVlZZFS4mZtkpEo9ChAkDp/jtLMBACy6S4RiQghLyv5cgBRPnKUOX6smUGF'.
  1186. 'hSil0MYw9d77mPy1e5mnFE3batm3czvb6nYgEJztSFGU9LCRlMRdUjIH0+lnEMIwPNXD3NumoVJnrMCJaiciMUZfvQnz4QcBSvV1'.
  1187. 'vjE5GK358t0zmXDnDB79saLpo20c+aSRD+t25JTp7GZQwsEWFiVxl6hlUf/WO9z32CxmL1rOe6u/I2KuwGhzLQCB7/sYY9Bah3el'.
  1188. 'FKbvrrVm4vS7GH/7ncx+chEHGz7myCeNbPtoO0JI2jq78WIRLGkzsqs7V5SfFV5EovXACoiqqsfNpk2vo5VCWtYFBfoU0VoTBAFa'.
  1189. 'a7TRaK2p+MoURk+cxMzq+Rzbv49DDbuo27UTW9h0dedssPxuK+kIfN8XxhgDYPVXf2Fh4XKtFIl4AiklAlBKAYRKKK36wHIweTCt'.
  1190. 'NfHiEkaOn8j0+7/BmDFjaT30GbHywSxcuZkpFfFg+m1jjZ/NmnVvNfRvwd69e8WBA/uNFAIh4JVXXmHsmDHE4vEQQgjQ2lxQIm9N'.
  1191. 'nz35q3BEOZOHzaG2thaA4mRU+L29It+IV21CpbRQfeMFC35gRB/M2rVrubnyZmLxWJhECBEmz/eHyo/7lMlH3LFFujsthNFCCGOu'.
  1192. '+WNyeUgpjSVzMKtWraKyshLPdcPEeYWCIEBdpIxSivr6eta8vI7d6+cGnhdV06pe1QP+F/QXWmuRL+jZZ58LlVmxYgUVFRV4rhtu'.
  1193. '4TzMxXAA6XRaRAtsYUkx8I/JtSJQOlSwpmZpCLN8+fPcdNNoHMfB9/0QJgRoP295TlR7UVv8xxZcHMuWIZ9/Hn35vG3JEGZpzVJG'.
  1194. 'jx5N1IlitKahsZE1L69j69qHgx+urFX/lQL9JYdLlfnZihUhzOLFi8N3Ml1dthOxVH/f/8/CtqSJ2JaJ2JZ59J7RPsC/AViJsQS/'.
  1195. 'dBntAAAAAElFTkSuQmCC' ;
  1196. //==========================================================
  1197. // folder.png
  1198. //==========================================================
  1199. $this->iBuiltinIcon[11][0]= 1824 ;
  1200. $this->iBuiltinIcon[11][1]=
  1201. 'iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlz'.
  1202. 'AAALEAAACxABrSO9dQAAAAd0SU1FB9ECAQgFFyd9cRUAAAadSURBVHiczdhvbBP3Hcfx9/2xfefEOA5JoCNNnIT8AdtZmYBETJsI'.
  1203. '6+jQOlQihT1AYgytqzZpD1atfyYqlT1h0lRpT7aRJ4NQpRvZGELVuo5Ua9jEJDIETQsNQyPBsUJMWGPnj//e+e72wNg4xElMR6ed'.
  1204. 'ZNln3933dZ/f93f6yfB/sgmrHdDV1WXlPg8NDZUDScD8LFFFEZZlWYZhWMFg0Orq6sq/gDJAfFy1iiZy9OjrVnj4JzQ1rMWqfxm/'.
  1205. '309jYyNtbW0kEgnu3bvH4cOH88c/jqSKQl4/XGkd+eVtAN46up1LH92ktqYS++ZX8Pv9NDQ0sGnTJlKpFOFwmO7u7vy5IyMjeVRd'.
  1206. 'XV1+WEOh0IrY4pDnq6wXX/sTiCJaMkFZdRNqxefoe7VtCSqXVDqdZnZ2ltraWkzTpKqqijt3JpFlG7dvj7NzZ1f++qFQyA3EClHL'.
  1207. 'Ql743nFkhxPDtJAd5eTaYSVUfX09lZWVlJWVIUnSg7sVQMBCUcu4ceMGe/bsIRQK1QAzOcyykIM9P0KyudAyCWyqG8nhwqa4SkLt'.
  1208. '3r0bVVVxu924XC40TUOWZUQxe97CwgIdHR2LMHIxSCaVInVvFElxE0vMY1Pd2NUKJMWNTXHlUfF//4vETJCelwbpFm3MjP2dt37x'.
  1209. 'AlN+PzU1NViWRSwW4+7du3g8HjweD4qi5EFAJzAExIpCANbooxhplfB0FJvTg6xWIqsVRVF6MopkU3FXPcnkJxGU0VEAdF2noqKC'.
  1210. 'W3/8DpnqLjzep2lubsblcjE8PExHR8fboVDID9xYFpLBDpJF0jDQIncQpWlkm31FlFLtp9PfyuW/vYQj1kPSuRW/38+lj27S2Q7v'.
  1211. '/aWXUBVUffVNtm3blivVCEwsC5Eyc5iiApEpDEAXMqQdldhSiWVQHjJagud+8Fuexck/zv+K82dfoSbSCsDe75/km+4GVPd6+l5t'.
  1212. '4zJHcqVUYN2yEEtZQDCSJCueRAYsPY49HsFIZVG6p25JUumFafT4DKJN4amtT7Nz38sk5+5A70HMtEYyMkFiZhxzjQ/poXrLQrRU'.
  1213. 'DFGEeFpAlkQkm4pRiCpIKodKzk0T/2QMh+piPjxKZPwiSkUtu/b9mNnJEWS7E8nhAmvpM60oJDkXJxqNozxRRUxPIesispBBlsXV'.
  1214. 'UaKEFo8gzoaJhz8s2lOmrpUG+WBhJ9/60g+Z+fDXTAXfxllRjl1VkO0OFATsYhYliiK21ZKKhhHnFveUqSdKgwAEOp7F2v51vvw8'.
  1215. 'XH7/N1wd/BlTweuUV65BdtgfoLTSkipsdD3tRi0VYpommUwGwzDwdT5HYEc3giAwcvH3jLz3BlPB67jWeZBEKYsSBWwpHZtNKo4q'.
  1216. 'aHTDsJeeiGEYWJaFZVmYpommaRiGQdPnv0bb1m8gSRL/vPIOV979aR4lmAJ2p4qCgCxksNuKJ6VNpx4NYhgGpmkuQhmGQTqdxjAM'.
  1217. 'qr2d7HtxEEEQuH1tkKvvvkF44tqDnrIcKJKAPf1g+LAUElq8dIiu60sApmnm93Pfzc7OYhgGrie+wFe++ztcLhcT1wf54PzPCU9c'.
  1218. 'w7XWjWS3IdsdOAUBWZAxrRJnTQ6SG5bce2FCpmkughmGQSqVYm5uDtnj44sH38TtdhP6+Dwf//V4ttHXrkGURZJaic8RgHQ6jWma'.
  1219. 'SJKUL5RLKNfIOczDKF3XSSaTRCIRhLJWntp3nGfWrSMxc5OLf3iNP4+68T9Ub9nF76lTpxgfHycajZJKpdA0LZ9GbjYV7hcDWZaF'.
  1220. 'pmnMz88Ti8UYunSLmu1HFi2aVkxkaGjINTY2ttDb24vX6+XQoUNs3ryZ8vJyIDu1BUFYkkxhgxeiWlpaOHPmDE1NTdTX1xe98eWG'.
  1221. 'JnF/9dQZCoXUYDA4AOD1ejlw4ACtra2Ul5fniwmCkEcUJiUIAoFAgL6+Pnw+H21tbfT39z8SxCS7hHsfWH9/8dL4MKqnp4eWlhac'.
  1222. 'TmcekEvMNE2am5s5ceIEgUCA9vZ2Tp48ic/nY3j4UsmQHCYOjJHtpeBKqL1799Lc3IzT6UTXdRobGxkYGKC9vZ3W1tZ8Ko86NJ8a'.
  1223. 'tXHjRo4dO8bp06fZsmULGzZsoL+/n0AggNfr5ezZs/8VpGTU5OSkc//+/acBfD4f1dXV7Nq1i4aGBs6dO4fP5+Pq1SuPBbIiyjTN'.
  1224. 'RUnV1dUNXLhwAa/Xy44dO4jFYgBEo9FFF1r134BPuYlk16LrAYXsAlmtq6sbKDwoFAp9m+ykuP5ZQVZF3f8tCdwCov8LyHIoAANI'.
  1225. 'AXf/A1TI0XCDh7OWAAAAAElFTkSuQmCC' ;
  1226. //==========================================================
  1227. // file_important.png
  1228. //==========================================================
  1229. $this->iBuiltinIcon[12][0]= 1785 ;
  1230. $this->iBuiltinIcon[12][1]=
  1231. 'iVBORw0KGgoAAAANSUhEUgAAACIAAAAiCAYAAAA6RwvCAAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAAAAAAAA+UO7fwAAAAlwSFlz'.
  1232. 'AAALDwAACw8BkvkDpQAAAAd0SU1FB9ECDAcjDeD3lKsAAAZ2SURBVHicrZhPaFzHHcc/897s7lutJCsr2VHsOHWMk0MPbsBUrcnF'.
  1233. 'OFRdSo6FNhdB6SGHlpDmYtJCDyoxyKe6EBxKQkt7KKL0T6ABo0NbciqigtC6PhWKI2NFqqxdSd7V2/dmftPDvPd212t55dCBYfbN'.
  1234. 'zpvfZ77z+/1mdhUjytWrV93Hf/24eD5z9gwiMlDjOKbb7dLtdhER2u02u7u73Lp1CxEZBw4AeZwdNQqkMd9wbziFGINJUt6rRbz5'.
  1235. '1ptUq1XK5TJBEAAUMHt7e+zu7gKwvLzMysoKwAng/uNg9CgQgFKlgg1DUJ67Vqtx6tQpZmdniaIIpRTOOZRSdDoddnZ2aLfbLC8v'.
  1236. 's7S0xJUrV7ZGwQSj1PhhfRodVdDlMrpc5vup5Z2fvMPdu3fZ29vDWjvwztjYGPV6nVqtRqVS4dKlSywtLQFsAdOH2XwsCEApg3jl'.
  1237. 'w98Rak2gvYjNZpNms0mSJDjnHgkDMDc3dySYQ0Ea8w139YUX0OUKulzyg7UmCEO+l1huvHuDra0t9vf3h1TJYSqVypFhHquIrlQI'.
  1238. 'S5qv/uIDAC7/4bcEQYAKvK+0Wq1DVQGIoog7d+4cCeaRII35hrt+8SsEOkRlUaEyR0UpFIrXHxyMVKVUKnHv3r0jwRwaNelBjBjL'.
  1239. 'Sz/7KYuLiwAsLi7y4z/9kY9e+TpkCuSqjI+Po7XuAWeKXLt2DWNMUZMkwRjDhQsXWFtbK6JpCCT3jfQgxomPtPX19YHWicM5x3c2'.
  1240. '73Pj3Ru8/aO3mZqaolKpoHVvyuvXr/Ppnf/Q7uzz380NPtu4y/qnG+ztd1hfX2dtbQ3gIvDnRyqSxl1UoPjyz98D4PTp0wPtq39Z'.
  1241. '4fdzLxegrVaLVqvF5OQkYRgWqpRKJZ77wvNsbW1RG5tgfKLOTH2G7Z1twqBQrgrMDvhInjfSOCY5iIv+hYWFgRZArEWsZWF941Bf'.
  1242. 'SdMUgMnJCWpjVU4cn+HUyePM1Gc4+fRUPkzBI5w1jbukcczLv/5l0XfmzJmBFuCba38r/CRXpT+CrDUoZ0jjB4RYonJAOYRobJKT'.
  1243. 'z5zgqfqxAbsFSH6mpHFM2qdGXh4VnoViD6mSJF2cTQeqDqBaKVHWmonJCWpZjhkC6anR5WsffTgwaHV1FaUUq6urA/2v3f5k4LnV'.
  1244. 'arG9tUn3oI2YBCcWHYAxMVYs1qZEZY2SFB2aYZDGfMN9d7uJiWPSeFiNo5Rclc3NTXZbO6RpF7EJVixYA9agwwDnUiqlEPdQ3imi'.
  1245. 'Jo27BGHIt/7x9yEjc3Nzh27Na7c/4TdffKl4bja3ae5MUIu0T/HOEIaOpJt4gwoSsVTK4SBIY77hFtY3ABBjBiZ90rKwvsH77/+K'.
  1246. 't37wOhO1iPpTk4SBw1mLsz6CnKQ4l3qV+kE+t9XHlNZOk+bUJLVIE1VCcIJWQmJ6qjj30NbcXLkZMt8YPig+Z3n1G5fZ39/j/vY2'.
  1247. '9ckqZT2Ochbn0p4qNkU/dDfUADdXbh4HXgRO4zNdEU0XL1784PLly5w9e7Z4SazFOfGrEotDcOKrcoJPmrYIXf/Zop3QNd1skuGt'.
  1248. 'cUAb2MgAxvHZTgFUq1Wmp6eZnZ0F8JlTjDduDThBnDeECEoJtbGIp6enqEblzCcEZ1PECU4yVRiOGgd0gc+AB0CZvkv1sWPHOHfu'.
  1249. 'HOfPn8da41cpkkltEBEPJhYnBkTQJcdYVKGkgRxCfBsq5xXNgAa2Bn+hjTOgHEKBP8pzRUxykIH4ifLJRTJAl+UMBJzPHQ6bfe/f'.
  1250. 'cWIzPxlUpD+zugzIZtVk1d8znBAqRxgoQuVQgSJQ3h9C5QhDRYgjUILCAzlnEdsHYTKfMTEBcP7F54YUGVmc2GLlIn6ve6v0ahSt'.
  1251. '8X25TzjJ+rIx1grKpQPWR4LkGVVsMgghvS0qjPdvm5OeceOTWA5Evo2mFzkjQfL7hZPUy5yvvF/uPFQL3+nbDmsLCEmT3sTmCTNr'.
  1252. 'rogT6yFsOix3ftw7OwQhkvSU6CuinhCk0+kAkFoBazEEICHaHHiPVmU0gnUp4EAc1mYrF0EBVpwPi34VrBkwPxKk3W5ju/e5/c+d'.
  1253. 'bGUHIAIuydTIE5zfc5Wr4lJcahHnHTP3CVGm78DrgY38N+DEibp7dmYKdAQmBh1hjEFjis+9CTWYGK21H6PxPyOI0DobYwzZF/z7'.
  1254. '7jadTvJtYG0kCD7lfwl49ijgT1gc0AH+dZSJA/xB+Mz/GSIvFoj/B7H1mAd8CO/zAAAAAElFTkSuQmCC' ;
  1255. $this->iLen = count($this->iBuiltinIcon);
  1256. }
  1257. }
  1258. //===================================================
  1259. // Global cache for builtin images
  1260. //===================================================
  1261. $_gPredefIcons = new PredefIcons();
  1262. //===================================================
  1263. // CLASS IconImage
  1264. // Description: Holds properties for an icon image
  1265. //===================================================
  1266. class IconImage {
  1267. private $iGDImage=null;
  1268. private $iWidth,$iHeight;
  1269. private $ixalign='left',$iyalign='center';
  1270. private $iScale=1.0;
  1271. function IconImage($aIcon,$aScale=1) {
  1272. GLOBAL $_gPredefIcons ;
  1273. if( is_string($aIcon) ) {
  1274. $this->iGDImage = Graph::LoadBkgImage('',$aIcon);
  1275. }
  1276. elseif( is_integer($aIcon) ) {
  1277. // Builtin image
  1278. $this->iGDImage = $_gPredefIcons->GetImg($aIcon);
  1279. }
  1280. else {
  1281. JpGraphError::RaiseL(6011);
  1282. //('Argument to IconImage must be string or integer');
  1283. }
  1284. $this->iScale = $aScale;
  1285. $this->iWidth = Image::GetWidth($this->iGDImage);
  1286. $this->iHeight = Image::GetHeight($this->iGDImage);
  1287. }
  1288. function GetWidth() {
  1289. return round($this->iScale*$this->iWidth);
  1290. }
  1291. function GetHeight() {
  1292. return round($this->iScale*$this->iHeight);
  1293. }
  1294. function SetAlign($aX='left',$aY='center') {
  1295. $this->ixalign = $aX;
  1296. $this->iyalign = $aY;
  1297. }
  1298. function Stroke($aImg,$x,$y) {
  1299. if( $this->ixalign == 'right' ) {
  1300. $x -= $this->iWidth;
  1301. }
  1302. elseif( $this->ixalign == 'center' ) {
  1303. $x -= round($this->iWidth/2*$this->iScale);
  1304. }
  1305. if( $this->iyalign == 'bottom' ) {
  1306. $y -= $this->iHeight;
  1307. }
  1308. elseif( $this->iyalign == 'center' ) {
  1309. $y -= round($this->iHeight/2*$this->iScale);
  1310. }
  1311. $aImg->Copy($this->iGDImage,
  1312. $x,$y,0,0,
  1313. round($this->iWidth*$this->iScale),round($this->iHeight*$this->iScale),
  1314. $this->iWidth,$this->iHeight);
  1315. }
  1316. }
  1317. //===================================================
  1318. // CLASS TextProperty
  1319. // Description: Holds properties for a text
  1320. //===================================================
  1321. class TextProperty {
  1322. public $iShow=true;
  1323. public $csimtarget='',$csimwintarget='',$csimalt='';
  1324. private $iFFamily=FF_FONT1,$iFStyle=FS_NORMAL,$iFSize=10;
  1325. private $iColor="black";
  1326. private $iText="";
  1327. private $iHAlign="left",$iVAlign="bottom";
  1328. //---------------
  1329. // CONSTRUCTOR
  1330. function TextProperty($aTxt='') {
  1331. $this->iText = $aTxt;
  1332. }
  1333. //---------------
  1334. // PUBLIC METHODS
  1335. function Set($aTxt) {
  1336. $this->iText = $aTxt;
  1337. }
  1338. function SetCSIMTarget($aTarget,$aAltText='',$aWinTarget='') {
  1339. if( is_string($aTarget) )
  1340. $aTarget = array($aTarget);
  1341. $this->csimtarget=$aTarget;
  1342. if( is_string($aWinTarget) )
  1343. $aWinTarget = array($aWinTarget);
  1344. $this->csimwintarget=$aWinTarget;
  1345. if( is_string($aAltText) )
  1346. $aAltText = array($aAltText);
  1347. $this->csimalt=$aAltText;
  1348. }
  1349. function SetCSIMAlt($aAltText) {
  1350. if( is_string($aAltText) )
  1351. $aAltText = array($aAltText);
  1352. $this->csimalt=$aAltText;
  1353. }
  1354. // Set text color
  1355. function SetColor($aColor) {
  1356. $this->iColor = $aColor;
  1357. }
  1358. function HasTabs() {
  1359. if( is_string($this->iText) ) {
  1360. return substr_count($this->iText,"\t") > 0;
  1361. }
  1362. elseif( is_array($this->iText) ) {
  1363. return false;
  1364. }
  1365. }
  1366. // Get number of tabs in string
  1367. function GetNbrTabs() {
  1368. if( is_string($this->iText) ) {
  1369. return substr_count($this->iText,"\t") ;
  1370. }
  1371. else{
  1372. return 0;
  1373. }
  1374. }
  1375. // Set alignment
  1376. function Align($aHAlign,$aVAlign="bottom") {
  1377. $this->iHAlign=$aHAlign;
  1378. $this->iVAlign=$aVAlign;
  1379. }
  1380. // Synonym
  1381. function SetAlign($aHAlign,$aVAlign="bottom") {
  1382. $this->iHAlign=$aHAlign;
  1383. $this->iVAlign=$aVAlign;
  1384. }
  1385. // Specify font
  1386. function SetFont($aFFamily,$aFStyle=FS_NORMAL,$aFSize=10) {
  1387. $this->iFFamily = $aFFamily;
  1388. $this->iFStyle = $aFStyle;
  1389. $this->iFSize = $aFSize;
  1390. }
  1391. function IsColumns() {
  1392. return is_array($this->iText) ;
  1393. }
  1394. // Get width of text. If text contains several columns separated by
  1395. // tabs then return both the total width as well as an array with a
  1396. // width for each column.
  1397. function GetWidth($aImg,$aUseTabs=false,$aTabExtraMargin=1.1) {
  1398. $extra_margin=4;
  1399. $aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  1400. if( is_string($this->iText) ) {
  1401. if( strlen($this->iText) == 0 ) return 0;
  1402. $tmp = split("\t",$this->iText);
  1403. if( count($tmp) <= 1 || !$aUseTabs ) {
  1404. $w = $aImg->GetTextWidth($this->iText);
  1405. return $w + 2*$extra_margin;
  1406. }
  1407. else {
  1408. $tot=0;
  1409. $n = count($tmp);
  1410. for($i=0; $i < $n; ++$i) {
  1411. $res[$i] = $aImg->GetTextWidth($tmp[$i]);
  1412. $tot += $res[$i]*$aTabExtraMargin;
  1413. }
  1414. return array(round($tot),$res);
  1415. }
  1416. }
  1417. elseif( is_object($this->iText) ) {
  1418. // A single icon
  1419. return $this->iText->GetWidth()+2*$extra_margin;
  1420. }
  1421. elseif( is_array($this->iText) ) {
  1422. // Must be an array of texts. In this case we return the sum of the
  1423. // length + a fixed margin of 4 pixels on each text string
  1424. $n = count($this->iText);
  1425. for( $i=0, $w=0; $i < $n; ++$i ) {
  1426. $tmp = $this->iText[$i];
  1427. if( is_string($tmp) ) {
  1428. $w += $aImg->GetTextWidth($tmp)+$extra_margin;
  1429. }
  1430. else {
  1431. if( is_object($tmp) === false ) {
  1432. JpGraphError::RaiseL(6012);
  1433. }
  1434. $w += $tmp->GetWidth()+$extra_margin;
  1435. }
  1436. }
  1437. return $w;
  1438. }
  1439. else {
  1440. JpGraphError::RaiseL(6012);
  1441. }
  1442. }
  1443. // for the case where we have multiple columns this function returns the width of each
  1444. // column individually. If there is no columns just return the width of the single
  1445. // column as an array of one
  1446. function GetColWidth($aImg,$aMargin=0) {
  1447. $aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  1448. if( is_array($this->iText) ) {
  1449. $n = count($this->iText);
  1450. for( $i=0, $w=array(); $i < $n; ++$i ) {
  1451. $tmp = $this->iText[$i];
  1452. if( is_string($tmp) ) {
  1453. $w[$i] = $aImg->GetTextWidth($this->iText[$i])+$aMargin;
  1454. }
  1455. else {
  1456. if( is_object($tmp) === false ) {
  1457. JpGraphError::RaiseL(6012);
  1458. }
  1459. $w[$i] = $tmp->GetWidth()+$aMargin;
  1460. }
  1461. }
  1462. return $w;
  1463. }
  1464. else {
  1465. return array($this->GetWidth($aImg));
  1466. }
  1467. }
  1468. // Get total height of text
  1469. function GetHeight($aImg) {
  1470. $aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  1471. return $aImg->GetFontHeight();
  1472. }
  1473. // Unhide/hide the text
  1474. function Show($aShow=true) {
  1475. $this->iShow=$aShow;
  1476. }
  1477. // Stroke text at (x,y) coordinates. If the text contains tabs then the
  1478. // x parameter should be an array of positions to be used for each successive
  1479. // tab mark. If no array is supplied then the tabs will be ignored.
  1480. function Stroke($aImg,$aX,$aY) {
  1481. if( $this->iShow ) {
  1482. $aImg->SetColor($this->iColor);
  1483. $aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  1484. $aImg->SetTextAlign($this->iHAlign,$this->iVAlign);
  1485. if( $this->GetNbrTabs() <= 1 ) {
  1486. if( is_string($this->iText) ) {
  1487. // Get rid of any "\t" characters and stroke string
  1488. if( is_array($aX) ) $aX=$aX[0];
  1489. if( is_array($aY) ) $aY=$aY[0];
  1490. $aImg->StrokeText($aX,$aY,str_replace("\t"," ",$this->iText));
  1491. }
  1492. elseif( is_array($this->iText) && ($n = count($this->iText)) > 0 ) {
  1493. $ax = is_array($aX) ;
  1494. $ay = is_array($aY) ;
  1495. if( $ax && $ay ) {
  1496. // Nothing; both are already arrays
  1497. }
  1498. elseif( $ax ) {
  1499. $aY = array_fill(0,$n,$aY);
  1500. }
  1501. elseif( $ay ) {
  1502. $aX = array_fill(0,$n,$aX);
  1503. }
  1504. else {
  1505. $aX = array_fill(0,$n,$aX);
  1506. $aY = array_fill(0,$n,$aY);
  1507. }
  1508. $n = min($n, count($aX) ) ;
  1509. $n = min($n, count($aY) ) ;
  1510. for($i=0; $i < $n; ++$i ) {
  1511. $tmp = $this->iText[$i];
  1512. if( is_object($tmp) ) {
  1513. $tmp->Stroke($aImg,$aX[$i],$aY[$i]);
  1514. }
  1515. else
  1516. $aImg->StrokeText($aX[$i],$aY[$i],str_replace("\t"," ",$tmp));
  1517. }
  1518. }
  1519. }
  1520. else {
  1521. $tmp = split("\t",$this->iText);
  1522. $n = min(count($tmp),count($aX));
  1523. for($i=0; $i < $n; ++$i) {
  1524. $aImg->StrokeText($aX[$i],$aY,$tmp[$i]);
  1525. }
  1526. }
  1527. }
  1528. }
  1529. }
  1530. //===================================================
  1531. // CLASS HeaderProperty
  1532. // Description: Data encapsulating class to hold property
  1533. // for each type of the scale headers
  1534. //===================================================
  1535. class HeaderProperty {
  1536. public $grid;
  1537. public $iShowLabels=true,$iShowGrid=true;
  1538. public $iTitleVertMargin=3,$iFFamily=FF_FONT0,$iFStyle=FS_NORMAL,$iFSize=8;
  1539. public $iStyle=0;
  1540. public $iFrameColor="black",$iFrameWeight=1;
  1541. public $iBackgroundColor="white";
  1542. public $iWeekendBackgroundColor="lightgray",$iSundayTextColor="red"; // these are only used with day scale
  1543. public $iTextColor="black";
  1544. public $iLabelFormStr="%d";
  1545. public $iIntervall = 1;
  1546. //---------------
  1547. // CONSTRUCTOR
  1548. function HeaderProperty() {
  1549. $this->grid = new LineProperty();
  1550. }
  1551. //---------------
  1552. // PUBLIC METHODS
  1553. function Show($aShow=true) {
  1554. $this->iShowLabels = $aShow;
  1555. }
  1556. function SetIntervall($aInt) {
  1557. $this->iIntervall = $aInt;
  1558. }
  1559. function GetIntervall() {
  1560. return $this->iIntervall ;
  1561. }
  1562. function SetFont($aFFamily,$aFStyle=FS_NORMAL,$aFSize=10) {
  1563. $this->iFFamily = $aFFamily;
  1564. $this->iFStyle = $aFStyle;
  1565. $this->iFSize = $aFSize;
  1566. }
  1567. function SetFontColor($aColor) {
  1568. $this->iTextColor = $aColor;
  1569. }
  1570. function GetFontHeight($aImg) {
  1571. $aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  1572. return $aImg->GetFontHeight();
  1573. }
  1574. function GetFontWidth($aImg) {
  1575. $aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  1576. return $aImg->GetFontWidth();
  1577. }
  1578. function GetStrWidth($aImg,$aStr) {
  1579. $aImg->SetFont($this->iFFamily,$this->iFStyle,$this->iFSize);
  1580. return $aImg->GetTextWidth($aStr);
  1581. }
  1582. function SetStyle($aStyle) {
  1583. $this->iStyle = $aStyle;
  1584. }
  1585. function SetBackgroundColor($aColor) {
  1586. $this->iBackgroundColor=$aColor;
  1587. }
  1588. function SetFrameWeight($aWeight) {
  1589. $this->iFrameWeight=$aWeight;
  1590. }
  1591. function SetFrameColor($aColor) {
  1592. $this->iFrameColor=$aColor;
  1593. }
  1594. // Only used by day scale
  1595. function SetWeekendColor($aColor) {
  1596. $this->iWeekendBackgroundColor=$aColor;
  1597. }
  1598. // Only used by day scale
  1599. function SetSundayFontColor($aColor) {
  1600. $this->iSundayTextColor=$aColor;
  1601. }
  1602. function SetTitleVertMargin($aMargin) {
  1603. $this->iTitleVertMargin=$aMargin;
  1604. }
  1605. function SetLabelFormatString($aStr) {
  1606. $this->iLabelFormStr=$aStr;
  1607. }
  1608. function SetFormatString($aStr) {
  1609. $this->SetLabelFormatString($aStr);
  1610. }
  1611. }
  1612. //===================================================
  1613. // CLASS GanttScale
  1614. // Description: Responsible for calculating and showing
  1615. // the scale in a gantt chart. This includes providing methods for
  1616. // converting dates to position in the chart as well as stroking the
  1617. // date headers (days, week, etc).
  1618. //===================================================
  1619. class GanttScale {
  1620. public $minute,$hour,$day,$week,$month,$year;
  1621. public $divider,$dividerh,$tableTitle;
  1622. public $iStartDate=-1,$iEndDate=-1;
  1623. // Number of gantt bar position (n.b not necessariliy the same as the number of bars)
  1624. // we could have on bar in position 1, and one bar in position 5 then there are two
  1625. // bars but the number of bar positions is 5
  1626. public $actinfo;
  1627. public $iTopPlotMargin=10,$iBottomPlotMargin=15;
  1628. public $iVertLines=-1;
  1629. public $iVertHeaderSize=-1;
  1630. // The width of the labels (defaults to the widest of all labels)
  1631. private $iLabelWidth;
  1632. // Out image to stroke the scale to
  1633. private $iImg;
  1634. private $iTableHeaderBackgroundColor="white",$iTableHeaderFrameColor="black";
  1635. private $iTableHeaderFrameWeight=1;
  1636. private $iAvailableHeight=-1,$iVertSpacing=-1;
  1637. private $iDateLocale;
  1638. private $iVertLayout=GANTT_EVEN;
  1639. private $iUsePlotWeekendBackground=true;
  1640. private $iWeekStart = 1; // Default to have weekends start on Monday
  1641. //---------------
  1642. // CONSTRUCTOR
  1643. function GanttScale($aImg) {
  1644. $this->iImg = $aImg;
  1645. $this->iDateLocale = new DateLocale();
  1646. $this->minute = new HeaderProperty();
  1647. $this->minute->SetIntervall(15);
  1648. $this->minute->SetLabelFormatString('i');
  1649. $this->minute->SetFont(FF_FONT0);
  1650. $this->minute->grid->SetColor("gray");
  1651. $this->hour = new HeaderProperty();
  1652. $this->hour->SetFont(FF_FONT0);
  1653. $this->hour->SetIntervall(6);
  1654. $this->hour->SetStyle(HOURSTYLE_HM24);
  1655. $this->hour->SetLabelFormatString('H:i');
  1656. $this->hour->grid->SetColor("gray");
  1657. $this->day = new HeaderProperty();
  1658. $this->day->grid->SetColor("gray");
  1659. $this->day->SetLabelFormatString('l');
  1660. $this->week = new HeaderProperty();
  1661. $this->week->SetLabelFormatString("w%d");
  1662. $this->week->SetFont(FF_FONT1);
  1663. $this->month = new HeaderProperty();
  1664. $this->month->SetFont(FF_FONT1,FS_BOLD);
  1665. $this->year = new HeaderProperty();
  1666. $this->year->SetFont(FF_FONT1,FS_BOLD);
  1667. $this->divider=new LineProperty();
  1668. $this->dividerh=new LineProperty();
  1669. $this->dividerh->SetWeight(2);
  1670. $this->divider->SetWeight(6);
  1671. $this->divider->SetColor('gray');
  1672. $this->divider->SetStyle('fancy');
  1673. $this->tableTitle=new TextProperty();
  1674. $this->tableTitle->Show(false);
  1675. $this->actinfo = new GanttActivityInfo();
  1676. }
  1677. //---------------
  1678. // PUBLIC METHODS
  1679. // Specify what headers should be visible
  1680. function ShowHeaders($aFlg) {
  1681. $this->day->Show($aFlg & GANTT_HDAY);
  1682. $this->week->Show($aFlg & GANTT_HWEEK);
  1683. $this->month->Show($aFlg & GANTT_HMONTH);
  1684. $this->year->Show($aFlg & GANTT_HYEAR);
  1685. $this->hour->Show($aFlg & GANTT_HHOUR);
  1686. $this->minute->Show($aFlg & GANTT_HMIN);
  1687. // Make some default settings of gridlines whihc makes sense
  1688. if( $aFlg & GANTT_HWEEK ) {
  1689. $this->month->grid->Show(false);
  1690. $this->year->grid->Show(false);
  1691. }
  1692. if( $aFlg & GANTT_HHOUR ) {
  1693. $this->day->grid->SetColor("black");
  1694. }
  1695. }
  1696. // Should the weekend background stretch all the way down in the plotarea
  1697. function UseWeekendBackground($aShow) {
  1698. $this->iUsePlotWeekendBackground = $aShow;
  1699. }
  1700. // Have a range been specified?
  1701. function IsRangeSet() {
  1702. return $this->iStartDate!=-1 && $this->iEndDate!=-1;
  1703. }
  1704. // Should the layout be from top or even?
  1705. function SetVertLayout($aLayout) {
  1706. $this->iVertLayout = $aLayout;
  1707. }
  1708. // Which locale should be used?
  1709. function SetDateLocale($aLocale) {
  1710. $this->iDateLocale->Set($aLocale);
  1711. }
  1712. // Number of days we are showing
  1713. function GetNumberOfDays() {
  1714. return round(($this->iEndDate-$this->iStartDate)/SECPERDAY);
  1715. }
  1716. // The width of the actual plot area
  1717. function GetPlotWidth() {
  1718. $img=$this->iImg;
  1719. return $img->width - $img->left_margin - $img->right_margin;
  1720. }
  1721. // Specify the width of the titles(labels) for the activities
  1722. // (This is by default set to the minimum width enought for the
  1723. // widest title)
  1724. function SetLabelWidth($aLabelWidth) {
  1725. $this->iLabelWidth=$aLabelWidth;
  1726. }
  1727. // Which day should the week start?
  1728. // 0==Sun, 1==Monday, 2==Tuesday etc
  1729. function SetWeekStart($aStartDay) {
  1730. $this->iWeekStart = $aStartDay % 7;
  1731. //Recalculate the startday since this will change the week start
  1732. $this->SetRange($this->iStartDate,$this->iEndDate);
  1733. }
  1734. // Do we show min scale?
  1735. function IsDisplayMinute() {
  1736. return $this->minute->iShowLabels;
  1737. }
  1738. // Do we show day scale?
  1739. function IsDisplayHour() {
  1740. return $this->hour->iShowLabels;
  1741. }
  1742. // Do we show day scale?
  1743. function IsDisplayDay() {
  1744. return $this->day->iShowLabels;
  1745. }
  1746. // Do we show week scale?
  1747. function IsDisplayWeek() {
  1748. return $this->week->iShowLabels;
  1749. }
  1750. // Do we show month scale?
  1751. function IsDisplayMonth() {
  1752. return $this->month->iShowLabels;
  1753. }
  1754. // Do we show year scale?
  1755. function IsDisplayYear() {
  1756. return $this->year->iShowLabels;
  1757. }
  1758. // Specify spacing (in percent of bar height) between activity bars
  1759. function SetVertSpacing($aSpacing) {
  1760. $this->iVertSpacing = $aSpacing;
  1761. }
  1762. // Specify scale min and max date either as timestamp or as date strings
  1763. // Always round to the nearest week boundary
  1764. function SetRange($aMin,$aMax) {
  1765. $this->iStartDate = $this->NormalizeDate($aMin);
  1766. $this->iEndDate = $this->NormalizeDate($aMax);
  1767. }
  1768. // Adjust the start and end date so they fit to beginning/ending
  1769. // of the week taking the specified week start day into account.
  1770. function AdjustStartEndDay() {
  1771. if( !($this->IsDisplayYear() ||$this->IsDisplayMonth() || $this->IsDisplayWeek()) ) {
  1772. // Don't adjust
  1773. return;
  1774. }
  1775. // Get day in week for start and ending date (Sun==0)
  1776. $ds=strftime("%w",$this->iStartDate);
  1777. $de=strftime("%w",$this->iEndDate);
  1778. // We want to start on iWeekStart day. But first we subtract a week
  1779. // if the startdate is "behind" the day the week start at.
  1780. // This way we ensure that the given start date is always included
  1781. // in the range. If we don't do this the nearest correct weekday in the week
  1782. // to start at might be later than the start date.
  1783. if( $ds < $this->iWeekStart )
  1784. $d = strtotime('-7 day',$this->iStartDate);
  1785. else
  1786. $d = $this->iStartDate;
  1787. $adjdate = strtotime(($this->iWeekStart-$ds).' day',$d /*$this->iStartDate*/ );
  1788. $this->iStartDate = $adjdate;
  1789. // We want to end on the last day of the week
  1790. $preferredEndDay = ($this->iWeekStart+6)%7;
  1791. if( $preferredEndDay != $de ) {
  1792. // Solve equivalence eq: $de + x ~ $preferredDay (mod 7)
  1793. $adj = (7+($preferredEndDay - $de)) % 7;
  1794. $adjdate = strtotime("+$adj day",$this->iEndDate);
  1795. $this->iEndDate = $adjdate;
  1796. }
  1797. }
  1798. // Specify background for the table title area (upper left corner of the table)
  1799. function SetTableTitleBackground($aColor) {
  1800. $this->iTableHeaderBackgroundColor = $aColor;
  1801. }
  1802. ///////////////////////////////////////
  1803. // PRIVATE Methods
  1804. // Determine the height of all the scale headers combined
  1805. function GetHeaderHeight() {
  1806. $img=$this->iImg;
  1807. $height=1;
  1808. if( $this->minute->iShowLabels ) {
  1809. $height += $this->minute->GetFontHeight($img);
  1810. $height += $this->minute->iTitleVertMargin;
  1811. }
  1812. if( $this->hour->iShowLabels ) {
  1813. $height += $this->hour->GetFontHeight($img);
  1814. $height += $this->hour->iTitleVertMargin;
  1815. }
  1816. if( $this->day->iShowLabels ) {
  1817. $height += $this->day->GetFontHeight($img);
  1818. $height += $this->day->iTitleVertMargin;
  1819. }
  1820. if( $this->week->iShowLabels ) {
  1821. $height += $this->week->GetFontHeight($img);
  1822. $height += $this->week->iTitleVertMargin;
  1823. }
  1824. if( $this->month->iShowLabels ) {
  1825. $height += $this->month->GetFontHeight($img);
  1826. $height += $this->month->iTitleVertMargin;
  1827. }
  1828. if( $this->year->iShowLabels ) {
  1829. $height += $this->year->GetFontHeight($img);
  1830. $height += $this->year->iTitleVertMargin;
  1831. }
  1832. return $height;
  1833. }
  1834. // Get width (in pixels) for a single day
  1835. function GetDayWidth() {
  1836. return ($this->GetPlotWidth()-$this->iLabelWidth+1)/$this->GetNumberOfDays();
  1837. }
  1838. // Get width (in pixels) for a single hour
  1839. function GetHourWidth() {
  1840. return $this->GetDayWidth() / 24 ;
  1841. }
  1842. function GetMinuteWidth() {
  1843. return $this->GetHourWidth() / 60 ;
  1844. }
  1845. // Nuber of days in a year
  1846. function GetNumDaysInYear($aYear) {
  1847. if( $this->IsLeap($aYear) )
  1848. return 366;
  1849. else
  1850. return 365;
  1851. }
  1852. // Get week number
  1853. function GetWeekNbr($aDate,$aSunStart=true) {
  1854. // We can't use the internal strftime() since it gets the weeknumber
  1855. // wrong since it doesn't follow ISO on all systems since this is
  1856. // system linrary dependent.
  1857. // Even worse is that this works differently if we are on a Windows
  1858. // or UNIX box (it even differs between UNIX boxes how strftime()
  1859. // is natively implemented)
  1860. //
  1861. // Credit to Nicolas Hoizey <nhoizey@phpheaven.net> for this elegant
  1862. // version of Week Nbr calculation.
  1863. $day = $this->NormalizeDate($aDate);
  1864. if( $aSunStart )
  1865. $day += 60*60*24;
  1866. /*-------------------------------------------------------------------------
  1867. According to ISO-8601 :
  1868. "Week 01 of a year is per definition the first week that has the Thursday in this year,
  1869. which is equivalent to the week that contains the fourth day of January.
  1870. In other words, the first week of a new year is the week that has the majority of its
  1871. days in the new year."
  1872. Be carefull, with PHP, -3 % 7 = -3, instead of 4 !!!
  1873. day of year = date("z", $day) + 1
  1874. offset to thursday = 3 - (date("w", $day) + 6) % 7
  1875. first thursday of year = 1 + (11 - date("w", mktime(0, 0, 0, 1, 1, date("Y", $day)))) % 7
  1876. week number = (thursday's day of year - first thursday's day of year) / 7 + 1
  1877. ---------------------------------------------------------------------------*/
  1878. $thursday = $day + 60 * 60 * 24 * (3 - (date("w", $day) + 6) % 7); // take week's thursday
  1879. $week = 1 + (date("z", $thursday) - (11 - date("w", mktime(0, 0, 0, 1, 1, date("Y", $thursday)))) % 7) / 7;
  1880. return $week;
  1881. }
  1882. // Is year a leap year?
  1883. function IsLeap($aYear) {
  1884. // Is the year a leap year?
  1885. //$year = 0+date("Y",$aDate);
  1886. if( $aYear % 4 == 0)
  1887. if( !($aYear % 100 == 0) || ($aYear % 400 == 0) )
  1888. return true;
  1889. return false;
  1890. }
  1891. // Get current year
  1892. function GetYear($aDate) {
  1893. return 0+Date("Y",$aDate);
  1894. }
  1895. // Return number of days in a year
  1896. function GetNumDaysInMonth($aMonth,$aYear) {
  1897. $days=array(31,28,31,30,31,30,31,31,30,31,30,31);
  1898. $daysl=array(31,29,31,30,31,30,31,31,30,31,30,31);
  1899. if( $this->IsLeap($aYear))
  1900. return $daysl[$aMonth];
  1901. else
  1902. return $days[$aMonth];
  1903. }
  1904. // Get day in month
  1905. function GetMonthDayNbr($aDate) {
  1906. return 0+strftime("%d",$aDate);
  1907. }
  1908. // Get day in year
  1909. function GetYearDayNbr($aDate) {
  1910. return 0+strftime("%j",$aDate);
  1911. }
  1912. // Get month number
  1913. function GetMonthNbr($aDate) {
  1914. return 0+strftime("%m",$aDate);
  1915. }
  1916. // Translate a date to screen coordinates (horizontal scale)
  1917. function TranslateDate($aDate) {
  1918. //
  1919. // In order to handle the problem with Daylight savings time
  1920. // the scale written with equal number of seconds per day beginning
  1921. // with the start date. This means that we "cement" the state of
  1922. // DST as it is in the start date. If later the scale includes the
  1923. // switchover date (depends on the locale) we need to adjust back
  1924. // if the date we try to translate has a different DST status since
  1925. // we would otherwise be off by one hour.
  1926. $aDate = $this->NormalizeDate($aDate);
  1927. $tmp = localtime($aDate);
  1928. $cloc = $tmp[8];
  1929. $tmp = localtime($this->iStartDate);
  1930. $sloc = $tmp[8];
  1931. $offset = 0;
  1932. if( $sloc != $cloc) {
  1933. if( $sloc )
  1934. $offset = 3600;
  1935. else
  1936. $offset = -3600;
  1937. }
  1938. $img=$this->iImg;
  1939. return ($aDate-$this->iStartDate-$offset)/SECPERDAY*$this->GetDayWidth()+$img->left_margin+$this->iLabelWidth;;
  1940. }
  1941. // Get screen coordinatesz for the vertical position for a bar
  1942. function TranslateVertPos($aPos) {
  1943. $img=$this->iImg;
  1944. $ph=$this->iAvailableHeight;
  1945. if( $aPos > $this->iVertLines )
  1946. JpGraphError::RaiseL(6015,$aPos);
  1947. // 'Illegal vertical position %d'
  1948. if( $this->iVertLayout == GANTT_EVEN ) {
  1949. // Position the top bar at 1 vert spacing from the scale
  1950. return round($img->top_margin + $this->iVertHeaderSize + ($aPos+1)*$this->iVertSpacing);
  1951. }
  1952. else {
  1953. // position the top bar at 1/2 a vert spacing from the scale
  1954. return round($img->top_margin + $this->iVertHeaderSize + $this->iTopPlotMargin + ($aPos+1)*$this->iVertSpacing);
  1955. }
  1956. }
  1957. // What is the vertical spacing?
  1958. function GetVertSpacing() {
  1959. return $this->iVertSpacing;
  1960. }
  1961. // Convert a date to timestamp
  1962. function NormalizeDate($aDate) {
  1963. if( $aDate === false ) return false;
  1964. if( is_string($aDate) ) {
  1965. $t = strtotime($aDate);
  1966. if( $t === FALSE || $t === -1 ) {
  1967. JpGraphError::RaiseL(6016,$aDate);
  1968. //("Date string ($aDate) specified for Gantt activity can not be interpretated. Please make sure it is a valid time string, e.g. 2005-04-23 13:30");
  1969. }
  1970. return $t;
  1971. }
  1972. elseif( is_int($aDate) || is_float($aDate) )
  1973. return $aDate;
  1974. else
  1975. JpGraphError::RaiseL(6017,$aDate);
  1976. //Unknown date format in GanttScale ($aDate).");
  1977. }
  1978. // Convert a time string to minutes
  1979. function TimeToMinutes($aTimeString) {
  1980. // Split in hours and minutes
  1981. $pos=strpos($aTimeString,':');
  1982. $minint=60;
  1983. if( $pos === false ) {
  1984. $hourint = $aTimeString;
  1985. $minint = 0;
  1986. }
  1987. else {
  1988. $hourint = floor(substr($aTimeString,0,$pos));
  1989. $minint = floor(substr($aTimeString,$pos+1));
  1990. }
  1991. $minint += 60 * $hourint;
  1992. return $minint;
  1993. }
  1994. // Stroke the day scale (including gridlines)
  1995. function StrokeMinutes($aYCoord,$getHeight=false) {
  1996. $img=$this->iImg;
  1997. $xt=$img->left_margin+$this->iLabelWidth;
  1998. $yt=$aYCoord+$img->top_margin;
  1999. if( $this->minute->iShowLabels ) {
  2000. $img->SetFont($this->minute->iFFamily,$this->minute->iFStyle,$this->minute->iFSize);
  2001. $yb = $yt + $img->GetFontHeight() +
  2002. $this->minute->iTitleVertMargin + $this->minute->iFrameWeight;
  2003. if( $getHeight ) {
  2004. return $yb - $img->top_margin;
  2005. }
  2006. $xb = $img->width-$img->right_margin+1;
  2007. $img->SetColor($this->minute->iBackgroundColor);
  2008. $img->FilledRectangle($xt,$yt,$xb,$yb);
  2009. $x = $xt;
  2010. $img->SetTextAlign("center");
  2011. $day = date('w',$this->iStartDate);
  2012. $minint = $this->minute->GetIntervall() ;
  2013. if( 60 % $minint !== 0 ) {
  2014. JpGraphError::RaiseL(6018,$minint);
  2015. //'Intervall for minutes must divide the hour evenly, e.g. 1,5,10,12,15,20,30 etc You have specified an intervall of '.$minint.' minutes.');
  2016. }
  2017. $n = 60 / $minint;
  2018. $datestamp = $this->iStartDate;
  2019. $width = $this->GetHourWidth() / $n ;
  2020. if( $width < 8 ) {
  2021. // TO small width to draw minute scale
  2022. JpGraphError::RaiseL(6019,$width);
  2023. //('The available width ('.$width.') for minutes are to small for this scale to be displayed. Please use auto-sizing or increase the width of the graph.');
  2024. }
  2025. $nh = ceil(24*60 / $this->TimeToMinutes($this->hour->GetIntervall()) );
  2026. $nd = $this->GetNumberOfDays();
  2027. // Convert to intervall to seconds
  2028. $minint *= 60;
  2029. for($j=0; $j < $nd; ++$j, $day += 1, $day %= 7) {
  2030. for( $k=0; $k < $nh; ++$k ) {
  2031. for($i=0; $i < $n ;++$i, $x+=$width, $datestamp += $minint ) {
  2032. if( $day==6 || $day==0 ) {
  2033. $img->PushColor($this->day->iWeekendBackgroundColor);
  2034. if( $this->iUsePlotWeekendBackground )
  2035. $img->FilledRectangle($x,$yt+$this->day->iFrameWeight,$x+$width,$img->height-$img->bottom_margin);
  2036. else
  2037. $img->FilledRectangle($x,$yt+$this->day->iFrameWeight,$x+$width,$yb-$this->day->iFrameWeight);
  2038. $img->PopColor();
  2039. }
  2040. if( $day==0 )
  2041. $img->SetColor($this->day->iSundayTextColor);
  2042. else
  2043. $img->SetColor($this->day->iTextColor);
  2044. switch( $this->minute->iStyle ) {
  2045. case MINUTESTYLE_CUSTOM:
  2046. $txt = date($this->minute->iLabelFormStr,$datestamp);
  2047. break;
  2048. case MINUTESTYLE_MM:
  2049. default:
  2050. // 15
  2051. $txt = date('i',$datestamp);
  2052. break;
  2053. }
  2054. $img->StrokeText(round($x+$width/2),round($yb-$this->minute->iTitleVertMargin),$txt);
  2055. // FIXME: The rounding problem needs to be solved properly ...
  2056. //
  2057. // Fix a rounding problem the wrong way ..
  2058. // If we also have hour scale then don't draw the firsta or last
  2059. // gridline since that will be overwritten by the hour scale gridline if such exists.
  2060. // However, due to the propagation of rounding of the 'x+=width' term in the loop
  2061. // this might sometimes be one pixel of so we fix this by not drawing it.
  2062. // The proper way to fix it would be to re-calculate the scale for each step and
  2063. // not using the additive term.
  2064. if( !(($i == $n || $i==0) && $this->hour->iShowLabels && $this->hour->grid->iShow) ) {
  2065. $img->SetColor($this->minute->grid->iColor);
  2066. $img->SetLineWeight($this->minute->grid->iWeight);
  2067. $img->Line($x,$yt,$x,$yb);
  2068. $this->minute->grid->Stroke($img,$x,$yb,$x,$img->height-$img->bottom_margin);
  2069. }
  2070. }
  2071. }
  2072. }
  2073. $img->SetColor($this->minute->iFrameColor);
  2074. $img->SetLineWeight($this->minute->iFrameWeight);
  2075. $img->Rectangle($xt,$yt,$xb,$yb);
  2076. return $yb - $img->top_margin;
  2077. }
  2078. return $aYCoord;
  2079. }
  2080. // Stroke the day scale (including gridlines)
  2081. function StrokeHours($aYCoord,$getHeight=false) {
  2082. $img=$this->iImg;
  2083. $xt=$img->left_margin+$this->iLabelWidth;
  2084. $yt=$aYCoord+$img->top_margin;
  2085. if( $this->hour->iShowLabels ) {
  2086. $img->SetFont($this->hour->iFFamily,$this->hour->iFStyle,$this->hour->iFSize);
  2087. $yb = $yt + $img->GetFontHeight() +
  2088. $this->hour->iTitleVertMargin + $this->hour->iFrameWeight;
  2089. if( $getHeight ) {
  2090. return $yb - $img->top_margin;
  2091. }
  2092. $xb = $img->width-$img->right_margin+1;
  2093. $img->SetColor($this->hour->iBackgroundColor);
  2094. $img->FilledRectangle($xt,$yt,$xb,$yb);
  2095. $x = $xt;
  2096. $img->SetTextAlign("center");
  2097. $tmp = $this->hour->GetIntervall() ;
  2098. $minint = $this->TimeToMinutes($tmp);
  2099. if( 1440 % $minint !== 0 ) {
  2100. JpGraphError::RaiseL(6020,$tmp);
  2101. //('Intervall for hours must divide the day evenly, e.g. 0:30, 1:00, 1:30, 4:00 etc. You have specified an intervall of '.$tmp);
  2102. }
  2103. $n = ceil(24*60 / $minint );
  2104. $datestamp = $this->iStartDate;
  2105. $day = date('w',$this->iStartDate);
  2106. $doback = !$this->minute->iShowLabels;
  2107. $width = $this->GetDayWidth() / $n ;
  2108. for($j=0; $j < $this->GetNumberOfDays(); ++$j, $day += 1,$day %= 7) {
  2109. for($i=0; $i < $n ;++$i, $x+=$width) {
  2110. if( $day==6 || $day==0 ) {
  2111. $img->PushColor($this->day->iWeekendBackgroundColor);
  2112. if( $this->iUsePlotWeekendBackground && $doback )
  2113. $img->FilledRectangle($x,$yt+$this->day->iFrameWeight,$x+$width,$img->height-$img->bottom_margin);
  2114. else
  2115. $img->FilledRectangle($x,$yt+$this->day->iFrameWeight,$x+$width,$yb-$this->day->iFrameWeight);
  2116. $img->PopColor();
  2117. }
  2118. if( $day==0 )
  2119. $img->SetColor($this->day->iSundayTextColor);
  2120. else
  2121. $img->SetColor($this->day->iTextColor);
  2122. switch( $this->hour->iStyle ) {
  2123. case HOURSTYLE_HMAMPM:
  2124. // 1:35pm
  2125. $txt = date('g:ia',$datestamp);
  2126. break;
  2127. case HOURSTYLE_H24:
  2128. // 13
  2129. $txt = date('H',$datestamp);
  2130. break;
  2131. case HOURSTYLE_HAMPM:
  2132. $txt = date('ga',$datestamp);
  2133. break;
  2134. case HOURSTYLE_CUSTOM:
  2135. $txt = date($this->hour->iLabelFormStr,$datestamp);
  2136. break;
  2137. case HOURSTYLE_HM24:
  2138. default:
  2139. $txt = date('H:i',$datestamp);
  2140. break;
  2141. }
  2142. $img->StrokeText(round($x+$width/2),round($yb-$this->hour->iTitleVertMargin),$txt);
  2143. $img->SetColor($this->hour->grid->iColor);
  2144. $img->SetLineWeight($this->hour->grid->iWeight);
  2145. $img->Line($x,$yt,$x,$yb);
  2146. $this->hour->grid->Stroke($img,$x,$yb,$x,$img->height-$img->bottom_margin);
  2147. //$datestamp += $minint*60
  2148. $datestamp = mktime(date('H',$datestamp),date('i',$datestamp)+$minint,0,
  2149. date("m",$datestamp),date("d",$datestamp)+1,date("Y",$datestamp));
  2150. }
  2151. }
  2152. $img->SetColor($this->hour->iFrameColor);
  2153. $img->SetLineWeight($this->hour->iFrameWeight);
  2154. $img->Rectangle($xt,$yt,$xb,$yb);
  2155. return $yb - $img->top_margin;
  2156. }
  2157. return $aYCoord;
  2158. }
  2159. // Stroke the day scale (including gridlines)
  2160. function StrokeDays($aYCoord,$getHeight=false) {
  2161. $img=$this->iImg;
  2162. $daywidth=$this->GetDayWidth();
  2163. $xt=$img->left_margin+$this->iLabelWidth;
  2164. $yt=$aYCoord+$img->top_margin;
  2165. if( $this->day->iShowLabels ) {
  2166. $img->SetFont($this->day->iFFamily,$this->day->iFStyle,$this->day->iFSize);
  2167. $yb=$yt + $img->GetFontHeight() + $this->day->iTitleVertMargin + $this->day->iFrameWeight;
  2168. if( $getHeight ) {
  2169. return $yb - $img->top_margin;
  2170. }
  2171. $xb=$img->width-$img->right_margin+1;
  2172. $img->SetColor($this->day->iBackgroundColor);
  2173. $img->FilledRectangle($xt,$yt,$xb,$yb);
  2174. $x = $xt;
  2175. $img->SetTextAlign("center");
  2176. $day = date('w',$this->iStartDate);
  2177. $datestamp = $this->iStartDate;
  2178. $doback = !($this->hour->iShowLabels || $this->minute->iShowLabels);
  2179. setlocale(LC_TIME,$this->iDateLocale->iLocale);
  2180. for($i=0; $i < $this->GetNumberOfDays(); ++$i, $x+=$daywidth, $day += 1,$day %= 7) {
  2181. if( $day==6 || $day==0 ) {
  2182. $img->SetColor($this->day->iWeekendBackgroundColor);
  2183. if( $this->iUsePlotWeekendBackground && $doback)
  2184. $img->FilledRectangle($x,$yt+$this->day->iFrameWeight,
  2185. $x+$daywidth,$img->height-$img->bottom_margin);
  2186. else
  2187. $img->FilledRectangle($x,$yt+$this->day->iFrameWeight,
  2188. $x+$daywidth,$yb-$this->day->iFrameWeight);
  2189. }
  2190. $mn = strftime('%m',$datestamp);
  2191. if( $mn[0]=='0' )
  2192. $mn = $mn[1];
  2193. switch( $this->day->iStyle ) {
  2194. case DAYSTYLE_LONG:
  2195. // "Monday"
  2196. $txt = strftime('%A',$datestamp);
  2197. break;
  2198. case DAYSTYLE_SHORT:
  2199. // "Mon"
  2200. $txt = strftime('%a',$datestamp);
  2201. break;
  2202. case DAYSTYLE_SHORTDAYDATE1:
  2203. // "Mon 23/6"
  2204. $txt = strftime('%a %d/'.$mn,$datestamp);
  2205. break;
  2206. case DAYSTYLE_SHORTDAYDATE2:
  2207. // "Mon 23 Jun"
  2208. $txt = strftime('%a %d %b',$datestamp);
  2209. break;
  2210. case DAYSTYLE_SHORTDAYDATE3:
  2211. // "Mon 23 Jun 2003"
  2212. $txt = strftime('%a %d %b %Y',$datestamp);
  2213. break;
  2214. case DAYSTYLE_LONGDAYDATE1:
  2215. // "Monday 23 Jun"
  2216. $txt = strftime('%A %d %b',$datestamp);
  2217. break;
  2218. case DAYSTYLE_LONGDAYDATE2:
  2219. // "Monday 23 Jun 2003"
  2220. $txt = strftime('%A %d %b %Y',$datestamp);
  2221. break;
  2222. case DAYSTYLE_SHORTDATE1:
  2223. // "23/6"
  2224. $txt = strftime('%d/'.$mn,$datestamp);
  2225. break;
  2226. case DAYSTYLE_SHORTDATE2:
  2227. // "23 Jun"
  2228. $txt = strftime('%d %b',$datestamp);
  2229. break;
  2230. case DAYSTYLE_SHORTDATE3:
  2231. // "Mon 23"
  2232. $txt = strftime('%a %d',$datestamp);
  2233. break;
  2234. case DAYSTYLE_SHORTDATE4:
  2235. // "23"
  2236. $txt = strftime('%d',$datestamp);
  2237. break;
  2238. case DAYSTYLE_CUSTOM:
  2239. // Custom format
  2240. $txt = strftime($this->day->iLabelFormStr,$datestamp);
  2241. break;
  2242. case DAYSTYLE_ONELETTER:
  2243. default:
  2244. // "M"
  2245. $txt = strftime('%A',$datestamp);
  2246. $txt = strtoupper($txt[0]);
  2247. break;
  2248. }
  2249. if( $day==0 )
  2250. $img->SetColor($this->day->iSundayTextColor);
  2251. else
  2252. $img->SetColor($this->day->iTextColor);
  2253. $img->StrokeText(round($x+$daywidth/2+1),
  2254. round($yb-$this->day->iTitleVertMargin),$txt);
  2255. $img->SetColor($this->day->grid->iColor);
  2256. $img->SetLineWeight($this->day->grid->iWeight);
  2257. $img->Line($x,$yt,$x,$yb);
  2258. $this->day->grid->Stroke($img,$x,$yb,$x,$img->height-$img->bottom_margin);
  2259. $datestamp = mktime(0,0,0,date("m",$datestamp),date("d",$datestamp)+1,date("Y",$datestamp));
  2260. //$datestamp += SECPERDAY;
  2261. }
  2262. $img->SetColor($this->day->iFrameColor);
  2263. $img->SetLineWeight($this->day->iFrameWeight);
  2264. $img->Rectangle($xt,$yt,$xb,$yb);
  2265. return $yb - $img->top_margin;
  2266. }
  2267. return $aYCoord;
  2268. }
  2269. // Stroke week header and grid
  2270. function StrokeWeeks($aYCoord,$getHeight=false) {
  2271. if( $this->week->iShowLabels ) {
  2272. $img=$this->iImg;
  2273. $yt=$aYCoord+$img->top_margin;
  2274. $img->SetFont($this->week->iFFamily,$this->week->iFStyle,$this->week->iFSize);
  2275. $yb=$yt + $img->GetFontHeight() + $this->week->iTitleVertMargin + $this->week->iFrameWeight;
  2276. if( $getHeight ) {
  2277. return $yb - $img->top_margin;
  2278. }
  2279. $xt=$img->left_margin+$this->iLabelWidth;
  2280. $weekwidth=$this->GetDayWidth()*7;
  2281. $wdays=$this->iDateLocale->GetDayAbb();
  2282. $xb=$img->width-$img->right_margin+1;
  2283. $week = $this->iStartDate;
  2284. $weeknbr=$this->GetWeekNbr($week);
  2285. $img->SetColor($this->week->iBackgroundColor);
  2286. $img->FilledRectangle($xt,$yt,$xb,$yb);
  2287. $img->SetColor($this->week->grid->iColor);
  2288. $x = $xt;
  2289. if( $this->week->iStyle==WEEKSTYLE_WNBR ) {
  2290. $img->SetTextAlign("center");
  2291. $txtOffset = $weekwidth/2+1;
  2292. }
  2293. elseif( $this->week->iStyle==WEEKSTYLE_FIRSTDAY ||
  2294. $this->week->iStyle==WEEKSTYLE_FIRSTDAY2 ||
  2295. $this->week->iStyle==WEEKSTYLE_FIRSTDAYWNBR ||
  2296. $this->week->iStyle==WEEKSTYLE_FIRSTDAY2WNBR ) {
  2297. $img->SetTextAlign("left");
  2298. $txtOffset = 3;
  2299. }
  2300. else
  2301. JpGraphError::RaiseL(6021);
  2302. //("Unknown formatting style for week.");
  2303. for($i=0; $i<$this->GetNumberOfDays()/7; ++$i, $x+=$weekwidth) {
  2304. $img->PushColor($this->week->iTextColor);
  2305. if( $this->week->iStyle==WEEKSTYLE_WNBR )
  2306. $txt = sprintf($this->week->iLabelFormStr,$weeknbr);
  2307. elseif( $this->week->iStyle==WEEKSTYLE_FIRSTDAY ||
  2308. $this->week->iStyle==WEEKSTYLE_FIRSTDAYWNBR )
  2309. $txt = date("j/n",$week);
  2310. elseif( $this->week->iStyle==WEEKSTYLE_FIRSTDAY2 ||
  2311. $this->week->iStyle==WEEKSTYLE_FIRSTDAY2WNBR ) {
  2312. $monthnbr = date("n",$week)-1;
  2313. $shortmonth = $this->iDateLocale->GetShortMonthName($monthnbr);
  2314. $txt = Date("j",$week)." ".$shortmonth;
  2315. }
  2316. if( $this->week->iStyle==WEEKSTYLE_FIRSTDAYWNBR ||
  2317. $this->week->iStyle==WEEKSTYLE_FIRSTDAY2WNBR ) {
  2318. $w = sprintf($this->week->iLabelFormStr,$weeknbr);
  2319. $txt .= ' '.$w;
  2320. }
  2321. $img->StrokeText(round($x+$txtOffset),
  2322. round($yb-$this->week->iTitleVertMargin),$txt);
  2323. $week = strtotime('+7 day',$week);
  2324. $weeknbr = $this->GetWeekNbr($week);
  2325. $img->PopColor();
  2326. $img->SetLineWeight($this->week->grid->iWeight);
  2327. $img->Line($x,$yt,$x,$yb);
  2328. $this->week->grid->Stroke($img,$x,$yb,$x,$img->height-$img->bottom_margin);
  2329. }
  2330. $img->SetColor($this->week->iFrameColor);
  2331. $img->SetLineWeight($this->week->iFrameWeight);
  2332. $img->Rectangle($xt,$yt,$xb,$yb);
  2333. return $yb-$img->top_margin;
  2334. }
  2335. return $aYCoord;
  2336. }
  2337. // Format the mont scale header string
  2338. function GetMonthLabel($aMonthNbr,$year) {
  2339. $sn = $this->iDateLocale->GetShortMonthName($aMonthNbr);
  2340. $ln = $this->iDateLocale->GetLongMonthName($aMonthNbr);
  2341. switch($this->month->iStyle) {
  2342. case MONTHSTYLE_SHORTNAME:
  2343. $m=$sn;
  2344. break;
  2345. case MONTHSTYLE_LONGNAME:
  2346. $m=$ln;
  2347. break;
  2348. case MONTHSTYLE_SHORTNAMEYEAR2:
  2349. $m=$sn." '".substr("".$year,2);
  2350. break;
  2351. case MONTHSTYLE_SHORTNAMEYEAR4:
  2352. $m=$sn." ".$year;
  2353. break;
  2354. case MONTHSTYLE_LONGNAMEYEAR2:
  2355. $m=$ln." '".substr("".$year,2);
  2356. break;
  2357. case MONTHSTYLE_LONGNAMEYEAR4:
  2358. $m=$ln." ".$year;
  2359. break;
  2360. case MONTHSTYLE_FIRSTLETTER:
  2361. $m=$sn[0];
  2362. break;
  2363. }
  2364. return $m;
  2365. }
  2366. // Stroke month scale and gridlines
  2367. function StrokeMonths($aYCoord,$getHeight=false) {
  2368. if( $this->month->iShowLabels ) {
  2369. $img=$this->iImg;
  2370. $img->SetFont($this->month->iFFamily,$this->month->iFStyle,$this->month->iFSize);
  2371. $yt=$aYCoord+$img->top_margin;
  2372. $yb=$yt + $img->GetFontHeight() + $this->month->iTitleVertMargin + $this->month->iFrameWeight;
  2373. if( $getHeight ) {
  2374. return $yb - $img->top_margin;
  2375. }
  2376. $monthnbr = $this->GetMonthNbr($this->iStartDate)-1;
  2377. $xt=$img->left_margin+$this->iLabelWidth;
  2378. $xb=$img->width-$img->right_margin+1;
  2379. $img->SetColor($this->month->iBackgroundColor);
  2380. $img->FilledRectangle($xt,$yt,$xb,$yb);
  2381. $img->SetLineWeight($this->month->grid->iWeight);
  2382. $img->SetColor($this->month->iTextColor);
  2383. $year = 0+strftime("%Y",$this->iStartDate);
  2384. $img->SetTextAlign("center");
  2385. if( $this->GetMonthNbr($this->iStartDate) == $this->GetMonthNbr($this->iEndDate)
  2386. && $this->GetYear($this->iStartDate)==$this->GetYear($this->iEndDate) ) {
  2387. $monthwidth=$this->GetDayWidth()*($this->GetMonthDayNbr($this->iEndDate) - $this->GetMonthDayNbr($this->iStartDate) + 1);
  2388. }
  2389. else {
  2390. $monthwidth=$this->GetDayWidth()*($this->GetNumDaysInMonth($monthnbr,$year)-$this->GetMonthDayNbr($this->iStartDate)+1);
  2391. }
  2392. // Is it enough space to stroke the first month?
  2393. $monthName = $this->GetMonthLabel($monthnbr,$year);
  2394. if( $monthwidth >= 1.2*$img->GetTextWidth($monthName) ) {
  2395. $img->SetColor($this->month->iTextColor);
  2396. $img->StrokeText(round($xt+$monthwidth/2+1),
  2397. round($yb-$this->month->iTitleVertMargin),
  2398. $monthName);
  2399. }
  2400. $x = $xt + $monthwidth;
  2401. while( $x < $xb ) {
  2402. $img->SetColor($this->month->grid->iColor);
  2403. $img->Line($x,$yt,$x,$yb);
  2404. $this->month->grid->Stroke($img,$x,$yb,$x,$img->height-$img->bottom_margin);
  2405. $monthnbr++;
  2406. if( $monthnbr==12 ) {
  2407. $monthnbr=0;
  2408. $year++;
  2409. }
  2410. $monthName = $this->GetMonthLabel($monthnbr,$year);
  2411. $monthwidth=$this->GetDayWidth()*$this->GetNumDaysInMonth($monthnbr,$year);
  2412. if( $x + $monthwidth < $xb )
  2413. $w = $monthwidth;
  2414. else
  2415. $w = $xb-$x;
  2416. if( $w >= 1.2*$img->GetTextWidth($monthName) ) {
  2417. $img->SetColor($this->month->iTextColor);
  2418. $img->StrokeText(round($x+$w/2+1),
  2419. round($yb-$this->month->iTitleVertMargin),$monthName);
  2420. }
  2421. $x += $monthwidth;
  2422. }
  2423. $img->SetColor($this->month->iFrameColor);
  2424. $img->SetLineWeight($this->month->iFrameWeight);
  2425. $img->Rectangle($xt,$yt,$xb,$yb);
  2426. return $yb-$img->top_margin;
  2427. }
  2428. return $aYCoord;
  2429. }
  2430. // Stroke year scale and gridlines
  2431. function StrokeYears($aYCoord,$getHeight=false) {
  2432. if( $this->year->iShowLabels ) {
  2433. $img=$this->iImg;
  2434. $yt=$aYCoord+$img->top_margin;
  2435. $img->SetFont($this->year->iFFamily,$this->year->iFStyle,$this->year->iFSize);
  2436. $yb=$yt + $img->GetFontHeight() + $this->year->iTitleVertMargin + $this->year->iFrameWeight;
  2437. if( $getHeight ) {
  2438. return $yb - $img->top_margin;
  2439. }
  2440. $xb=$img->width-$img->right_margin+1;
  2441. $xt=$img->left_margin+$this->iLabelWidth;
  2442. $year = $this->GetYear($this->iStartDate);
  2443. $img->SetColor($this->year->iBackgroundColor);
  2444. $img->FilledRectangle($xt,$yt,$xb,$yb);
  2445. $img->SetLineWeight($this->year->grid->iWeight);
  2446. $img->SetTextAlign("center");
  2447. if( $year == $this->GetYear($this->iEndDate) )
  2448. $yearwidth=$this->GetDayWidth()*($this->GetYearDayNbr($this->iEndDate)-$this->GetYearDayNbr($this->iStartDate)+1);
  2449. else
  2450. $yearwidth=$this->GetDayWidth()*($this->GetNumDaysInYear($year)-$this->GetYearDayNbr($this->iStartDate)+1);
  2451. // The space for a year must be at least 20% bigger than the actual text
  2452. // so we allow 10% margin on each side
  2453. if( $yearwidth >= 1.20*$img->GetTextWidth("".$year) ) {
  2454. $img->SetColor($this->year->iTextColor);
  2455. $img->StrokeText(round($xt+$yearwidth/2+1),
  2456. round($yb-$this->year->iTitleVertMargin),
  2457. $year);
  2458. }
  2459. $x = $xt + $yearwidth;
  2460. while( $x < $xb ) {
  2461. $img->SetColor($this->year->grid->iColor);
  2462. $img->Line($x,$yt,$x,$yb);
  2463. $this->year->grid->Stroke($img,$x,$yb,$x,$img->height-$img->bottom_margin);
  2464. $year += 1;
  2465. $yearwidth=$this->GetDayWidth()*$this->GetNumDaysInYear($year);
  2466. if( $x + $yearwidth < $xb )
  2467. $w = $yearwidth;
  2468. else
  2469. $w = $xb-$x;
  2470. if( $w >= 1.2*$img->GetTextWidth("".$year) ) {
  2471. $img->SetColor($this->year->iTextColor);
  2472. $img->StrokeText(round($x+$w/2+1),
  2473. round($yb-$this->year->iTitleVertMargin),
  2474. $year);
  2475. }
  2476. $x += $yearwidth;
  2477. }
  2478. $img->SetColor($this->year->iFrameColor);
  2479. $img->SetLineWeight($this->year->iFrameWeight);
  2480. $img->Rectangle($xt,$yt,$xb,$yb);
  2481. return $yb-$img->top_margin;
  2482. }
  2483. return $aYCoord;
  2484. }
  2485. // Stroke table title (upper left corner)
  2486. function StrokeTableHeaders($aYBottom) {
  2487. $img=$this->iImg;
  2488. $xt=$img->left_margin;
  2489. $yt=$img->top_margin;
  2490. $xb=$xt+$this->iLabelWidth;
  2491. $yb=$aYBottom+$img->top_margin;
  2492. if( $this->tableTitle->iShow ) {
  2493. $img->SetColor($this->iTableHeaderBackgroundColor);
  2494. $img->FilledRectangle($xt,$yt,$xb,$yb);
  2495. $this->tableTitle->Align("center","top");
  2496. $this->tableTitle->Stroke($img,$xt+($xb-$xt)/2+1,$yt+2);
  2497. $img->SetColor($this->iTableHeaderFrameColor);
  2498. $img->SetLineWeight($this->iTableHeaderFrameWeight);
  2499. $img->Rectangle($xt,$yt,$xb,$yb);
  2500. }
  2501. $this->actinfo->Stroke($img,$xt,$yt,$xb,$yb,$this->tableTitle->iShow);
  2502. // Draw the horizontal dividing line
  2503. $this->dividerh->Stroke($img,$xt,$yb,$img->width-$img->right_margin,$yb);
  2504. // Draw the vertical dividing line
  2505. // We do the width "manually" since we want the line only to grow
  2506. // to the left
  2507. $fancy = $this->divider->iStyle == 'fancy' ;
  2508. if( $fancy ) {
  2509. $this->divider->iStyle = 'solid';
  2510. }
  2511. $tmp = $this->divider->iWeight;
  2512. $this->divider->iWeight=1;
  2513. $y = $img->height-$img->bottom_margin;
  2514. for($i=0; $i < $tmp; ++$i ) {
  2515. $this->divider->Stroke($img,$xb-$i,$yt,$xb-$i,$y);
  2516. }
  2517. // Should we draw "fancy" divider
  2518. if( $fancy ) {
  2519. $img->SetLineWeight(1);
  2520. $img->SetColor($this->iTableHeaderFrameColor);
  2521. $img->Line($xb,$yt,$xb,$y);
  2522. $img->Line($xb-$tmp+1,$yt,$xb-$tmp+1,$y);
  2523. $img->SetColor('white');
  2524. $img->Line($xb-$tmp+2,$yt,$xb-$tmp+2,$y);
  2525. }
  2526. }
  2527. // Main entry point to stroke scale
  2528. function Stroke() {
  2529. if( !$this->IsRangeSet() )
  2530. JpGraphError::RaiseL(6022);
  2531. //("Gantt scale has not been specified.");
  2532. $img=$this->iImg;
  2533. // If minutes are displayed then hour interval must be 1
  2534. if( $this->IsDisplayMinute() && $this->hour->GetIntervall() > 1 ) {
  2535. JpGraphError::RaiseL(6023);
  2536. //('If you display both hour and minutes the hour intervall must be 1 (Otherwise it doesn\' make sense to display minutes).');
  2537. }
  2538. // Stroke all headers. As argument we supply the offset from the
  2539. // top which depends on any previous headers
  2540. // First find out the height of each header
  2541. $offy=$this->StrokeYears(0,true);
  2542. $offm=$this->StrokeMonths($offy,true);
  2543. $offw=$this->StrokeWeeks($offm,true);
  2544. $offd=$this->StrokeDays($offw,true);
  2545. $offh=$this->StrokeHours($offd,true);
  2546. $offmin=$this->StrokeMinutes($offh,true);
  2547. // ... then we can stroke them in the "backwards order to ensure that
  2548. // the larger scale gridlines is stroked over the smaller scale gridline
  2549. $this->StrokeMinutes($offh);
  2550. $this->StrokeHours($offd);
  2551. $this->StrokeDays($offw);
  2552. $this->StrokeWeeks($offm);
  2553. $this->StrokeMonths($offy);
  2554. $this->StrokeYears(0);
  2555. // Now when we now the oaverall size of the scale headers
  2556. // we can stroke the overall table headers
  2557. $this->StrokeTableHeaders($offmin);
  2558. // Now we can calculate the correct scaling factor for each vertical position
  2559. $this->iAvailableHeight = $img->height - $img->top_margin - $img->bottom_margin - $offd;
  2560. $this->iVertHeaderSize = $offmin;
  2561. if( $this->iVertSpacing == -1 )
  2562. $this->iVertSpacing = $this->iAvailableHeight / $this->iVertLines;
  2563. }
  2564. }
  2565. //===================================================
  2566. // CLASS GanttConstraint
  2567. // Just a structure to store all the values for a constraint
  2568. //===================================================
  2569. class GanttConstraint {
  2570. public $iConstrainRow;
  2571. public $iConstrainType;
  2572. public $iConstrainColor;
  2573. public $iConstrainArrowSize;
  2574. public $iConstrainArrowType;
  2575. //---------------
  2576. // CONSTRUCTOR
  2577. function GanttConstraint($aRow,$aType,$aColor,$aArrowSize,$aArrowType){
  2578. $this->iConstrainType = $aType;
  2579. $this->iConstrainRow = $aRow;
  2580. $this->iConstrainColor=$aColor;
  2581. $this->iConstrainArrowSize=$aArrowSize;
  2582. $this->iConstrainArrowType=$aArrowType;
  2583. }
  2584. }
  2585. //===================================================
  2586. // CLASS GanttPlotObject
  2587. // The common signature for a Gantt object
  2588. //===================================================
  2589. class GanttPlotObject {
  2590. public $title,$caption;
  2591. public $csimarea='',$csimtarget='',$csimwintarget='',$csimalt='';
  2592. public $constraints = array();
  2593. public $iCaptionMargin=5;
  2594. public $iConstrainPos=array();
  2595. protected $iStart=""; // Start date
  2596. public $iVPos=0; // Vertical position
  2597. protected $iLabelLeftMargin=2; // Title margin
  2598. function GanttPlotObject() {
  2599. $this->title = new TextProperty();
  2600. $this->title->Align("left","center");
  2601. $this->caption = new TextProperty();
  2602. }
  2603. function GetCSIMArea() {
  2604. return $this->csimarea;
  2605. }
  2606. function SetCSIMTarget($aTarget,$aAlt='',$aWinTarget='') {
  2607. if( !is_string($aTarget) ) {
  2608. $tv = substr(var_export($aTarget,true),0,40);
  2609. JpGraphError::RaiseL(6024,$tv);
  2610. //('CSIM Target must be specified as a string.'."\nStart of target is:\n$tv");
  2611. }
  2612. if( !is_string($aAlt) ) {
  2613. $tv = substr(var_export($aAlt,true),0,40);
  2614. JpGraphError::RaiseL(6025,$tv);
  2615. //('CSIM Alt text must be specified as a string.'."\nStart of alt text is:\n$tv");
  2616. }
  2617. $this->csimtarget=$aTarget;
  2618. $this->csimwintarget=$aWinTarget;
  2619. $this->csimalt=$aAlt;
  2620. }
  2621. function SetCSIMAlt($aAlt) {
  2622. if( !is_string($aAlt) ) {
  2623. $tv = substr(var_export($aAlt,true),0,40);
  2624. JpGraphError::RaiseL(6025,$tv);
  2625. //('CSIM Alt text must be specified as a string.'."\nStart of alt text is:\n$tv");
  2626. }
  2627. $this->csimalt=$aAlt;
  2628. }
  2629. function SetConstrain($aRow,$aType,$aColor='black',$aArrowSize=ARROW_S2,$aArrowType=ARROWT_SOLID) {
  2630. $this->constraints[] = new GanttConstraint($aRow, $aType, $aColor, $aArrowSize, $aArrowType);
  2631. }
  2632. function SetConstrainPos($xt,$yt,$xb,$yb) {
  2633. $this->iConstrainPos = array($xt,$yt,$xb,$yb);
  2634. }
  2635. /*
  2636. function GetConstrain() {
  2637. return array($this->iConstrainRow,$this->iConstrainType);
  2638. }
  2639. */
  2640. function GetMinDate() {
  2641. return $this->iStart;
  2642. }
  2643. function GetMaxDate() {
  2644. return $this->iStart;
  2645. }
  2646. function SetCaptionMargin($aMarg) {
  2647. $this->iCaptionMargin=$aMarg;
  2648. }
  2649. function GetAbsHeight($aImg) {
  2650. return 0;
  2651. }
  2652. function GetLineNbr() {
  2653. return $this->iVPos;
  2654. }
  2655. function SetLabelLeftMargin($aOff) {
  2656. $this->iLabelLeftMargin=$aOff;
  2657. }
  2658. function StrokeActInfo($aImg,$aScale,$aYPos) {
  2659. $cols=array();
  2660. $aScale->actinfo->GetColStart($aImg,$cols,true);
  2661. $this->title->Stroke($aImg,$cols,$aYPos);
  2662. }
  2663. }
  2664. //===================================================
  2665. // CLASS Progress
  2666. // Holds parameters for the progress indicator
  2667. // displyed within a bar
  2668. //===================================================
  2669. class Progress {
  2670. public $iProgress=-1;
  2671. public $iPattern=GANTT_SOLID;
  2672. public $iColor="black", $iFillColor='black';
  2673. public $iDensity=98, $iHeight=0.65;
  2674. function Set($aProg) {
  2675. if( $aProg < 0.0 || $aProg > 1.0 )
  2676. JpGraphError::RaiseL(6027);
  2677. //("Progress value must in range [0, 1]");
  2678. $this->iProgress = $aProg;
  2679. }
  2680. function SetPattern($aPattern,$aColor="blue",$aDensity=98) {
  2681. $this->iPattern = $aPattern;
  2682. $this->iColor = $aColor;
  2683. $this->iDensity = $aDensity;
  2684. }
  2685. function SetFillColor($aColor) {
  2686. $this->iFillColor = $aColor;
  2687. }
  2688. function SetHeight($aHeight) {
  2689. $this->iHeight = $aHeight;
  2690. }
  2691. }
  2692. DEFINE('GANTT_HGRID1',0);
  2693. DEFINE('GANTT_HGRID2',1);
  2694. //===================================================
  2695. // CLASS HorizontalGridLine
  2696. // Responsible for drawinf horizontal gridlines and filled alternatibg rows
  2697. //===================================================
  2698. class HorizontalGridLine {
  2699. private $iGraph=NULL;
  2700. private $iRowColor1 = '', $iRowColor2 = '';
  2701. private $iShow=false;
  2702. private $line=null;
  2703. private $iStart=0; // 0=from left margin, 1=just along header
  2704. function HorizontalGridLine() {
  2705. $this->line = new LineProperty();
  2706. $this->line->SetColor('gray@0.4');
  2707. $this->line->SetStyle('dashed');
  2708. }
  2709. function Show($aShow=true) {
  2710. $this->iShow = $aShow;
  2711. }
  2712. function SetRowFillColor($aColor1,$aColor2='') {
  2713. $this->iRowColor1 = $aColor1;
  2714. $this->iRowColor2 = $aColor2;
  2715. }
  2716. function SetStart($aStart) {
  2717. $this->iStart = $aStart;
  2718. }
  2719. function Stroke($aImg,$aScale) {
  2720. if( ! $this->iShow ) return;
  2721. // Get horizontal width of line
  2722. /*
  2723. $limst = $aScale->iStartDate;
  2724. $limen = $aScale->iEndDate;
  2725. $xt = round($aScale->TranslateDate($aScale->iStartDate));
  2726. $xb = round($aScale->TranslateDate($limen));
  2727. */
  2728. if( $this->iStart === 0 ) {
  2729. $xt = $aImg->left_margin-1;
  2730. }
  2731. else {
  2732. $xt = round($aScale->TranslateDate($aScale->iStartDate))+1;
  2733. }
  2734. $xb = $aImg->width-$aImg->right_margin;
  2735. $yt = round($aScale->TranslateVertPos(0));
  2736. $yb = round($aScale->TranslateVertPos(1));
  2737. $height = $yb - $yt;
  2738. // Loop around for all lines in the chart
  2739. for($i=0; $i < $aScale->iVertLines; ++$i ) {
  2740. $yb = $yt - $height;
  2741. $this->line->Stroke($aImg,$xt,$yb,$xb,$yb);
  2742. if( $this->iRowColor1 !== '' ) {
  2743. if( $i % 2 == 0 ) {
  2744. $aImg->PushColor($this->iRowColor1);
  2745. $aImg->FilledRectangle($xt,$yt,$xb,$yb);
  2746. $aImg->PopColor();
  2747. }
  2748. elseif( $this->iRowColor2 !== '' ) {
  2749. $aImg->PushColor($this->iRowColor2);
  2750. $aImg->FilledRectangle($xt,$yt,$xb,$yb);
  2751. $aImg->PopColor();
  2752. }
  2753. }
  2754. $yt = round($aScale->TranslateVertPos($i+1));
  2755. }
  2756. $yb = $yt - $height;
  2757. $this->line->Stroke($aImg,$xt,$yb,$xb,$yb);
  2758. }
  2759. }
  2760. //===================================================
  2761. // CLASS GanttBar
  2762. // Responsible for formatting individual gantt bars
  2763. //===================================================
  2764. class GanttBar extends GanttPlotObject {
  2765. public $progress;
  2766. public $leftMark,$rightMark;
  2767. private $iEnd;
  2768. private $iHeightFactor=0.5;
  2769. private $iFillColor="white",$iFrameColor="black";
  2770. private $iShadow=false,$iShadowColor="darkgray",$iShadowWidth=1,$iShadowFrame="black";
  2771. private $iPattern=GANTT_RDIAG,$iPatternColor="blue",$iPatternDensity=95;
  2772. //---------------
  2773. // CONSTRUCTOR
  2774. function GanttBar($aPos,$aLabel,$aStart,$aEnd,$aCaption="",$aHeightFactor=0.6) {
  2775. parent::GanttPlotObject();
  2776. $this->iStart = $aStart;
  2777. // Is the end date given as a date or as number of days added to start date?
  2778. if( is_string($aEnd) ) {
  2779. // If end date has been specified without a time we will asssume
  2780. // end date is at the end of that date
  2781. if( strpos($aEnd,':') === false )
  2782. $this->iEnd = strtotime($aEnd)+SECPERDAY-1;
  2783. else
  2784. $this->iEnd = $aEnd;
  2785. }
  2786. elseif(is_int($aEnd) || is_float($aEnd) )
  2787. $this->iEnd = strtotime($aStart)+round($aEnd*SECPERDAY);
  2788. $this->iVPos = $aPos;
  2789. $this->iHeightFactor = $aHeightFactor;
  2790. $this->title->Set($aLabel);
  2791. $this->caption = new TextProperty($aCaption);
  2792. $this->caption->Align("left","center");
  2793. $this->leftMark =new PlotMark();
  2794. $this->leftMark->Hide();
  2795. $this->rightMark=new PlotMark();
  2796. $this->rightMark->Hide();
  2797. $this->progress = new Progress();
  2798. }
  2799. //---------------
  2800. // PUBLIC METHODS
  2801. function SetShadow($aShadow=true,$aColor="gray") {
  2802. $this->iShadow=$aShadow;
  2803. $this->iShadowColor=$aColor;
  2804. }
  2805. function GetMaxDate() {
  2806. return $this->iEnd;
  2807. }
  2808. function SetHeight($aHeight) {
  2809. $this->iHeightFactor = $aHeight;
  2810. }
  2811. function SetColor($aColor) {
  2812. $this->iFrameColor = $aColor;
  2813. }
  2814. function SetFillColor($aColor) {
  2815. $this->iFillColor = $aColor;
  2816. }
  2817. function GetAbsHeight($aImg) {
  2818. if( is_int($this->iHeightFactor) || $this->leftMark->show || $this->rightMark->show ) {
  2819. $m=-1;
  2820. if( is_int($this->iHeightFactor) )
  2821. $m = $this->iHeightFactor;
  2822. if( $this->leftMark->show )
  2823. $m = max($m,$this->leftMark->width*2);
  2824. if( $this->rightMark->show )
  2825. $m = max($m,$this->rightMark->width*2);
  2826. return $m;
  2827. }
  2828. else
  2829. return -1;
  2830. }
  2831. function SetPattern($aPattern,$aColor="blue",$aDensity=95) {
  2832. $this->iPattern = $aPattern;
  2833. $this->iPatternColor = $aColor;
  2834. $this->iPatternDensity = $aDensity;
  2835. }
  2836. function Stroke($aImg,$aScale) {
  2837. $factory = new RectPatternFactory();
  2838. $prect = $factory->Create($this->iPattern,$this->iPatternColor);
  2839. $prect->SetDensity($this->iPatternDensity);
  2840. // If height factor is specified as a float between 0,1 then we take it as meaning
  2841. // percetage of the scale width between horizontal line.
  2842. // If it is an integer > 1 we take it to mean the absolute height in pixels
  2843. if( $this->iHeightFactor > -0.0 && $this->iHeightFactor <= 1.1)
  2844. $vs = $aScale->GetVertSpacing()*$this->iHeightFactor;
  2845. elseif(is_int($this->iHeightFactor) && $this->iHeightFactor>2 && $this->iHeightFactor < 200 )
  2846. $vs = $this->iHeightFactor;
  2847. else
  2848. JpGraphError::RaiseL(6028,$this->iHeightFactor);
  2849. //("Specified height (".$this->iHeightFactor.") for gantt bar is out of range.");
  2850. // Clip date to min max dates to show
  2851. $st = $aScale->NormalizeDate($this->iStart);
  2852. $en = $aScale->NormalizeDate($this->iEnd);
  2853. $limst = max($st,$aScale->iStartDate);
  2854. $limen = min($en,$aScale->iEndDate);
  2855. $xt = round($aScale->TranslateDate($limst));
  2856. $xb = round($aScale->TranslateDate($limen));
  2857. $yt = round($aScale->TranslateVertPos($this->iVPos)-$vs-($aScale->GetVertSpacing()/2-$vs/2));
  2858. $yb = round($aScale->TranslateVertPos($this->iVPos)-($aScale->GetVertSpacing()/2-$vs/2));
  2859. $middle = round($yt+($yb-$yt)/2);
  2860. $this->StrokeActInfo($aImg,$aScale,$middle);
  2861. // CSIM for title
  2862. if( ! empty($this->title->csimtarget) ) {
  2863. $colwidth = $this->title->GetColWidth($aImg);
  2864. $colstarts=array();
  2865. $aScale->actinfo->GetColStart($aImg,$colstarts,true);
  2866. $n = min(count($colwidth),count($this->title->csimtarget));
  2867. for( $i=0; $i < $n; ++$i ) {
  2868. $title_xt = $colstarts[$i];
  2869. $title_xb = $title_xt + $colwidth[$i];
  2870. $coords = "$title_xt,$yt,$title_xb,$yt,$title_xb,$yb,$title_xt,$yb";
  2871. if( ! empty($this->title->csimtarget[$i]) ) {
  2872. $this->csimarea .= "<area shape=\"poly\" coords=\"$coords\" href=\"".$this->title->csimtarget[$i]."\"";
  2873. if( ! empty($this->title->csimwintarget[$i]) ) {
  2874. $this->csimarea .= "target=\"".$this->title->csimwintarget[$i]."\" ";
  2875. }
  2876. if( ! empty($this->title->csimalt[$i]) ) {
  2877. $tmp = $this->title->csimalt[$i];
  2878. $this->csimarea .= " title=\"$tmp\" alt=\"$tmp\" ";
  2879. }
  2880. $this->csimarea .= " />\n";
  2881. }
  2882. }
  2883. }
  2884. // Check if the bar is totally outside the current scale range
  2885. if( $en < $aScale->iStartDate || $st > $aScale->iEndDate )
  2886. return;
  2887. // Remember the positions for the bar
  2888. $this->SetConstrainPos($xt,$yt,$xb,$yb);
  2889. $prect->ShowFrame(false);
  2890. $prect->SetBackground($this->iFillColor);
  2891. if( $this->iShadow ) {
  2892. $aImg->SetColor($this->iFrameColor);
  2893. $aImg->ShadowRectangle($xt,$yt,$xb,$yb,$this->iFillColor,$this->iShadowWidth,$this->iShadowColor);
  2894. $prect->SetPos(new Rectangle($xt+1,$yt+1,$xb-$xt-$this->iShadowWidth-2,$yb-$yt-$this->iShadowWidth-2));
  2895. $prect->Stroke($aImg);
  2896. }
  2897. else {
  2898. $prect->SetPos(new Rectangle($xt,$yt,$xb-$xt+1,$yb-$yt+1));
  2899. $prect->Stroke($aImg);
  2900. $aImg->SetColor($this->iFrameColor);
  2901. $aImg->Rectangle($xt,$yt,$xb,$yb);
  2902. }
  2903. // CSIM for bar
  2904. if( ! empty($this->csimtarget) ) {
  2905. $coords = "$xt,$yt,$xb,$yt,$xb,$yb,$xt,$yb";
  2906. $this->csimarea .= "<area shape=\"poly\" coords=\"$coords\" href=\"".$this->csimtarget."\"";
  2907. if( !empty($this->csimwintarget) ) {
  2908. $this->csimarea .= " target=\"".$this->csimwintarget."\" ";
  2909. }
  2910. if( $this->csimalt != '' ) {
  2911. $tmp = $this->csimalt;
  2912. $this->csimarea .= " title=\"$tmp\" alt=\"$tmp\" ";
  2913. }
  2914. $this->csimarea .= " />\n";
  2915. }
  2916. // Draw progress bar inside activity bar
  2917. if( $this->progress->iProgress > 0 ) {
  2918. $xtp = $aScale->TranslateDate($st);
  2919. $xbp = $aScale->TranslateDate($en);
  2920. $len = ($xbp-$xtp)*$this->progress->iProgress;
  2921. $endpos = $xtp+$len;
  2922. if( $endpos > $xt ) {
  2923. // Take away the length of the progress that is not visible (before the start date)
  2924. $len -= ($xt-$xtp);
  2925. // Is the the progress bar visible after the start date?
  2926. if( $xtp < $xt )
  2927. $xtp = $xt;
  2928. // Make sure that the progess bar doesn't extend over the end date
  2929. if( $xtp+$len-1 > $xb )
  2930. $len = $xb - $xtp ;
  2931. $prog = $factory->Create($this->progress->iPattern,$this->progress->iColor);
  2932. $prog->SetDensity($this->progress->iDensity);
  2933. $prog->SetBackground($this->progress->iFillColor);
  2934. $barheight = ($yb-$yt+1);
  2935. if( $this->iShadow )
  2936. $barheight -= $this->iShadowWidth;
  2937. $progressheight = floor($barheight*$this->progress->iHeight);
  2938. $marg = ceil(($barheight-$progressheight)/2);
  2939. $pos = new Rectangle($xtp,$yt + $marg, $len,$barheight-2*$marg);
  2940. $prog->SetPos($pos);
  2941. $prog->Stroke($aImg);
  2942. }
  2943. }
  2944. // We don't plot the end mark if the bar has been capped
  2945. if( $limst == $st ) {
  2946. $y = $middle;
  2947. // We treat the RIGHT and LEFT triangle mark a little bi
  2948. // special so that these marks are placed right under the
  2949. // bar.
  2950. if( $this->leftMark->GetType() == MARK_LEFTTRIANGLE ) {
  2951. $y = $yb ;
  2952. }
  2953. $this->leftMark->Stroke($aImg,$xt,$y);
  2954. }
  2955. if( $limen == $en ) {
  2956. $y = $middle;
  2957. // We treat the RIGHT and LEFT triangle mark a little bi
  2958. // special so that these marks are placed right under the
  2959. // bar.
  2960. if( $this->rightMark->GetType() == MARK_RIGHTTRIANGLE ) {
  2961. $y = $yb ;
  2962. }
  2963. $this->rightMark->Stroke($aImg,$xb,$y);
  2964. $margin = $this->iCaptionMargin;
  2965. if( $this->rightMark->show )
  2966. $margin += $this->rightMark->GetWidth();
  2967. $this->caption->Stroke($aImg,$xb+$margin,$middle);
  2968. }
  2969. }
  2970. }
  2971. //===================================================
  2972. // CLASS MileStone
  2973. // Responsible for formatting individual milestones
  2974. //===================================================
  2975. class MileStone extends GanttPlotObject {
  2976. public $mark;
  2977. //---------------
  2978. // CONSTRUCTOR
  2979. function MileStone($aVPos,$aLabel,$aDate,$aCaption="") {
  2980. GanttPlotObject::GanttPlotObject();
  2981. $this->caption->Set($aCaption);
  2982. $this->caption->Align("left","center");
  2983. $this->caption->SetFont(FF_FONT1,FS_BOLD);
  2984. $this->title->Set($aLabel);
  2985. $this->title->SetColor("darkred");
  2986. $this->mark = new PlotMark();
  2987. $this->mark->SetWidth(10);
  2988. $this->mark->SetType(MARK_DIAMOND);
  2989. $this->mark->SetColor("darkred");
  2990. $this->mark->SetFillColor("darkred");
  2991. $this->iVPos = $aVPos;
  2992. $this->iStart = $aDate;
  2993. }
  2994. //---------------
  2995. // PUBLIC METHODS
  2996. function GetAbsHeight($aImg) {
  2997. return max($this->title->GetHeight($aImg),$this->mark->GetWidth());
  2998. }
  2999. function Stroke($aImg,$aScale) {
  3000. // Put the mark in the middle at the middle of the day
  3001. $d = $aScale->NormalizeDate($this->iStart)+SECPERDAY/2;
  3002. $x = $aScale->TranslateDate($d);
  3003. $y = $aScale->TranslateVertPos($this->iVPos)-($aScale->GetVertSpacing()/2);
  3004. $this->StrokeActInfo($aImg,$aScale,$y);
  3005. // CSIM for title
  3006. if( ! empty($this->title->csimtarget) ) {
  3007. $yt = round($y - $this->title->GetHeight($aImg)/2);
  3008. $yb = round($y + $this->title->GetHeight($aImg)/2);
  3009. $colwidth = $this->title->GetColWidth($aImg);
  3010. $colstarts=array();
  3011. $aScale->actinfo->GetColStart($aImg,$colstarts,true);
  3012. $n = min(count($colwidth),count($this->title->csimtarget));
  3013. for( $i=0; $i < $n; ++$i ) {
  3014. $title_xt = $colstarts[$i];
  3015. $title_xb = $title_xt + $colwidth[$i];
  3016. $coords = "$title_xt,$yt,$title_xb,$yt,$title_xb,$yb,$title_xt,$yb";
  3017. if( !empty($this->title->csimtarget[$i]) ) {
  3018. $this->csimarea .= "<area shape=\"poly\" coords=\"$coords\" href=\"".$this->title->csimtarget[$i]."\"";
  3019. if( !empty($this->title->csimwintarget[$i]) ) {
  3020. $this->csimarea .= "target=\"".$this->title->csimwintarget[$i]."\"";
  3021. }
  3022. if( ! empty($this->title->csimalt[$i]) ) {
  3023. $tmp = $this->title->csimalt[$i];
  3024. $this->csimarea .= " title=\"$tmp\" alt=\"$tmp\" ";
  3025. }
  3026. $this->csimarea .= " />\n";
  3027. }
  3028. }
  3029. }
  3030. if( $d < $aScale->iStartDate || $d > $aScale->iEndDate )
  3031. return;
  3032. // Remember the coordinates for any constrains linking to
  3033. // this milestone
  3034. $w = $this->mark->GetWidth()/2;
  3035. $this->SetConstrainPos($x,round($y-$w),$x,round($y+$w));
  3036. // Setup CSIM
  3037. if( $this->csimtarget != '' ) {
  3038. $this->mark->SetCSIMTarget( $this->csimtarget );
  3039. $this->mark->SetCSIMAlt( $this->csimalt );
  3040. }
  3041. $this->mark->Stroke($aImg,$x,$y);
  3042. $this->caption->Stroke($aImg,$x+$this->mark->width/2+$this->iCaptionMargin,$y);
  3043. $this->csimarea .= $this->mark->GetCSIMAreas();
  3044. }
  3045. }
  3046. //===================================================
  3047. // CLASS GanttVLine
  3048. // Responsible for formatting individual milestones
  3049. //===================================================
  3050. class TextPropertyBelow extends TextProperty {
  3051. function TextPropertyBelow($aTxt='') {
  3052. parent::TextProperty($aTxt);
  3053. }
  3054. function GetColWidth($aImg,$aMargin=0) {
  3055. // Since we are not stroking the title in the columns
  3056. // but rather under the graph we want this to return 0.
  3057. return array(0);
  3058. }
  3059. }
  3060. class GanttVLine extends GanttPlotObject {
  3061. private $iLine,$title_margin=3, $iDayOffset=1;
  3062. //---------------
  3063. // CONSTRUCTOR
  3064. function GanttVLine($aDate,$aTitle="",$aColor="black",$aWeight=3,$aStyle="dashed") {
  3065. GanttPlotObject::GanttPlotObject();
  3066. $this->iLine = new LineProperty();
  3067. $this->iLine->SetColor($aColor);
  3068. $this->iLine->SetWeight($aWeight);
  3069. $this->iLine->SetStyle($aStyle);
  3070. $this->iStart = $aDate;
  3071. $this->title = new TextPropertyBelow();
  3072. $this->title->Set($aTitle);
  3073. }
  3074. //---------------
  3075. // PUBLIC METHODS
  3076. function SetDayOffset($aOff=0.5) {
  3077. if( $aOff < 0.0 || $aOff > 1.0 )
  3078. JpGraphError::RaiseL(6029);
  3079. //("Offset for vertical line must be in range [0,1]");
  3080. $this->iDayOffset = $aOff;
  3081. }
  3082. function SetTitleMargin($aMarg) {
  3083. $this->title_margin = $aMarg;
  3084. }
  3085. function Stroke($aImg,$aScale) {
  3086. $d = $aScale->NormalizeDate($this->iStart);
  3087. if( $d < $aScale->iStartDate || $d > $aScale->iEndDate )
  3088. return;
  3089. if($this->iDayOffset != 0.0)
  3090. $d += 24*60*60*$this->iDayOffset;
  3091. $x = $aScale->TranslateDate($d);
  3092. $y1 = $aScale->iVertHeaderSize+$aImg->top_margin;
  3093. $y2 = $aImg->height - $aImg->bottom_margin;
  3094. $this->iLine->Stroke($aImg,$x,$y1,$x,$y2);
  3095. $this->title->Align("center","top");
  3096. $this->title->Stroke($aImg,$x,$y2+$this->title_margin);
  3097. }
  3098. }
  3099. //===================================================
  3100. // CLASS LinkArrow
  3101. // Handles the drawing of a an arrow
  3102. //===================================================
  3103. class LinkArrow {
  3104. private $ix,$iy;
  3105. private $isizespec = array(
  3106. array(2,3),array(3,5),array(3,8),array(6,15),array(8,22));
  3107. private $iDirection=ARROW_DOWN,$iType=ARROWT_SOLID,$iSize=ARROW_S2;
  3108. private $iColor='black';
  3109. function LinkArrow($x,$y,$aDirection,$aType=ARROWT_SOLID,$aSize=ARROW_S2) {
  3110. $this->iDirection = $aDirection;
  3111. $this->iType = $aType;
  3112. $this->iSize = $aSize;
  3113. $this->ix = $x;
  3114. $this->iy = $y;
  3115. }
  3116. function SetColor($aColor) {
  3117. $this->iColor = $aColor;
  3118. }
  3119. function SetSize($aSize) {
  3120. $this->iSize = $aSize;
  3121. }
  3122. function SetType($aType) {
  3123. $this->iType = $aType;
  3124. }
  3125. function Stroke($aImg) {
  3126. list($dx,$dy) = $this->isizespec[$this->iSize];
  3127. $x = $this->ix;
  3128. $y = $this->iy;
  3129. switch ( $this->iDirection ) {
  3130. case ARROW_DOWN:
  3131. $c = array($x,$y,$x-$dx,$y-$dy,$x+$dx,$y-$dy,$x,$y);
  3132. break;
  3133. case ARROW_UP:
  3134. $c = array($x,$y,$x-$dx,$y+$dy,$x+$dx,$y+$dy,$x,$y);
  3135. break;
  3136. case ARROW_LEFT:
  3137. $c = array($x,$y,$x+$dy,$y-$dx,$x+$dy,$y+$dx,$x,$y);
  3138. break;
  3139. case ARROW_RIGHT:
  3140. $c = array($x,$y,$x-$dy,$y-$dx,$x-$dy,$y+$dx,$x,$y);
  3141. break;
  3142. default:
  3143. JpGraphError::RaiseL(6030);
  3144. //('Unknown arrow direction for link.');
  3145. die();
  3146. break;
  3147. }
  3148. $aImg->SetColor($this->iColor);
  3149. switch( $this->iType ) {
  3150. case ARROWT_SOLID:
  3151. $aImg->FilledPolygon($c);
  3152. break;
  3153. case ARROWT_OPEN:
  3154. $aImg->Polygon($c);
  3155. break;
  3156. default:
  3157. JpGraphError::RaiseL(6031);
  3158. //('Unknown arrow type for link.');
  3159. die();
  3160. break;
  3161. }
  3162. }
  3163. }
  3164. //===================================================
  3165. // CLASS GanttLink
  3166. // Handles the drawing of a link line between 2 points
  3167. //===================================================
  3168. class GanttLink {
  3169. private $ix1,$ix2,$iy1,$iy2;
  3170. private $iPathType=2,$iPathExtend=15;
  3171. private $iColor='black',$iWeight=1;
  3172. private $iArrowSize=ARROW_S2,$iArrowType=ARROWT_SOLID;
  3173. function GanttLink($x1=0,$y1=0,$x2=0,$y2=0) {
  3174. $this->ix1 = $x1;
  3175. $this->ix2 = $x2;
  3176. $this->iy1 = $y1;
  3177. $this->iy2 = $y2;
  3178. }
  3179. function SetPos($x1,$y1,$x2,$y2) {
  3180. $this->ix1 = $x1;
  3181. $this->ix2 = $x2;
  3182. $this->iy1 = $y1;
  3183. $this->iy2 = $y2;
  3184. }
  3185. function SetPath($aPath) {
  3186. $this->iPathType = $aPath;
  3187. }
  3188. function SetColor($aColor) {
  3189. $this->iColor = $aColor;
  3190. }
  3191. function SetArrow($aSize,$aType=ARROWT_SOLID) {
  3192. $this->iArrowSize = $aSize;
  3193. $this->iArrowType = $aType;
  3194. }
  3195. function SetWeight($aWeight) {
  3196. $this->iWeight = $aWeight;
  3197. }
  3198. function Stroke($aImg) {
  3199. // The way the path for the arrow is constructed is partly based
  3200. // on some heuristics. This is not an exact science but draws the
  3201. // path in a way that, for me, makes esthetic sence. For example
  3202. // if the start and end activities are very close we make a small
  3203. // detour to endter the target horixontally. If there are more
  3204. // space between axctivities then no suh detour is made and the
  3205. // target is "hit" directly vertical. I have tried to keep this
  3206. // simple. no doubt this could become almost infinitive complex
  3207. // and have some real AI. Feel free to modify this.
  3208. // This will no-doubt be tweaked as times go by. One design aim
  3209. // is to avoid having the user choose what types of arrow
  3210. // he wants.
  3211. // The arrow is drawn between (x1,y1) to (x2,y2)
  3212. $x1 = $this->ix1 ;
  3213. $x2 = $this->ix2 ;
  3214. $y1 = $this->iy1 ;
  3215. $y2 = $this->iy2 ;
  3216. // Depending on if the target is below or above we have to
  3217. // handle thi different.
  3218. if( $y2 > $y1 ) {
  3219. $arrowtype = ARROW_DOWN;
  3220. $midy = round(($y2-$y1)/2+$y1);
  3221. if( $x2 > $x1 ) {
  3222. switch ( $this->iPathType ) {
  3223. case 0:
  3224. $c = array($x1,$y1,$x1,$midy,$x2,$midy,$x2,$y2);
  3225. break;
  3226. case 1:
  3227. case 2:
  3228. case 3:
  3229. $c = array($x1,$y1,$x2,$y1,$x2,$y2);
  3230. break;
  3231. default:
  3232. JpGraphError::RaiseL(6032,$this->iPathType);
  3233. //('Internal error: Unknown path type (='.$this->iPathType .') specified for link.');
  3234. exit(1);
  3235. break;
  3236. }
  3237. }
  3238. else {
  3239. switch ( $this->iPathType ) {
  3240. case 0:
  3241. case 1:
  3242. $c = array($x1,$y1,$x1,$midy,$x2,$midy,$x2,$y2);
  3243. break;
  3244. case 2:
  3245. // Always extend out horizontally a bit from the first point
  3246. // If we draw a link back in time (end to start) and the bars
  3247. // are very close we also change the path so it comes in from
  3248. // the left on the activity
  3249. $c = array($x1,$y1,$x1+$this->iPathExtend,$y1,
  3250. $x1+$this->iPathExtend,$midy,
  3251. $x2,$midy,$x2,$y2);
  3252. break;
  3253. case 3:
  3254. if( $y2-$midy < 6 ) {
  3255. $c = array($x1,$y1,$x1,$midy,
  3256. $x2-$this->iPathExtend,$midy,
  3257. $x2-$this->iPathExtend,$y2,
  3258. $x2,$y2);
  3259. $arrowtype = ARROW_RIGHT;
  3260. }
  3261. else {
  3262. $c = array($x1,$y1,$x1,$midy,$x2,$midy,$x2,$y2);
  3263. }
  3264. break;
  3265. default:
  3266. JpGraphError::RaiseL(6032,$this->iPathType);
  3267. //('Internal error: Unknown path type specified for link.');
  3268. exit(1);
  3269. break;
  3270. }
  3271. }
  3272. $arrow = new LinkArrow($x2,$y2,$arrowtype);
  3273. }
  3274. else {
  3275. // Y2 < Y1
  3276. $arrowtype = ARROW_UP;
  3277. $midy = round(($y1-$y2)/2+$y2);
  3278. if( $x2 > $x1 ) {
  3279. switch ( $this->iPathType ) {
  3280. case 0:
  3281. case 1:
  3282. $c = array($x1,$y1,$x1,$midy,$x2,$midy,$x2,$y2);
  3283. break;
  3284. case 3:
  3285. if( $midy-$y2 < 8 ) {
  3286. $arrowtype = ARROW_RIGHT;
  3287. $c = array($x1,$y1,$x1,$y2,$x2,$y2);
  3288. }
  3289. else {
  3290. $c = array($x1,$y1,$x1,$midy,$x2,$midy,$x2,$y2);
  3291. }
  3292. break;
  3293. default:
  3294. JpGraphError::RaiseL(6032,$this->iPathType);
  3295. //('Internal error: Unknown path type specified for link.');
  3296. break;
  3297. }
  3298. }
  3299. else {
  3300. switch ( $this->iPathType ) {
  3301. case 0:
  3302. case 1:
  3303. $c = array($x1,$y1,$x1,$midy,$x2,$midy,$x2,$y2);
  3304. break;
  3305. case 2:
  3306. // Always extend out horizontally a bit from the first point
  3307. $c = array($x1,$y1,$x1+$this->iPathExtend,$y1,
  3308. $x1+$this->iPathExtend,$midy,
  3309. $x2,$midy,$x2,$y2);
  3310. break;
  3311. case 3:
  3312. if( $midy-$y2 < 16 ) {
  3313. $arrowtype = ARROW_RIGHT;
  3314. $c = array($x1,$y1,$x1,$midy,$x2-$this->iPathExtend,$midy,
  3315. $x2-$this->iPathExtend,$y2,
  3316. $x2,$y2);
  3317. }
  3318. else {
  3319. $c = array($x1,$y1,$x1,$midy,$x2,$midy,$x2,$y2);
  3320. }
  3321. break;
  3322. default:
  3323. JpGraphError::RaiseL(6032,$this->iPathType);
  3324. //('Internal error: Unknown path type specified for link.');
  3325. break;
  3326. }
  3327. }
  3328. $arrow = new LinkArrow($x2,$y2,$arrowtype);
  3329. }
  3330. $aImg->SetColor($this->iColor);
  3331. $aImg->SetLineWeight($this->iWeight);
  3332. $aImg->Polygon($c);
  3333. $aImg->SetLineWeight(1);
  3334. $arrow->SetColor($this->iColor);
  3335. $arrow->SetSize($this->iArrowSize);
  3336. $arrow->SetType($this->iArrowType);
  3337. $arrow->Stroke($aImg);
  3338. }
  3339. }
  3340. // <EOF>
  3341. ?>