diff --git a/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php b/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php index 9c428f0..43811ca 100644 --- a/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php +++ b/src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php @@ -171,14 +171,11 @@ class IHMParamManagerClass } /* - * @brief Add a local parameter - */ - private function addLocalParam($param, $paramsData, $templateArgs, $tableLink) + * @brief Split param components if defined + */ + private function splitParamComponents($param) { - //local parameter $indexes = array(); - $calib_infos = array(); - //check for components $pattern = "/(?P<param>.*)\((?P<components>.*)\)/"; preg_match_all($pattern, $param, $matches); if ((count($matches["param"]) > 0) && (count($matches["components"]) > 0)) @@ -188,6 +185,19 @@ class IHMParamManagerClass } else $paramId = $param; + return array('param' => $paramId, 'indexes' => $indexes); + } + + /* + * @brief Add a local parameter + */ + private function addLocalParam($param, $paramsData, $templateArgs, $tableLink) + { + //local parameter + $res = $this->splitParamComponents($param); + $indexes = $res['indexes']; + $paramId = $res['param']; + $calib_infos = array(); //check templated parameter $real_param_id = $paramId; @@ -201,7 +211,7 @@ class IHMParamManagerClass else { $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; if (!file_exists($paramPath)) - throw new Exception('Cannot find parameter local file '.$paramId); + throw new Exception('Cannot find parameter local file '.$paramId." - ".$paramPath); } $paramsData->addParamToCopy($real_param_id,$paramPath); @@ -229,7 +239,7 @@ class IHMParamManagerClass else { $paramPath = IHMConfigClass::getLocalParamDBPath().$paramId.".xml"; if (empty($paramPath) || !@$doc->load($paramPath)) - throw new Exception('Cannot find parameter local file '.$paramId); + throw new Exception('Cannot find parameter local file '.$paramId." - ".$paramPath); } //<get> @@ -282,6 +292,10 @@ class IHMParamManagerClass */ private function addDerivedParam($param,$paramsData) { + $res = $this->splitParamComponents($param); + $indexes = $res['indexes']; + $param = $res['param']; + $time = time(); if (!isset($this->userParameterMgr)) $this->userParameterMgr = new IHMUserParamManagerClass(); @@ -307,14 +321,20 @@ class IHMParamManagerClass } $paramId = $param; + + $reference_param = $res["param"]["info"]["reference_param"]; + if (!empty($res["param"]["info"]["reference_param"])) { + $res_split = $this->splitParamComponents($reference_param); + $reference_param = $res_split['param']; + } //create a process param for the derived parameter $this->addProcessParam($paramId, $expressionInfo["expression"], $res["param"]["expression"], - $expressionInfo['params'], $res["param"]["info"]["sampling_mode"], $res["param"]["info"]["timestep"], $res["param"]["info"]["reference_param"], + $expressionInfo['params'], $res["param"]["info"]["sampling_mode"], $res["param"]["info"]["timestep"], $reference_param, 0,$res["param"]["dateModif"],!empty($res["param"]["info"]["units"]) ? $res["param"]["info"]["units"] : "", !empty($res["param"]["info"]["yTitle"]) ? $res["param"]["info"]["yTitle"] : "", $paramsData); - return array("id" => $paramId, "indexes" => array(), "calib_infos" => array()); + return array("id" => $paramId, "indexes" => $indexes, "calib_infos" => array()); } /* @@ -408,6 +428,10 @@ class IHMParamManagerClass */ private function addUploadedParam($param,$paramsData) { + $res = $this->splitParamComponents($param); + $indexes = $res['indexes']; + $param = $res['param']; + if (!isset($this->userParameterMgr)) $this->userParameterMgr = new IHMUserParamManagerClass(); @@ -531,7 +555,7 @@ class IHMParamManagerClass } } - return array("id" => $paramId, "plotType" => $res["param"]["info"]["plotType"]); + return array("id" => $paramId, "indexes" => $indexes, "plotType" => $res["param"]["info"]["plotType"]); } public function applyFilter($paramsData, $paramData, &$paramInfo) { -- libgit2 0.21.2