Commit 260839343bec2232d486ed280ce6ed8c5776ffa3

Authored by Benjamin Renard
1 parent 5c3dbb57

Improve intervals info in plot context

src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... ... @@ -1131,8 +1131,8 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
1131 1131  
1132 1132 if ($paramDrawingData->{'intervals-column-show'}){
1133 1133 $columnId = $paramDrawingData->{'intervals-param-show'};
1134   - if ($columnId !== "none" || $columnId !== "" )
1135   - $intervalsNode ->setColumnId($columnId);
  1134 + if ($columnId !== "" )
  1135 + $intervalsNode->setColumnId($columnId);
1136 1136 }
1137 1137  
1138 1138 if ($paramDrawingData->{'legend-text-activated'}) {
... ...
src/InputOutput/IHMImpl/Tools/IHMPlotContextFileClass.php
... ... @@ -72,27 +72,64 @@ class IHMPlotContextFileClass
72 72 'MinSampling' => $item->getAttribute('MinSampling')
73 73 );
74 74  
75   - $panelContext[$PARAMETERS_TAG][] = $pContext;
76   - }
77   - }
78   -
79   -
80   - //<intervals>
81   - $intervalsNodes = $panelNode->getElementsByTagName('intervals');
82   - if ($intervalsNodes->length > 0) {
83   - $panelContext['intervals'] = array();
84   -
85   - foreach ($intervalsNodes as $intervalsNode) {
86   - $intervalsContext = array(
87   - 'name' => $intervalsNode->getAttribute('name'),
88   - 'id' => $intervalsNode->getAttribute('id'),
89   - 'startTime' => $intervalsNode->getAttribute('startTime'),
90   - 'stopTime' => $intervalsNode->getAttribute('stopTime'),
91   - 'params' => $intervalsNode->getAttribute('params'),
92   - 'selectedColValue' => $intervalsNode->getAttribute('selectedColValue')
93   - );
94   -
95   - $panelContext['intervals'][] = $intervalsContext;
  75 + //<catalog> or <timetable>
  76 + $catalogNodes = $item->getElementsByTagName('catalog');
  77 + $timetableNodes = $item->getElementsByTagName('timetable');
  78 + if (($catalogNodes->length > 0) || ($timetableNodes->length > 0)) {
  79 + $isCatalog = FALSE;
  80 + if ($catalogNodes->length > 0) {
  81 + $isCatalog = TRUE;
  82 + $ttorcatNode = $catalogNodes->item(0);
  83 + }
  84 + else {
  85 + $ttorcatNode = $timetableNodes->item(0);
  86 + }
  87 +
  88 + $ttOrCatContext = array(
  89 + 'name' => $ttorcatNode->getAttribute('name'),
  90 + 'columnToShow' => $ttorcatNode->getAttribute('columnToShow'),
  91 + );
  92 +
  93 + if ($isCatalog) {
  94 + //<columns>
  95 + $columnsNodes = $ttorcatNode->getElementsByTagName('columns');
  96 + if ($columnsNodes->length > 0) {
  97 + $ttOrCatContext['columns'] = [];
  98 + $columnNodes = $columnsNodes->item(0)->getElementsByTagName('column');
  99 + foreach ($columnNodes as $columnNode) {
  100 + $ttOrCatContext['columns'][$columnNode->getAttribute('id')] = array(
  101 + 'name' => $columnNode->getAttribute('name')
  102 + );
  103 + }
  104 + }
  105 +
  106 + }
  107 +
  108 + //<intervals>
  109 + $intervalsNodes = $ttorcatNode->getElementsByTagName('intervals');
  110 + if ($intervalsNodes->length > 0) {
  111 + $ttOrCatContext['intervals'] = [];
  112 + $intervalNodes = $intervalsNodes->item(0)->getElementsByTagName('interval');
  113 + foreach ($intervalNodes as $intervalNode) {
  114 + $intervalContext = array(
  115 + 'start' => $intervalNode->getAttribute('startTime'),
  116 + 'stop' => $intervalNode->getAttribute('stopTime'),
  117 + );
  118 + if ($isCatalog) {
  119 + $intervalContext['params'] = array();
  120 + $paramNodes = $intervalNode->getElementsByTagName('param');
  121 + if ($paramNodes->length > 0) {
  122 + foreach ($paramNodes as $paramNode) {
  123 + $intervalContext['params'][$paramNode->getAttribute('id')] = $paramNode->getAttribute('val');
  124 + }
  125 + }
  126 + }
  127 + $ttOrCatContext['intervals'][$intervalNode->getAttribute('id')] = $intervalContext;
  128 + }
  129 + }
  130 + $pContext['ttorcat'] = $ttOrCatContext;
  131 + }
  132 + $panelContext[$PARAMETERS_TAG][] = $pContext;
96 133 }
97 134 }
98 135  
... ...