Commit b1a5ee3c259f3768d633aed500d7eec0bfc54dd9
1 parent
7cced201
Exists in
master
and in
20 other branches
Integration part for parameter status
Showing
4 changed files
with
86 additions
and
36 deletions
Show diff stats
src/InputOutput/IHMImpl/Params/DataMiningImpl/IHMInputOutputParamsDataMiningClass.php
... | ... | @@ -42,7 +42,7 @@ class IHMInputOutputParamsDataMiningClass extends IHMInputOutputParamsAbstractCl |
42 | 42 | //create a derived param for the expression |
43 | 43 | $this->paramManager->addProcessParam($paramId, $expressionInfo["expression"], $input->expression, |
44 | 44 | $expressionInfo['params'], $input->sampling_mode, $input->sampling, $input->reference_param, |
45 | - $input->gap,time(),"","",$this->paramsData); | |
45 | + $input->gap,time(),"","",$input->status,$this->paramsData); | |
46 | 46 | |
47 | 47 | //add derived param to output |
48 | 48 | $paramsNode->addParam($paramId); | ... | ... |
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... | ... | @@ -32,7 +32,7 @@ class IHMParamManagerClass |
32 | 32 | //create a process param for the derived parameter |
33 | 33 | $this->addProcessParam($paramId, $expressionInfo["expression"], $expression, |
34 | 34 | $expressionInfo['params'], $sampling_mode, $sampling_step, $ref_param, |
35 | - 0, time(), "", "", $paramsData); | |
35 | + 0, time(), "", "","", $paramsData); | |
36 | 36 | } |
37 | 37 | |
38 | 38 | /* |
... | ... | @@ -53,12 +53,62 @@ class IHMParamManagerClass |
53 | 53 | return ""; |
54 | 54 | } |
55 | 55 | |
56 | + public function statusStrToArray($statusStr){ | |
57 | + $defs = explode("-",$statusStr); | |
58 | + if (!empty($statusStr)) { | |
59 | + foreach ($defs as $def) { | |
60 | + $def = trim($def); | |
61 | + $p = strpos($def, ":"); | |
62 | + if ($p === FALSE) { | |
63 | + continue; | |
64 | + } | |
65 | + | |
66 | + $vals = trim(substr($def, 0, $p)); | |
67 | + $name = substr($def, $p+1); | |
68 | + | |
69 | + $name = trim($name); | |
70 | + $color = ""; | |
71 | + $p = strpos($name, "["); | |
72 | + if ($p !== FALSE) { | |
73 | + $color = substr($name, $p); | |
74 | + $color = trim($color); | |
75 | + $name = substr($name, 0, $p); | |
76 | + $name = trim($name); | |
77 | + if(empty($name)) | |
78 | + $name = $vals; | |
79 | + } | |
80 | + | |
81 | + $p2=strpos($vals, ","); | |
82 | + $minVal = ""; | |
83 | + $maxVal = ""; | |
84 | + if ($p2 !== FALSE) { | |
85 | + $minVal= trim(substr($vals, 1, $p2)); | |
86 | + $maxVal = trim(substr($vals,$p2+1, -1)); | |
87 | + } | |
88 | + else{ | |
89 | + $minVal= $vals; | |
90 | + $maxVal = $vals; | |
91 | + } | |
92 | + $status[] = array( | |
93 | + "min" => floatval($minVal), | |
94 | + "max" => floatval($maxVal), | |
95 | + "name" => $name, | |
96 | + "color" => $color, | |
97 | + ); | |
98 | + } | |
99 | + return $status; | |
100 | + } | |
101 | + | |
102 | + } | |
103 | + | |
56 | 104 | /* |
57 | 105 | * @brief Add a process parameter |
58 | 106 | */ |
59 | - public function addProcessParam($paramId,$expression,$expression_info,$params, $sampling_mode, $sampling_step, $ref_param, $gap,$dateModif,$units,$ytitle,$paramsData) | |
107 | + public function addProcessParam($paramId,$expression,$expression_info,$params, $sampling_mode, $sampling_step, $ref_param, $gap,$dateModif,$units,$ytitle,$statusStr,$paramsData) | |
60 | 108 | { |
61 | - $paramsData->addProcessParamToCreate($paramId, $expression, $expression_info, $params, $sampling_mode, $sampling_step, $ref_param, $gap,$dateModif, $units, $ytitle); | |
109 | + $status = $this->statusStrToArray($statusStr); | |
110 | + | |
111 | + $paramsData->addProcessParamToCreate($paramId, $expression, $expression_info, $params, $sampling_mode, $sampling_step, $ref_param, $gap,$dateModif, $units, $ytitle, $status); | |
62 | 112 | |
63 | 113 | foreach ($params as $param) { |
64 | 114 | $template_args = NULL; |
... | ... | @@ -134,31 +184,7 @@ class IHMParamManagerClass |
134 | 184 | ); |
135 | 185 | } |
136 | 186 | else { |
137 | - foreach ($defs as $def) { | |
138 | - $def = trim($def); | |
139 | - $p = strpos($def, ":"); | |
140 | - if ($p === FALSE) { | |
141 | - continue; | |
142 | - } | |
143 | - $val = substr($def, 0, $p); | |
144 | - $val = trim($val); | |
145 | - $name = substr($def, $p+1); | |
146 | - $name = trim($name); | |
147 | - $color = ""; | |
148 | - $p = strpos($name, "["); | |
149 | - if ($p !== FALSE) { | |
150 | - $color = substr($name, $p); | |
151 | - $color = trim($color); | |
152 | - $name = substr($name, 0, $p); | |
153 | - $name = trim($name); | |
154 | - } | |
155 | - $status[] = array( | |
156 | - "min" => floatval($val), | |
157 | - "max" => floatval($val), | |
158 | - "name" => $name, | |
159 | - "color" => $color, | |
160 | - ); | |
161 | - } | |
187 | + $status = $this->statusStrToArray($statusParam); | |
162 | 188 | } |
163 | 189 | } |
164 | 190 | else { |
... | ... | @@ -377,7 +403,8 @@ class IHMParamManagerClass |
377 | 403 | $this->addProcessParam($paramId, $expressionInfo["expression"], $res["param"]["expression"], |
378 | 404 | $expressionInfo['params'], $res["param"]["info"]["sampling_mode"], $res["param"]["info"]["timestep"], $reference_param, |
379 | 405 | 0,$res["param"]["dateModif"],!empty($res["param"]["info"]["units"]) ? $res["param"]["info"]["units"] : "", |
380 | - !empty($res["param"]["info"]["yTitle"]) ? $res["param"]["info"]["yTitle"] : $newParamName, $paramsData); | |
406 | + !empty($res["param"]["info"]["yTitle"]) ? $res["param"]["info"]["yTitle"] : $newParamName, | |
407 | + !empty($res["param"]["info"]["status"]) ? $res["param"]["info"]["status"] : "", $paramsData); | |
381 | 408 | |
382 | 409 | return array("id" => $paramId, "indexes" => $indexes, "calib_infos" => array()); |
383 | 410 | } |
... | ... | @@ -414,7 +441,7 @@ class IHMParamManagerClass |
414 | 441 | $res["param"]["info"]["viId"], $res["param"]["info"]["realVar"], |
415 | 442 | $res["param"]["info"]["minSampling"], $res["param"]["info"]["maxSampling"], |
416 | 443 | $res["param"]["info"]["type"],$res["param"]["info"]["size"], |
417 | - NULL,$res["param"]["dateModif"],true); | |
444 | + NULL,$res["param"]["dateModif"],"",true); | |
418 | 445 | |
419 | 446 | $newParamNode->getInfo()->setName($res["param"]["info"]['name']); |
420 | 447 | $newParamNode->getInfo()->setShortName($res["param"]["info"]['name']); |
... | ... | @@ -487,12 +514,12 @@ class IHMParamManagerClass |
487 | 514 | throw new Exception('Error to load uploaded parameter file : '.$res["message"]); |
488 | 515 | |
489 | 516 | $paramId = $param; |
490 | - | |
517 | + $status = $this->statusStrToArray($res["param"]["info"]["status"]); | |
491 | 518 | $newParamNode = $paramsData->addLocalParamToCreate($paramId, |
492 | 519 | $res["param"]["info"]["viId"], $res["param"]["info"]["realVar"], |
493 | 520 | $res["param"]["info"]["minSampling"], $res["param"]["info"]["maxSampling"], |
494 | 521 | $res["param"]["info"]["type"],$res["param"]["info"]["size"], |
495 | - $res["param"]["info"]["fillValue"],$res["param"]["dateModif"]); | |
522 | + $res["param"]["info"]["fillValue"],$res["param"]["dateModif"],$status); | |
496 | 523 | |
497 | 524 | if (!empty($res["param"]["info"]["yTitle"])) { |
498 | 525 | $newParamNode->getInfo()->setName($res["param"]["info"]['yTitle']); | ... | ... |
src/InputOutput/IHMImpl/Tools/IHMUserParamManagerClass.php
... | ... | @@ -20,6 +20,7 @@ class IHMUserParamManagerClass |
20 | 20 | private static $infoDerivedUnitsNode = 'units'; |
21 | 21 | private static $infoDerivedYTitleNode = 'ytitle'; |
22 | 22 | private static $infoDerivedDescriptionNode = 'description'; |
23 | + private static $infoDerivedStatusNode = 'status'; | |
23 | 24 | private static $infoDerivedParsedExpNode = 'parsedExp'; |
24 | 25 | private static $infoDerivedParsedExpValAtt = 'exp'; |
25 | 26 | private static $infoDerivedParsedExpHashAtt = 'hash'; |
... | ... | @@ -49,6 +50,7 @@ class IHMUserParamManagerClass |
49 | 50 | private static $infoUploadedFillValNode = 'fillvalue'; |
50 | 51 | private static $infoUploadedPlotTypeNode = 'plottype'; |
51 | 52 | private static $infoUploadedTableDefNode = 'tableDef'; |
53 | + private static $infoUploadedStatusNode = 'status'; | |
52 | 54 | private static $infoUploadedUnitsNode = 'units'; |
53 | 55 | private static $infoUploadedYTitleNode = 'ytitle'; |
54 | 56 | |
... | ... | @@ -257,7 +259,7 @@ class IHMUserParamManagerClass |
257 | 259 | /* |
258 | 260 | * @brief Load additionnal derived parameter info from paramId |
259 | 261 | */ |
260 | - private function loadDerivedParameterInfo($paramId, $paramExpression) | |
262 | + private function loadDerivedParameterInfo($paramId, $paramExpression=NULL) | |
261 | 263 | { |
262 | 264 | //get full path |
263 | 265 | $path = IHMConfigClass::getUserDerivedParamFilePath($paramId); |
... | ... | @@ -266,6 +268,7 @@ class IHMUserParamManagerClass |
266 | 268 | "units" => "", |
267 | 269 | "yTitle" => "", |
268 | 270 | "description" => "", |
271 | + "status" => "", | |
269 | 272 | "parsedExpression" => NULL, |
270 | 273 | "sampling_mode" => "timestep", |
271 | 274 | "timestep" => 0, |
... | ... | @@ -327,6 +330,10 @@ class IHMUserParamManagerClass |
327 | 330 | if ($descNodes->length > 0) |
328 | 331 | $result["description"] = $descNodes->item(0)->nodeValue; |
329 | 332 | |
333 | + //get parameter status | |
334 | + $statusNodes = $dom->getElementsByTagName(self::$infoDerivedStatusNode); | |
335 | + if ($statusNodes->length > 0) | |
336 | + $result["status"] = $statusNodes->item(0)->nodeValue; | |
330 | 337 | //get parsed expression if exists |
331 | 338 | $parsedExpNodes = $dom->getElementsByTagName(self::$infoDerivedParsedExpNode); |
332 | 339 | if ($parsedExpNodes->length > 0) { |
... | ... | @@ -415,6 +422,11 @@ class IHMUserParamManagerClass |
415 | 422 | if ($typeNodes->length > 0) |
416 | 423 | $result["type"] = $typeNodes->item(0)->nodeValue; |
417 | 424 | |
425 | + //get parameter status | |
426 | + $statusNodes = $dom->getElementsByTagName(self::$infoUploadedStatusNode); | |
427 | + if ($statusNodes->length > 0) | |
428 | + $result["status"] = $statusNodes->item(0)->nodeValue; | |
429 | + | |
418 | 430 | //get parameter size |
419 | 431 | $sizeNodes = $dom->getElementsByTagName(self::$infoUploadedSizeNode); |
420 | 432 | if ($sizeNodes->length > 0) | ... | ... |
src/Request/ParamsRequestImpl/ParamsRequestDataClass.php
... | ... | @@ -141,7 +141,7 @@ class ParamsRequestDataClass extends ProcessRequestDataClass |
141 | 141 | $this->datasetId[] = $dsId; |
142 | 142 | } |
143 | 143 | |
144 | - public function addProcessParamToCreate($paramId, $expression, $expression_info, $getParams, $sampling_mode, $sampling_step, $ref_param, $gap, $dateModif, $units, $ytitle) | |
144 | + public function addProcessParamToCreate($paramId, $expression, $expression_info, $getParams, $sampling_mode, $sampling_step, $ref_param, $gap, $dateModif, $units, $ytitle, $status) | |
145 | 145 | { |
146 | 146 | $newParam = new ParamNodeClass(); |
147 | 147 | $newParam->setId($paramId); |
... | ... | @@ -154,6 +154,11 @@ class ParamsRequestDataClass extends ProcessRequestDataClass |
154 | 154 | else { |
155 | 155 | $newParam->getInfo()->setShortName($paramId); |
156 | 156 | } |
157 | + if (!empty($status)) { | |
158 | + foreach ($status as $def) { | |
159 | + $newParam->getInfo()->addStatus($def["min"], $def["max"], $def["name"], $def["color"]); | |
160 | + } | |
161 | + } | |
157 | 162 | switch ($sampling_mode) { |
158 | 163 | case 'refparam': |
159 | 164 | $newParam->setReferenceParameter($ref_param); |
... | ... | @@ -223,7 +228,7 @@ class ParamsRequestDataClass extends ProcessRequestDataClass |
223 | 228 | return $this->localParamsToCreateAndCopy; |
224 | 229 | } |
225 | 230 | |
226 | - public function addLocalParamToCreate($paramId, $viId, $realVarId, $minSampling, $maxSampling, $type, $size, $fillValue, $dateModif, $isImpex = false) | |
231 | + public function addLocalParamToCreate($paramId, $viId, $realVarId, $minSampling, $maxSampling, $type, $size, $fillValue, $dateModif, $status, $isImpex = false) | |
227 | 232 | { |
228 | 233 | $newParam = new ParamNodeClass(); |
229 | 234 | $newParam->setId($paramId); |
... | ... | @@ -240,6 +245,12 @@ class ParamsRequestDataClass extends ProcessRequestDataClass |
240 | 245 | |
241 | 246 | $newParam->setProcess("",""); |
242 | 247 | $newParam->setOutput(); |
248 | + | |
249 | + if (!empty($status)) { | |
250 | + foreach ($status as $def) { | |
251 | + $newParam->getInfo()->addStatus($def["min"], $def["max"], $def["name"], $def["color"]); | |
252 | + } | |
253 | + } | |
243 | 254 | |
244 | 255 | if ($isImpex) |
245 | 256 | { | ... | ... |