PageRenderTime 56ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 1ms

/TEMPLATE/Reports/class/PHPJasperXML.inc.php

https://bitbucket.org/Lahiru_LCB/sep_wd_07
PHP | 3829 lines | 2955 code | 399 blank | 475 comment | 198 complexity | 3e2ded497e7c7e38aac9c7aac9fce426 MD5 | raw file
Possible License(s): LGPL-3.0, GPL-3.0, LGPL-2.1

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

  1. <?php
  2. //version 0.8c
  3. class PHPJasperXML {
  4. private $adjust=1.2;
  5. public $version=0.8;
  6. private $pdflib;
  7. private $lang;
  8. private $previousarraydata;
  9. public $debugsql=false;
  10. private $myconn;
  11. private $con;
  12. public $group_name;
  13. public $newPageGroup = false;
  14. private $curgroup=0;
  15. private $groupno=0;
  16. private $footershowed=true;
  17. private $titleheight=0;
  18. private $report_count=1; //### New declaration (variable exists in original too)
  19. private $group_count = array(); //### New declaration
  20. public function PHPJasperXML($lang="en",$pdflib="TCPDF") {
  21. $this->lang=$lang;
  22. error_reporting(0);
  23. $this->pdflib=$pdflib;
  24. }
  25. public function connect($db_host,$db_user,$db_pass,$db_or_dsn_name,$cndriver="mysql") {
  26. $this->db_host=$db_host;
  27. $this->db_user=$db_user;
  28. $this->db_pass=$db_pass;
  29. $this->db_or_dsn_name=$db_or_dsn_name;
  30. $this->cndriver=$cndriver;
  31. if($cndriver=="mysql") {
  32. if(!$this->con) {
  33. $this->myconn = @mysql_connect($db_host,$db_user,$db_pass);
  34. if($this->myconn) {
  35. $seldb = @mysql_select_db($db_or_dsn_name,$this->myconn);
  36. if($seldb) {
  37. $this->con = true;
  38. return true;
  39. }
  40. else {
  41. return false;
  42. }
  43. } else {
  44. return false;
  45. }
  46. } else {
  47. return true;
  48. }
  49. return true;
  50. }elseif($cndriver=="psql") {
  51. global $pgport;
  52. if($pgport=="" || $pgport==0)
  53. $pgport=5432;
  54. $conn_string = "host=$db_host port=$pgport dbname=$db_or_dsn_name user=$db_user password=$db_pass";
  55. $this->myconn = pg_connect($conn_string);
  56. if($this->myconn) {
  57. $this->con = true;
  58. return true;
  59. }else
  60. return false;
  61. }
  62. else {
  63. if(!$this->con) {
  64. $this->myconn = odbc_connect($db_or_dsn_name,$db_user,$db_pass);
  65. if( $this->myconn) {
  66. $this->con = true;
  67. return true;
  68. } else {
  69. return false;
  70. }
  71. } else {
  72. return true;
  73. }
  74. }
  75. }
  76. public function disconnect($cndriver="mysql") {
  77. if($cndriver=="mysql") {
  78. if($this->con) {
  79. if(@mysql_close()) {
  80. $this->con = false;
  81. return true;
  82. }
  83. else {
  84. return false;
  85. }
  86. }
  87. }elseif($cndriver=="psql") {
  88. $this->con = false;
  89. pg_close($this->myconn);
  90. }
  91. else {
  92. $this->con = false;
  93. odbc_close( $this->myconn);
  94. }
  95. }
  96. public function xml_dismantle($xml) {
  97. $this->page_setting($xml);
  98. foreach ($xml as $k=>$out) {
  99. switch($k) {
  100. case "parameter":
  101. $this->parameter_handler($out);
  102. break;
  103. case "queryString":
  104. $this->queryString_handler($out);
  105. break;
  106. case "field":
  107. $this->field_handler($out);
  108. break;
  109. case "variable":
  110. $this->variable_handler($out);
  111. break;
  112. case "group":
  113. $this->group_handler($out);
  114. break;
  115. case "subDataset":
  116. $this->subDataset_handler($out);
  117. break;
  118. case "background":
  119. $this->pointer=&$this->arraybackground;
  120. $this->pointer[]=array("height"=>$out->band["height"],"splitType"=>$out->band["splitType"]);
  121. foreach ($out as $bg) {
  122. $this->default_handler($bg);
  123. }
  124. break;
  125. default:
  126. foreach ($out as $object) {
  127. eval("\$this->pointer=&"."\$this->array$k".";");
  128. $this->arrayband[]=array("name"=>$k);
  129. if($k=='detail')
  130. $this->detailbandheight=$object["height"]+0;
  131. elseif($k=='pageHeader')
  132. $this->headerbandheight=$object["height"]+0;
  133. elseif($k=='pageFooter')
  134. $this->footerbandheight=$object["height"]+0;
  135. elseif($k=='lastPageFooter')
  136. $this->lastfooterbandheight=$object["height"]+0;
  137. elseif($k=='summary')
  138. $this->summarybandheight=$object["height"]+0;
  139. $this->pointer[]=array("type"=>"band","height"=>$object["height"],"splitType"=>$object["splitType"],"y_axis"=>$this->y_axis);
  140. $this->default_handler($object);
  141. }
  142. $this->y_axis=$this->y_axis+$out->band["height"]; //after handle , then adjust y axis
  143. break;
  144. }
  145. }
  146. }
  147. public function subDataset_handler($data){
  148. $this->subdataset[$data['name'].'']= $data->queryString;
  149. }
  150. //read level 0,Jasperreport page setting
  151. public function page_setting($xml_path) {
  152. $this->arrayPageSetting["orientation"]="P";
  153. $this->arrayPageSetting["name"]=$xml_path["name"];
  154. $this->arrayPageSetting["language"]=$xml_path["language"];
  155. $this->arrayPageSetting["pageWidth"]=$xml_path["pageWidth"];
  156. $this->arrayPageSetting["pageHeight"]=$xml_path["pageHeight"];
  157. if(isset($xml_path["orientation"])) {
  158. $this->arrayPageSetting["orientation"]=substr($xml_path["orientation"],0,1);
  159. }
  160. $this->arrayPageSetting["columnWidth"]=$xml_path["columnWidth"];
  161. $this->arrayPageSetting["leftMargin"]=$xml_path["leftMargin"];
  162. $this->arrayPageSetting["rightMargin"]=$xml_path["rightMargin"];
  163. $this->arrayPageSetting["topMargin"]=$xml_path["topMargin"];
  164. $this->y_axis=$xml_path["topMargin"];
  165. $this->arrayPageSetting["bottomMargin"]=$xml_path["bottomMargin"];
  166. }
  167. public function parameter_handler($xml_path) {
  168. // $defaultValueExpression=str_replace('"','',$xml_path->defaultValueExpression);
  169. // if($defaultValueExpression!='')
  170. // $this->arrayParameter[$xml_path["name"].'']=$defaultValueExpression;
  171. // else
  172. $this->arrayParameter[$xml_path["name"].''];
  173. }
  174. public function queryString_handler($xml_path) {
  175. $this->sql =$xml_path;
  176. if(isset($this->arrayParameter)) {
  177. foreach($this->arrayParameter as $v => $a) {
  178. $this->sql = str_replace('$P{'.$v.'}', $a, $this->sql);
  179. }
  180. }
  181. }
  182. public function field_handler($xml_path) {
  183. $this->arrayfield[]=$xml_path["name"];
  184. }
  185. public function variable_handler($xml_path) {
  186. $this->arrayVariable["$xml_path[name]"]=array("calculation"=>$xml_path["calculation"],"target"=>substr($xml_path->variableExpression,3,-1),"class"=>$xml_path["class"] , "resetType"=>$xml_path["resetType"]);
  187. }
  188. public function group_handler($xml_path) {
  189. // $this->arraygroup=$xml_path;
  190. if($xml_path["isStartNewPage"]=="true")
  191. $this->newPageGroup=true;
  192. else
  193. $this->newPageGroup="";
  194. foreach($xml_path as $tag=>$out) {
  195. switch ($tag) {
  196. case "groupHeader":
  197. $this->pointer=&$this->arraygroup[$xml_path["name"]]["groupHeader"];
  198. $this->pointer=&$this->arraygrouphead;
  199. $this->arraygroupheadheight=$out->band["height"];
  200. $this->arrayband[]=array("name"=>"group", "gname"=>$xml_path["name"],"isStartNewPage"=>$xml_path["isStartNewPage"],"groupExpression"=>substr($xml_path->groupExpression,3,-1));
  201. $this->pointer[]=array("type"=>"band","height"=>$out->band["height"]+0,"y_axis"=>"","groupExpression"=>substr($xml_path->groupExpression,3,-1));
  202. //### Modification for group count
  203. $gnam=$xml_path["name"];
  204. $this->gnam=$xml_path["name"];
  205. $this->group_count["$gnam"]=1; // Count rows of groups, we're on the first row of the group.
  206. //### End of modification
  207. foreach($out as $band) {
  208. $this->default_handler($band);
  209. }
  210. $this->y_axis=$this->y_axis+$out->band["height"]; //after handle , then adjust y axis
  211. break;
  212. case "groupFooter":
  213. $this->pointer=&$this->arraygroup[$xml_path["name"]]["groupFooter"];
  214. $this->pointer=&$this->arraygroupfoot;
  215. $this->arraygroupfootheight=$out->band["height"];
  216. $this->pointer[]=array("type"=>"band","height"=>$out->band["height"]+0,"y_axis"=>"","groupExpression"=>substr($xml_path->groupExpression,3,-1));
  217. foreach($out as $b=>$band) {
  218. $this->default_handler($band);
  219. }
  220. break;
  221. default:
  222. break;
  223. }
  224. }
  225. }
  226. public function default_handler($xml_path) {
  227. foreach($xml_path as $k=>$out) {
  228. switch($k) {
  229. case "staticText":
  230. $this->element_staticText($out);
  231. break;
  232. case "image":
  233. $this->element_image($out);
  234. break;
  235. case "line":
  236. $this->element_line($out);
  237. break;
  238. case "rectangle":
  239. $this->element_rectangle($out);
  240. break;
  241. case "ellipse":
  242. $this->element_ellipse($out);
  243. break;
  244. case "textField":
  245. $this->element_textField($out);
  246. break;
  247. // case "stackedBarChart":
  248. // $this->element_barChart($out,'StackedBarChart');
  249. // break;
  250. // case "barChart":
  251. // $this->element_barChart($out,'BarChart');
  252. // break;
  253. // case "pieChart":
  254. // $this->element_pieChart($out);
  255. // break;
  256. // case "pie3DChart":
  257. // $this->element_pie3DChart($out);
  258. // break;
  259. // case "lineChart":
  260. // $this->element_lineChart($out);
  261. // break;
  262. // case "stackedAreaChart":
  263. // $this->element_areaChart($out,'stackedAreaChart');
  264. // break;
  265. case "stackedBarChart":
  266. $this->element_Chart($out,'stackedBarChart');
  267. break;
  268. case "barChart":
  269. $this->element_Chart($out,'barChart');
  270. break;
  271. case "pieChart":
  272. $this->element_Chart($out,'pieChart');
  273. break;
  274. case "pie3DChart":
  275. $this->element_pie3DChart($out,'pie3DChart');
  276. break;
  277. case "lineChart":
  278. $this->element_Chart($out,'lineChart');
  279. break;
  280. case "stackedAreaChart":
  281. $this->element_Chart($out,'stackedAreaChart');
  282. break;
  283. case "subreport":
  284. $this->element_subReport($out);
  285. break;
  286. default:
  287. break;
  288. }
  289. };
  290. }
  291. public function element_staticText($data) {
  292. $align="L";
  293. $fill=0;
  294. $border=0;
  295. $fontsize=10;
  296. $font="helvetica";
  297. $fontstyle="";
  298. $textcolor = array("r"=>0,"g"=>0,"b"=>0);
  299. $fillcolor = array("r"=>255,"g"=>255,"b"=>255);
  300. $txt="";
  301. $rotation="";
  302. $drawcolor=array("r"=>0,"g"=>0,"b"=>0);
  303. $height=$data->reportElement["height"];
  304. $stretchoverflow="true";
  305. $printoverflow="false";
  306. if(isset($data->reportElement["forecolor"])) {
  307. $textcolor = array('forecolor'=>$data->reportElement["forecolor"],"r"=>hexdec(substr($data->reportElement["forecolor"],1,2)),"g"=>hexdec(substr($data->reportElement["forecolor"],3,2)),"b"=>hexdec(substr($data->reportElement["forecolor"],5,2)));
  308. }
  309. if(isset($data->reportElement["backcolor"])) {
  310. $fillcolor = array('backcolor'=>$data->reportElement["backcolor"],"r"=>hexdec(substr($data->reportElement["backcolor"],1,2)),"g"=>hexdec(substr($data->reportElement["backcolor"],3,2)),"b"=>hexdec(substr($data->reportElement["backcolor"],5,2)));
  311. }
  312. if($data->reportElement["mode"]=="Opaque") {
  313. $fill=1;
  314. }
  315. if(isset($data["isStretchWithOverflow"])&&$data["isStretchWithOverflow"]=="true") {
  316. $stretchoverflow="true";
  317. }
  318. if(isset($data->reportElement["isPrintWhenDetailOverflows"])&&$data->reportElement["isPrintWhenDetailOverflows"]=="true") {
  319. $printoverflow="true";
  320. $stretchoverflow="false";
  321. }
  322. if((isset($data->box))&&($data->box->pen["lineWidth"]>0)) {
  323. $border=1;
  324. if(isset($data->box->pen["lineColor"])) {
  325. $drawcolor=array("r"=>hexdec(substr($data->box->pen["lineColor"],1,2)),"g"=>hexdec(substr($data->box->pen["lineColor"],3,2)),"b"=>hexdec(substr($data->box->pen["lineColor"],5,2)));
  326. }
  327. }
  328. if(isset($data->textElement["textAlignment"])) {
  329. $align=$this->get_first_value($data->textElement["textAlignment"]);
  330. }
  331. if(isset($data->textElement["rotation"])) {
  332. $rotation=$data->textElement["rotation"];
  333. }
  334. if(isset($data->textElement->font["pdfFontName"])) {
  335. $font=$data->textElement->font["pdfFontName"];
  336. }
  337. if(isset($data->textElement->font["size"])) {
  338. $fontsize=$data->textElement->font["size"];
  339. }
  340. if(isset($data->textElement->font["isBold"])&&$data->textElement->font["isBold"]=="true") {
  341. $fontstyle=$fontstyle."B";
  342. }
  343. if(isset($data->textElement->font["isItalic"])&&$data->textElement->font["isItalic"]=="true") {
  344. $fontstyle=$fontstyle."I";
  345. }
  346. if(isset($data->textElement->font["isUnderline"])&&$data->textElement->font["isUnderline"]=="true") {
  347. $fontstyle=$fontstyle."U";
  348. }
  349. if(isset($data->reportElement["key"])) {
  350. $height=$fontsize*$this->adjust;
  351. }
  352. $this->pointer[]=array("type"=>"SetXY","x"=>$data->reportElement["x"],"y"=>$data->reportElement["y"],"hidden_type"=>"SetXY");
  353. $this->pointer[]=array("type"=>"SetTextColor",'forecolor'=>$data->reportElement["forecolor"].'',"r"=>$textcolor["r"],"g"=>$textcolor["g"],"b"=>$textcolor["b"],"hidden_type"=>"textcolor");
  354. $this->pointer[]=array("type"=>"SetDrawColor","r"=>$drawcolor["r"],"g"=>$drawcolor["g"],"b"=>$drawcolor["b"],"hidden_type"=>"drawcolor");
  355. $this->pointer[]=array("type"=>"SetFillColor",'backcolor'=>$data->reportElement["backcolor"].'',"r"=>$fillcolor["r"],"g"=>$fillcolor["g"],"b"=>$fillcolor["b"],"hidden_type"=>"fillcolor");
  356. $this->pointer[]=array("type"=>"SetFont","font"=>$font,"fontstyle"=>$fontstyle,"fontsize"=>$fontsize,"hidden_type"=>"font");
  357. //"height"=>$data->reportElement["height"]
  358. //### UTF-8 characters, a must for me.
  359. $txtEnc=utf8_decode($data->text);
  360. $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>$txtEnc,"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"statictext","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"rotation"=>$rotation);
  361. //### End of modification, below is the original line
  362. // $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>$data->text,"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"statictext","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"rotation"=>$rotation);
  363. }
  364. public function element_image($data) {
  365. $imagepath=$data->imageExpression;
  366. //$imagepath= substr($data->imageExpression, 1, -1);
  367. //$imagetype= substr($imagepath,-3);
  368. switch($data[scaleImage]) {
  369. case "FillFrame":
  370. $this->pointer[]=array("type"=>"Image","path"=>$imagepath,"x"=>$data->reportElement["x"]+0,"y"=>$data->reportElement["y"]+0,"width"=>$data->reportElement["width"]+0,"height"=>$data->reportElement["height"]+0,"imgtype"=>$imagetype,"link"=>substr($data->hyperlinkReferenceExpression,1,-1),"hidden_type"=>"image");
  371. break;
  372. default:
  373. $this->pointer[]=array("type"=>"Image","path"=>$imagepath,"x"=>$data->reportElement["x"]+0,"y"=>$data->reportElement["y"]+0,"width"=>$data->reportElement["width"]+0,"height"=>$data->reportElement["height"]+0,"imgtype"=>$imagetype,"link"=>substr($data->hyperlinkReferenceExpression,1,-1),"hidden_type"=>"image");
  374. break;
  375. }
  376. }
  377. public function element_line($data) { //default line width=0.567(no detect line width)
  378. $drawcolor=array("r"=>0,"g"=>0,"b"=>0);
  379. $hidden_type="line";
  380. if(isset($data->reportElement["forecolor"])) {
  381. $drawcolor=array("r"=>hexdec(substr($data->reportElement["forecolor"],1,2)),"g"=>hexdec(substr($data->reportElement["forecolor"],3,2)),"b"=>hexdec(substr($data->reportElement["forecolor"],5,2)));
  382. }
  383. $this->pointer[]=array("type"=>"SetDrawColor","r"=>$drawcolor["r"],"g"=>$drawcolor["g"],"b"=>$drawcolor["b"],"hidden_type"=>"drawcolor");
  384. if(isset($data->reportElement[positionType])&&$data->reportElement[positionType]=="FixRelativeToBottom") {
  385. $hidden_type="relativebottomline";
  386. }
  387. if($data->reportElement["width"][0]+0 > $data->reportElement["height"][0]+0) //width > height means horizontal line
  388. {
  389. $this->pointer[]=array("type"=>"Line", "x1"=>$data->reportElement["x"],"y1"=>$data->reportElement["y"],"x2"=>$data->reportElement["x"]+$data->reportElement["width"],"y2"=>$data->reportElement["y"]+$data->reportElement["height"]-1,"hidden_type"=>$hidden_type);
  390. }
  391. elseif($data->reportElement["height"][0]+0>$data->reportElement["width"][0]+0) //vertical line
  392. {
  393. $this->pointer[]=array("type"=>"Line", "x1"=>$data->reportElement["x"],"y1"=>$data->reportElement["y"],"x2"=>$data->reportElement["x"]+$data->reportElement["width"]-1,"y2"=>$data->reportElement["y"]+$data->reportElement["height"],"hidden_type"=>$hidden_type);
  394. }
  395. $this->pointer[]=array("type"=>"SetDrawColor","r"=>0,"g"=>0,"b"=>0,"hidden_type"=>"drawcolor");
  396. $this->pointer[]=array("type"=>"SetFillColor","r"=>255,"g"=>255,"b"=>255,"hidden_type"=>"fillcolor");
  397. }
  398. public function element_rectangle($data) {
  399. $radius=$data['radius'];
  400. $drawcolor=array("r"=>0,"g"=>0,"b"=>0);
  401. $fillcolor=array("r"=>255,"g"=>255,"b"=>255);
  402. if(isset($data->reportElement["forecolor"])) {
  403. $drawcolor=array("r"=>hexdec(substr($data->reportElement["forecolor"],1,2)),"g"=>hexdec(substr($data->reportElement["forecolor"],3,2)),"b"=>hexdec(substr($data->reportElement["forecolor"],5,2)));
  404. }
  405. if(isset($data->reportElement["backcolor"]) ) {
  406. $fillcolor=array("r"=>hexdec(substr($data->reportElement["backcolor"],1,2)),"g"=>hexdec(substr($data->reportElement["backcolor"],3,2)),"b"=>hexdec(substr($data->reportElement["backcolor"],5,2)));
  407. }
  408. $this->pointer[]=array("type"=>"SetDrawColor","r"=>$drawcolor["r"],"g"=>$drawcolor["g"],"b"=>$drawcolor["b"],"hidden_type"=>"drawcolor");
  409. $this->pointer[]=array("type"=>"SetFillColor","r"=>$fillcolor["r"],"g"=>$fillcolor["g"],"b"=>$fillcolor["b"],"hidden_type"=>"fillcolor");
  410. if($radius=='')
  411. $this->pointer[]=array("type"=>"Rect","x"=>$data->reportElement["x"],"y"=>$data->reportElement["y"],"width"=>$data->reportElement["width"],"height"=>$data->reportElement["height"],"hidden_type"=>"rect","drawcolor"=>$drawcolor,"fillcolor"=>$fillcolor,"mode"=>$data->reportElement["mode"]);
  412. else
  413. $this->pointer[]=array("type"=>"RoundedRect","x"=>$data->reportElement["x"],"y"=>$data->reportElement["y"],"width"=>$data->reportElement["width"],"height"=>$data->reportElement["height"],"hidden_type"=>"roundedrect","radius"=>$radius,"drawcolor"=>$drawcolor,"fillcolor"=>$fillcolor,"mode"=>$data->reportElement["mode"]);
  414. $this->pointer[]=array("type"=>"SetDrawColor","r"=>0,"g"=>0,"b"=>0,"hidden_type"=>"drawcolor");
  415. $this->pointer[]=array("type"=>"SetFillColor","r"=>255,"g"=>255,"b"=>255,"hidden_type"=>"fillcolor");
  416. }
  417. public function element_ellipse($data) {
  418. $drawcolor=array("r"=>0,"g"=>0,"b"=>0);
  419. $fillcolor=array("r"=>255,"g"=>255,"b"=>255);
  420. if(isset($data->reportElement["forecolor"])) {
  421. $drawcolor=array("r"=>hexdec(substr($data->reportElement["forecolor"],1,2)),"g"=>hexdec(substr($data->reportElement["forecolor"],3,2)),"b"=>hexdec(substr($data->reportElement["forecolor"],5,2)));
  422. }
  423. if(isset($data->reportElement["backcolor"])) {
  424. $fillcolor=array("r"=>hexdec(substr($data->reportElement["backcolor"],1,2)),"g"=>hexdec(substr($data->reportElement["backcolor"],3,2)),"b"=>hexdec(substr($data->reportElement["backcolor"],5,2)));
  425. }
  426. //$color=array("r"=>$drawcolor["r"],"g"=>$drawcolor["g"],"b"=>$drawcolor["b"]);
  427. $this->pointer[]=array("type"=>"SetFillColor","r"=>$fillcolor["r"],"g"=>$fillcolor["g"],"b"=>$fillcolor["b"],"hidden_type"=>"fillcolor");
  428. $this->pointer[]=array("type"=>"SetDrawColor","r"=>$drawcolor["r"],"g"=>$drawcolor["g"],"b"=>$drawcolor["b"],"hidden_type"=>"drawcolor");
  429. $this->pointer[]=array("type"=>"Ellipse","x"=>$data->reportElement["x"],"y"=>$data->reportElement["y"],"width"=>$data->reportElement["width"],"height"=>$data->reportElement["height"],"hidden_type"=>"ellipse","drawcolor"=>$drawcolor,"fillcolor"=>$fillcolor);
  430. $this->pointer[]=array("type"=>"SetDrawColor","r"=>0,"g"=>0,"b"=>0,"hidden_type"=>"drawcolor");
  431. $this->pointer[]=array("type"=>"SetFillColor","r"=>255,"g"=>255,"b"=>255,"hidden_type"=>"fillcolor");
  432. }
  433. public function element_textField($data) {
  434. $align="L";
  435. $fill=0;
  436. $border=0;
  437. $fontsize=10;
  438. $font="helvetica";
  439. $rotation="";
  440. $fontstyle="";
  441. $textcolor = array("r"=>0,"g"=>0,"b"=>0);
  442. $fillcolor = array("r"=>255,"g"=>255,"b"=>255);
  443. $stretchoverflow="false";
  444. $printoverflow="false";
  445. $height=$data->reportElement["height"];
  446. $drawcolor=array("r"=>0,"g"=>0,"b"=>0);
  447. if(isset($data->reportElement["forecolor"])) {
  448. $textcolor = array("r"=>hexdec(substr($data->reportElement["forecolor"],1,2)),"g"=>hexdec(substr($data->reportElement["forecolor"],3,2)),"b"=>hexdec(substr($data->reportElement["forecolor"],5,2)));
  449. }
  450. if(isset($data->reportElement["backcolor"])) {
  451. $fillcolor = array("r"=>hexdec(substr($data->reportElement["backcolor"],1,2)),"g"=>hexdec(substr($data->reportElement["backcolor"],3,2)),"b"=>hexdec(substr($data->reportElement["backcolor"],5,2)));
  452. }
  453. if($data->reportElement["mode"]=="Opaque") {
  454. $fill=1;
  455. }
  456. if(isset($data["isStretchWithOverflow"])&&$data["isStretchWithOverflow"]=="true") {
  457. $stretchoverflow="true";
  458. }
  459. if(isset($data->reportElement["isPrintWhenDetailOverflows"])&&$data->reportElement["isPrintWhenDetailOverflows"]=="true") {
  460. $printoverflow="true";
  461. }
  462. if(isset($data->box)&&$data->box->pen["lineWidth"]>0) {
  463. $border=1;
  464. if(isset($data->box->pen["lineColor"])) {
  465. $drawcolor=array("r"=>hexdec(substr($data->box->pen["lineColor"],1,2)),"g"=>hexdec(substr($data->box->pen["lineColor"],3,2)),"b"=>hexdec(substr($data->box->pen["lineColor"],5,2)));
  466. }
  467. }
  468. if(isset($data->reportElement["key"])) {
  469. $height=$fontsize*$this->adjust;
  470. }
  471. if(isset($data->textElement["textAlignment"])) {
  472. $align=$this->get_first_value($data->textElement["textAlignment"]);
  473. }
  474. if(isset($data->textElement["rotation"])) {
  475. $rotation=$data->textElement["rotation"];
  476. }
  477. if(isset($data->textElement->font["pdfFontName"])) {
  478. $font=$data->textElement->font["pdfFontName"];
  479. }
  480. if(isset($data->textElement->font["size"])) {
  481. $fontsize=$data->textElement->font["size"];
  482. }
  483. if(isset($data->textElement->font["isBold"])&&$data->textElement->font["isBold"]=="true") {
  484. $fontstyle=$fontstyle."B";
  485. }
  486. if(isset($data->textElement->font["isItalic"])&&$data->textElement->font["isItalic"]=="true") {
  487. $fontstyle=$fontstyle."I";
  488. }
  489. if(isset($data->textElement->font["isUnderline"])&&$data->textElement->font["isUnderline"]=="true") {
  490. $fontstyle=$fontstyle."U";
  491. }
  492. $this->pointer[]=array("type"=>"SetXY","x"=>$data->reportElement["x"],"y"=>$data->reportElement["y"],"hidden_type"=>"SetXY");
  493. $this->pointer[]=array("type"=>"SetTextColor","forecolor"=>$data->reportElement["forecolor"],"r"=>$textcolor["r"],"g"=>$textcolor["g"],"b"=>$textcolor["b"],"hidden_type"=>"textcolor");
  494. $this->pointer[]=array("type"=>"SetDrawColor","r"=>$drawcolor["r"],"g"=>$drawcolor["g"],"b"=>$drawcolor["b"],"hidden_type"=>"drawcolor");
  495. $this->pointer[]=array("type"=>"SetFillColor","backcolor"=>$data->reportElement["backcolor"],"r"=>$fillcolor["r"],"g"=>$fillcolor["g"],"b"=>$fillcolor["b"],"hidden_type"=>"fillcolor");
  496. $this->pointer[]=array("type"=>"SetFont","font"=>$font,"fontstyle"=>$fontstyle,"fontsize"=>$fontsize,"hidden_type"=>"font");
  497. //$data->hyperlinkReferenceExpression=$this->analyse_expression($data->hyperlinkReferenceExpression);
  498. //if( $data->hyperlinkReferenceExpression!=''){echo "$data->hyperlinkReferenceExpression";die;}
  499. switch ($data->textFieldExpression) {
  500. case 'new java.util.Date()':
  501. //### New: =>date("Y.m.d.",....
  502. $this->pointer[]=array ("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>date("Y-m-d H:i:s"),"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"date","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"link"=>substr($data->hyperlinkReferenceExpression,1,-1));
  503. //### End of modification
  504. break;
  505. case '"Page "+$V{PAGE_NUMBER}+" of"':
  506. $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>'Page $this->PageNo() of',"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"pageno","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"link"=>substr($data->hyperlinkReferenceExpression,1,-1),"pattern"=>$data["pattern"]);
  507. break;
  508. case '$V{PAGE_NUMBER}':
  509. if(isset($data["evaluationTime"])&&$data["evaluationTime"]=="Report") {
  510. $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>'{nb}',"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"pageno","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"link"=>substr($data->hyperlinkReferenceExpression,1,-1),"pattern"=>$data["pattern"]);
  511. }
  512. else {
  513. $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>'$this->PageNo()',"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"pageno","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"link"=>substr($data->hyperlinkReferenceExpression,1,-1),"pattern"=>$data["pattern"]);
  514. }
  515. break;
  516. case '" " + $V{PAGE_NUMBER}':
  517. $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>' {nb}',"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"nb","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"link"=>substr($data->hyperlinkReferenceExpression,1,-1),"pattern"=>$data["pattern"]);
  518. break;
  519. case '$V{REPORT_COUNT}':
  520. //### $this->report_count=0;
  521. $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>&$this->report_count,"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"report_count","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"link"=>substr($data->hyperlinkReferenceExpression,1,-1),"pattern"=>$data["pattern"]);
  522. break;
  523. case '$V{'.$this->gnam.'_COUNT}':
  524. // case '$V{'.$this->arrayband[0]["gname"].'_COUNT}':
  525. //### $this->group_count=0;
  526. $gnam=$this->arrayband[0]["gname"];
  527. $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>&$this->group_count["$this->gnam"],"border"=>$border,"align"=>$align,"fill"=>$fill,"hidden_type"=>"group_count","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,"link"=>substr($data->hyperlinkReferenceExpression,1,-1),"pattern"=>$data["pattern"]);
  528. break;
  529. default:
  530. $writeHTML=false;
  531. if($data->reportElement->property["name"]=="writeHTML")
  532. $writeHTML=$data->reportElement->property["value"];
  533. if(isset($data->reportElement["isPrintRepeatedValues"]))
  534. $isPrintRepeatedValues=$data->reportElement["isPrintRepeatedValues"];
  535. $this->pointer[]=array("type"=>"MultiCell","width"=>$data->reportElement["width"],"height"=>$height,"txt"=>$data->textFieldExpression,
  536. "border"=>$border,"align"=>$align,"fill"=>$fill,
  537. "hidden_type"=>"field","soverflow"=>$stretchoverflow,"poverflow"=>$printoverflow,
  538. "printWhenExpression"=>$data->reportElement->printWhenExpression,
  539. "link"=>substr($data->hyperlinkReferenceExpression,1,-1),"pattern"=>$data["pattern"],
  540. "writeHTML"=>$writeHTML,"isPrintRepeatedValues"=>$isPrintRepeatedValues,"rotation"=>$rotation);
  541. break;
  542. }
  543. }
  544. public function element_subReport($data) {
  545. // $b=$data->subreportParameter;
  546. $srsearcharr=array('.jasper','"',"'",' ','$P{SUBREPORT_DIR}+');
  547. $srrepalcearr=array('.jrxml',"","",'',$this->arrayParameter['SUBREPORT_DIR']);
  548. if (strpos($data->subreportExpression,'$P{SUBREPORT_DIR}') === false){
  549. $subreportExpression=str_replace($srsearcharr,$srrepalcearr,$data->subreportExpression);
  550. }
  551. else{
  552. $subreportExpression=str_replace($srsearcharr,$srrepalcearr,$data->subreportExpression);
  553. }
  554. $b=array();
  555. foreach($data as $name=>$out){
  556. if($name=='subreportParameter'){
  557. $b[$out['name'].'']=$out->subreportParameterExpression;
  558. }
  559. }//loop to let multiple parameter pass to subreport pass to subreport
  560. $this->pointer[]=array("type"=>"subreport", "x"=>$data->reportElement["x"], "y"=>$data->reportElement["y"],
  561. "width"=>$data->reportElement["width"], "height"=>$data->reportElement["height"],
  562. "subreportparameterarray"=>$b,"connectionExpression"=>$data->connectionExpression,
  563. "subreportExpression"=>$subreportExpression,"hidden_type"=>"subreport");
  564. }
  565. public function transferDBtoArray($host,$user,$password,$db_or_dsn_name,$cndriver="mysql") {
  566. $this->m=0;
  567. if(!$this->connect($host,$user,$password,$db_or_dsn_name,$cndriver)) //connect database
  568. {
  569. echo "Fail to connect database";
  570. exit(0);
  571. }
  572. if($this->debugsql==true) {
  573. echo $this->sql;
  574. die;
  575. }
  576. if($cndriver=="odbc") {
  577. $result=odbc_exec( $this->myconn,$this->sql);
  578. while ($row = odbc_fetch_array($result)) {
  579. foreach($this->arrayfield as $out) {
  580. $this->arraysqltable[$this->m]["$out"]=$row["$out"];
  581. }
  582. $this->m++;
  583. }
  584. }elseif($cndriver=="psql") {
  585. pg_send_query($this->myconn,$this->sql);
  586. $result = pg_get_result($this->myconn);
  587. while ($row = pg_fetch_array($result, NULL, PGSQL_ASSOC)) {
  588. foreach($this->arrayfield as $out) {
  589. $this->arraysqltable[$this->m]["$out"]=$row["$out"];
  590. }
  591. $this->m++;
  592. }
  593. }
  594. else {
  595. $result = @mysql_query($this->sql); //query from db
  596. while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
  597. foreach($this->arrayfield as $out) {
  598. $this->arraysqltable[$this->m]["$out"]=$row["$out"];
  599. }
  600. $this->m++;
  601. }
  602. }
  603. //close connection to db
  604. }
  605. public function time_to_sec($time) {
  606. $hours = substr($time, 0, -6);
  607. $minutes = substr($time, -5, 2);
  608. $seconds = substr($time, -2);
  609. return $hours * 3600 + $minutes * 60 + $seconds;
  610. }
  611. public function sec_to_time($seconds) {
  612. $hours = floor($seconds / 3600);
  613. $minutes = floor($seconds % 3600 / 60);
  614. $seconds = $seconds % 60;
  615. return sprintf("%d:%02d:%02d", $hours, $minutes, $seconds);
  616. }
  617. public function orivariable_calculation() {
  618. foreach($this->arrayVariable as $k=>$out) {
  619. // echo $out['resetType']. "<br/><br/>";
  620. switch($out["calculation"]) {
  621. case "Sum":
  622. $sum=0;
  623. if(isset($this->arrayVariable[$k]['class'])&&$this->arrayVariable[$k]['class']=="java.sql.Time") {
  624. foreach($this->arraysqltable as $table) {
  625. $sum=$sum+$this->time_to_sec($table["$out[target]"]);
  626. //$sum=$sum+substr($table["$out[target]"],0,2)*3600+substr($table["$out[target]"],3,2)*60+substr($table["$out[target]"],6,2);
  627. }
  628. //$sum= floor($sum / 3600).":".floor($sum%3600 / 60);
  629. //if($sum=="0:0"){$sum="00:00";}
  630. $sum=$this->sec_to_time($sum);
  631. }
  632. else {
  633. foreach($this->arraysqltable as $table) {
  634. $sum=$sum+$table[$out["target"]];
  635. $table[$out["target"]];
  636. }
  637. }
  638. $this->arrayVariable[$k]["ans"]=$sum;
  639. break;
  640. case "Average":
  641. $sum=0;
  642. if(isset($this->arrayVariable[$k]['class'])&&$this->arrayVariable[$k]['class']=="java.sql.Time") {
  643. $m=0;
  644. foreach($this->arraysqltable as $table) {
  645. $m++;
  646. $sum=$sum+$this->time_to_sec($table["$out[target]"]);
  647. }
  648. $sum=$this->sec_to_time($sum/$m);
  649. $this->arrayVariable[$k]["ans"]=$sum;
  650. }
  651. else {
  652. $this->arrayVariable[$k]["ans"]=$sum;
  653. $m=0;
  654. foreach($this->arraysqltable as $table) {
  655. $m++;
  656. $sum=$sum+$table["$out[target]"];
  657. }
  658. $this->arrayVariable[$k]["ans"]=$sum/$m;
  659. }
  660. break;
  661. case "DistinctCount":
  662. break;
  663. case "Lowest":
  664. foreach($this->arraysqltable as $table) {
  665. $lowest=$table[$out["target"]];
  666. if($table[$out["target"]]<$lowest) {
  667. $lowest=$table[$out["target"]];
  668. }
  669. $this->arrayVariable[$k]["ans"]=$lowest;
  670. }
  671. break;
  672. case "Highest":
  673. $out["ans"]=0;
  674. foreach($this->arraysqltable as $table) {
  675. if($table[$out["target"]]>$out["ans"]) {
  676. $this->arrayVariable[$k]["ans"]=$table[$out["target"]];
  677. }
  678. }
  679. break;
  680. //### A Count for groups, as a variable. Not tested yet, but seemed to work in print_r()
  681. case "Count":
  682. $value=$this->arrayVariable[$k]["ans"];
  683. if( $this->arraysqltable[$this->global_pointer][$this->group_pointer]!=$this->arraysqltable[$this->global_pointer-1][$this->group_pointer])
  684. $value=0;
  685. $value++;
  686. $this->arrayVariable[$k]["ans"]=$value;
  687. break;
  688. //### End of modification
  689. default:
  690. $out["target"]=0; //other cases needed, temporary leave 0 if not suitable case
  691. break;
  692. }
  693. }
  694. }
  695. public function variable_calculation($rowno) {
  696. // $this->variable_calculation($rownum, $this->arraysqltable[$this->global_pointer][$this->group_pointer]);
  697. // print_r($this->arraysqltable);
  698. foreach($this->arrayVariable as $k=>$out) {
  699. // echo $out['resetType']. "<br/><br/>";
  700. switch($out["calculation"]) {
  701. case "Sum":
  702. $value=$this->arrayVariable[$k]["ans"];
  703. if($out['resetType']==''){
  704. if(isset($this->arrayVariable[$k]['class'])&&$this->arrayVariable[$k]['class']=="java.sql.Time") {
  705. // foreach($this->arraysqltable as $table) {
  706. $value=$this->time_to_sec($value);
  707. $value+=$this->time_to_sec($this->arraysqltable[$rowno]["$out[target]"]);
  708. //$sum=$sum+substr($table["$out[target]"],0,2)*3600+substr($table["$out[target]"],3,2)*60+substr($table["$out[target]"],6,2);
  709. // }
  710. //$sum= floor($sum / 3600).":".floor($sum%3600 / 60);
  711. //if($sum=="0:0"){$sum="00:00";}
  712. $value=$this->sec_to_time($value);
  713. }
  714. else {
  715. // foreach($this->arraysqltable as $table) {
  716. $value+=$this->arraysqltable[$rowno]["$out[target]"];
  717. // $table[$out["target"]];
  718. // }
  719. }
  720. }// finisish resettype=''
  721. else //reset type='group'
  722. {if( $this->arraysqltable[$this->global_pointer][$this->group_pointer]!=$this->arraysqltable[$this->global_pointer-1][$this->group_pointer])
  723. $value=0;
  724. // echo $this->global_pointer.",".$this->group_pointer.",".$this->arraysqltable[$this->global_pointer][$this->group_pointer].",".$this->arraysqltable[$this->global_pointer-1][$this->group_pointer].",".$this->arraysqltable[$rowno]["$out[target]"];
  725. if(isset($this->arrayVariable[$k]['class'])&&$this->arrayVariable[$k]['class']=="java.sql.Time") {
  726. $value+=$this->time_to_sec($this->arraysqltable[$rowno]["$out[target]"]);
  727. //$sum= floor($sum / 3600).":".floor($sum%3600 / 60);
  728. //if($sum=="0:0"){$sum="00:00";}
  729. $value=$this->sec_to_time($value);
  730. }
  731. else {
  732. $value+=$this->arraysqltable[$rowno]["$out[target]"];
  733. }
  734. }
  735. $this->arrayVariable[$k]["ans"]=$value;
  736. // echo ",$value<br/>";
  737. break;
  738. case "Average":
  739. $sum=0;
  740. if(isset($this->arrayVariable[$k]['class'])&&$this->arrayVariable[$k]['class']=="java.sql.Time") {
  741. $m=0;
  742. //$value=$this->arrayVariable[$k]["ans"];
  743. //$value=$this->time_to_sec($value);
  744. //$value+=$this->time_to_sec($this->arraysqltable[$rowno]["$out[target]"]);
  745. foreach($this->arraysqltable as $table) {
  746. $m++;
  747. $sum=$sum+$this->time_to_sec($table["$out[target]"]);
  748. // echo ",".$table["$out[target]"]."<br/>";
  749. }
  750. $sum=$this->sec_to_time($sum/$m);
  751. // echo "Total:".$sum."<br/>";
  752. $this->arrayVariable[$k]["ans"]=$sum;
  753. }
  754. else {
  755. $this->arrayVariable[$k]["ans"]=$sum;
  756. $m=0;
  757. foreach($this->arraysqltable as $table) {
  758. $m++;
  759. $sum=$sum+$table["$out[target]"];
  760. }
  761. $this->arrayVariable[$k]["ans"]=$sum/$m;
  762. }
  763. break;
  764. case "DistinctCount":
  765. break;
  766. case "Lowest":
  767. foreach($this->arraysqltable as $table) {
  768. $lowest=$table[$out["target"]];
  769. if($table[$out["target"]]<$lowest) {
  770. $lowest=$table[$out["target"]];
  771. }
  772. $this->arrayVariable[$k]["ans"]=$lowest;
  773. }
  774. break;
  775. case "Highest":
  776. $out["ans"]=0;
  777. foreach($this->arraysqltable as $table) {
  778. if($table[$out["target"]]>$out["ans"]) {
  779. $this->arrayVariable[$k]["ans"]=$table[$out["target"]];
  780. }
  781. }
  782. break;
  783. //### A Count for groups, as a variable. Not tested yet, but seemed to work in print_r()
  784. case "Count":
  785. $value=$this->arrayVariable[$k]["ans"];
  786. if( $this->arraysqltable[$this->global_pointer][$this->group_pointer]!=$this->arraysqltable[$this->global_pointer-1][$this->group_pointer])
  787. $value=0;
  788. $value++;
  789. $this->arrayVariable[$k]["ans"]=$value;
  790. break;
  791. //### End of modification
  792. default:
  793. $out["target"]=0; //other cases needed, temporary leave 0 if not suitable case
  794. break;
  795. }
  796. }
  797. }
  798. public function outpage($out_method="I",$filename="") {
  799. if($this->lang=="cn") {
  800. if($this->arrayPageSetting["orientation"]=="P") {
  801. $this->pdf=new PDF_Unicode($this->arrayPageSetting["orientation"],'pt',array($this->arrayPageSetting["pageWidth"],$this->arrayPageSetting["pageHeight"]));
  802. $this->pdf->AddUniGBhwFont("uGB");
  803. }
  804. else {
  805. $this->pdf=new PDF_Unicode($this->arrayPageSetting["orientation"],'pt',array($this->arrayPageSetting["pageHeight"],$this->arrayPageSetting["pageWidth"]));
  806. $this->pdf->AddUniGBhwFont("uGB");
  807. }
  808. }
  809. else {
  810. if($this->pdflib=="TCPDF") {
  811. if($this->arrayPageSetting["orientation"]=="P")
  812. $this->pdf=new TCPDF($this->arrayPageSetting["orientation"],'pt',array($this->arrayPageSetting["pageWidth"],$this->arrayPageSetting["pageHeight"]));
  813. else
  814. $this->pdf=new TCPDF($this->arrayPageSetting["orientation"],'pt',array($this->arrayPageSetting["pageHeight"],$this->arrayPageSetting["pageWidth"]));
  815. $this->pdf->setPrintHeader(false);
  816. $this->pdf->setPrintFooter(false);
  817. }elseif($this->pdflib=="FPDF") {
  818. if($this->arrayPageSetting["orientation"]=="P")
  819. $this->pdf=new FPDF($this->arrayPageSetting["orientation"],'pt',array($this->arrayPageSetting["pageWidth"],$this->arrayPageSetting["pageHeight"]));
  820. else
  821. $this->pdf=new FPDF($this->arrayPageSetting["orientation"],'pt',array($this->arrayPageSetting["pageHeight"],$this->arrayPageSetting["pageWidth"]));
  822. }
  823. elseif($this->pdflib=="XLS"){
  824. include dirname(__FILE__)."/ExportXLS.inc.php";
  825. $xls= new ExportXLS($this,$filename);
  826. die;
  827. }
  828. }
  829. //$this->arrayPageSetting["language"]=$xml_path["language"];
  830. $this->pdf->SetLeftMargin($this->arrayPageSetting["leftMargin"]);
  831. $this->pdf->SetRightMargin($this->arrayPageSetting["rightMargin"]);
  832. $this->pdf->SetTopMargin($this->arrayPageSetting["topMargin"]);
  833. $this->pdf->SetAutoPageBreak(true,$this->arrayPageSetting["bottomMargin"]/2);
  834. $this->pdf->AliasNbPages();
  835. $this->global_pointer=0;
  836. foreach ($this->arrayband as $band) {
  837. // $this->currentband=$band["name"]; // to know current where current band in!
  838. switch($band["name"]) {
  839. case "title":
  840. if($this->arraytitle[0]["height"]>0)
  841. $this->title();
  842. break;
  843. case "pageHeader":
  844. if(!$this->newPageGroup) {
  845. $headerY = $this->arrayPageSetting["topMargin"]+$this->arraypageHeader[0]["height"];
  846. $this->pageHeader($headerY);
  847. }else {
  848. $this->pageHeaderNewPage();
  849. }
  850. break;
  851. case "detail":
  852. if(!$this->newPageGroup) {
  853. $this->detail();
  854. }else {
  855. $this->detailNewPage();
  856. //$this->groupNewPage();
  857. }
  858. break;
  859. case "group":
  860. $this->group_pointer=$band["groupExpression"];
  861. $this->group_name=$band["gname"];
  862. break;
  863. default:
  864. break;
  865. }
  866. }
  867. if($filename=="")
  868. $filename=$this->arrayPageSetting["name"].".pdf";
  869. $this->disconnect($this->cndriver);
  870. return $this->pdf->Output($filename,$out_method); //send out the complete page
  871. }
  872. public function element_pieChart($data){
  873. $height=$data->chart->reportElement["height"];
  874. $width=$data->chart->reportElement["width"];
  875. $x=$data->chart->reportElement["x"];
  876. $y=$data->chart->reportElement["y"];
  877. $charttitle['position']=$data->chart->chartTitle['position'];
  878. $charttitle['text']=$data->chart->chartTitle->titleExpression;
  879. $chartsubtitle['text']=$data->chart->chartSubTitle->subtitleExpression;
  880. $chartLegendPos=$data->chart->chartLegend['position'];
  881. $dataset=$data->pieDataset->dataset->datasetRun['subDataset'];
  882. $seriesexp=$data->pieDataset->keyExpression;
  883. $valueexp=$data->pieDataset->valueExpression;
  884. $bb=$data->pieDataset->dataset->datasetRun['subDataset'];
  885. $sql=$this->arraysubdataset["$bb"]['sql'];
  886. // $ylabel=$data->linePlot->valueAxisLabelExpression;
  887. $param=array();
  888. foreach($data->categoryDataset->dataset->datasetRun->datasetParameter as $tag=>$value){
  889. $param[]= array("$value[name]"=>$value->datasetParameterExpression);
  890. }
  891. // print_r($param);
  892. $this->pointer[]=array('type'=>'PieChart','x'=>$x,'y'=>$y,'height'=>$height,'width'=>$width,'charttitle'=>$charttitle,
  893. 'chartsubtitle'=> $chartsubtitle,
  894. 'chartLegendPos'=> $chartLegendPos,'dataset'=>$dataset,'seriesexp'=>$seriesexp,
  895. 'valueexp'=>$valueexp,'param'=>$param,'sql'=>$sql,'ylabel'=>$ylabel);
  896. }
  897. public function element_pie3DChart($data){
  898. }
  899. public function element_Chart($data,$type){
  900. $seriesexp=array();
  901. $catexp=array();
  902. $valueexp=array();
  903. $labelexp=array();
  904. $height=$data->chart->reportElement["height"];
  905. $width=$data->chart->reportElement["width"];
  906. $x=$data->chart->reportElement["x"];
  907. $y=$data->chart->reportElement["y"];
  908. $charttitle['position']=$data->chart->c

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