PageRenderTime 87ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 1ms

/libraries/plugin/jpgraph/jpgraph_gantt.php

https://bitbucket.org/kkfd008/simplephp
PHP | 3955 lines | 2919 code | 476 blank | 560 comment | 423 complexity | 914be73f079e693ce043594f030395a8 MD5 | raw file

Large files files are truncated, but you can click here to view the full file

  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 1809 2009-09-09 13:07:33Z ljp $
  7. //
  8. // Copyright (c) Asial Corporation. 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',8000);
  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 __construct() {
  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,$aXRight,$yTop+1);
  238. }
  239. for($i=0; $i < $n; ++$i ) {
  240. if( $this->iStyle == 1 ) {
  241. // Make a 3D effect
  242. $aImg->SetColor('white');
  243. $aImg->Line($x+1,$yTop,$x+1,$aYBottom);
  244. }
  245. $x += $this->iLeftColMargin;
  246. $txt->Set($this->iTitles[$i]);
  247. // Adjust the text anchor position according to the choosen alignment
  248. $xp = $x;
  249. if( $this->iHeaderAlign == 'center' ) {
  250. $xp = (($x-$this->iLeftColMargin)+($x+$this->iWidth[$i]))/2;
  251. }
  252. elseif( $this->iHeaderAlign == 'right' ) {
  253. $xp = $x +$this->iWidth[$i]-$this->iRightColMargin;
  254. }
  255. $txt->Stroke($aImg,$xp,$yTop+$this->iTopHeaderMargin);
  256. $x += $this->iWidth[$i];
  257. if( $i < $n-1 ) {
  258. $aImg->SetColor($this->iColor);
  259. $aImg->Line($x,$yTop,$x,$aYBottom);
  260. }
  261. }
  262. $aImg->SetColor($this->iColor);
  263. $aImg->Line($aXLeft,$yTop, $aXRight,$yTop);
  264. // Stroke vertical column dividers
  265. $cols=array();
  266. $this->GetColStart($aImg,$cols);
  267. $n=count($cols);
  268. for( $i=1; $i < $n; ++$i ) {
  269. $this->vgrid->Stroke($aImg,$cols[$i],$aYBottom,$cols[$i],
  270. $aImg->height - $aImg->bottom_margin);
  271. }
  272. }
  273. }
  274. //===================================================
  275. // CLASS GanttGraph
  276. // Description: Main class to handle gantt graphs
  277. //===================================================
  278. class GanttGraph extends Graph {
  279. public $scale; // Public accessible
  280. public $hgrid=null;
  281. private $iObj=array(); // Gantt objects
  282. private $iLabelHMarginFactor=0.2; // 10% margin on each side of the labels
  283. private $iLabelVMarginFactor=0.4; // 40% margin on top and bottom of label
  284. private $iLayout=GANTT_FROMTOP; // Could also be GANTT_EVEN
  285. private $iSimpleFont = FF_FONT1,$iSimpleFontSize=11;
  286. private $iSimpleStyle=GANTT_RDIAG,$iSimpleColor='yellow',$iSimpleBkgColor='red';
  287. private $iSimpleProgressBkgColor='gray',$iSimpleProgressColor='darkgreen';
  288. private $iSimpleProgressStyle=GANTT_SOLID;
  289. private $iZoomFactor = 1.0;
  290. //---------------
  291. // CONSTRUCTOR
  292. // Create a new gantt graph
  293. function __construct($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. parent::__construct($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 user specified scale zoom factor when auto sizing is used
  403. function SetZoomFactor($aZoom) {
  404. $this->iZoomFactor = $aZoom;
  405. }
  406. // Set what headers should be shown
  407. function ShowHeaders($aFlg) {
  408. $this->scale->ShowHeaders($aFlg);
  409. }
  410. // Specify the fraction of the font height that should be added
  411. // as vertical margin
  412. function SetLabelVMarginFactor($aVal) {
  413. $this->iLabelVMarginFactor = $aVal;
  414. }
  415. // Synonym to the method above
  416. function SetVMarginFactor($aVal) {
  417. $this->iLabelVMarginFactor = $aVal;
  418. }
  419. // Add a new Gantt object
  420. function Add($aObject) {
  421. if( is_array($aObject) && count($aObject) > 0 ) {
  422. $cl = $aObject[0];
  423. if( class_exists('IconPlot',false) && ($cl instanceof IconPlot) ) {
  424. $this->AddIcon($aObject);
  425. }
  426. elseif( class_exists('Text',false) && ($cl instanceof Text) ) {
  427. $this->AddText($aObject);
  428. }
  429. else {
  430. $n = count($aObject);
  431. for($i=0; $i < $n; ++$i)
  432. $this->iObj[] = $aObject[$i];
  433. }
  434. }
  435. else {
  436. if( class_exists('IconPlot',false) && ($aObject instanceof IconPlot) ) {
  437. $this->AddIcon($aObject);
  438. }
  439. elseif( class_exists('Text',false) && ($aObject instanceof Text) ) {
  440. $this->AddText($aObject);
  441. }
  442. else {
  443. $this->iObj[] = $aObject;
  444. }
  445. }
  446. }
  447. function StrokeTexts() {
  448. // Stroke any user added text objects
  449. if( $this->texts != null ) {
  450. $n = count($this->texts);
  451. for($i=0; $i < $n; ++$i) {
  452. if( $this->texts[$i]->iScalePosX !== null && $this->texts[$i]->iScalePosY !== null ) {
  453. $x = $this->scale->TranslateDate($this->texts[$i]->iScalePosX);
  454. $y = $this->scale->TranslateVertPos($this->texts[$i]->iScalePosY);
  455. $y -= $this->scale->GetVertSpacing()/2;
  456. }
  457. else {
  458. $x = $y = null;
  459. }
  460. $this->texts[$i]->Stroke($this->img,$x,$y);
  461. }
  462. }
  463. }
  464. // Override inherit method from Graph and give a warning message
  465. function SetScale($aAxisType,$aYMin=1,$aYMax=1,$aXMin=1,$aXMax=1) {
  466. JpGraphError::RaiseL(6005);
  467. //("SetScale() is not meaningfull with Gantt charts.");
  468. }
  469. // Specify the date range for Gantt graphs (if this is not set it will be
  470. // automtically determined from the input data)
  471. function SetDateRange($aStart,$aEnd) {
  472. // Adjust the start and end so that the indicate the
  473. // begining and end of respective start and end days
  474. if( strpos($aStart,':') === false )
  475. $aStart = date('Y-m-d 00:00',strtotime($aStart));
  476. if( strpos($aEnd,':') === false )
  477. $aEnd = date('Y-m-d 23:59',strtotime($aEnd));
  478. $this->scale->SetRange($aStart,$aEnd);
  479. }
  480. // Get the maximum width of the activity titles columns for the bars
  481. // The name is lightly misleading since we from now on can have
  482. // multiple columns in the label section. When this was first written
  483. // it only supported a single label, hence the name.
  484. function GetMaxLabelWidth() {
  485. $m=10;
  486. if( $this->iObj != null ) {
  487. $marg = $this->scale->actinfo->iLeftColMargin+$this->scale->actinfo->iRightColMargin;
  488. $n = count($this->iObj);
  489. for($i=0; $i < $n; ++$i) {
  490. if( !empty($this->iObj[$i]->title) ) {
  491. if( $this->iObj[$i]->title->HasTabs() ) {
  492. list($tot,$w) = $this->iObj[$i]->title->GetWidth($this->img,true);
  493. $m=max($m,$tot);
  494. }
  495. else
  496. $m=max($m,$this->iObj[$i]->title->GetWidth($this->img));
  497. }
  498. }
  499. }
  500. return $m;
  501. }
  502. // Get the maximum height of the titles for the bars
  503. function GetMaxLabelHeight() {
  504. $m=10;
  505. if( $this->iObj != null ) {
  506. $n = count($this->iObj);
  507. // We can not include the title of GnttVLine since that title is stroked at the bottom
  508. // of the Gantt bar and not in the activity title columns
  509. for($i=0; $i < $n; ++$i) {
  510. if( !empty($this->iObj[$i]->title) && !($this->iObj[$i] instanceof GanttVLine) ) {
  511. $m=max($m,$this->iObj[$i]->title->GetHeight($this->img));
  512. }
  513. }
  514. }
  515. return $m;
  516. }
  517. function GetMaxBarAbsHeight() {
  518. $m=0;
  519. if( $this->iObj != null ) {
  520. $m = $this->iObj[0]->GetAbsHeight($this->img);
  521. $n = count($this->iObj);
  522. for($i=1; $i < $n; ++$i) {
  523. $m=max($m,$this->iObj[$i]->GetAbsHeight($this->img));
  524. }
  525. }
  526. return $m;
  527. }
  528. // Get the maximum used line number (vertical position) for bars
  529. function GetBarMaxLineNumber() {
  530. $m=1;
  531. if( $this->iObj != null ) {
  532. $m = $this->iObj[0]->GetLineNbr();
  533. $n = count($this->iObj);
  534. for($i=1; $i < $n; ++$i) {
  535. $m=max($m,$this->iObj[$i]->GetLineNbr());
  536. }
  537. }
  538. return $m;
  539. }
  540. // Get the minumum and maximum used dates for all bars
  541. function GetBarMinMax() {
  542. $start = 0 ;
  543. $n = count($this->iObj);
  544. while( $start < $n && $this->iObj[$start]->GetMaxDate() === false )
  545. ++$start;
  546. if( $start >= $n ) {
  547. JpgraphError::RaiseL(6006);
  548. //('Cannot autoscale Gantt chart. No dated activities exist. [GetBarMinMax() start >= n]');
  549. }
  550. $max=$this->scale->NormalizeDate($this->iObj[$start]->GetMaxDate());
  551. $min=$this->scale->NormalizeDate($this->iObj[$start]->GetMinDate());
  552. for($i=$start+1; $i < $n; ++$i) {
  553. $rmax = $this->scale->NormalizeDate($this->iObj[$i]->GetMaxDate());
  554. if( $rmax != false )
  555. $max=Max($max,$rmax);
  556. $rmin = $this->scale->NormalizeDate($this->iObj[$i]->GetMinDate());
  557. if( $rmin != false )
  558. $min=Min($min,$rmin);
  559. }
  560. $minDate = date("Y-m-d",$min);
  561. $min = strtotime($minDate);
  562. $maxDate = date("Y-m-d 23:59",$max);
  563. $max = strtotime($maxDate);
  564. return array($min,$max);
  565. }
  566. // Create a new auto sized canvas if the user hasn't specified a size
  567. // The size is determined by what scale the user has choosen and hence
  568. // the minimum width needed to display the headers. Some margins are
  569. // also added to make it better looking.
  570. function AutoSize() {
  571. if( $this->img->img == null ) {
  572. // The predefined left, right, top, bottom margins.
  573. // Note that the top margin might incease depending on
  574. // the title.
  575. $hadj = $vadj = 0;
  576. if( $this->doshadow ) {
  577. $hadj = $this->shadow_width;
  578. $vadj = $this->shadow_width+5;
  579. }
  580. $lm = $this->img->left_margin;
  581. $rm = $this->img->right_margin +$hadj;
  582. $rm += 2 ;
  583. $tm = $this->img->top_margin;
  584. $bm = $this->img->bottom_margin + $vadj;
  585. $bm += 2;
  586. // If there are any added GanttVLine we must make sure that the
  587. // bottom margin is wide enough to hold a title.
  588. $n = count($this->iObj);
  589. for($i=0; $i < $n; ++$i) {
  590. if( $this->iObj[$i] instanceof GanttVLine ) {
  591. $bm = max($bm,$this->iObj[$i]->title->GetHeight($this->img)+10);
  592. }
  593. }
  594. // First find out the height
  595. $n=$this->GetBarMaxLineNumber()+1;
  596. $m=max($this->GetMaxLabelHeight(),$this->GetMaxBarAbsHeight());
  597. $height=$n*((1+$this->iLabelVMarginFactor)*$m);
  598. // Add the height of the scale titles
  599. $h=$this->scale->GetHeaderHeight();
  600. $height += $h;
  601. // Calculate the top margin needed for title and subtitle
  602. if( $this->title->t != "" ) {
  603. $tm += $this->title->GetFontHeight($this->img);
  604. }
  605. if( $this->subtitle->t != "" ) {
  606. $tm += $this->subtitle->GetFontHeight($this->img);
  607. }
  608. // ...and then take the bottom and top plot margins into account
  609. $height += $tm + $bm + $this->scale->iTopPlotMargin + $this->scale->iBottomPlotMargin;
  610. // Now find the minimum width for the chart required
  611. // If day scale or smaller is shown then we use the day font width
  612. // as the base size unit.
  613. // If only weeks or above is displayed we use a modified unit to
  614. // get a smaller image.
  615. if( $this->scale->IsDisplayHour() || $this->scale->IsDisplayMinute() ) {
  616. // Add 2 pixel margin on each side
  617. $fw=$this->scale->day->GetFontWidth($this->img)+4;
  618. }
  619. elseif( $this->scale->IsDisplayWeek() ) {
  620. $fw = 8;
  621. }
  622. elseif( $this->scale->IsDisplayMonth() ) {
  623. $fw = 4;
  624. }
  625. else {
  626. $fw = 2;
  627. }
  628. $nd=$this->scale->GetNumberOfDays();
  629. if( $this->scale->IsDisplayDay() ) {
  630. // If the days are displayed we also need to figure out
  631. // how much space each day's title will require.
  632. switch( $this->scale->day->iStyle ) {
  633. case DAYSTYLE_LONG :
  634. $txt = "Monday";
  635. break;
  636. case DAYSTYLE_LONGDAYDATE1 :
  637. $txt = "Monday 23 Jun";
  638. break;
  639. case DAYSTYLE_LONGDAYDATE2 :
  640. $txt = "Monday 23 Jun 2003";
  641. break;
  642. case DAYSTYLE_SHORT :
  643. $txt = "Mon";
  644. break;
  645. case DAYSTYLE_SHORTDAYDATE1 :
  646. $txt = "Mon 23/6";
  647. break;
  648. case DAYSTYLE_SHORTDAYDATE2 :
  649. $txt = "Mon 23 Jun";
  650. break;
  651. case DAYSTYLE_SHORTDAYDATE3 :
  652. $txt = "Mon 23";
  653. break;
  654. case DAYSTYLE_SHORTDATE1 :
  655. $txt = "23/6";
  656. break;
  657. case DAYSTYLE_SHORTDATE2 :
  658. $txt = "23 Jun";
  659. break;
  660. case DAYSTYLE_SHORTDATE3 :
  661. $txt = "Mon 23";
  662. break;
  663. case DAYSTYLE_SHORTDATE4 :
  664. $txt = "88";
  665. break;
  666. case DAYSTYLE_CUSTOM :
  667. $txt = date($this->scale->day->iLabelFormStr,strtotime('2003-12-20 18:00'));
  668. break;
  669. case DAYSTYLE_ONELETTER :
  670. default:
  671. $txt = "M";
  672. break;
  673. }
  674. $fw = $this->scale->day->GetStrWidth($this->img,$txt)+6;
  675. }
  676. // If we have hours enabled we must make sure that each day has enough
  677. // space to fit the number of hours to be displayed.
  678. if( $this->scale->IsDisplayHour() ) {
  679. // Depending on what format the user has choose we need different amount
  680. // of space. We therefore create a typical string for the choosen format
  681. // and determine the length of that string.
  682. switch( $this->scale->hour->iStyle ) {
  683. case HOURSTYLE_HMAMPM:
  684. $txt = '12:00pm';
  685. break;
  686. case HOURSTYLE_H24:
  687. // 13
  688. $txt = '24';
  689. break;
  690. case HOURSTYLE_HAMPM:
  691. $txt = '12pm';
  692. break;
  693. case HOURSTYLE_CUSTOM:
  694. $txt = date($this->scale->hour->iLabelFormStr,strtotime('2003-12-20 18:00'));
  695. break;
  696. case HOURSTYLE_HM24:
  697. default:
  698. $txt = '24:00';
  699. break;
  700. }
  701. $hfw = $this->scale->hour->GetStrWidth($this->img,$txt)+6;
  702. $mw = $hfw;
  703. if( $this->scale->IsDisplayMinute() ) {
  704. // Depending on what format the user has choose we need different amount
  705. // of space. We therefore create a typical string for the choosen format
  706. // and determine the length of that string.
  707. switch( $this->scale->minute->iStyle ) {
  708. case HOURSTYLE_CUSTOM:
  709. $txt2 = date($this->scale->minute->iLabelFormStr,strtotime('2005-05-15 18:55'));
  710. break;
  711. case MINUTESTYLE_MM:
  712. default:
  713. $txt2 = '15';
  714. break;
  715. }
  716. $mfw = $this->scale->minute->GetStrWidth($this->img,$txt2)+6;
  717. $n2 = ceil(60 / $this->scale->minute->GetIntervall() );
  718. $mw = $n2 * $mfw;
  719. }
  720. $hfw = $hfw < $mw ? $mw : $hfw ;
  721. $n = ceil(24*60 / $this->scale->TimeToMinutes($this->scale->hour->GetIntervall()) );
  722. $hw = $n * $hfw;
  723. $fw = $fw < $hw ? $hw : $fw ;
  724. }
  725. // We need to repeat this code block here as well.
  726. // THIS iS NOT A MISTAKE !
  727. // We really need it since we need to adjust for minutes both in the case
  728. // where hour scale is shown and when it is not shown.
  729. if( $this->scale->IsDisplayMinute() ) {
  730. // Depending on what format the user has choose we need different amount
  731. // of space. We therefore create a typical string for the choosen format
  732. // and determine the length of that string.
  733. switch( $this->scale->minute->iStyle ) {
  734. case HOURSTYLE_CUSTOM:
  735. $txt = date($this->scale->minute->iLabelFormStr,strtotime('2005-05-15 18:55'));
  736. break;
  737. case MINUTESTYLE_MM:
  738. default:
  739. $txt = '15';
  740. break;
  741. }
  742. $mfw = $this->scale->minute->GetStrWidth($this->img,$txt)+6;
  743. $n = ceil(60 / $this->scale->TimeToMinutes($this->scale->minute->GetIntervall()) );
  744. $mw = $n * $mfw;
  745. $fw = $fw < $mw ? $mw : $fw ;
  746. }
  747. // If we display week we must make sure that 7*$fw is enough
  748. // to fit up to 10 characters of the week font (if the week is enabled)
  749. if( $this->scale->IsDisplayWeek() ) {
  750. // Depending on what format the user has choose we need different amount
  751. // of space
  752. $fsw = strlen($this->scale->week->iLabelFormStr);
  753. if( $this->scale->week->iStyle==WEEKSTYLE_FIRSTDAY2WNBR ) {
  754. $fsw += 8;
  755. }
  756. elseif( $this->scale->week->iStyle==WEEKSTYLE_FIRSTDAYWNBR ) {
  757. $fsw += 7;
  758. }
  759. else {
  760. $fsw += 4;
  761. }
  762. $ww = $fsw*$this->scale->week->GetFontWidth($this->img);
  763. if( 7*$fw < $ww ) {
  764. $fw = ceil($ww/7);
  765. }
  766. }
  767. if( !$this->scale->IsDisplayDay() && !$this->scale->IsDisplayHour() &&
  768. !( ($this->scale->week->iStyle==WEEKSTYLE_FIRSTDAYWNBR ||
  769. $this->scale->week->iStyle==WEEKSTYLE_FIRSTDAY2WNBR) && $this->scale->IsDisplayWeek() ) ) {
  770. // If we don't display the individual days we can shrink the
  771. // scale a little bit. This is a little bit pragmatic at the
  772. // moment and should be re-written to take into account
  773. // a) What scales exactly are shown and
  774. // b) what format do they use so we know how wide we need to
  775. // make each scale text space at minimum.
  776. $fw /= 2;
  777. if( !$this->scale->IsDisplayWeek() ) {
  778. $fw /= 1.8;
  779. }
  780. }
  781. $cw = $this->GetMaxActInfoColWidth() ;
  782. $this->scale->actinfo->SetMinColWidth($cw);
  783. if( $this->img->width <= 0 ) {
  784. // Now determine the width for the activity titles column
  785. // Firdst find out the maximum width of each object column
  786. $titlewidth = max(max($this->GetMaxLabelWidth(),
  787. $this->scale->tableTitle->GetWidth($this->img)),
  788. $this->scale->actinfo->GetWidth($this->img));
  789. // Add the width of the vertivcal divider line
  790. $titlewidth += $this->scale->divider->iWeight*2;
  791. // Adjust the width by the user specified zoom factor
  792. $fw *= $this->iZoomFactor;
  793. // Now get the total width taking
  794. // titlewidth, left and rigt margin, dayfont size
  795. // into account
  796. $width = $titlewidth + $nd*$fw + $lm+$rm;
  797. }
  798. else {
  799. $width = $this->img->width;
  800. }
  801. $width = round($width);
  802. $height = round($height);
  803. // Make a sanity check on image size
  804. if( $width > MAX_GANTTIMG_SIZE_W || $height > MAX_GANTTIMG_SIZE_H ) {
  805. JpgraphError::RaiseL(6007,$width,$height);
  806. //("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.");
  807. }
  808. $this->img->CreateImgCanvas($width,$height);
  809. $this->img->SetMargin($lm,$rm,$tm,$bm);
  810. }
  811. }
  812. // Return an array width the maximum width for each activity
  813. // column. This is used when we autosize the columns where we need
  814. // to find out the maximum width of each column. In order to do that we
  815. // must walk through all the objects, sigh...
  816. function GetMaxActInfoColWidth() {
  817. $n = count($this->iObj);
  818. if( $n == 0 ) return;
  819. $w = array();
  820. $m = $this->scale->actinfo->iLeftColMargin + $this->scale->actinfo->iRightColMargin;
  821. for( $i=0; $i < $n; ++$i ) {
  822. $tmp = $this->iObj[$i]->title->GetColWidth($this->img,$m);
  823. $nn = count($tmp);
  824. for( $j=0; $j < $nn; ++$j ) {
  825. if( empty($w[$j]) )
  826. $w[$j] = $tmp[$j];
  827. else
  828. $w[$j] = max($w[$j],$tmp[$j]);
  829. }
  830. }
  831. return $w;
  832. }
  833. // Stroke the gantt chart
  834. function Stroke($aStrokeFileName="") {
  835. // If the filename is the predefined value = '_csim_special_'
  836. // we assume that the call to stroke only needs to do enough
  837. // to correctly generate the CSIM maps.
  838. // We use this variable to skip things we don't strictly need
  839. // to do to generate the image map to improve performance
  840. // a best we can. Therefor you will see a lot of tests !$_csim in the
  841. // code below.
  842. $_csim = ($aStrokeFileName===_CSIM_SPECIALFILE);
  843. // Should we autoscale dates?
  844. if( !$this->scale->IsRangeSet() ) {
  845. list($min,$max) = $this->GetBarMinMax();
  846. $this->scale->SetRange($min,$max);
  847. }
  848. $this->scale->AdjustStartEndDay();
  849. // Check if we should autoscale the image
  850. $this->AutoSize();
  851. // Should we start from the top or just spread the bars out even over the
  852. // available height
  853. $this->scale->SetVertLayout($this->iLayout);
  854. if( $this->iLayout == GANTT_FROMTOP ) {
  855. $maxheight=max($this->GetMaxLabelHeight(),$this->GetMaxBarAbsHeight());
  856. $this->scale->SetVertSpacing($maxheight*(1+$this->iLabelVMarginFactor));
  857. }
  858. // If it hasn't been set find out the maximum line number
  859. if( $this->scale->iVertLines == -1 )
  860. $this->scale->iVertLines = $this->GetBarMaxLineNumber()+1;
  861. $maxwidth=max($this->scale->actinfo->GetWidth($this->img),
  862. max($this->GetMaxLabelWidth(),
  863. $this->scale->tableTitle->GetWidth($this->img)));
  864. $this->scale->SetLabelWidth($maxwidth+$this->scale->divider->iWeight);//*(1+$this->iLabelHMarginFactor));
  865. if( !$_csim ) {
  866. $this->StrokePlotArea();
  867. if( $this->iIconDepth == DEPTH_BACK ) {
  868. $this->StrokeIcons();
  869. }
  870. }
  871. $this->scale->Stroke();
  872. if( !$_csim ) {
  873. // Due to a minor off by 1 bug we need to temporarily adjust the margin
  874. $this->img->right_margin--;
  875. $this->StrokePlotBox();
  876. $this->img->right_margin++;
  877. }
  878. // Stroke Grid line
  879. $this->hgrid->Stroke($this->img,$this->scale);
  880. $n = count($this->iObj);
  881. for($i=0; $i < $n; ++$i) {
  882. //$this->iObj[$i]->SetLabelLeftMargin(round($maxwidth*$this->iLabelHMarginFactor/2));
  883. $this->iObj[$i]->Stroke($this->img,$this->scale);
  884. }
  885. $this->StrokeTitles();
  886. if( !$_csim ) {
  887. $this->StrokeConstrains();
  888. $this->footer->Stroke($this->img);
  889. if( $this->iIconDepth == DEPTH_FRONT) {
  890. $this->StrokeIcons();
  891. }
  892. // Stroke all added user texts
  893. $this->StrokeTexts();
  894. // Should we do any final image transformation
  895. if( $this->iImgTrans ) {
  896. if( !class_exists('ImgTrans',false) ) {
  897. require_once('jpgraph_imgtrans.php');
  898. }
  899. $tform = new ImgTrans($this->img->img);
  900. $this->img->img = $tform->Skew3D($this->iImgTransHorizon,$this->iImgTransSkewDist,
  901. $this->iImgTransDirection,$this->iImgTransHighQ,
  902. $this->iImgTransMinSize,$this->iImgTransFillColor,
  903. $this->iImgTransBorder);
  904. }
  905. // If the filename is given as the special "__handle"
  906. // then the image handler is returned and the image is NOT
  907. // streamed back
  908. if( $aStrokeFileName == _IMG_HANDLER ) {
  909. return $this->img->img;
  910. }
  911. else {
  912. // Finally stream the generated picture
  913. $this->cache->PutAndStream($this->img,$this->cache_name,$this->inline,
  914. $aStrokeFileName);
  915. }
  916. }
  917. }
  918. function StrokeConstrains() {
  919. $n = count($this->iObj);
  920. // Stroke all constrains
  921. for($i=0; $i < $n; ++$i) {
  922. // Some gantt objects may not have constraints associated with them
  923. // for example we can add IconPlots which doesn't have this property.
  924. if( empty($this->iObj[$i]->constraints) ) continue;
  925. $numConstrains = count($this->iObj[$i]->constraints);
  926. for( $k = 0; $k < $numConstrains; $k++ ) {
  927. $vpos = $this->iObj[$i]->constraints[$k]->iConstrainRow;
  928. if( $vpos >= 0 ) {
  929. $c1 = $this->iObj[$i]->iConstrainPos;
  930. // Find out which object is on the target row
  931. $targetobj = -1;
  932. for( $j=0; $j < $n && $targetobj == -1; ++$j ) {
  933. if( $this->iObj[$j]->iVPos == $vpos ) {
  934. $targetobj = $j;
  935. }
  936. }
  937. if( $targetobj == -1 ) {
  938. JpGraphError::RaiseL(6008,$this->iObj[$i]->iVPos,$vpos);
  939. //('You have specifed a constrain from row='.$this->iObj[$i]->iVPos.' to row='.$vpos.' which does not have any activity.');
  940. }
  941. $c2 = $this->iObj[$targetobj]->iConstrainPos;
  942. if( count($c1) == 4 && count($c2 ) == 4) {
  943. switch( $this->iObj[$i]->constraints[$k]->iConstrainType ) {
  944. case CONSTRAIN_ENDSTART:
  945. if( $c1[1] < $c2[1] ) {
  946. $link = new GanttLink($c1[2],$c1[3],$c2[0],$c2[1]);
  947. }
  948. else {
  949. $link = new GanttLink($c1[2],$c1[1],$c2[0],$c2[3]);
  950. }
  951. $link->SetPath(3);
  952. break;
  953. case CONSTRAIN_STARTEND:
  954. if( $c1[1] < $c2[1] ) {
  955. $link = new GanttLink($c1[0],$c1[3],$c2[2],$c2[1]);
  956. }
  957. else {
  958. $link = new GanttLink($c1[0],$c1[1],$c2[2],$c2[3]);
  959. }
  960. $link->SetPath(0);
  961. break;
  962. case CONSTRAIN_ENDEND:
  963. if( $c1[1] < $c2[1] ) {
  964. $link = new GanttLink($c1[2],$c1[3],$c2[2],$c2[1]);
  965. }
  966. else {
  967. $link = new GanttLink($c1[2],$c1[1],$c2[2],$c2[3]);
  968. }
  969. $link->SetPath(1);
  970. break;
  971. case CONSTRAIN_STARTSTART:
  972. if( $c1[1] < $c2[1] ) {
  973. $link = new GanttLink($c1[0],$c1[3],$c2[0],$c2[1]);
  974. }
  975. else {
  976. $link = new GanttLink($c1[0],$c1[1],$c2[0],$c2[3]);
  977. }
  978. $link->SetPath(3);
  979. break;
  980. default:
  981. JpGraphError::RaiseL(6009,$this->iObj[$i]->iVPos,$vpos);
  982. //('Unknown constrain type specified from row='.$this->iObj[$i]->iVPos.' to row='.$vpos);
  983. break;
  984. }
  985. $link->SetColor($this->iObj[$i]->constraints[$k]->iConstrainColor);
  986. $link->SetArrow($this->iObj[$i]->constraints[$k]->iConstrainArrowSize,
  987. $this->iObj[$i]->constraints[$k]->iConstrainArrowType);
  988. $link->Stroke($this->img);
  989. }
  990. }
  991. }
  992. }
  993. }
  994. function GetCSIMAreas() {
  995. if( !$this->iHasStroked )
  996. $this->Stroke(_CSIM_SPECIALFILE);
  997. $csim = $this->title->GetCSIMAreas();
  998. $csim .= $this->subtitle->GetCSIMAreas();
  999. $csim .= $this->subsubtitle->GetCSIMAreas();
  1000. $n = count($this->iObj);
  1001. for( $i=$n-1; $i >= 0; --$i )
  1002. $csim .= $this->iObj[$i]->GetCSIMArea();
  1003. return $csim;
  1004. }
  1005. }
  1006. //===================================================
  1007. // CLASS PredefIcons
  1008. // Description: Predefined icons for use with Gantt charts
  1009. //===================================================
  1010. define('GICON_WARNINGRED',0);
  1011. define('GICON_TEXT',1);
  1012. define('GICON_ENDCONS',2);
  1013. define('GICON_MAIL',3);
  1014. define('GICON_STARTCONS',4);
  1015. define('GICON_CALC',5);
  1016. define('GICON_MAGNIFIER',6);
  1017. define('GICON_LOCK',7);
  1018. define('GICON_STOP',8);
  1019. define('GICON_WARNINGYELLOW',9);
  1020. define('GICON_FOLDEROPEN',10);
  1021. define('GICON_FOLDER',11);
  1022. define('GICON_TEXTIMPORTANT',12);
  1023. class PredefIcons {
  1024. private $iBuiltinIcon = null, $iLen = -1 ;
  1025. function GetLen() {
  1026. return $this->iLen ;
  1027. }
  1028. function GetImg($aIdx) {
  1029. if( $aIdx < 0 || $aIdx >= $this->iLen ) {
  1030. JpGraphError::RaiseL(6010,$aIdx);
  1031. //('Illegal icon index for Gantt builtin icon ['.$aIdx.']');
  1032. }
  1033. return Image::CreateFromString(base64_decode($this->iBuiltinIcon[$aIdx][1]));
  1034. }
  1035. function __construct() {
  1036. //==========================================================
  1037. // warning.png
  1038. //==========================================================
  1039. $this->iBuiltinIcon[0][0]= 1043 ;
  1040. $this->iBuiltinIcon[0][1]=
  1041. 'iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsSAAALEgHS3X78AAAA'.
  1042. 'B3RJTUUH0wgKFSgilWPhUQAAA6BJREFUeNrtl91rHFUYh5/3zMx+Z5JNUoOamCZNaqTZ6IWIkqRiQWmi1IDetHfeiCiltgXBP8AL'.
  1043. '0SIUxf/AvfRSBS9EKILFFqyIH9CEmFZtPqrBJLs7c+b1YneT3WTTbNsUFPLCcAbmzPt73o9zzgzs2Z793231UOdv3w9k9Z2uzOdA'.
  1044. '5+2+79yNeL7Hl7hw7oeixRMZ6PJM26W18DNAm/Vh7lR8fqh97NmMF11es1iFpMATqdirwMNA/J4DpIzkr5YsAF1PO6gIMYHRdPwl'.
  1045. 'oO2elmB+qH3sm7XozbkgYvy8SzYnZPtcblyM6I+5z3jQ+0vJfgpEu56BfI9vUkbyi2HZd1QJoeWRiAjBd4SDCW8SSAOy6wBHMzF7'.
  1046. 'YdV2A+ROuvRPLfHoiSU0EMY/cDAIhxJeGngKaN1VgHyPL7NBxI1K9P4QxBzw3K1zJ/zkG8B9uwaQ7/HNsRZv9kohBGD0o7JqMYS/'.
  1047. '/ynPidQw/LrBiPBcS/yFCT95DvB2BWAy4575PaQbQKW+tPd3GCItu2odKI++YxiKu0d26oWmAD7paZU/rLz37VqIijD2YbnzNBBE'.
  1048. 'IBHf8K8qjL7vYhCGErEU8CTg3xXAeMp96GrJEqkyXkm9Bhui1xfsunjdGhcYLq+IzjsGmBt5YH/cmJkFq6gIqlon3u4LxdKGuCIo'.
  1049. 'Qu41g0E41po+2R33Xt5uz9kRIB2UTle7PnfKrROP1HD4sRjZlq0lzhwoZ6rDNeTi3nEg1si/7FT7kYQbXS6E5E65tA5uRF9tutq0'.
  1050. 'K/VwAF+/FbIYWt6+tjQM/AqUms7A4Wy6d7YSfSNxgMmzi0ycWWworio4QJvj4LpuL5BqugTnXzzqJsJwurrlNhJXFaavW67NRw3F'.
  1051. 'q+aJcCQVe9fzvJGmAY7/dPH0gi0f64OveGxa+usCuQMeZ0+kt8BVrX+qPO9Bzx0MgqBvs+a2PfDdYIf+WAjXU1ub4tqNaPPzRs8A'.
  1052. 'blrli+WVn79cXn0cWKl+tGx7HLc7pu3CSmnfitL+l1UihAhwjFkPQev4K/fSABjBM8JCaFuurJU+rgW41SroA8aNMVNAFtgHJCsn'.
  1053. 'XGy/58QVxAC9MccJtZ5kIzNlW440WrJ2ea4YPA9cAooA7i0A/gS+iqLoOpB1HOegqrYB3UBmJrAtQAJwpwPr1Ry92wVlgZsiYlW1'.
  1054. 'uX1gU36dymgqYxJIJJNJT1W9QqHgNwFQBGYqo94OwHZQUuPD7ACglSvc+5n5T9m/wfJJX4U9qzEAAAAASUVORK5CYII=' ;
  1055. //==========================================================
  1056. // edit.png
  1057. //==========================================================
  1058. $this->iBuiltinIcon[1][0]= 959 ;
  1059. $this->iBuiltinIcon[1][1]=
  1060. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAFgAWABY9j+ZuwAAAAlwSFlz'.
  1061. 'AAALEAAACxABrSO9dQAAAAd0SU1FB9AKDAwbIEXOA6AAAAM8SURBVHicpdRPaBxlHMbx76ZvsmOTmm1dsEqQSIIsEmGVBAQjivEQ'.
  1062. 'PAUJngpWsAWlBw8egpQepKwplN4ULEG9CjkEyUFKlSJrWTG0IU51pCsdYW2ncUPjdtp9Z+f3vuNhu8nKbmhaf5cZeGc+PO8zf1Lc'.
  1063. 'm0KhkACICCKCMeaBjiLC0tLSnjNvPmuOHRpH0TZTU1M8zBi9wakzn7OFTs5sw8YYACYmJrre7HkeuVyu69qPF77hlT1XmZ0eQ03O'.
  1064. 'wOLJTvhBx1rLz18VmJ0eY+jVd2FxDkKXnvYLHgb97OgLzE4ON9Hzc1B1QaQzsed5O0Lta3Ec89OnR5h5McfQ+Mw2qgQUnfBOPbZ3'.
  1065. 'bK3l+xOvMT0+3ERLp5FNF6UEjcL32+DdVmGt5WLhDYYPZrbRqreFumXwql0S3w9tnDvLWD5PZigPpdOwuYpSCo3C8wU3UHxQdHbf'.
  1066. 'cZIkNM6dxcnlUM4k1eUFMlUPpUADbpkttFarHe6oYqeOr6yt4RzMQHYUcUsQVtGicHDwKprViuLDkkOtVnsHCHZVRVy/zcj1i5Af'.
  1067. 'h8AjdIts+hUcGcYPK3iBtKM3gD/uAzf/AdY2mmmVgy6X8YNNKmGIvyloPcB8SUin07RQ4EZHFdsdG0wkJEnEaHAJxvKEpSLeaokV'.
  1068. 'r4zWmhUZYLlY4b1D03y5eIEWCtS7vsciAgiIxkQRabWOrlQor66y4pUphoJb1jiO4uO5o0S3q6RSqVbiOmC7VCEgAhLSaDQ48dH7'.
  1069. 'vD46REY0iysegSjKQciRt99ib7qXwX0O+pG4teM6YKHLB9JMq4mTmF9/+AKA4wvLZByH7OgYL7+UY2qvw/7Bfg5kHiXjJFyv3CGO'.
  1070. 'Y1rof+BW4t/XLiPG0DCGr79d4XzRxRnIMn98huXSTYyJ6et1UNYQhRvcinpJq86H3wGPPPM0iBDd+QffD1g4eZjLvuG7S1Wef26E'.
  1071. 'J7L7eSx7gAHVg7V3MSbi6m/r93baBd6qQjerAJg/9Ql/XrvG0ON1+vv7GH3qSfY5fahUnSTpwZgIEQesaVXRPbHRG/xyJSAxMYlp'.
  1072. 'EOm71HUINiY7mGb95l/8jZCyQmJjMDGJjUmsdCROtZ0n/P/Z8v4Fs2MTUUf7vYoAAAAASUVORK5CYII=' ;
  1073. //==========================================================
  1074. // endconstrain.png
  1075. //==========================================================
  1076. $this->iBuiltinIcon[2][0]= 666 ;
  1077. $this->iBuiltinIcon[2][1]=
  1078. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGdBTUEAALGPC/xhBQAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlz'.
  1079. 'AAALDwAACw8BkvkDpQAAAAd0SU1FB9ALEREILkh0+eQAAAIXSURBVHictZU9aFNRFMd/N81HX77aptJUWmp1LHRpIcWhg5sIDlUQ'.
  1080. 'LAXB4t7RRUpwEhy7iQ46CCIoSHcl0CFaoVARU2MFMYktadLXJNok7x2HtCExvuYFmnO4w/3gx+Gc/z1HKRTdMEdXqHbB/sgc/sic'.
  1081. 'nDoYAI8XwDa8o1RMLT+2hAsigtTvbIGVqhX46szUifBGswUeCPgAGB7QeLk0X4Ork+HOxo1VgSqGASjMqkn8W4r4vVtEgI/RRQEL'.
  1082. 'vaoGD85cl5V3nySR/S1mxWxab7f35PnntNyMJeRr9kCMqiHTy09EoeToLwggx6ymiMOD/VwcD7Oa/MHkcIiQx026WGYto5P/U+ZZ'.
  1083. '7gD0QwDuT5z9N3LrVPi0Xs543eQPKkRzaS54eviJIp4tMFQFMllAWN2qcRZHBnixNM8NYD162xq8u7ePSQ+GX2Pjwxc2dB2cLtB8'.
  1084. '7GgamCb0anBYBeChMtl8855CarclxU1gvViiUK4w2OMkNDnGeJ8bt9fH90yOnOkCwLFTwhzykhvtYzOWoBBbY//R3dbaNTYhf2RO'.
  1085. 'QpeuUMzv188MlwuHy0H13HnE48UzMcL0WAtUHX8OxZHoG1URiFw7rnLLCswuSPD1ulze/iWjT2PSf+dBXRFtVVGIvzqph0pQL7VE'.
  1086. 'avXYaXXxPwsnt0imdttCocMmZBdK7YU9D8wuNOW0nXc6QWzPsSa5naZ1beb9BbGB6dxGtMnXAAAAAElFTkSuQmCC' ;
  1087. //==========================================================
  1088. // mail.png
  1089. //==========================================================
  1090. $this->iBuiltinIcon[3][0]= 1122 ;
  1091. $this->iBuiltinIcon[3][1]=
  1092. 'iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABGd…

Large files files are truncated, but you can click here to view the full file