summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/SSRS/Form/Adapter/ZendFramework2.php2
-rwxr-xr-xlibrary/SSRS/Object/RenderStream.php5
-rwxr-xr-xlibrary/SSRS/Object/ReportOutput.php23
-rwxr-xr-xlibrary/SSRS/Report.php13
-rw-r--r--library/SSRS/Report/CachedStreamResource.php5
5 files changed, 40 insertions, 8 deletions
diff --git a/library/SSRS/Form/Adapter/ZendFramework2.php b/library/SSRS/Form/Adapter/ZendFramework2.php
index 26e28a2..316c3f6 100644
--- a/library/SSRS/Form/Adapter/ZendFramework2.php
+++ b/library/SSRS/Form/Adapter/ZendFramework2.php
@@ -48,7 +48,7 @@ class ZendFramework2 extends AbstractAdapter {
foreach ($this->form->getElements() as $key => $element) {
$html .= '<div id="' . $key . '" class="element">';
$html .= $formRow->render($element);
- $html .= '</div>';
+ $html .= '</div>' . PHP_EOL;
}
$html .= $formRenderer->closeTag();
diff --git a/library/SSRS/Object/RenderStream.php b/library/SSRS/Object/RenderStream.php
index 02cbb33..7b10725 100755
--- a/library/SSRS/Object/RenderStream.php
+++ b/library/SSRS/Object/RenderStream.php
@@ -14,6 +14,11 @@ class RenderStream extends ObjectAbstract {
}
}
+ public function send() {
+ header('Content-Type: ' . $this->MimeType);
+ echo $this->Result;
+ }
+
public function __toString() {
return $this->Result;
}
diff --git a/library/SSRS/Object/ReportOutput.php b/library/SSRS/Object/ReportOutput.php
index 70d7928..7522edd 100755
--- a/library/SSRS/Object/ReportOutput.php
+++ b/library/SSRS/Object/ReportOutput.php
@@ -4,9 +4,15 @@ namespace SSRS\Object;
use SSRS\Report;
use SSRS\Report\CachedStreamResource;
+use SSRS\Object\ExecutionInfo;
class ReportOutput extends ObjectAbstract {
+ public function __construct($data = null, ExecutionInfo $executionInfo = null) {
+ parent::__construct($data);
+ $this->executionInfo = $executionInfo;
+ }
+
public function preCacheStreams(Report $report, $localCachePath, $format = 'HTML4.0') {
$this->verifyCachePath($localCachePath);
@@ -42,8 +48,23 @@ class ReportOutput extends ObjectAbstract {
exit(0);
}
+ public function resultClean() {
+ $output = (string) $this->Result;
+ $clean = $this->convertReplacementRootUrls($output);
+
+ return $clean;
+ }
+
+ protected function convertReplacementRootUrls($output) {
+ $executionId = ($this->executionInfo) ? $this->executionInfo->getExecutionId() : null;
+
+ return preg_replace_callback('#href="//php-ssrs//([^\?]+)([^"]+)"#', function($results) use($executionId) {
+ return 'href="' . html_entity_decode(urldecode($results[2])) . '&executionId=' . $executionId . '"';
+ }, $output);
+ }
+
public function __toString() {
- return (string) $this->Result;
+ return $this->resultClean();
}
protected function verifyCachePath($path) {
diff --git a/library/SSRS/Report.php b/library/SSRS/Report.php
index 2333d3a..71d786e 100755
--- a/library/SSRS/Report.php
+++ b/library/SSRS/Report.php
@@ -65,6 +65,7 @@ class Report {
$defaults = array(
'cache_wsdl_path' => null,
'curl_options' => array(),
+ 'hijackActionUrls' => false
);
$this->options = array_merge($defaults, $options);
@@ -340,16 +341,22 @@ class Report {
*/
public function render($format, $deviceInfo = array(), $PaginationMode = 'Estimate') {
$this->checkSessionId();
- $deviceInfo = array('DeviceInfo' => $deviceInfo);
+
+ $deviceInfoDefaults = array();
+ if ($this->options['hijackActionUrls']) {
+ $deviceInfoDefaults['ReplacementRoot'] = '//php-ssrs//';
+ }
+
+ $deviceInfoTree = array('DeviceInfo' => array_merge($deviceInfoDefaults, $deviceInfo));
$renderParams = array(
'Format' => $format,
- 'DeviceInfo' => $this->renderDeviceInfo($deviceInfo),
+ 'DeviceInfo' => $this->renderDeviceInfo($deviceInfoTree),
'PaginationMode' => $PaginationMode
);
$result = $this->getSoapExecution()->Render2($renderParams);
- return new ReportOutput($result);
+ return new ReportOutput($result, $this->getExecutionInfo());
}
/**
diff --git a/library/SSRS/Report/CachedStreamResource.php b/library/SSRS/Report/CachedStreamResource.php
index 013eaee..949c6d7 100644
--- a/library/SSRS/Report/CachedStreamResource.php
+++ b/library/SSRS/Report/CachedStreamResource.php
@@ -39,9 +39,8 @@ class CachedStreamResource {
public function send() {
$stream = $this->read();
-
- header('Content-Type: ' . $stream->MimeType);
- echo $stream->Result;
+ $stream->send();
+ return $this;
}
}