diff options
author | jaysmith6811@gmail.com <jaysmith6811@gmail.com@deae1e92-32f9-c189-e222-5b9b5081a27a> | 2012-09-25 15:50:03 +0000 |
---|---|---|
committer | jaysmith6811@gmail.com <jaysmith6811@gmail.com@deae1e92-32f9-c189-e222-5b9b5081a27a> | 2012-09-25 15:50:03 +0000 |
commit | e5402b28c9a3f22030f40a4fa179a3bcf6480b7c (patch) | |
tree | 57891e35a4519edf97fbe3a390aef879bb133977 /library/SSRS/Object | |
parent | d5fc5d659d7c6f76b07f781f253b67835f1b1dd1 (diff) | |
download | php-ssrs-e5402b28c9a3f22030f40a4fa179a3bcf6480b7c.zip php-ssrs-e5402b28c9a3f22030f40a4fa179a3bcf6480b7c.tar.gz php-ssrs-e5402b28c9a3f22030f40a4fa179a3bcf6480b7c.tar.bz2 |
Execution info object, getExecutionInfo method
Diffstat (limited to 'library/SSRS/Object')
-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 |
4 files changed, 90 insertions, 23 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); - } - -} |