diff --git a/application/applicationcontext.class.inc.php b/application/applicationcontext.class.inc.php index fd29c7ab5..97bb0cd6c 100644 --- a/application/applicationcontext.class.inc.php +++ b/application/applicationcontext.class.inc.php @@ -57,9 +57,10 @@ class ApplicationContext if (empty(self::$aDefaultValues)) { self::$aDefaultValues = array(); + $aContext = utils::ReadParam('c', array()); foreach($this->aNames as $sName) { - $sValue = utils::ReadParam($sName, ''); + $sValue = isset($aContext[$sName]) ? $aContext[$sName] : ''; // TO DO: check if some of the context parameters are mandatory (or have default values) if (!empty($sValue)) { @@ -70,6 +71,20 @@ class ApplicationContext $this->aValues = self::$aDefaultValues; } + /** + * Returns the current value for the given parameter + * @param string $sParamName Name of the parameter to read + * @return mixed The value for this parameter + */ + public function GetCurrentValue($sParamName, $defaultValue = '') + { + if (isset($this->aValues[$sParamName])) + { + return $this->aValues[$sParamName]; + } + return $defaultValue; + } + /** * Returns the context as string with the format name1=value1&name2=value2.... * return string The context as a string to be appended to an href property @@ -79,7 +94,7 @@ class ApplicationContext $aParams = array(); foreach($this->aValues as $sName => $sValue) { - $aParams[] = $sName.'='.urlencode($sValue); + $aParams[] = "c[$sName]".'='.urlencode($sValue); } return implode("&", $aParams); } @@ -93,7 +108,7 @@ class ApplicationContext $sContext = ""; foreach($this->aValues as $sName => $sValue) { - $sContext .= "\n"; + $sContext .= "\n"; } return $sContext; } @@ -104,7 +119,12 @@ class ApplicationContext */ public function GetAsHash() { - return $this->aValues; + $aReturn = array(); + foreach($this->aValues as $sName => $sValue) + { + $aReturn["c[$sName]"] = $sValue; + } + return $aReturn; } /** diff --git a/application/cmdbabstract.class.inc.php b/application/cmdbabstract.class.inc.php index 64693fa20..e8236ff7b 100644 --- a/application/cmdbabstract.class.inc.php +++ b/application/cmdbabstract.class.inc.php @@ -899,7 +899,8 @@ EOF } $aOptions[MetaModel::GetName($sClassName)] = "