Commit 5dd3aab74784fef1f73e95433745caf0a86e59de

Authored by Benjamin Renard
2 parents ee56181e 26083934
Exists in amdadev and in 1 other branch SpeasyGet

Merge branch 'FER_11500' into amdadev

src/InputOutput/IHMImpl/Params/PlotImpl/IHMInputOutputParamsPlotClass.php
... ... @@ -1136,6 +1136,12 @@ class IHMInputOutputParamsPlotClass extends IHMInputOutputParamsAbstractClass
1136 1136  
1137 1137 $intervalsNode = $paramNode->addIntervals($color);
1138 1138  
  1139 + if ($paramDrawingData->{'intervals-column-show'}){
  1140 + $columnId = $paramDrawingData->{'intervals-param-show'};
  1141 + if ($columnId !== "" )
  1142 + $intervalsNode->setColumnId($columnId);
  1143 + }
  1144 +
1139 1145 if ($paramDrawingData->{'legend-text-activated'}) {
1140 1146 $textLegendNode = $intervalsNode->addTextLegend();
1141 1147  
... ...
src/InputOutput/IHMImpl/Tools/IHMPlotContextFileClass.php
... ... @@ -72,26 +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   - );
93   -
94   - $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;
95 133 }
96 134 }
97 135  
... ...
src/Request/ParamsRequestImpl/Nodes/Requests/RequestOutputPlotIntervalsNodeClass.php
... ... @@ -2,6 +2,7 @@
2 2  
3 3 define("REQUESTOUTPUTPLOTINTERVALS_NAME", "intervals");
4 4 define("REQUESTOUTPUTPLOTINTERVALS_COLOR", "color");
  5 +define("REQUESTOUTPUTPLOTINTERVALS_COLUMNID", "columnId");
5 6  
6 7  
7 8 /**
... ... @@ -26,6 +27,14 @@ class RequestOutputPlotIntervalsNodeClass extends NodeClass
26 27 {
27 28 return $this->getAttribute(REQUESTOUTPUTPLOTINTERVALS_COLOR);
28 29 }
  30 +
  31 + public function setColumnId($columnId){
  32 + $this->setAttribute(REQUESTOUTPUTPLOTINTERVALS_COLUMNID, $columnId);
  33 + }
  34 +
  35 + public function getColumnId(){
  36 + return $this->getAttribute(REQUESTOUTPUTPLOTINTERVALS_COLUMNID);
  37 + }
29 38  
30 39 public function addTextLegend()
31 40 {
... ...