/**
  * Returns a JasperResponseXmlDoc to working on
  * @return JasperResponseXmlDoc
  */
 private function getJasperResponse()
 {
     $request = new JasperRequestXmlDoc('get');
     $request->setResourceDescriptor(JasperRequestXmlDoc::DESCRIPTOR_ATTR_URI, $this->__uri);
     $response = new JasperResponseXmlDoc($this->__client->get($request->getSoapParameter()));
     return $response;
 }
 private function buildSoapRequest($uri)
 {
     $request = new JasperRequestXmlDoc('get');
     $request->setResourceDescriptor(JasperRequestXmlDoc::DESCRIPTOR_ATTR_URI, $uri);
     $descriptors = new JasperResponseXmlDoc($this->__client->get($request->getSoapParameter()));
     foreach ($descriptors as $rd) {
         if ($rd->getResourceDescriptor()->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_TYPE) == 'inputControl') {
             $this->__inputControls[] = $rd;
         }
     }
 }
 /**
  * Fire the request and return the result. Also do a basic security
  * checking against the configured root path
  * @throws AgaviSecurityException
  * @return JasperSoapMultipartClient
  */
 public function doJasperRequest()
 {
     if ($this->checkUri($this->__uri) == false) {
         throw new AgaviSecurityException('You are not allowed to access ' . $this->__uri);
     }
     $this->__soap = $this->__client->getSoapClientForWSDL(Reporting_JasperSoapFactoryModel::SERVICE_REPOSITORY);
     $request = new JasperRequestXmlDoc('get');
     $request->setResourceDescriptor(JasperRequestXmlDoc::DESCRIPTOR_ATTR_URI, $this->__uri);
     $this->__soap->doRequest($request);
     return $this->__soap;
 }
 private function getListvalues($uri)
 {
     $request = new JasperRequestXmlDoc('get');
     $request->setResourceDescriptor(JasperRequestXmlDoc::DESCRIPTOR_ATTR_URI, $uri);
     $response = new JasperResponseXmlDoc($this->__client->get($request->getSoapParameter()));
     $data = array();
     foreach ($response as $rd) {
         $data = $rd->getProperties()->getParameter(JasperResourceDescriptor::PROP_LOV);
         break;
     }
     return $data;
 }
 public function getJsonStructure()
 {
     $request = new JasperRequestXmlDoc('list');
     $request->setResourceDescriptor(JasperRequestXmlDoc::DESCRIPTOR_ATTR_TYPE, 'folder');
     $uri = $this->__parent;
     if ($this->hasParameter('tree_root')) {
         if (!preg_match('/^' . preg_quote($this->getParameter('tree_root'), '/') . '/', $uri)) {
             if ($uri !== 'root') {
                 $this->getContext()->getLoggerManager()->log('Reports: Possible security hack, try accessing jasper server on ' . $uri . ' without matching root path', AgaviLogger::ERROR);
             }
             $uri = $this->getParameter('tree_root');
         }
     } else {
         if ($uri == 'root') {
             $uri = '/';
         }
     }
     $request->setResourceDescriptor(JasperRequestXmlDoc::DESCRIPTOR_ATTR_URI, $uri);
     $response = new JasperResponseXmlDoc($this->__soap->list($request->getSoapParameter()));
     $out = array();
     foreach ($response as $rd) {
         /*
          * Maybe we should dereference references without name, don't know
          */
         if (!$rd->getResourceDescriptor()->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_NAME)) {
             continue;
         }
         if ($this->__filter) {
             if ($this->__filter->matchDescriptor($rd) == false) {
                 continue;
             }
         }
         $p = $rd->getResourceDescriptor();
         $tmp = array('id' => $p->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_URI), 'text' => $p->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_NAME), 'leaf' => $p->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_TYPE) == 'folder' ? false : true, 'type' => $p->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_TYPE), 'uri' => $p->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_URI), 'name' => $p->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_NAME), 'label' => $rd->getLabel(), 'iconCls' => $this->mapIconClassByType($p->getParameter(JasperResourceDescriptor::DESCRIPTOR_ATTR_TYPE)));
         $tmp = (array) $rd->getProperties()->getParameters() + $tmp;
         $out[] = $tmp;
     }
     return $out;
 }
 private function decodeSoapReply($content)
 {
     $dom = new DOMDocument(self::XML_VERSION, self::XML_ENCODING);
     $dom->loadXML($content);
     $xpath = new DOMXPath($dom);
     $xpath->registerNamespace('soapenv', self::SOAP_NS);
     $xpath->registerNamespace('jasper', self::JASPER_NS);
     $nodes = $xpath->evaluate(sprintf('soapenv:Body/jasper:%1$sResponse/%1$sReturn[@xsi:type=\'xsd:string\']', $this->__request->getOperationName()));
     if ($nodes && $nodes->length == 1) {
         $result = $nodes->item(0)->nodeValue;
         return $result;
     }
 }
 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;
 }