Commit 86263051110fdfaacdef81c4286e4956eaf9574a
1 parent
95dbfcfd
Exists in
master
and in
111 other branches
visu second draft
Showing
4 changed files
with
98 additions
and
8 deletions
Show diff stats
js/app/views/VisuUI.js
... | ... | @@ -74,7 +74,7 @@ Ext.define('amdaUI.VisuUI', { |
74 | 74 | Ext.Array.each(result.parameters, function(obj) |
75 | 75 | { |
76 | 76 | |
77 | - index = 'param'+(i+2).toString(); | |
77 | + index = 'param'+i.toString(); | |
78 | 78 | fields[i] = Ext.create('Ext.data.Field', { name : index, id: index, text : obj.name, |
79 | 79 | convert: function(value, record) { |
80 | 80 | return parseFloat(value); |
... | ... | @@ -105,10 +105,10 @@ Ext.define('amdaUI.VisuUI', { |
105 | 105 | type: 'direct', |
106 | 106 | api : |
107 | 107 | { |
108 | - read : AmdaAction.readTTCacheIntervals | |
108 | + read : AmdaAction.readIntervalsForChart | |
109 | 109 | }, |
110 | 110 | // remplir automatiquement tt, sharedtt , catalog, shared catalog |
111 | - extraParams : {'typeTT' : 'catalog'}, | |
111 | + extraParams : {'typeTT' : 'catalog', 'id' : me.object.get('id')}, | |
112 | 112 | reader: |
113 | 113 | { |
114 | 114 | type: 'json', |
... | ... | @@ -128,7 +128,7 @@ Ext.define('amdaUI.VisuUI', { |
128 | 128 | |
129 | 129 | } |
130 | 130 | |
131 | - AmdaAction.initTTCacheFromTT(this.object.get('id'), 'catalog', onAfterInit); | |
131 | + AmdaAction.initForChartFromTT(this.object.get('id'), 'catalog', onAfterInit); | |
132 | 132 | |
133 | 133 | }, |
134 | 134 | ... | ... |
php/classes/AmdaAction.php
... | ... | @@ -954,6 +954,14 @@ class AmdaAction { |
954 | 954 | return $cacheMgr->initFromTT($id, $type); |
955 | 955 | } |
956 | 956 | |
957 | + public function initForChartFromTT($id, $type) | |
958 | + { | |
959 | + if ($type == 'catalog') $objMgr = new CatalogMgr(); | |
960 | + | |
961 | + | |
962 | + return $objMgr->initForChartFromTT($id, $type); | |
963 | + } | |
964 | + | |
957 | 965 | public function initTTCacheFromTmpObject($folderId, $name, $isCatalog = false) |
958 | 966 | { |
959 | 967 | if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr(); |
... | ... | @@ -978,7 +986,15 @@ class AmdaAction { |
978 | 986 | |
979 | 987 | return $cacheMgr->getIntervals($o->start,$o->limit,$o->sort,$o->filter); |
980 | 988 | } |
981 | - | |
989 | + | |
990 | + public function readIntervalsForChart($o) | |
991 | + { | |
992 | + if ($o->typeTT == 'catalog') $objMgr = new CatalogMgr(); | |
993 | + | |
994 | + | |
995 | + return $objMgr->getIntervalsForChart($o->id, $o->typeTT); | |
996 | + } | |
997 | + | |
982 | 998 | public function saveTTCacheIntervalsInTT($o) |
983 | 999 | { |
984 | 1000 | $cacheMgr = new TimeTableCacheMgr(); | ... | ... |
php/classes/CatalogMgr.php
... | ... | @@ -249,6 +249,74 @@ class CatalogMgr extends TimeTableMgr { |
249 | 249 | |
250 | 250 | } |
251 | 251 | |
252 | + public function initForChartFromTT($id, $typeTT) | |
253 | + { | |
254 | + $intervals_res = $this->loadIntervalsFromTT($id,$typeTT); | |
255 | + | |
256 | + if (!$intervals_res['success']) | |
257 | + return $intervals_res; | |
258 | + | |
259 | + $paramHeaders = []; | |
260 | + | |
261 | + foreach ( $intervals_res['parameters'] as $param ) { | |
262 | + | |
263 | + if ($param['size'] > 1) { | |
264 | + | |
265 | + for ($i = 0; $i < $param['size']; $i++) { | |
266 | + $paramComp = array(); | |
267 | + $paramComp['id'] = $param['id'].'_'.$i; | |
268 | + $paramComp['name'] = $param['name'].'_'.$i; | |
269 | + // $paramComp['size'] = 1; | |
270 | + | |
271 | + $paramHeaders[] = $paramComp; | |
272 | + } | |
273 | + } | |
274 | + else { | |
275 | + $paramHeaders[] = $param; | |
276 | + } | |
277 | + } | |
278 | + | |
279 | + unset($intervals_res); | |
280 | + | |
281 | + return array('success' => true, 'parameters' => $paramHeaders); | |
282 | + } | |
283 | + | |
284 | + public function getIntervalsForChart($id, $type) { | |
285 | + | |
286 | + $intervals_res = $this->loadIntervalsFromTT($id,$type); | |
287 | + | |
288 | + if (!$intervals_res['success']) | |
289 | + return $intervals_res; | |
290 | + | |
291 | + $newIntervals = array(); | |
292 | + | |
293 | + foreach ($intervals_res['intervals'] as $interval) | |
294 | + { | |
295 | + $newIntervalComp = array(); | |
296 | + $k = 0; | |
297 | + | |
298 | + for ( $j = 0; $j < count($interval['paramTable']); $j++ ) { | |
299 | + | |
300 | + $param = $interval['paramTable'][$j]; | |
301 | + $tempArr = explode(',',$param); | |
302 | + | |
303 | + if (count($tempArr) > 1) { | |
304 | + for ($i = 0; $i < count($tempArr); $i++) { | |
305 | + $newIntervalComp['param'.$k] = $tempArr[$i]; | |
306 | + $k++; | |
307 | + } | |
308 | + } | |
309 | + else { | |
310 | + $newIntervalComp['param'.$k] = $param; | |
311 | + $k++; | |
312 | + } | |
313 | + } | |
314 | + $newIntervals[] = $newIntervalComp; | |
315 | + } | |
316 | + | |
317 | + return array('success' => true, 'intervals' => $newIntervals); | |
318 | + | |
319 | + } | |
252 | 320 | |
253 | 321 | } |
254 | 322 | ?> | ... | ... |
php/config.php
... | ... | @@ -241,9 +241,9 @@ $API = array( |
241 | 241 | 'modifyObject'=>array( |
242 | 242 | 'len'=>1 |
243 | 243 | ), |
244 | - 'validNameObject'=>array( | |
245 | - 'len'=>1 | |
246 | - ), | |
244 | + 'validNameObject'=>array( | |
245 | + 'len'=>1 | |
246 | + ), | |
247 | 247 | 'getJobs'=>array( |
248 | 248 | 'len'=>0 |
249 | 249 | ), |
... | ... | @@ -278,6 +278,9 @@ $API = array( |
278 | 278 | 'initTTCacheFromTT' => array( |
279 | 279 | 'len'=>2 |
280 | 280 | ), |
281 | + 'initForChartFromTT' => array( | |
282 | + 'len'=>2 | |
283 | + ), | |
281 | 284 | 'initTTCacheFromTmpObject' => array( |
282 | 285 | 'len'=>3 |
283 | 286 | ), |
... | ... | @@ -287,6 +290,9 @@ $API = array( |
287 | 290 | 'readTTCacheIntervals'=>array( |
288 | 291 | 'len'=>1 |
289 | 292 | ), |
293 | + 'readIntervalsForChart'=>array( | |
294 | + 'len'=>1 | |
295 | + ), | |
290 | 296 | 'addTTCacheInterval'=>array ( |
291 | 297 | 'len'=>1 |
292 | 298 | ), | ... | ... |