Commit 577d5c043c0761adf93e2de4976c51ce05ffceb8
1 parent
ffc5cb81
Exists in
master
and in
66 other branches
IMPEX integration
Showing
5 changed files
with
99 additions
and
11 deletions
Show diff stats
src/InputOutput/IHMImpl/Config/IHMConfigClass.php
... | ... | @@ -53,8 +53,8 @@ class IHMConfigClass |
53 | 53 | |
54 | 54 | private static $userHost; |
55 | 55 | |
56 | - public static $remoteDataDir = "/home/budnik/RemoteDataCenter/MAJ/"; | |
57 | - | |
56 | + public static $remoteDataDir = "RemoteData/"; | |
57 | + | |
58 | 58 | public static function setUserName($userName) |
59 | 59 | { |
60 | 60 | self::$userName = $userName; |
... | ... | @@ -215,8 +215,7 @@ class IHMConfigClass |
215 | 215 | public static function getRemoteParamsFile() |
216 | 216 | { |
217 | 217 | $remoteBasePath = self::getUserPath().self::$wsDir; |
218 | - | |
219 | - | |
218 | + | |
220 | 219 | return $remoteBasePath.'RemoteParams.xml'; |
221 | 220 | } |
222 | 221 | |
... | ... | @@ -229,6 +228,14 @@ class IHMConfigClass |
229 | 228 | |
230 | 229 | return $requestPath; |
231 | 230 | } |
231 | + | |
232 | + public static function getRemoteDataPath() | |
233 | + { | |
234 | + $remoteDataPath = IHM_SRC_DIR.self::$genericDataDir.self::$remoteDataDir; | |
235 | + | |
236 | + return $remoteDataPath; | |
237 | + } | |
238 | + | |
232 | 239 | } |
233 | 240 | |
234 | 241 | ?> |
... | ... |
src/InputOutput/IHMImpl/ParamInfo/IHMInputOutputParamInfoClass.php
... | ... | @@ -100,7 +100,7 @@ class IHMInputOutputParamInfoClass implements InputOutputInterface |
100 | 100 | $templatedParams = $this->paramImpexMgr->getParamTemplates(); |
101 | 101 | |
102 | 102 | $simRegion = $this->paramImpexMgr->getSimulationRegion($input->paramId); |
103 | - | |
103 | + | |
104 | 104 | // No SimulationRuns (LESIA) |
105 | 105 | if ($simRegion == "UNKNOWN") |
106 | 106 | $simRegion = $this->paramImpexMgr->getResourceID($input->paramId); |
... | ... |
src/InputOutput/IHMImpl/Tools/IHMImpexParamClass.php
... | ... | @@ -132,7 +132,7 @@ class IHMImpexParamClass extends IHMParamTemplateClass |
132 | 132 | |
133 | 133 | public function setParamTemplateListFilePath($paramId) |
134 | 134 | { |
135 | - $this->paramTemplateListFilePath = IHMConfigClass::$remoteDataDir.$this->getDataProducer($paramId).'_Templates.xml'; | |
135 | + $this->paramTemplateListFilePath = IHMConfigClass::getRemoteDataPath().$this->getDataProducer($paramId)."/".$this->getDataProducer($paramId).'_Templates.xml'; | |
136 | 136 | } |
137 | 137 | |
138 | 138 | /* |
... | ... | @@ -252,7 +252,7 @@ class IHMImpexParamClass extends IHMParamTemplateClass |
252 | 252 | if ($this->getDataProducer($paramId) != "IPIM" && !$this->isSpectra($paramId)) |
253 | 253 | return null; |
254 | 254 | |
255 | - $templateXml = IHMConfigClass::$remoteDataDir.$this->getDataProducer($paramId).'_PlotSettings.xml'; | |
255 | + $templateXml = IHMConfigClass::getRemoteDataPath().$this->getDataProducer($paramId)."/".$this->getDataProducer($paramId).'_PlotSettings.xml'; | |
256 | 256 | |
257 | 257 | if (!file_exists($templateXml)) |
258 | 258 | throw new Exception("No $templateXml"); |
... | ... | @@ -285,4 +285,32 @@ class IHMImpexParamClass extends IHMParamTemplateClass |
285 | 285 | return $paramNode->hasAttribute('isSpectra'); |
286 | 286 | |
287 | 287 | } |
288 | + | |
289 | + public function getEnergyTableName($paramId) | |
290 | + { | |
291 | + $paramNode = $this->dom->getElementById($paramId); | |
292 | + if (!$paramNode) | |
293 | + throw new Exception("No $paramId"); | |
294 | + | |
295 | + return $paramNode->getAttribute('energyRange'); | |
296 | + | |
297 | + } | |
298 | + | |
299 | + public function getEnergyUnits($paramId) | |
300 | + { | |
301 | + $paramNode = $this->dom->getElementById($paramId); | |
302 | + if (!$paramNode) | |
303 | + throw new Exception("No $paramId"); | |
304 | + | |
305 | + return $paramNode->getAttribute('energyUnits'); | |
306 | + } | |
307 | + | |
308 | + public function getUnits($paramId) | |
309 | + { | |
310 | + $paramNode = $this->dom->getElementById($paramId); | |
311 | + if (!$paramNode) | |
312 | + throw new Exception("No $paramId"); | |
313 | + | |
314 | + return $paramNode->getAttribute('units'); | |
315 | + } | |
288 | 316 | } |
289 | 317 | \ No newline at end of file |
... | ... |
src/InputOutput/IHMImpl/Tools/IHMParamManagerClass.php
... | ... | @@ -233,10 +233,45 @@ class IHMParamManagerClass |
233 | 233 | $res["param"]["info"]["type"],$res["param"]["info"]["size"], |
234 | 234 | $res["param"]["dateModif"],true); |
235 | 235 | |
236 | + $newParamNode->getInfo()->setName($res["param"]["info"]['name']); | |
237 | + $newParamNode->getInfo()->setShortName($res["param"]["info"]['name']); | |
238 | + $newParamNode->getInfo()->setUnits($res["param"]["info"]['units']); | |
239 | + | |
236 | 240 | $tableDef = $res["param"]["info"]["tableDef"]; |
237 | 241 | if (isset($tableDef) && array_key_exists('tableDefType', $tableDef) && ($tableDef['tableDefType'] != 'NONE')) |
238 | 242 | { |
239 | - | |
243 | + switch ($tableDef['channelsDefType']) | |
244 | + { | |
245 | + case 'BOUND' : | |
246 | + $boundTable = $newParamNode->getInfo()->addTable(InfoParamTableTypeEnum::BOUNDS, $res["param"]["info"]["yTitle"]); | |
247 | + $boundTable->setUnits($res["param"]["info"]["yUnits"]); | |
248 | + switch ($tableDef['tableDefType']) | |
249 | + { | |
250 | + case 'SELECT' : | |
251 | + $boundTable->setBoundsName($tableDef['data']['bound']); | |
252 | + $newParamNode->getParamGet()->getLocalParam($res["param"]["info"]["realVar"])->addCalibInfo($tableDef['data']['bound']); | |
253 | + break; | |
254 | + default : | |
255 | + throw new Exception("Unknown tableDefType ".$tableDef['tableDefType']); | |
256 | + } | |
257 | + break; | |
258 | + case 'CENTER' : | |
259 | + $centerTable = $newParamNode->getInfo()->addTable(InfoParamTableTypeEnum::CENTER, $res["param"]["info"]["yTitle"]); | |
260 | + $centerTable->setUnits($res["param"]["info"]["yUnits"]); | |
261 | + $centerTable->setSize($tableDef['data']['width']); | |
262 | + switch ($tableDef['tableDefType']) | |
263 | + { | |
264 | + case 'SELECT' : | |
265 | + $centerTable->setCenterName($tableDef['data']['center']); | |
266 | + $newParamNode->getParamGet()->getLocalParam($res["param"]["info"]["realVar"])->addCalibInfo($tableDef['data']['center']); | |
267 | + break; | |
268 | + default : | |
269 | + throw new Exception("Unknown tableDefType ".$tableDef['tableDefType']); | |
270 | + } | |
271 | + break; | |
272 | + default : | |
273 | + throw new Exception("Unknown tableDefType ".$tableDef['channelsDefType']); | |
274 | + } | |
240 | 275 | } |
241 | 276 | |
242 | 277 | return array("id" => $res["param"]["id"], "plotType" => $res["param"]["info"]["plotType"]); |
... | ... |
src/RequestManager.php
... | ... | @@ -27,19 +27,37 @@ function amdaintegration_autoload($class_name) |
27 | 27 | 'Request/ParamsRequestImpl/Nodes/Requests', |
28 | 28 | 'Request/ProcessRequestImpl', |
29 | 29 | 'Request/ProcessRequestImpl/Process', |
30 | - 'Request/TTRequestImpl', | |
31 | - 'RemoteDataCenter' | |
30 | + 'Request/TTRequestImpl' | |
32 | 31 | ); |
33 | - | |
32 | + | |
33 | + $ihm_dirs = array( | |
34 | + IHM_SRC_DIR.'php/classes', | |
35 | + IHM_SRC_DIR.'php/RemoteDataCenter' | |
36 | + ); | |
37 | + | |
38 | + $find = false; | |
39 | + | |
34 | 40 | foreach($dirs as $dir) |
35 | 41 | { |
36 | 42 | $file = __DIR__.'/'.$dir.'/'.$class_name.'.php'; |
37 | 43 | if (file_exists($file)) |
38 | 44 | { |
39 | 45 | require $file; |
46 | + $find = true; | |
40 | 47 | break; |
41 | 48 | } |
42 | 49 | } |
50 | + | |
51 | + if (!$find) | |
52 | + foreach($ihm_dirs as $dir) | |
53 | + { | |
54 | + $file = $dir.'/'.$class_name.'.php'; | |
55 | + if (file_exists($file)) | |
56 | + { | |
57 | + require $file; | |
58 | + break; | |
59 | + } | |
60 | + } | |
43 | 61 | } |
44 | 62 | |
45 | 63 | spl_autoload_register('amdaintegration_autoload'); |
... | ... |