private function analyse_expression($data, $isPrintRepeatedValue = "true") { $arrdata = explode("+", $data); $i = 0; foreach ($arrdata as $num => $out) { $i++; $arrdata[$num] = str_replace('"', "", $out); if (substr($out, 0, 3) == '$F{') { if ($isPrintRepeatedValue == "true" || $isPrintRepeatedValue == "") { $arrdata[$num] = $this->data[$this->global_pointer][substr($out, 3, -1)]; } else { if ($this->previousarraydata[$arrdata[$num]] == $this->data[$this->global_pointer][substr($out, 3, -1)]) { $arrdata[$num] = ""; } else { $arrdata[$num] = $this->data[$this->global_pointer][substr($out, 3, -1)]; $this->previousarraydata[$out] = $this->data[$this->global_pointer][substr($out, 3, -1)]; } } } elseif (substr($out, 0, 3) == '$V{') { $arrdata[$num] =& $this->RParser->variables[substr($out, 3, -1)]["ans"]; } elseif (substr($out, 0, 3) == '$P{') { $arrdata[$num] = $this->RParser->parameters[substr($out, 3, -1)]; } } if (IReportHelper::left($data, 3) == '"("' && IReportHelper::right($data, 3) == '")"') { $total = 0; foreach ($arrdata as $num => $out) { if ($num > 0 && $num < $i) { $total += $out; } } return $total; } else { return implode($arrdata); } }
private function ParserElementTextField($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 = IReportHelper::get_first_value($data->textElement["textAlignment"]); } if (isset($data->textElement["rotation"])) { $rotation = $data->textElement["rotation"]; } 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->pointer[] = array("type" => "SetXY", "x" => $data->reportElement["x"], "y" => $data->reportElement["y"], "hidden_type" => "SetXY"); $this->pointer[] = array("type" => "SetTextColor", "r" => $textcolor["r"], "g" => $textcolor["g"], "b" => $textcolor["b"], "hidden_type" => "textcolor"); $this->pointer[] = array("type" => "SetDrawColor", "r" => $drawcolor["r"], "g" => $drawcolor["g"], "b" => $drawcolor["b"], "hidden_type" => "drawcolor"); $this->pointer[] = array("type" => "SetFillColor", "r" => $fillcolor["r"], "g" => $fillcolor["g"], "b" => $fillcolor["b"], "hidden_type" => "fillcolor"); $this->pointer[] = array("type" => "SetFont", "font" => $font, "fontstyle" => $fontstyle, "fontsize" => $fontsize, "hidden_type" => "font"); //$data->hyperlinkReferenceExpression=$this->analyse_expression($data->hyperlinkReferenceExpression); switch ($data->textFieldExpression) { case 'new java.util.Date()': $this->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => date("d/m/y h:i A", time()), "border" => $border, "align" => $align, "fill" => $fill, "hidden_type" => "date", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1)); break; case '"Page "+$V{PAGE_NUMBER}+" of"': $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"]); break; case '$V{PAGE_NUMBER}': if (isset($data["evaluationTime"]) && $data["evaluationTime"] == "Report") { $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"]); } else { $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"]); } break; case '" " + $V{PAGE_NUMBER}': $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"]); break; case '$V{REPORT_COUNT}': $this->report_count = 0; $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"]); break; case '$V{' . (isset($this->band[0]["gname"]) ? $this->band[0]["gname"] : "XXXX") . '_COUNT}': $this->group_count = 0; $this->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => &$this->group_count, "border" => $border, "align" => $align, "fill" => $fill, "hidden_type" => "group_count", "soverflow" => $stretchoverflow, "poverflow" => $printoverflow, "link" => substr($data->hyperlinkReferenceExpression, 1, -1), "pattern" => $data["pattern"]); break; default: $writeHTML = false; $isPrintRepeatedValues = false; if ($data->reportElement->property["name"] == "writeHTML") { $writeHTML = $data->reportElement->property["value"]; } if (isset($data->reportElement["isPrintRepeatedValues"])) { $isPrintRepeatedValues = $data->reportElement["isPrintRepeatedValues"]; } $this->pointer[] = array("type" => "MultiCell", "width" => $data->reportElement["width"], "height" => $height, "txt" => $data->textFieldExpression, "border" => $border, "align" => $align, "fill" => $fill, "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; } }