diff options
Diffstat (limited to 'library')
-rwxr-xr-x | library/SSRS/Object/ExecutionInfo.php | 32 | ||||
-rwxr-xr-x | library/SSRS/Object/ExecutionParameters.php | 9 | ||||
-rw-r--r-- | library/SSRS/Object/Properties.php | 58 | ||||
-rwxr-xr-x | library/SSRS/Object/Report.php | 14 | ||||
-rwxr-xr-x | library/SSRS/Report.php | 32 | ||||
-rwxr-xr-x | library/SSRS/Soap/Exception.php | 14 | ||||
-rwxr-xr-x | library/SSRS/Soap/NTLM.php | 2 |
7 files changed, 132 insertions, 29 deletions
diff --git a/library/SSRS/Object/ExecutionInfo.php b/library/SSRS/Object/ExecutionInfo.php index 55998fd..97c74f9 100755 --- a/library/SSRS/Object/ExecutionInfo.php +++ b/library/SSRS/Object/ExecutionInfo.php @@ -7,23 +7,43 @@ */ class SSRS_Object_ExecutionInfo extends SSRS_Object_Abstract { - public function setExecutionInfo(stdClass $info) { - $this->setData($info); + /** + * Copy of self for backwards compatibility + * + * @var SSRS_Object_ExecutionInfo + */ + public $executionInfo; + + public function __construct(stdClass $info) { + $this->setData($info->executionInfo); + $this->executionInfo = $this; } public function setParameters(stdClass $params) { + return $this->setReportParameters($params); + } + + public function setReportParameters(stdClass $params) { $parameters = array(); foreach ($params->ReportParameter AS $reportParam) { - $parameter = new SSRS_Object_ReportParameter($reportParam->Name, null); + $parameter = new SSRS_Object_ReportParameter($reportParam->Name, isset($reportParam->Value) ? $reportParam->Value : null); $parameter->setData($reportParam); $parameters[] = $parameter; } - $execParams = new SSRS_Object_ExecutionParameters(); - $execParams->setParameters($parameters); + $this->data['ReportParameters'] = $parameters; + return $this; + } - $this->data['Parameters'] = $execParams; + /** + * Returns all report parameters in an array + * + * @return array parameters + * + */ + public function getReportParameters() { + return $this->data['ReportParameters']; } } diff --git a/library/SSRS/Object/ExecutionParameters.php b/library/SSRS/Object/ExecutionParameters.php index 95f4dee..bf3b819 100755 --- a/library/SSRS/Object/ExecutionParameters.php +++ b/library/SSRS/Object/ExecutionParameters.php @@ -23,10 +23,13 @@ class SSRS_Object_ExecutionParameters extends SSRS_Object_ArrayIterator { foreach ($parameters AS $key => $parameter) { if (($parameter instanceof SSRS_Object_ReportParameter) === false) { - $parameter = new SSRS_Object_ReportParameter($key, $parameter); + $values = (array) $parameter; + foreach ($values AS $value) { + $this->data['Parameters'][] = new SSRS_Object_ReportParameter($key, $value); + } + } else { + $this->data['Parameters'][] = $parameter; } - - $this->data['Parameters'][] = $parameter; } } diff --git a/library/SSRS/Object/Properties.php b/library/SSRS/Object/Properties.php new file mode 100644 index 0000000..6765450 --- /dev/null +++ b/library/SSRS/Object/Properties.php @@ -0,0 +1,58 @@ +<?php + +class SSRS_Object_Properties { + + protected $_properties = array(); + + public function __construct($properties = array()) { + $this->addProperties($properties); + } + + public function __get($name){ + return $this->getProperty($name); + } + + /** + * + * @param array $properties + */ + public function addProperties(array $properties) { + foreach ($properties AS $key => $value) { + if (is_object($value) && isset($value->Name)) { + $key = $value->Name; + $value = isset($value->Value)? $value->Value : null; + } + + $this->addProperty($key, $value); + } + } + + /** + * + * @param string $key + * @param mixed $value + * @return \SSRS_Object_Properties + */ + public function addProperty($key, $value) { + $this->_properties[$key] = $value; + return $this; + } + + /** + * + * @return array + */ + public function getProperties() { + return $this->_properties; + } + + /** + * + * @param string $key + * @return mixed + */ + public function getProperty($key) { + return array_key_exists($key, $this->_properties) ? $this->_properties[$key] : null; + } + +}
\ No newline at end of file diff --git a/library/SSRS/Object/Report.php b/library/SSRS/Object/Report.php deleted file mode 100755 index 6733e28..0000000 --- a/library/SSRS/Object/Report.php +++ /dev/null @@ -1,14 +0,0 @@ -<?php - -/** - * Description of ExecutionParameters - * - * @author andrew - */ -class SSRS_Object_Report extends SSRS_Object_Abstract{ - - public function setExecutionInfo(stdClass $info){ - $this->data['executionInfo'] = new SSRS_Object_ExecutionInfo($info); - } - -} diff --git a/library/SSRS/Report.php b/library/SSRS/Report.php index 83f7ca3..97a3362 100755 --- a/library/SSRS/Report.php +++ b/library/SSRS/Report.php @@ -21,7 +21,6 @@ require_once('Object/ExecutionInfo.php'); require_once('Object/Extensions.php'); require_once('Object/Extension.php'); require_once('Object/ReportParameter.php'); -require_once('Object/Report.php'); require_once('Object/ReportOutput.php'); require_once('Report/Exception.php'); @@ -205,6 +204,21 @@ class SSRS_Report { } /** + * Returns item properties + * + * @param string $path + * @return \SSRS_Object_Properties + */ + public function getProperties($itemPath) { + $params = array( + 'ItemPath' => $itemPath, + ); + + $result = $this->getSoapService()->GetProperties($params); + return new SSRS_Object_Properties($result->Values->Property); + } + + /** * Returns item definition details in a XML string. * Used to backup report definitions into a XML based RDL file. * @@ -233,7 +247,7 @@ class SSRS_Report { * * @param string $Report * @param string $HistoryId - * @return SSRS_Object_Report + * @return SSRS_Object_ExecutionInfo */ public function loadReport($Report, $HistoryId = null) { $params = array( @@ -242,7 +256,17 @@ class SSRS_Report { ); $result = $this->getSoapExecution()->LoadReport($params); - return new SSRS_Object_Report($result); + return new SSRS_Object_ExecutionInfo($result); + } + + /** + * Get current execution info + * + * @return \SSRS_Object_ExecutionInfo + */ + public function getExecutionInfo(){ + $result = $this->getSoapExecution()->GetExecutionInfo2(); + return new SSRS_Object_ExecutionInfo($result); } /** @@ -273,7 +297,7 @@ class SSRS_Report { * @param string $PaginationMode * @return SSRS_Object_ReportOutput */ - public function render($format, $deviceInfo = array(), $PaginationMode='Estimate') { + public function render($format, $deviceInfo = array(), $PaginationMode = 'Estimate') { $this->checkSessionId(); $deviceInfo = array('DeviceInfo' => array_merge(array('Toolbar' => 'false'), $deviceInfo)); diff --git a/library/SSRS/Soap/Exception.php b/library/SSRS/Soap/Exception.php index c2c0977..9d0902a 100755 --- a/library/SSRS/Soap/Exception.php +++ b/library/SSRS/Soap/Exception.php @@ -1,3 +1,15 @@ <?php -class SSRS_Soap_Exception extends Exception{}
\ No newline at end of file +class SSRS_Soap_Exception extends Exception{ + + public $httpCode; + public $response; + + public function __construct($message, $code, $response) { + $this->httpCode = $code; + $this->response = $response; + + parent::__construct($message, $code); + } + +}
\ No newline at end of file diff --git a/library/SSRS/Soap/NTLM.php b/library/SSRS/Soap/NTLM.php index 9132eae..0562c6d 100755 --- a/library/SSRS/Soap/NTLM.php +++ b/library/SSRS/Soap/NTLM.php @@ -154,7 +154,7 @@ class SSRS_Soap_NTLM extends SoapClient { $httpCode = curl_getinfo($handle, CURLINFO_HTTP_CODE); if ($httpCode !== 200) { - throw new SSRS_Soap_Exception('HTTP error: ' . $httpCode . ' ' . $response, $httpCode); + throw new SSRS_Soap_Exception('HTTP error: ' . $httpCode . ' ' . $response, $httpCode, $response); } curl_close($handle); |