public function getReportData() { $uri = $this->__report->getResourceDescriptor()->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_URI); $request = new JasperRequestXmlDoc('runReport'); $request->setArgument('RUN_OUTPUT_FORMAT', $this->getFormat()); if ($this->getFormat() === 'HTML') { $request->setArgument('RUN_OUTPUT_IMAGES_URI', 'base64_inline_image:'); $request->setArgument('IMAGES_URI', 'base64_inline_image:'); } $request->setResourceDescriptor(JasperRequestXmlDoc::DESCRIPTOR_ATTR_URI, $uri); foreach ($this->__parameters as $pName => $pValue) { $request->setParameter($pName, $pValue); } $this->runReport($request); /** * Insert foreign image data as base64 inline images that * the html report could be viewed stand alone without * additional resources */ if ($this->getFormat() === 'HTML') { $this->htmlInsertInlineImages(); } return $this->__data; }
public function matchDescriptor(JasperResourceDescriptor &$rd) { if (count($this->__filters) == 0) { return true; } foreach ($this->__filters as $filter) { $val = null; switch ($filter['type']) { case self::TYPE_DESCRIPTOR: $val = $rd->getResourceDescriptor()->getParameter($filter['field'], false); break; case self::TYPE_PROPERTY: $val = $rd->getProperties()->getParameter($field['field'], false); break; } if (preg_match($filter['regex'], $val) == false) { return false; } } return true; }
private function applyInputControlStructs(JasperResourceDescriptor &$rd, array &$target, $key = 'jsControl') { $struct = array(); $rd_name = $rd->getResourceDescriptor()->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_NAME); $rd_type = $rd->getProperties()->getParameter(JasperResourceDescriptor::PROP_DATATYPE_TYPE); $rd_control = $rd->getProperties()->getParameter(JasperResourceDescriptor::PROP_INPUTCONTROL_TYPE); // $this->context->getLoggerManager()->log("Control: $rd_control, Name: $rd_name, Type: $rd_type", 16); if (array_key_exists($rd_name, $this->__nameMapping)) { $struct = $this->__nameMapping[$rd_name]; } elseif (array_key_exists($rd_control, $this->__controlMapping)) { $struct = $this->__controlMapping[$rd_control]; } elseif (array_key_exists($rd_type, $this->__typeMapping)) { $struct = $this->__typeMapping[$rd_type]; } $target[$key] = $struct; // $this->context->getLoggerManager()->log(print_r($target, 1), 16); return true; }
public function storeFile($data, $output_format, JasperResourceDescriptor $rd) { $extension = $this->getExtensionFromFormat($output_format); $filename = sprintf('%s/%s', $this->__dir, $this->getNewFilename($extension)); $bytes = file_put_contents($filename, $data); if (!strlen($data) == $bytes) { throw new AppKitModelException('Bytes written different to source data'); } $struct = array('filename' => $filename, 'format' => $output_format, 'bytes' => $bytes, 'checksum' => md5($data), 'reportname' => $rd->getResourceDescriptor()->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_NAME), 'pushname' => sprintf('%s.%s', $rd->getResourceDescriptor()->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_NAME), $extension)); $this->getContext()->getStorage()->write(self::STORE_NAME, $struct); return true; }