Commit 3e394754d75b22e7e41c59ec63d8886e1bdb276f

Authored by Benjamin Renard
2 parents 761d977c 5581ea41

Merge branch 'amdadev' into develop

src/InputOutput/IHMImpl/IHMInputOutputClass.php
... ... @@ -55,7 +55,7 @@ class IHMInputOutputClass implements InputOutputInterface
55 55 //set working dir for interactive plot
56 56 $requestId = "Plot";
57 57 break;
58   - case 'statistics' :
  58 + case 'statistic' :
59 59 //catalog generation
60 60 $this->inputOutput = new IHMInputOutputParamsStatisticsClass();
61 61 break;
... ...
src/InputOutput/IHMImpl/Tools/IHMJobsManagerClass.php
... ... @@ -10,12 +10,12 @@ class IHMJobsManagerClass {
10 10 protected $bkgRootNode = array('condition' => 'bkgSearch-treeRootNode',
11 11 'request' => 'bkgPlot-treeRootNode',
12 12 'download' => 'bkgDown-treeRootNode',
13   - 'statistics' => 'bkgStatistics-treeRootNode');
  13 + 'statistic' => 'bkgStatistics-treeRootNode');
14 14  
15 15 protected $resRootNode = array('condition' => 'resSearch-treeRootNode',
16 16 'request' => 'resPlot-treeRootNode',
17 17 'download' => 'resDown-treeRootNode',
18   - 'statistics' => 'resStatistics-treeRootNode');
  18 + 'statistic' => 'resStatistics-treeRootNode');
19 19  
20 20 /*
21 21 * @brief Constructor
... ... @@ -382,11 +382,11 @@ class IHMJobsManagerClass {
382 382 $infos['Start date'] = $obj['startDate'];
383 383 $infos['Stop date'] = $obj['stopDate'];
384 384 break;
385   - case 'statistics':
  385 + case 'statistic':
386 386 $name = 'statistics_'.time();
387   - $infos['Name'] = $obj['name']; // TODO: name toujours égal à 'test' (?)
388   -
389   - // TODO : lire data/user/TT/tt_0.xml -> trouver ttname + nbIntervals
  387 + if($obj['name'] != '') {
  388 + $infos['Name'] = $obj['name'];
  389 + }
390 390  
391 391 if(array_key_exists('timeTables', $obj)) {
392 392 $ttXml = new DomDocument();
... ...
src/InputOutput/IHMImpl/Tools/IHMUserWSManagerClass.php
... ... @@ -7,7 +7,7 @@
7 7 */
8 8 class IHMUserWSManagerClass
9 9 {
10   - private static $WS_VERSION = 2;
  10 + private static $WS_VERSION = 3;
11 11  
12 12 protected $wsInfo = null;
13 13  
... ... @@ -84,6 +84,35 @@ class IHMUserWSManagerClass
84 84 return file_put_contents(IHMConfigClass::getUserWSInfoFilePath(),$json_data);
85 85 }
86 86  
  87 + private function updateFromVersion2() {
  88 + // Update WS for save statistic requests
  89 +
  90 + // Load user requests file
  91 + $req_mgr_file_path = IHMConfigClass::getUserRequestManagerFilePath();
  92 + if (!file_exists($req_mgr_file_path)) {
  93 + return TRUE;
  94 + }
  95 +
  96 + $dom = new DOMDocument();
  97 + if (!$dom->load($req_mgr_file_path)) {
  98 + return FALSE;
  99 + }
  100 +
  101 + $statisticNodeTag = 'statisticList';
  102 + $statisticNodes = $dom->documentElement->getElementsByTagName($statisticNodeTag);
  103 + // Id statistic root node already exists, nothing to do
  104 + if ($statisticNodes->length > 0) {
  105 + return TRUE;
  106 + }
  107 +
  108 + // Create statistic root node
  109 + $statisticNode = $dom->createElement($statisticNodeTag);
  110 + $statisticNode->setAttribute('xml:id', 'statistic-treeRootNode');
  111 + $dom->documentElement->appendChild($statisticNode);
  112 +
  113 + return $dom->save($req_mgr_file_path);
  114 + }
  115 +
87 116 private function updateFromVersion1() {
88 117 // Update WS for save download requests
89 118  
... ...