Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

added report objects

Signed-off-by: Adrian Jones <adrianj1998@hotmail.com>
  • Loading branch information...
commit 298d3dd0cb7bb9d059478df2735db1d090181671 1 parent 2e99ff5
@adrianj98 adrianj98 authored
View
21 class/JasperGroovy.php
@@ -7,7 +7,7 @@
* @author adrian
*/
-class jasperJavascript extends JasperExp
+class JasperGroovy extends JasperExp
{
function _setVar($name,$codename,$value) {
@@ -17,10 +17,25 @@ function _setVar($name,$codename,$value) {
}
+ function right($value, $count) {
+
+ return substr($value, ($count * -1));
+ }
+
+ function left($string, $count) {
+ return substr($string, 0, $count);
+ }
+
+public $arraysqltable;
+public $previousarraydata ;
+public $arrayVariable;
+public $global_pointer;
+public $arrayParameter;
+
function run($code)
{
-$code = $this->replaceVars($code);
+//$code = $this->replaceVars($code);
$arrdata=explode("+",$code);
@@ -108,7 +123,7 @@ function run($code)
return implode($arrdata);
}
-return $result ;
+return false ;
}
View
54 class/JasperJS.php
@@ -1,41 +1,39 @@
<?php
+require_once(dirname(__FILE__) . '/j4p5/js.php');
-require_once(dirname(__FILE__).'/j4p5/js.php');
+class jasperJavascript extends JasperExp {
-
-class jasperJavascript extends JasperExp
-{
+ static $compiled = array();
- function _setVar($name,$codename,$value) {
-
- js::define($codename ,array(),array('value'=>$value));
-
-}
-
-
-function run($code)
-{
- // echo $code .' - ';
- $code = trim($code);
-if (empty($code))
- return $code;
-$code = $this->replaceVars($code);
+ function _setVar($name, $codename, $value) {
-$code = 'var result = ( '.$code .');';
+ js::define($codename, array(), array('value' => $value));
+ }
-#-- Run the js code.
+ function run($code) {
+ $code = trim($code);
+ if (empty($code))
+ return $code;
+ $code = $this->replaceVars($code);
+ $id = md5($code);
+ $code = 'function func_' . $id . ' () { return (' . $code . '); }';
+ // -- compile script
+ if (!self::$compiled[$id]) {
+ js::run($code, JS_DIRECT, $id);
+ self::$compiled[$id] = jsrt::$jsfunctions['func_' . $id];
+ }
-js::run($code);
+ $func = self::$compiled[$id];
+
+ //-- Run the js code.
+ $result = php_str(call_user_func($func));
+ // $result = php_str(jsrt::idv('result'));
-$result = php_str(jsrt::idv('result'));
+ return $result;
+ }
-return $result ;
-
- }
-
- }
+}
-
View
28 class/JasperParser.php
@@ -1,28 +0,0 @@
-<?php
-
-/**
- * ## JapserParser
- *
- * convert report xml object into an array or object tree that the layout engine can read.
- *
- * ### Methods
- *
- * - parseReport
- *
- *
- * @author adrian
- */
-class JasperParser {
-
- /**
- * runs the xml report through parser.
- * *
- * @param type $xml
- */
- public function parseReport($xml)
- {
-
- }
-}
-
-?>
View
1,080 class/PHPJasperXML.inc.php
212 additions, 868 deletions not shown
View
31 class/j4p5/js.php
@@ -1,7 +1,8 @@
<?php
/*
J4P5: EcmaScript interpreter for php
- ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
+ ------------------------------------
+
(also known as JavaScript over PHP5)
This is a true EcmaScript/JavaScript interpreter, as defined by Ecma-262 3d edition.
@@ -41,6 +42,8 @@ function enum() {
class js {
+ static private $compiled = array();
+ static private $memorycache = true;
#-- auto-magic function that should work out of the box without being too inefficient.
static function run($src, $mode=JS_DIRECT, $id=NULL) {
#-- attempt to setup our cache directory
@@ -50,6 +53,29 @@ static function run($src, $mode=JS_DIRECT, $id=NULL) {
#-- we need a unique ID for this script. passing $id makes this faster, but whatever.
if ($id==NULL) $id = md5($src);
$path = JS_CACHE_DIR."/".$id.".php";
+
+ if (self::$memorycache)
+ {
+ if (empty(self::$compiled[$id]))
+ {
+ #-- ok. we need to compile the darn thing.
+ require_once(dirname(__FILE__)."/jsc.php");
+
+ if ($mode==JS_INLINE) $src = "?>".$src;
+ $t1 = microtime(1);
+ $php = jsc::compile($src);
+ $t2 = microtime(2);
+ #echo "Compilation done in ".($t2-$t1). " seconds<hr>";
+ #-- then we run it.
+ self::$compiled[$id] = $php;
+ }
+ else
+ $php = self::$compiled[$id];
+
+ eval($php);
+ }else
+ {
+
if (!file_exists($path)) {
#-- ok. we need to compile the darn thing.
require_once(dirname(__FILE__)."/jsc.php");
@@ -58,12 +84,15 @@ static function run($src, $mode=JS_DIRECT, $id=NULL) {
$t1 = microtime(1);
$php = jsc::compile($src);
$t2 = microtime(2);
+
#echo "Compilation done in ".($t2-$t1). " seconds<hr>";
file_put_contents($path, "<?php\n".$php."\n?>");
+ echo $php;
#-- then we run it.
}
#echo highlight_linenum($path);
include $path;
+ }
}
#-- normally called by generated code. Your code doesn't need to call it.
View
2  class/j4p5/jsrt.php
@@ -16,6 +16,7 @@ class jsrt {
static $contexts;
#-- collection of functions. useful for lambda expressions
+static $jsfunctions;
static $functions;
static $global;
static $zero;
@@ -332,6 +333,7 @@ static function define_function($phpname, $jsname='', $args=array(), $proto = NU
if (is_string($phpname)) {
jsrt::$functions[$phpname] = $func;
}
+ jsrt::$jsfunctions[$jsname] = $phpname;
return $func;
}
View
95 class/parser/JasperBand.php
@@ -0,0 +1,95 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+include dirname(__FILE__).'/JasperObject.php';
+include dirname(__FILE__).'/JasperElement.php';
+include dirname(__FILE__).'/JasperElements.php';
+
+/**
+ * Description of JasperBand
+ *
+ *
+ * @link http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/schema.reference.html#band
+ * @author adrian
+ */
+
+class JasperBand extends JasperObject {
+
+ protected $_height;
+ protected $_isSplitAllowed;
+ protected $_splitType;
+
+ function addElement($element) {
+ $this->elements[] = $element;
+ }
+ function parse($xm_path)
+ {
+ $band = $xm_path->band[0];
+ $this->height = (integer) $band['height'];
+ $this->isSplitAllowed = (string) $band['isSplitAllowed'];
+ $this->splitType = (string) $band['splitType'];
+ $this->parseElements($band);
+ //array("type" => "band", "height" => $object["height"], "splitType" => $object["splitType"], "y_axis" => $this->y_axis);
+
+ }
+
+
+ public function parseElements($xml_path) {
+ foreach ($xml_path as $k => $out) {
+
+ $elementName = 'Jasper_'.$k;
+ if (class_exists($elementName))
+ $element = new $elementName();
+ else
+ $element = new JasperElement();
+ $element->type = $k;
+ $element->parse($out);
+ $this->addElement($element);
+// case "stackedBarChart":
+// $this->element_barChart($out,'StackedBarChart');
+// break;
+// case "barChart":
+// $this->element_barChart($out,'BarChart');
+// break;
+// case "pieChart":
+// $this->element_pieChart($out);
+// break;
+// case "pie3DChart":
+// $this->element_pie3DChart($out);
+// break;
+// case "lineChart":
+// $this->element_lineChart($out);
+// break;
+// case "stackedAreaChart":
+// $this->element_areaChart($out,'stackedAreaChart');
+// break;
+ /* case "stackedBarChart":
+ $this->element_Chart($out, 'stackedBarChart', $band);
+ break;
+ case "barChart":
+ $this->element_Chart($out, 'barChart', $band);
+ break;
+ case "pieChart":
+ $this->element_Chart($out, 'pieChart', $band);
+ break;
+ case "pie3DChart":
+ $this->element_pie3DChart($out, 'pie3DChart', $band);
+ break;
+ case "lineChart":
+ $this->element_Chart($out, 'lineChart', $band);
+ break;
+ case "stackedAreaChart":
+ $this->element_Chart($out, 'stackedAreaChart', $band);
+ break;
+ case "subreport":
+ $this->element_subReport($out, $band);
+ break;
+ default:
+ break;
+ }*/
+ }
+ }
+}
View
152 class/parser/JasperElement.php
@@ -0,0 +1,152 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of JasperElements
+ *
+ * @author adrian
+ */
+class JasperElement extends JasperObject {
+
+ function getInt($value,$def=0)
+ {
+ if (!isset($value))
+ return $def;
+ return (integer)$value;
+
+ }
+ function getString($value,$def='')
+ {
+ if (!isset($value))
+ return $def;
+ return (string)$value;
+
+ }
+ function getBool($value,$def=false)
+ {
+ if (!isset($value))
+ return$def;
+ if (strtolower($value) == 'false') return false;
+ if (strtolower($value) == 'no') return false;
+ if (empty($value)) return false;
+ if ($value)
+ return true;
+ }
+ public $_type;
+ protected $_height = 0;
+
+ protected $_x = 0;
+ protected $_y = 0;
+ protected $_width = 0;
+ protected $_fill = 0;
+ protected $_textcolor = array("r" => 0, "g" => 0, "b" => 0);
+ protected $_fillcolor = array("r" => 255, "g" => 255, "b" => 255);
+ protected $_stretchoverflow = "true";
+ protected $_printoverflow = "false";
+
+ function parse($data)
+ {
+
+ $this->height = $this->getInt($data->reportElement["height"],0);
+ $this->x = $this->getInt($data->reportElement["x"]);
+ $this->y = $this->getInt($data->reportElement["y"]);
+ $this->width = $this->getInt($data->reportElement["width"]);
+ /** allow forground color "forecolor" */
+
+ //reportElement
+ if (isset($data->reportElement["forecolor"])) {
+ $this->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)));
+ }
+ if (isset($data->reportElement["backcolor"])) {
+ $this->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)));
+ }
+ if ($data->reportElement["mode"] == "Opaque") {
+ $this->fill = 1;
+ }
+ if (isset($data["isStretchWithOverflow"]) && $data["isStretchWithOverflow"] == "true") {
+ $this->stretchoverflow = "true";
+ }
+ if (isset($data->reportElement["isPrintWhenDetailOverflows"]) && $data->reportElement["isPrintWhenDetailOverflows"] == "true") {
+ $this->printoverflow = "true";
+ $this->stretchoverflow = "false";
+ }
+
+ }
+}
+
+
+class JasperBox extends JasperElement
+{
+ //box
+ protected $_border = 0;
+ protected $_drawcolor = array("r" => 0, "g" => 0, "b" => 0);
+
+ function parse($data)
+ {
+ parent::parse($data) ;
+// box dom there is a lot more needed for this dom
+ if ((isset($data->box)) && ($data->box->pen["lineWidth"] > 0)) {
+ $this->border = 1;
+ if (isset($data->box->pen["lineColor"])) {
+ $this->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)));
+ }
+ }
+ }
+
+}
+
+class JasperText extends JasperBox
+{
+
+ //textElement
+ protected $_verticalAlignment ;
+ protected $_textAlignment;
+ protected $_rotation = "";
+ protected $_fontsize = 10;
+ protected $_font = "helvetica";
+ protected $_fontstyle = '';
+
+
+ function parse($data)
+ {
+ parent::parse($data) ;
+
+ /// textElement dom
+ if (isset($data->textElement["textAlignment"])) {
+ $this->textAlignment = substr($data->textElement["textAlignment"], 0, 1);
+ }
+ if (isset($data->textElement["verticalAlignment"])) {
+ $this->verticalAlignment = substr($data->textElement["verticalAlignment"], 0, 1);
+ }
+ if (isset($data->textElement["rotation"])) {
+ $this->rotation = $data->textElement["rotation"];
+ }
+ if (isset($data->textElement->font["fontName"])) {
+ $this->font = $data->textElement->font["fontName"];
+ }
+
+ if (isset($data->textElement->font["pdfFontName"])) {
+ $this->font = $data->textElement->font["pdfFontName"];
+ }
+ if (isset($data->textElement->font["size"])) {
+ $this->fontsize = $data->textElement->font["size"];
+ }
+ if (isset($data->textElement->font["isBold"]) && $data->textElement->font["isBold"] == "true") {
+ $fontstyle = $fontstyle . "B";
+ }
+ if (isset($data->textElement->font["isItalic"]) && $data->textElement->font["isItalic"] == "true") {
+ $fontstyle = $fontstyle . "I";
+ }
+ if (isset($data->textElement->font["isUnderline"]) && $data->textElement->font["isUnderline"] == "true") {
+ $fontstyle = $fontstyle . "U";
+ }
+ $this->fontstyle = $fontstyle;
+ if (isset($data->reportElement["key"])) {
+ $this->height = $fontsize * $this->adjust;
+ }
+ }
+}
View
107 class/parser/JasperElements.php
@@ -0,0 +1,107 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of JasperElements
+ *
+ * @author adrian
+ */
+class Jasper_staticText extends JasperText {
+
+ protected $_text = "";
+
+ public function parse($data) {
+
+ parent::parse($data);
+
+
+
+ // $this->report->pointer[] = array("type" => "SetXY", "x" => $data->reportElement["x"], "y" => $data->reportElement["y"], "hidden_type" => "SetXY");
+ // $this->report->pointer[] = array("type" => "SetTextColor", "r" => $textcolor["r"], "g" => $textcolor["g"], "b" => $textcolor["b"], "hidden_type" => "textcolor");
+ // $this->report->pointer[] = array("type" => "SetDrawColor", "r" => $drawcolor["r"], "g" => $drawcolor["g"], "b" => $drawcolor["b"], "hidden_type" => "drawcolor");
+ // $this->report->pointer[] = array("type" => "SetFillColor", "r" => $fillcolor["r"], "g" => $fillcolor["g"], "b" => $fillcolor["b"], "hidden_type" => "fillcolor");
+ // $this->report->pointer[] = array("type" => "SetFont", "font" => $font, "fontstyle" => $fontstyle, "fontsize" => $fontsize, "hidden_type" => "font");
+ //"height"=>$data->reportElement["height"]
+//### UTF-8 characters, a must for me.
+ $txtEnc = ($data->text);
+ $this->text = $$txtEnc;
+
+
+ /** add printWhenExpression */
+ // $this->report->pointer[] = array("type" => "MultiCell",
+ // "printWhenExpression" => $data->reportElement->printWhenExpression,
+ // "width" => $data->reportElement["width"], "height" => $height, "txt" => $txtEnc, "border" => $border, "align" => $align, "fill" => $fill, "hidden_type" => "statictext", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "rotation" => $rotation);
+//### End of modification, below is the original line
+// $this->report->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);
+ }
+
+}
+
+/**
+ *
+ *
+ * @todo hyperlinks need to be covered
+ */
+class Jasper_textField extends JasperText {
+
+ protected $_textFieldExpression = "";
+
+ public function parse($data) {
+
+ parent::parse($data);
+
+
+ $this->textFieldExpression = $data->textFieldExpression;
+ }
+
+}
+/**
+ *
+ * @link http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/schema.reference.html#group
+ */
+class Japser_group extends JasperElement {
+
+ public $_groupFooter;
+ public $_groupHeader;
+ public $_isStartNewPage;
+ public $_isStartNewColumn;
+ public $_isResetPageNumber;
+ public $_footerPosition;
+ public $_isReprintHeaderOnEachPage;
+ public $_minHeightToStartNewPage;
+
+ public function parse($data) {
+
+ parent::parse($data);
+
+ $this->isStartNewPage = $this->getBool($xml_path["isStartNewPage"],false);
+ $this->isStartNewColumn = $this->getBool($xml_path["isStartNewColumn"],false);
+ $this->isResetPageNumber = $this->getBool($xml_path["isResetPageNumber"],false);
+ $this->isReprintHeaderOnEachPage = $this->getBool($xml_path["isReprintHeaderOnEachPage"],false);
+ $this->minHeightToStartNewPage = $this->getInt($xml_path["minHeightToStartNewPage"],0);
+ $this->footerPosition = $this->getString($xml_path["footerPosition"],'Normal');
+
+
+ foreach ($data as $tag => $out) {
+ switch ($tag) {
+ case "groupHeader":
+ $this->groupHeader = new JasperBand();
+ $this->groupHeader->parse($out);
+ break;
+ case "groupFooter":
+
+ $this->groupFooter = new JasperBand();
+ $this->groupFooter->parse($out);
+break;
+ default:
+
+ break;
+ }
+ }
+ }
+
+}
View
63 class/parser/JasperObject.php
@@ -0,0 +1,63 @@
+<?php
+
+/*
+ * To change this template, choose Tools | Templates
+ * and open the template in the editor.
+ */
+
+/**
+ * Description of JasperObject
+ *
+ * @author adrian
+ */
+
+class JasperObject implements Iterator {
+
+ protected $elements = array();
+ protected $elements_position = 0;
+
+ public function __construct() {
+ $this->elements_position = 0;
+ }
+
+ function rewind() {
+ $this->elements_position = 0;
+ }
+
+ function current() {
+ return $this->elements[$this->elements_position];
+ }
+
+ function key() {
+ return $this->elements_position;
+ }
+
+ function next() {
+ ++$this->elements_position;
+ }
+
+ function valid() {
+ return isset($this->elements[$this->elements_position]);
+ }
+
+ function __get($name)
+ {
+ $name = '_'.$name;
+ if (!property_exists($this, $name))
+ die('does not exists '. $name);
+ return $this->$name;
+ }
+
+
+ function __set($name,$value)
+ {
+ $name = '_'.$name;
+ if (!property_exists($this, $name))
+ die('does not exists '. $name);
+ $this->$name = $value;
+ }
+
+
+
+}
+
View
577 class/parser/JasperParser.php
@@ -0,0 +1,577 @@
+<?php
+include dirname(__FILE__).'/JasperBand.php';
+/**
+ * ## JapserParser
+ *
+ * convert report xml object into an array or object tree that the layout engine can read.
+ *
+ * ### Methods
+ *
+ * - parseReport
+ *
+ *
+ * @author adrian
+
+ *
+ *
+ *
+ *
+ */
+class group {
+
+ public $group = array();
+ public $newPageGroup;
+ public $head = array();
+ public $headheight;
+ public $group_count;
+ public $grboupfootheight;
+
+}
+
+class report extends JasperObject {
+
+ public $pageSetting = array(); //$this->arrayPageSetting
+ public $parameters = array(); // $this->report->parameters
+ public $pointer; //$this->pointer
+ public $sql;
+ public $field;
+ public $groups = array();
+ public $Variable;
+ public $background_band;
+ public $title_band;
+ public $pageHeader_band;
+ public $columnHeader_band;
+ public $detail_band;
+ public $columnFooter_band;
+ public $pageFooter_band;
+ public $lastPageFooter_band;
+ public $summary_band;
+ public $noData_band;
+
+}
+
+class JasperParser {
+
+ private $y_axis;
+ public $report;
+ public $gnam;
+ public $arraytitle;
+ public $filterExpression;
+ public $subdataset;
+ public $arraycolumnHeader;
+ public $report_count;
+ public $arraycolumnFooter;
+ public $arraypageFooter;
+ public $arraysummary;
+ //band
+ public $arrayband;
+ // these fields need be removed
+ public $arraystyle;
+ public $arraypageHeader;
+ public $arraydetail;
+
+ function __construct() {
+
+ }
+
+ function __get($name) {
+ echo $name . " -p\n";
+ flsds();
+ }
+
+ function __set($name, $var) {
+ echo $name . " -pr\n";
+ }
+
+ /**
+ * runs the xml report through parser.
+ * this will run though the jasperReport dom
+ * {@link http://jasperforge.org/uploads/publish/jasperreportswebsite/trunk/schema.reference.html#jasperReport}
+ *
+ * the jasperReport dom contains
+ *
+ *
+ *
+ property*
+ import*
+ template*
+ reportFont*
+ style*
+ subDataset*
+ scriptlet*
+ parameter*
+ queryString?
+ field*
+ sortField*
+ variable*
+ filterExpression?
+ group*
+ background?
+ title?
+ pageHeader?
+ columnHeader?
+ detail?
+ columnFooter?
+ pageFooter?
+ lastPageFooter?
+ summary?
+ noData?
+ *
+ *
+ * @param type $xml
+ */
+ public function parse($xml, &$report) {
+
+ if (empty($report))
+ $report = new report();
+
+ $this->report = $report;
+ $this->page_setting($xml);
+ foreach ($xml as $k => $out) {
+ $hander = $k . '_handler';
+ if (method_exists($this, $hander))
+ $this->$hander($out, $this->report);
+ else {
+ $hander = $k . '_band';
+ if (property_exists($this->report, $hander)) {
+ $this->report->$hander = new JasperBand();
+ $this->report->$hander->parse($out);
+ $this->y_axis = $this->y_axis + $this->report->$hander->height;
+ }
+
+
+
+
+
+ }
+ }
+ $report = $this->report;
+ return true;
+
+ }
+
+ /* public function background_handler($xml_path, $report) {
+
+ // $report->background = array("height" => $out->band["height"], "splitType" => $out->band["splitType"]);
+ $this->band_handler($xml_path, $report->background);
+ }*/
+
+ public function parameter_handler($xml_path) {
+ $defaultValueExpression = (string) $xml_path->defaultValueExpression;
+ if (!isset($this->report->parameters[(string) $xml_path["name"]])) {
+ if ($defaultValueExpression != '')
+ $this->report->parameters[(string) $xml_path["name"]] = $defaultValueExpression;
+ else
+ $this->report->parameters[(string) $xml_path["name"]] = '';
+ }
+ }
+
+ public function filterExpression_handler($xml_path) {
+
+
+ $this->filterExpression = (string) $xml_path;
+ }
+
+ public function queryString_handler($xml_path) {
+ $this->report->sql = $xml_path;
+ }
+
+//read level 0,Jasperreport page setting
+
+ /**
+ *
+ *
+ * @param type $xml_path
+ */
+ public function page_setting($xml_path) {
+ $this->report->pageSetting = $xml_path;
+
+ if (!isset($xml_path["orientation"])) {
+ $this->report->pageSetting["orientation"] = 'P';
+ }
+ $this->y_axis = (integer) $xml_path["topMargin"];
+ }
+
+ public function field_handler($xml_path) {
+ $this->report->field["name"] = $xml_path["class"];
+ }
+
+ public function variable_handler($xml_path) {
+
+ $this->report->Variable["$xml_path[name]"] = array("calculation" => $xml_path["calculation"], "target" => substr($xml_path->variableExpression, 3, -1), "class" => $xml_path["class"], "resetType" => $xml_path["resetType"]);
+ }
+
+ public function group_handler($xml_path, $report) {
+
+ $group = new Japser_group();
+ $group->parse($xml_path);
+ $this->report->groups[] = $group;
+
+ }
+
+ public function band_hander($xml_path, $band) {
+
+ }
+
+
+
+ public function element_image($data) {
+ $imagepath = $data->imageExpression;
+ //$imagepath= substr($data->imageExpression, 1, -1);
+ //$imagetype= substr($imagepath,-3);
+ // $imagepath=$this->analyse_expression($imagepath);
+
+ switch ($data[scaleImage]) {
+ case "FillFrame":
+ /** add hAlign */
+ $this->report->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", 'hAlign' => $data['hAlign']);
+ break;
+ default:
+ $this->report->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");
+ break;
+ }
+ }
+
+ public function element_line($data) { //default line width=0.567(no detect line width)
+ $drawcolor = array("r" => 0, "g" => 0, "b" => 0);
+ $hidden_type = "line";
+ if (isset($data->reportElement["forecolor"])) {
+ $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)));
+ }
+ /** add drawing of lines */
+ if ((isset($data->graphicElement) ) and (isset($data->graphicElement->pen))) {
+ if (isset($data->graphicElement->pen["lineColor"]))
+ $drawcolor = array("r" => hexdec(substr($data->graphicElement->pen["lineColor"], 1, 2)), "g" => hexdec(substr($data->graphicElement->pen["lineColor"], 3, 2)), "b" => hexdec(substr($data->graphicElement->pen["lineColor"], 5, 2)));
+ if (isset($data->graphicElement->pen["lineWidth"]))
+ $this->report->pointer[] = array("type" => "SetLineWidth", "width" => $data->graphicElement->pen["lineWidth"]);
+ }
+
+ $this->report->pointer[] = array("type" => "SetDrawColor", "r" => $drawcolor["r"], "g" => $drawcolor["g"], "b" => $drawcolor["b"], "hidden_type" => "drawcolor");
+ if (isset($data->reportElement[positionType]) && $data->reportElement[positionType] == "FixRelativeToBottom") {
+ $hidden_type = "relativebottomline";
+ }
+ if ($data->reportElement["width"][0] + 0 > $data->reportElement["height"][0] + 0) { //width > height means horizontal line
+ $this->report->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);
+ } elseif ($data->reportElement["height"][0] + 0 > $data->reportElement["width"][0] + 0) { //vertical line
+ $this->report->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);
+ }
+ $this->report->pointer[] = array("type" => "SetLineWidth", "width" => "1");
+
+ $this->report->pointer[] = array("type" => "SetDrawColor", "r" => 0, "g" => 0, "b" => 0, "hidden_type" => "drawcolor");
+ $this->report->pointer[] = array("type" => "SetFillColor", "r" => 255, "g" => 255, "b" => 255, "hidden_type" => "fillcolor");
+ }
+
+ public function element_rectangle($data) {
+
+ $radius = $data['radius'];
+ $drawcolor = array("r" => 0, "g" => 0, "b" => 0);
+
+ $fillcolor = array("r" => 255, "g" => 255, "b" => 255);
+
+
+ if (isset($data->reportElement["forecolor"])) {
+ $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)));
+ }
+
+ if (isset($data->reportElement["backcolor"])) {
+ $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)));
+ }
+
+
+ $this->report->pointer[] = array("type" => "SetDrawColor", "r" => $drawcolor["r"], "g" => $drawcolor["g"], "b" => $drawcolor["b"], "hidden_type" => "drawcolor");
+ $this->report->pointer[] = array("type" => "SetFillColor", "r" => $fillcolor["r"], "g" => $fillcolor["g"], "b" => $fillcolor["b"], "hidden_type" => "fillcolor");
+
+ if ($radius == '')
+ $this->report->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"]);
+ else
+ $this->report->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"]);
+ $this->report->pointer[] = array("type" => "SetDrawColor", "r" => 0, "g" => 0, "b" => 0, "hidden_type" => "drawcolor");
+ $this->report->pointer[] = array("type" => "SetFillColor", "r" => 255, "g" => 255, "b" => 255, "hidden_type" => "fillcolor");
+ }
+
+ public function element_ellipse($data) {
+ $drawcolor = array("r" => 0, "g" => 0, "b" => 0);
+ $fillcolor = array("r" => 255, "g" => 255, "b" => 255);
+ if (isset($data->reportElement["forecolor"])) {
+ $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)));
+ }
+ if (isset($data->reportElement["backcolor"])) {
+ $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)));
+ }
+
+ //$color=array("r"=>$drawcolor["r"],"g"=>$drawcolor["g"],"b"=>$drawcolor["b"]);
+ $this->report->pointer[] = array("type" => "SetFillColor", "r" => $fillcolor["r"], "g" => $fillcolor["g"], "b" => $fillcolor["b"], "hidden_type" => "fillcolor");
+ $this->report->pointer[] = array("type" => "SetDrawColor", "r" => $drawcolor["r"], "g" => $drawcolor["g"], "b" => $drawcolor["b"], "hidden_type" => "drawcolor");
+ $this->report->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);
+ $this->report->pointer[] = array("type" => "SetDrawColor", "r" => 0, "g" => 0, "b" => 0, "hidden_type" => "drawcolor");
+ $this->report->pointer[] = array("type" => "SetFillColor", "r" => 255, "g" => 255, "b" => 255, "hidden_type" => "fillcolor");
+ }
+
+ public function element_textField($data) {
+ $align = "L";
+ $fill = 0;
+ $border = 0;
+ $fontsize = 10;
+ $font = "helvetica";
+ $rotation = "";
+ $fontstyle = "";
+ $textcolor = array("r" => 0, "g" => 0, "b" => 0);
+ $fillcolor = array("r" => 255, "g" => 255, "b" => 255);
+ $stretchoverflow = "false";
+ $printoverflow = "false";
+ $height = $data->reportElement["height"];
+ $drawcolor = array("r" => 0, "g" => 0, "b" => 0);
+ if (isset($data->reportElement["forecolor"])) {
+ $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)));
+ }
+ if (isset($data->reportElement["backcolor"])) {
+ $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)));
+ }
+ if ($data->reportElement["mode"] == "Opaque") {
+ $fill = 1;
+ }
+ if (isset($data["isStretchWithOverflow"]) && $data["isStretchWithOverflow"] == "true") {
+ $stretchoverflow = "true";
+ }
+ if (isset($data->reportElement["isPrintWhenDetailOverflows"]) && $data->reportElement["isPrintWhenDetailOverflows"] == "true") {
+ $printoverflow = "true";
+ }
+ if (isset($data->box) && $data->box->pen["lineWidth"] > 0) {
+ $border = 1;
+ if (isset($data->box->pen["lineColor"])) {
+ $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)));
+ }
+ }
+ if (isset($data->reportElement["key"])) {
+ $height = $fontsize * $this->adjust;
+ }
+ if (isset($data->textElement["textAlignment"])) {
+ $align = $this->get_first_value($data->textElement["textAlignment"]);
+ }
+ /** get verital align */
+ if (isset($data->textElement["textAlignment"])) {
+ $valign = $this->get_first_value($data->textElement["verticalAlignment"]);
+ }
+ if (isset($data->textElement["rotation"])) {
+ $rotation = $data->textElement["rotation"];
+ }
+ if (isset($data->textElement->font["fontName"])) {
+ $font = $data->textElement->font["fontName"];
+ }
+ if (isset($data->textElement->font["pdfFontName"])) {
+ $font = $data->textElement->font["pdfFontName"];
+ }
+ if (isset($data->textElement->font["size"])) {
+ $fontsize = $data->textElement->font["size"];
+ }
+ if (isset($data->textElement->font["isBold"]) && $data->textElement->font["isBold"] == "true") {
+ $fontstyle = $fontstyle . "B";
+ }
+ if (isset($data->textElement->font["isItalic"]) && $data->textElement->font["isItalic"] == "true") {
+ $fontstyle = $fontstyle . "I";
+ }
+ if (isset($data->textElement->font["isUnderline"]) && $data->textElement->font["isUnderline"] == "true") {
+ $fontstyle = $fontstyle . "U";
+ }
+ $this->report->pointer[] = array("type" => "SetXY", "x" => $data->reportElement["x"], "y" => $data->reportElement["y"], "hidden_type" => "SetXY");
+ /** todo: need to check that forecolor and backcolor work. I add it from older code without checking it */
+ $this->report->pointer[] = array("type" => "SetTextColor", "forecolor" => $data->reportElement["forecolor"], "r" => $textcolor["r"], "g" => $textcolor["g"], "b" => $textcolor["b"], "hidden_type" => "textcolor");
+ $this->report->pointer[] = array("type" => "SetDrawColor", "r" => $drawcolor["r"], "g" => $drawcolor["g"], "b" => $drawcolor["b"], "hidden_type" => "drawcolor");
+ $this->report->pointer[] = array("type" => "SetFillColor", "backcolor" => $data->reportElement["backcolor"], "r" => $fillcolor["r"], "g" => $fillcolor["g"], "b" => $fillcolor["b"], "hidden_type" => "fillcolor");
+ $this->report->pointer[] = array("type" => "SetFont", "font" => $font, "fontstyle" => $fontstyle, "fontsize" => $fontsize, "hidden_type" => "font");
+ //$data->hyperlinkReferenceExpression=$this->analyse_expression($data->hyperlinkReferenceExpression);
+ //if( $data->hyperlinkReferenceExpression!=''){echo "$data->hyperlinkReferenceExpression";die;}
+
+
+ switch ($data->textFieldExpression) {
+ case 'new java.util.Date()':
+//### New: =>date("Y.m.d.",....
+ /** added valign for the next 35 lines */
+ $this->report->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => date("Y-m-d H:i:s"), "border" => $border, "align" => $align, 'valign' => $valign, "fill" => $fill, "hidden_type" => "date", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1));
+//### End of modification
+ break;
+ case '"Page "+$V{PAGE_NUMBER}+" of"':
+
+ $this->report->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => 'Page $this->PageNo() of', "border" => $border, "align" => $align, 'valign' => $valign, "fill" => $fill, "hidden_type" => "pageno", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1), "pattern" => $data["pattern"]);
+ break;
+ case '$V{PAGE_NUMBER}':
+ if (isset($data["evaluationTime"]) && $data["evaluationTime"] == "Report") {
+ $this->report->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => '{nb}', "border" => $border, "align" => $align, 'valign' => $valign, "fill" => $fill, "hidden_type" => "pageno", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1), "pattern" => $data["pattern"]);
+ } else {
+ $this->report->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => '$this->PageNo()', "border" => $border, "align" => $align, 'valign' => $valign, "fill" => $fill, "hidden_type" => "pageno", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1), "pattern" => $data["pattern"]);
+ }
+ break;
+ case '" " + $V{PAGE_NUMBER}':
+ $this->report->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => ' {nb}', "border" => $border, "align" => $align, 'valign' => $valign, "fill" => $fill, "hidden_type" => "nb", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1), "pattern" => $data["pattern"]);
+ break;
+ case '$V{REPORT_COUNT}':
+//### $this->report_count=0;
+ $this->report->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => &$this->report_count, "border" => $border, "align" => $align, 'valign' => $valign, "fill" => $fill, "hidden_type" => "report_count", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1), "pattern" => $data["pattern"]);
+ break;
+ case '$V{' . $this->gnam . '_COUNT}':
+// case '$V{'.$this->report->band[0]["gname"].'_COUNT}':
+//### $this->report->group->count=0;
+ // $gnam = $this->report->band[0]["gname"];
+ $this->report->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => &$this->report->group->count["$this->gnam"], "border" => $border, "align" => $align, 'valign' => $valign, "fill" => $fill, "hidden_type" => "group_count", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1), "pattern" => $data["pattern"]);
+ break;
+ default:
+ $writeHTML = false;
+ if ($data->reportElement->property["name"] == "writeHTML")
+ $writeHTML = $data->reportElement->property["value"];
+ if (isset($data->reportElement["isPrintRepeatedValues"]))
+ $isPrintRepeatedValues = $data->reportElement["isPrintRepeatedValues"];
+
+
+ $this->report->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => $data->textFieldExpression,
+ "border" => $border, "align" => $align, "fill" => $fill, 'valign' => $valign,
+ "hidden_type" => "field", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow,
+ "printWhenExpression" => $data->reportElement->printWhenExpression,
+ "link" => substr($data->hyperlinkReferenceExpression, 1, -1), "pattern" => $data["pattern"],
+ "writeHTML" => $writeHTML, "isPrintRepeatedValues" => $isPrintRepeatedValues, "rotation" => $rotation);
+ break;
+ }
+ }
+
+ public function element_subReport($data) {
+// $b=$data->subreportParameter;
+ $srsearcharr = array('.jasper', '"', "'", ' ', '$P{SUBREPORT_DIR}+');
+ $srrepalcearr = array('.jrxml', "", "", '', $this->report->parameters['SUBREPORT_DIR']);
+
+ if (strpos($data->subreportExpression, '$P{SUBREPORT_DIR}') === false) {
+ $subreportExpression = str_replace($srsearcharr, $srrepalcearr, $data->subreportExpression);
+ } else {
+ $subreportExpression = str_replace($srsearcharr, $srrepalcearr, $data->subreportExpression);
+ }
+ $b = array();
+ foreach ($data as $name => $out) {
+ if ($name == 'subreportParameter') {
+ $b[$out['name'] . ''] = $out->subreportParameterExpression;
+ }
+ }//loop to let multiple parameter pass to subreport pass to subreport
+ $this->report->pointer[] = array("type" => "subreport", "x" => $data->reportElement["x"], "y" => $data->reportElement["y"],
+ "width" => $data->reportElement["width"], "height" => $data->reportElement["height"],
+ "subreportparameterarray" => $b, "connectionExpression" => $data->connectionExpression,
+ "subreportExpression" => $subreportExpression, "hidden_type" => "subreport");
+ }
+
+ public function element_pieChart($data) {
+
+ $height = $data->chart->reportElement["height"];
+ $width = $data->chart->reportElement["width"];
+ $x = $data->chart->reportElement["x"];
+ $y = $data->chart->reportElement["y"];
+ $charttitle['position'] = $data->chart->chartTitle['position'];
+
+ $charttitle['text'] = $data->chart->chartTitle->titleExpression;
+ $chartsubtitle['text'] = $data->chart->chartSubTitle->subtitleExpression;
+ $chartLegendPos = $data->chart->chartLegend['position'];
+
+ $dataset = $data->pieDataset->dataset->datasetRun['subDataset'];
+
+ $seriesexp = $data->pieDataset->keyExpression;
+ $valueexp = $data->pieDataset->valueExpression;
+ $bb = $data->pieDataset->dataset->datasetRun['subDataset'];
+ $sql = $this->arraysubdataset["$bb"]['sql'];
+
+ // $ylabel=$data->linePlot->valueAxisLabelExpression;
+
+
+ $param = array();
+ foreach ($data->categoryDataset->dataset->datasetRun->datasetParameter as $tag => $value) {
+ $param[] = array("$value[name]" => $value->datasetParameterExpression);
+ }
+// print_r($param);
+
+ $this->report->pointer[] = array('type' => 'PieChart', 'x' => $x, 'y' => $y, 'height' => $height, 'width' => $width, 'charttitle' => $charttitle,
+ 'chartsubtitle' => $chartsubtitle,
+ 'chartLegendPos' => $chartLegendPos, 'dataset' => $dataset, 'seriesexp' => $seriesexp,
+ 'valueexp' => $valueexp, 'param' => $param, 'sql' => $sql, 'ylabel' => $ylabel);
+ }
+
+ public function element_pie3DChart($data) {
+
+ }
+
+ public function subDataset_handler($data) {
+ $this->subdataset[$data['name'] . ''] = $data->queryString;
+ }
+
+ public function element_Chart($data, $type) {
+ $seriesexp = array();
+ $catexp = array();
+ $valueexp = array();
+ $labelexp = array();
+ $height = $data->chart->reportElement["height"];
+ $width = $data->chart->reportElement["width"];
+ $x = $data->chart->reportElement["x"];
+ $y = $data->chart->reportElement["y"];
+ $charttitle['position'] = $data->chart->chartTitle['position'];
+ $titlefontname = $data->chart->chartTitle->font['pdfFontName'];
+ $titlefontsize = $data->chart->chartTitle->font['size'];
+ $charttitle['text'] = $data->chart->chartTitle->titleExpression;
+ $chartsubtitle['text'] = $data->chart->chartSubTitle->subtitleExpression;
+ $chartLegendPos = $data->chart->chartLegend['position'];
+ $dataset = $data->categoryDataset->dataset->datasetRun['subDataset'];
+ $subcatdataset = $data->categoryDataset;
+ //echo $subcatdataset;
+ $i = 0;
+ foreach ($subcatdataset as $cat => $catseries) {
+ foreach ($catseries as $a => $series) {
+ if ("$series->categoryExpression" != '') {
+ array_push($seriesexp, "$series->seriesExpression");
+ array_push($catexp, "$series->categoryExpression");
+ array_push($valueexp, "$series->valueExpression");
+ array_push($labelexp, "$series->labelExpression");
+ }
+ }
+ }
+
+
+ $bb = $data->categoryDataset->dataset->datasetRun['subDataset'];
+ $sql = $this->arraysubdataset[$bb]['sql'];
+ switch ($type) {
+ case "barChart":
+ $ylabel = $data->barPlot->valueAxisLabelExpression;
+ $xlabel = $data->barPlot->categoryAxisLabelExpression;
+ $maxy = $data->barPlot->rangeAxisMaxValueExpression;
+ $miny = $data->barPlot->rangeAxisMinValueExpression;
+ break;
+ case "lineChart":
+ $ylabel = $data->linePlot->valueAxisLabelExpression;
+ $xlabel = $data->linePlot->categoryAxisLabelExpression;
+ $maxy = $data->linePlot->rangeAxisMaxValueExpression;
+ $miny = $data->linePlot->rangeAxisMinValueExpression;
+ $showshape = $data->linePlot["isShowShapes"];
+ break;
+ case "stackedAreaChart":
+ $ylabel = $data->areaPlot->valueAxisLabelExpression;
+ $xlabel = $data->areaPlot->categoryAxisLabelExpression;
+ $maxy = $data->areaPlot->rangeAxisMaxValueExpression;
+ $miny = $data->areaPlot->rangeAxisMinValueExpression;
+
+
+ break;
+ }
+
+
+
+ $param = array();
+ foreach ($data->categoryDataset->dataset->datasetRun->datasetParameter as $tag => $value) {
+ $param[] = array("$value[name]" => $value->datasetParameterExpression);
+ }
+ if ($maxy != '' && $miny != '') {
+ $scalesetting = array(0 => array("Min" => $miny, "Max" => $maxy));
+ }
+ else
+ $scalesetting = "";
+
+ $this->report->pointer[] = array('type' => $type, 'x' => $x, 'y' => $y, 'height' => $height, 'width' => $width, 'charttitle' => $charttitle,
+ 'chartsubtitle' => $chartsubtitle,
+ 'chartLegendPos' => $chartLegendPos, 'dataset' => $dataset, 'seriesexp' => $seriesexp,
+ 'catexp' => $catexp, 'valueexp' => $valueexp, 'labelexp' => $labelexp, 'param' => $param, 'sql' => $sql, 'xlabel' => $xlabel, 'showshape' => $showshape,
+ 'titlefontsize' => $titlefontname, 'titlefontsize' => $titlefontsize, 'scalesetting' => $scalesetting);
+ }
+
+
+
+}
View
53 samples/sample1.php
@@ -9,7 +9,16 @@
require_once '../class/JasperDatabase.php';
require_once '../class/JasperMysql.php';
require_once '../class/JasperExp.php';
+require_once '../class/JasperGroovy.php';
require_once '../class/JasperJS.php';
+
+// $javas = new JasperJavascript();
+// $result = $javas->run('1 + 5');
+// echo $result;
+//
+//die;
+
+
class myTCPDF extends TCPDF
{
public function __construct($orientation='P', $unit='mm', $format='A4', $unicode=true, $encoding='UTF-8', $diskcache=false) {
@@ -25,17 +34,49 @@ public function __construct($orientation='P', $unit='mm', $format='A4', $unicode
}
-
-$xml = simplexml_load_file("sample1.jrxml");
+ $test = array('javascript');//,'groovy','javascript','groovy','javascript','groovy');
+
+
+foreach($test as $test)
+{
+ $t1 = microtime(1);
+$xml = simplexml_load_file("report1.jrxml");
$PHPJasperXML = new PHPJasperXML("en","TCPDF","myTCPDF");
//$PHPJasperXML->debugsql=true;
-$PHPJasperXML->arrayParameter=array("parameter1"=>1);
-$PHPJasperXML->xml_dismantle($xml);
+ xhprof_enable();
+$PHPJasperXML->xml_dismantle($xml);
+$xhprof_data = xhprof_disable();
+$PHPJasperXML->report->PageSetting["language"] = $test;
+$PHPJasperXML->report->parameters=array("parameter1"=>1);
+$PHPJasperXML->report->parameters["name"] = $PHPJasperXML->report->parameters["language"];
$PHPJasperXML->transferDBtoArray($server,$user,$pass,$db);
-$PHPJasperXML->outpage("I"); //page output method I:standard output D:Download file
+$PHPJasperXML->outpage("S"); //page output method I:standard output D:Download file
+ // $t2 = microtime(2);
+ // echo $PHPJasperXML->arrayPageSetting["language"] ." - done in ".($t2-$t1). " seconds"."\n";
+
+}
+
+
+// display raw xhprof data for the profiler run
+//print_r($xhprof_data);
+
+
+$XHPROF_ROOT = 'd:\code\slcode\lib\xhprof';
+include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_lib.php";
+include_once $XHPROF_ROOT . "/xhprof_lib/utils/xhprof_runs.php";
+
+// save raw data for this profiler run using default
+// implementation of iXHProfRuns.
+$xhprof_runs = new XHProfRuns_Default();
+// save the run under a namespace "xhprof_foo"
+$run_id = $xhprof_runs->save_run($xhprof_data, "xhprof_foo");
-?>
+echo "---------------\n".
+ "Assuming you have set up the http based UI for \n".
+ "XHProf at some address, you can view run at \n".
+ "http://<xhprof-ui-address>/index.php?run=$run_id&source=xhprof_foo\n".
+ "---------------\n";
View
3  samples/sample2.php
@@ -19,8 +19,9 @@
$PHPJasperXML = new PHPJasperXML();
//$PHPJasperXML->debugsql=true;
-$PHPJasperXML->arrayParameter=array("parameter1"=>1);
+$PHPJasperXML->report->parameters=array("parameter1"=>1);
$PHPJasperXML->xml_dismantle($xml);
+$PHPJasperXML->report->pageSetting["language"] = 'javascript';
$PHPJasperXML->transferDBtoArray($server,$user,$pass,$db);
// use this line if you want to connect with mysql
View
2  samples/sample9.php
@@ -126,10 +126,10 @@ public function __construct($orientation = 'P', $unit = 'mm', $format = 'A4', $u
$PHPJasperXML->report_path = $root . '/';
//$PHPJasperXML->debugsql=true;
-$PHPJasperXML->arrayParameter = array("printType" => "quote");
$PHPJasperXML->xml_dismantle($xml);
$PHPJasperXML->transferXLStoArray($root . '/sample9.xls');
+$PHPJasperXML->report->parameters = array("printType" => "quote");
$PHPJasperXML->outpage("I"); //page output method I:standard output D:Download file
Please sign in to comment.
Something went wrong with that request. Please try again.