Commit e8ac74c9544a6a6a757e739bcea2d16d6581122d
Exists in
master
and in
32 other branches
Merge branch 'master_vge'
Showing
1 changed file
with
33 additions
and
9 deletions
Show diff stats
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... | ... | @@ -171,14 +171,11 @@ class IHMParamManagerClass |
171 | 171 | } |
172 | 172 | |
173 | 173 | /* |
174 | - * @brief Add a local parameter | |
175 | - */ | |
176 | - private function addLocalParam($param, $paramsData, $templateArgs, $tableLink) | |
174 | + * @brief Split param components if defined | |
175 | + */ | |
176 | + private function splitParamComponents($param) | |
177 | 177 | { |
178 | - //local parameter | |
179 | 178 | $indexes = array(); |
180 | - $calib_infos = array(); | |
181 | - //check for components | |
182 | 179 | $pattern = "/(?P<param>.*)\((?P<components>.*)\)/"; |
183 | 180 | preg_match_all($pattern, $param, $matches); |
184 | 181 | if ((count($matches["param"]) > 0) && (count($matches["components"]) > 0)) |
... | ... | @@ -188,6 +185,19 @@ class IHMParamManagerClass |
188 | 185 | } |
189 | 186 | else |
190 | 187 | $paramId = $param; |
188 | + return array('param' => $paramId, 'indexes' => $indexes); | |
189 | + } | |
190 | + | |
191 | + /* | |
192 | + * @brief Add a local parameter | |
193 | + */ | |
194 | + private function addLocalParam($param, $paramsData, $templateArgs, $tableLink) | |
195 | + { | |
196 | + //local parameter | |
197 | + $res = $this->splitParamComponents($param); | |
198 | + $indexes = $res['indexes']; | |
199 | + $paramId = $res['param']; | |
200 | + $calib_infos = array(); | |
191 | 201 | |
192 | 202 | //check templated parameter |
193 | 203 | $real_param_id = $paramId; |
... | ... | @@ -282,6 +292,10 @@ class IHMParamManagerClass |
282 | 292 | */ |
283 | 293 | private function addDerivedParam($param,$paramsData) |
284 | 294 | { |
295 | + $res = $this->splitParamComponents($param); | |
296 | + $indexes = $res['indexes']; | |
297 | + $param = $res['param']; | |
298 | + | |
285 | 299 | $time = time(); |
286 | 300 | if (!isset($this->userParameterMgr)) |
287 | 301 | $this->userParameterMgr = new IHMUserParamManagerClass(); |
... | ... | @@ -307,14 +321,20 @@ class IHMParamManagerClass |
307 | 321 | } |
308 | 322 | |
309 | 323 | $paramId = $param; |
324 | + | |
325 | + $reference_param = $res["param"]["info"]["reference_param"]; | |
326 | + if (!empty($res["param"]["info"]["reference_param"])) { | |
327 | + $res_split = $this->splitParamComponents($reference_param); | |
328 | + $reference_param = $res_split['param']; | |
329 | + } | |
310 | 330 | |
311 | 331 | //create a process param for the derived parameter |
312 | 332 | $this->addProcessParam($paramId, $expressionInfo["expression"], $res["param"]["expression"], |
313 | - $expressionInfo['params'], $res["param"]["info"]["sampling_mode"], $res["param"]["info"]["timestep"], $res["param"]["info"]["reference_param"], | |
333 | + $expressionInfo['params'], $res["param"]["info"]["sampling_mode"], $res["param"]["info"]["timestep"], $reference_param, | |
314 | 334 | 0,$res["param"]["dateModif"],!empty($res["param"]["info"]["units"]) ? $res["param"]["info"]["units"] : "", |
315 | 335 | !empty($res["param"]["info"]["yTitle"]) ? $res["param"]["info"]["yTitle"] : "", $paramsData); |
316 | 336 | |
317 | - return array("id" => $paramId, "indexes" => array(), "calib_infos" => array()); | |
337 | + return array("id" => $paramId, "indexes" => $indexes, "calib_infos" => array()); | |
318 | 338 | } |
319 | 339 | |
320 | 340 | /* |
... | ... | @@ -408,6 +428,10 @@ class IHMParamManagerClass |
408 | 428 | */ |
409 | 429 | private function addUploadedParam($param,$paramsData) |
410 | 430 | { |
431 | + $res = $this->splitParamComponents($param); | |
432 | + $indexes = $res['indexes']; | |
433 | + $param = $res['param']; | |
434 | + | |
411 | 435 | if (!isset($this->userParameterMgr)) |
412 | 436 | $this->userParameterMgr = new IHMUserParamManagerClass(); |
413 | 437 | |
... | ... | @@ -531,7 +555,7 @@ class IHMParamManagerClass |
531 | 555 | } |
532 | 556 | } |
533 | 557 | |
534 | - return array("id" => $paramId, "plotType" => $res["param"]["info"]["plotType"]); | |
558 | + return array("id" => $paramId, "indexes" => $indexes, "plotType" => $res["param"]["info"]["plotType"]); | |
535 | 559 | } |
536 | 560 | |
537 | 561 | public function applyFilter($paramsData, $paramData, &$paramInfo) { | ... | ... |