Commit 3b0da89476768fb38eb59bbb4222163455a3e545

Authored by Benjamin Renard
1 parent 5a2e21d3
Exists in anr_tempete

Inject snapshots in template_args

src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... ... @@ -578,7 +578,14 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
578 578  
579 579 //Param
580 580 if (!$isTTCat) {
581   - $paramInfo = $this->paramManager->addExistingParam($paramData->{'paramid'}, $this->paramsData, isset($paramData->{'template_args'}) ? $paramData->{'template_args'} : NULL);
  581 + $template_args = isset($paramData->{'template_args'}) ? $paramData->{'template_args'} : NULL;
  582 + if (isset($paramData->{'snapshots'})) {
  583 + // ANR TEMPETE - Inject snapshots in template_args
  584 + if (!isset($paramData->{'template_args'}))
  585 + $template_args = (Object)array();
  586 + $template_args->{'snapshots'} = $paramData->{'snapshots'};
  587 + }
  588 + $paramInfo = $this->paramManager->addExistingParam($paramData->{'paramid'}, $this->paramsData, $template_args);
582 589 } else {
583 590 $paramInfo = $this->paramManager->addTTCatParam($paramData->{'paramid'}, $this->paramsData);
584 591 }
... ...
src/InputOutput/IHMImpl/Tools/IHMImpexParamClass.php
... ... @@ -25,7 +25,7 @@ class IHMImpexParamClass extends IHMParamTemplateClass
25 25 if (!file_exists($this->filePath))
26 26 throw new Exception("no RemoteParams File ".$this->filePath);
27 27  
28   - $this->dom->load($this->filePath);
  28 + @$this->dom->load($this->filePath);
29 29  
30 30 }
31 31  
... ... @@ -139,13 +139,19 @@ class IHMImpexParamClass extends IHMParamTemplateClass
139 139 *
140 140 */
141 141 public function getImpexFullParamId($param_id, $templateArgs = NULL) {
142   -
  142 +
143 143 if (!$templateArgs)
144 144 return $param_id;
145 145  
146 146 $fullParamId = $param_id;
147   - foreach ($templateArgs as $key => $value)
148   - $fullParamId .= "_".$value;
  147 + foreach ($templateArgs as $key => $value) {
  148 + if ($key == 'snapshots') {
  149 + $fullParamId .= "_".md5(serialize($value));
  150 + }
  151 + else {
  152 + $fullParamId .= "_".$value;
  153 + }
  154 + }
149 155  
150 156 return $fullParamId;
151 157 }
... ... @@ -313,4 +319,4 @@ class IHMImpexParamClass extends IHMParamTemplateClass
313 319  
314 320 return $paramNode->getAttribute('units');
315 321 }
316   -}
317 322 \ No newline at end of file
  323 +}
... ...
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... ... @@ -324,7 +324,7 @@ class IHMParamManagerClass
324 324 {
325 325 if (!isset($this->paramImpexMgr))
326 326 $this->paramImpexMgr = new ImpexParamManager();
327   -
  327 +
328 328 $parameterID = $this->paramImpexMgr->getImpexFullParamId($param, $templateArgs);
329 329  
330 330 $requestNodes = $paramsData->getRequestNodes();
... ... @@ -337,11 +337,11 @@ class IHMParamManagerClass
337 337 $timesNode = $requestNodes[0]->getTimesNode();
338 338 $intervals = $timesNode->getIntervals();
339 339 $originFile = IHMConfigClass::getUserWSPath().$parameterID.".xml";
340   -
  340 +
341 341 if (!file_exists($originFile)) {
342   - // create IMPEX parameter info and data
  342 + // create IMPEX parameter info and data
343 343 $res = $this->paramImpexMgr->createImpexParameter($param, $intervals, $templateArgs);
344   -
  344 +
345 345 if (!$res["success"])
346 346 throw new Exception('Error to create IMPEX parameter : '.$res["message"]);
347 347  
... ...