From b0720b918c4a41f9653ddd9c5bb692a47c83d86a Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Wed, 22 Jan 2020 16:11:33 +0100 Subject: [PATCH] Finalize catalog histogram visualization + cleanup code (#6899) --- js/app/controllers/CatalogModule.js | 26 +++++++++++++------------- js/app/controllers/VisuModule.js | 23 ++++++++++++++++------- js/app/models/CatalogNode.js | 48 ++++++++++++++++++++++++++++++++++++++++++------ js/app/views/CatalogUI.js | 10 ++-------- js/app/views/CatalogVisuHistogram.js | 70 +++++++++++++++++++++++++++++++++++++++------------------------------- js/app/views/CatalogVisuScatter.js | 43 ++++++++++++++++++------------------------- js/app/views/VisuUI.js | 116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------------------------------------------------------------- php/classes/AmdaAction.php | 12 +----------- php/classes/CatalogCacheIntervalObject.php | 1 - php/classes/CatalogCacheMgr.php | 17 +++++++++++++++-- php/classes/CatalogMgr.php | 87 --------------------------------------------------------------------------------------- 11 files changed, 201 insertions(+), 252 deletions(-) diff --git a/js/app/controllers/CatalogModule.js b/js/app/controllers/CatalogModule.js index ef70640..affd862 100644 --- a/js/app/controllers/CatalogModule.js +++ b/js/app/controllers/CatalogModule.js @@ -3,27 +3,27 @@ * Name CatalogModule.js * @class amdaDesktop.CatalogModule * @extends amdaDesktop.InteractiveModule - * @brief Catalog Module controller definition + * @brief Catalog Module controller definition * @author elena */ Ext.define('amdaDesktop.CatalogModule', { extend: 'amdaDesktop.InteractiveModule', - + requires: [ 'amdaUI.CatalogUI', 'amdaUI.ShareObjectUI' ], - + contentId : 'catalogUI', isOperationOnShow : true, - + /** * @cfg {String} data models * @required */ nodeDataModel : 'amdaModel.CatalogNode', - + /** * @cfg {String} window definitions * @required @@ -33,9 +33,9 @@ Ext.define('amdaDesktop.CatalogModule', { uiType : 'panelCatalog', helpTitle : 'Help on Catalog Module', helpFile : 'catalogHelp', - + shareCatalog : function(catObj) { - var win = myDesktopApp.desktop.getWindow('sharecat-win'); + var win = myDesktopApp.desktop.getWindow('sharecat-win'); if(!win) { var me = this; @@ -54,7 +54,7 @@ Ext.define('amdaDesktop.CatalogModule', { id : 'shareCatUI', onAfterShareObject : function(folder_id, object_id) { win.close(); - var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); + var explorerTree = Ext.getCmp(amdaUI.ExplorerUI.RESRC_TAB.TREE_ID); var sharedCatRootNode = explorerTree.getRootNode().findChild('id','sharedcatalog-treeRootNode',true); amdaModel.InteractiveNode.preloadNodes(sharedCatRootNode, function() { sharedCatRootNode.expand(); @@ -72,20 +72,20 @@ Ext.define('amdaDesktop.CatalogModule', { } } ] - }); + }); } - + var sharePanel = win.down('#shareCatUI'); if (sharePanel) sharePanel.setProperties('catalog', catObj); - + AmdaAction.getObject(catObj.id, 'catalog', function(result,remoteEvent) { if (result) { if (result.description) sharePanel.setDescription(result.description); - } + } }, this.getObjectCallback, this); - + win.show(); } diff --git a/js/app/controllers/VisuModule.js b/js/app/controllers/VisuModule.js index 413a9af..c035a63 100644 --- a/js/app/controllers/VisuModule.js +++ b/js/app/controllers/VisuModule.js @@ -3,25 +3,25 @@ * Name VisuModule.js * @class amdaDesktop.VisuModule * @extends amdaDesktop.InteractiveModule - * @brief Visualization Module controller definition + * @brief Visualization Module controller definition * @author elena */ Ext.define('amdaDesktop.VisuModule', { extend: 'amdaDesktop.InteractiveModule', - + requires: [ 'amdaUI.VisuUI' ], - + contentId : 'visuUI', - + /** * @cfg {String} data models * @required */ nodeDataModel : 'amdaModel.CatalogNode', // 'amdaModel.MyDataNode' - + /** * @cfg {String} window definitions * @required @@ -30,6 +30,15 @@ Ext.define('amdaDesktop.VisuModule', { height: 700, uiType : 'panelVisu', helpTitle : 'Help on Visualization Module', - helpFile : 'visuHelp' - + helpFile : 'visuHelp', + + visualize : function(catObj) { + var temporaryNode = Ext.create('amdaModel.CatalogNode', {leaf: true}); + if (temporaryNode) + temporaryNode.set('object', catObj); + this.setLinkedNode(temporaryNode); + + this.createWindow(); + } + }); diff --git a/js/app/models/CatalogNode.js b/js/app/models/CatalogNode.js index 574c72e..94fb0db 100644 --- a/js/app/models/CatalogNode.js +++ b/js/app/models/CatalogNode.js @@ -68,16 +68,52 @@ Ext.define('amdaModel.CatalogNode', { }); }, - visu : function(contextNode) { - var me = this; - myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) { + visu : function(node) { + var me = this; + + var visuWinFunc = function(object) { + myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) { + module.visualize(object); + }); + }; + + amdaModel.InteractiveNode.preloadNodes(this.getRootNode(), + function() + { + if (me.get('object')) { + visuWinFunc(me.get('object')); + } + else + { + AmdaAction.getObject(me.get('id'), me.get('nodeType'), function (result,remoteEvent) { + var t = remoteEvent.getTransaction(); + + if (result) { + var paramObj = Ext.create(me.get('objectDataModel'), result); + // set parameter into node + me.set('object',paramObj); + // Edition of parameter into parameter Module + visuWinFunc(me.get('object')); + } + else { + myDesktopApp.errorMsg(t.action + "." + t.method + " : No catalog '" + + this.get('name') + "' found!"); + } + }, me); + } + }); + + + //var me = this; + //myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) { + // module.visualize(me); // Catalog & TimeTable nodes normally use no objects in the tree - var obj = {'id' : me.get('id'), 'name' : me.get('text') }; +/* var obj = {'id' : me.get('id'), 'name' : me.get('text') }; object = Ext.create(me.get('objectDataModel'), obj); me.set('object',object); module.setLinkedNode(me); - module.createWindow(); - }); + module.createWindow();*/ + //}); }, generateTT: function(node){ var catObj = Ext.create('amdaModel.TimeTable'); diff --git a/js/app/views/CatalogUI.js b/js/app/views/CatalogUI.js index 4d5c53c..9572cdc 100644 --- a/js/app/views/CatalogUI.js +++ b/js/app/views/CatalogUI.js @@ -93,7 +93,7 @@ Ext.define('amdaUI.CatalogUI', { if (updateStatus) { /// real object update // update TimeTable object with the content of form - basicForm.updateRecord(this.object.get('name')); + basicForm.updateRecord(this.object); } // return the update status return updateStatus; @@ -1000,13 +1000,7 @@ Ext.define('amdaUI.CatalogUI', { handler: function () { var me = this; myDesktopApp.getLoadedModule(myDesktopApp.dynamicModules.visu.id, true, function (module) { - //temporary linked node - as Visu module is 'pseudo' interactive - no 'save', no 'execute' - var temporaryNode = Ext.create('amdaModel.CatalogNode', {leaf: true}); - if (temporaryNode) - temporaryNode.set('object', me.object); - module.setLinkedNode(temporaryNode); - - module.createWindow(); + module.visualize(me.object); }); } } diff --git a/js/app/views/CatalogVisuHistogram.js b/js/app/views/CatalogVisuHistogram.js index 2de9182..e3d64ba 100644 --- a/js/app/views/CatalogVisuHistogram.js +++ b/js/app/views/CatalogVisuHistogram.js @@ -17,10 +17,9 @@ Ext.define('amdaUI.CatalogVisuHistogram', { this.callParent(arguments); }, - getChart: function(catalogStore) { + getChartConfig: function(catalogStore) { var paramOpt = { paramId: '', - index: 0, title: 'Parameter' }; @@ -29,15 +28,14 @@ Ext.define('amdaUI.CatalogVisuHistogram', { if (paramFieldId && (paramFieldId != "")) { var paramField = paramField.getStore().getById(paramFieldId); if (paramField) { - paramOpt.paramId = paramField.get('paramId'); - paramOpt.index = paramField.get('index'); + paramOpt.paramId = paramField.get('id'); paramOpt.title = paramField.get('name'); - if (paramField.get('size') > 1) { - paramOpt.title += '['+opt.index+']'; - paramOpt.paramId += '_COMPONENT_'+opt.index; - } } } + else { + myDesktopApp.errorMsg('Missing parameter selection'); + return null; + } var paramTitleField = Ext.getCmp('visu-histo-title'); var paramTitle = paramTitleField.getValue(); @@ -62,12 +60,20 @@ Ext.define('amdaUI.CatalogVisuHistogram', { maxValue = (maxValue == null) ? item.get(paramOpt.paramId) : Math.max(maxValue, item.get(paramOpt.paramId)); }); + if (!minValue || !maxValue || (minValue == maxValue)) { + myDesktopApp.errorMsg('Not enought data or constant data'); + return null; + } + var binSize = (maxValue-minValue) / (nbBinsValue-1); var data = []; for (i = 0; i < nbBinsValue; ++i) { + var center = minValue + i * binSize; data.push({ - center: minValue + i * binSize, - count: 0 + center: center, + min: center - binSize/2, + max: center + binSize/2, + count: 0 }); } @@ -78,7 +84,7 @@ Ext.define('amdaUI.CatalogVisuHistogram', { this.histogramStore = Ext.create('Ext.data.Store', { - fields: ['center', 'count'] + fields: ['center', 'min', 'max', 'count'] }); this.histogramStore.loadData(data); @@ -99,7 +105,12 @@ Ext.define('amdaUI.CatalogVisuHistogram', { type: 'Category', position: 'bottom', fields: ['center'], - title: paramOpt.title + title: paramOpt.title, + label: { + renderer: function(value, label, storeItem, item, i, display, animate, index) { + return value.toFixed(2); + } + } }], series: [{ type: 'column', @@ -107,20 +118,19 @@ Ext.define('amdaUI.CatalogVisuHistogram', { highlight: true, gutter: 5, xField: 'center', - yField: 'count'/*, + yField: 'count', tips: { - width: 10, height: 20, - hideDelay: 100, //200 ms + hideDelay: 200, mouseOffset: [0,0], //[15,18] renderer: function(storeItem, item) { - //this.setTitle(storeItem.index + 1); + this.setTitle('['+storeItem.get('min').toFixed(2)+', '+storeItem.get('max').toFixed(2)+']'); } - }*/ + } }] }; - return Ext.create('Ext.chart.Chart', chartConfig); + return chartConfig; }, getHistoConfig: function(parametersStore) { @@ -130,19 +140,9 @@ Ext.define('amdaUI.CatalogVisuHistogram', { editable: false, store: parametersStore, queryMode: 'local', - displayField: 'text', + displayField: 'name', valueField: 'id', - id: 'visu-histo-param', - tpl: Ext.create('Ext.XTemplate', - '', - '
{name}[{index}]
', - '
' - ), - displayTpl: Ext.create('Ext.XTemplate', - '', - '{name}[{index}]', - '' - ) + id: 'visu-histo-param' }; var sliderConfig = { @@ -162,7 +162,14 @@ Ext.define('amdaUI.CatalogVisuHistogram', { increment: 1, minValue: 2, maxValue: 100, - id: 'visu-histo-bin-slider' + id: 'visu-histo-bin-slider', + listeners: { + change: function ( slider, newValue, thumb, eOpts ) { + var binValueField = Ext.getCmp('visu-histo-bin-value'); + binValueField.setValue(newValue); + }, + scope: this + } }, { xtype: 'splitter' @@ -172,6 +179,7 @@ Ext.define('amdaUI.CatalogVisuHistogram', { hideTrigger: true, width: 50, disabled: true, + value: 10, id: 'visu-histo-bin-value' } ] diff --git a/js/app/views/CatalogVisuScatter.js b/js/app/views/CatalogVisuScatter.js index 090ca46..f9c883c 100644 --- a/js/app/views/CatalogVisuScatter.js +++ b/js/app/views/CatalogVisuScatter.js @@ -16,7 +16,7 @@ Ext.define('amdaUI.CatalogVisuScatter', { this.callParent(arguments); }, - getChart: function(catalogStore) { + getChartConfig: function(catalogStore) { var plotTypeField = Ext.getCmp('visu-scatter-type'); var plotType = plotTypeField.getValue(); @@ -26,6 +26,16 @@ Ext.define('amdaUI.CatalogVisuScatter', { var xAxisOpt = this.getAxisOptions('X'); var yAxisOpt = this.getAxisOptions('Y'); + if ((!xAxisOpt.paramId) || (xAxisOpt.paramId == '')) { + myDesktopApp.errorMsg('Missing parameter selection for X axis'); + return null; + } + + if ((!yAxisOpt.paramId) || (yAxisOpt.paramId == '')) { + myDesktopApp.errorMsg('Missing parameter selection for Y axis'); + return null; + } + var chartConfig = { animate: false, mask: false, @@ -55,12 +65,11 @@ Ext.define('amdaUI.CatalogVisuScatter', { yField: yAxisOpt.paramId, type: plotType, tips: { - width: 10, height: 20, - hideDelay: 100, //200 ms - mouseOffset: [0,0], //[15,18] + hideDelay: 200, + mouseOffset: [0,0], renderer: function(storeItem, item) { - this.setTitle(storeItem.index + 1); + this.setTitle('['+storeItem.get('start').toISOString() + ', ' + storeItem.get('stop').toISOString() + ']'); } } }] @@ -76,13 +85,12 @@ Ext.define('amdaUI.CatalogVisuScatter', { chartConfig.axes[1].maximum = yAxisOpt.range.max; } - return Ext.create('Ext.chart.Chart', chartConfig); + return chartConfig; }, getAxisOptions: function(axisName) { var opt = { paramId: '', - index: 0, title: axisName+' axis' }; @@ -91,13 +99,8 @@ Ext.define('amdaUI.CatalogVisuScatter', { if (paramFieldId && (paramFieldId != "")) { var paramField = axisParamField.getStore().getById(axisParamField.getValue()); if (paramField) { - opt.paramId = paramField.get('paramId'); - opt.index = paramField.get('index'); + opt.paramId = paramField.get('id'); opt.title = paramField.get('name'); - if (paramField.get('size') > 1) { - opt.title += '['+opt.index+']'; - opt.paramId += '_COMPONENT_'+opt.index; - } } } @@ -129,20 +132,10 @@ Ext.define('amdaUI.CatalogVisuScatter', { editable: false, store: parametersStore, queryMode: 'local', - displayField: 'text', + displayField: 'name', valueField: 'id', axisIndex: axisIndex, - id: 'visu-scatter-' + axisName + '-param', - tpl: Ext.create('Ext.XTemplate', - '', - '
{name}[{index}]
', - '
' - ), - displayTpl: Ext.create('Ext.XTemplate', - '', - '{name}[{index}]', - '' - ) + id: 'visu-scatter-' + axisName + '-param' }; var comboRangeConfig = { diff --git a/js/app/views/VisuUI.js b/js/app/views/VisuUI.js index e2a107f..c3bb7f5 100644 --- a/js/app/views/VisuUI.js +++ b/js/app/views/VisuUI.js @@ -20,47 +20,32 @@ Ext.define('amdaUI.VisuUI', { parametersStore: null, catalogStore: null, + emptyChartConfig: null, constructor: function(config) { this.init(config); this.callParent(arguments); - if (this.object) this.reformObject(); + if (this.object) + this.loadObject(); }, setObject : function (obj) { this.object = obj; - this.reformObject(); + this.loadObject(); }, updateObject : function () { return true; }, - reformObject : function () { - this.fromPlugin = this.object.get('fromPlugin'); - - if (this.fromPlugin) { - if (this.object.get('folderId') == '') - this.object.set('id','cacheCat'); - else - this.object.set('id',this.object.get('folderId')); - - this.object.set('objName',this.object.get('objName')); - } - else { - this.object.set('id',this.object.get('id')); - this.object.set('name',this.object.get('name')); - } - // load object into view - if (this.object.get('id') != '') - this.loadObject(); - }, - reset : function() { var tabPanel = Ext.getCmp('visu-tabpanel'); - Ext.each(tabPanel.activeTab.items.items[0].query('field'), function(field) { - field.reset(); - }); + Ext.Array.each(tabPanel.items.items, function(item) { + Ext.each(item.query('field'), function(field) { + field.reset(); + }); + }); + this.replaceChart(null); }, /** @@ -70,14 +55,7 @@ Ext.define('amdaUI.VisuUI', { { var me = this; - this.parametersStore.removeAll(); - Ext.Array.each(this.object.get('parameters'), function(param) { - for (index = 0; index < param.size; ++index) { - me.parametersStore.add({'id': param.id + (param.size > 1 ? '_COMPONENT_'+index : ''), 'paramId': param.id, 'name' : param.name, 'index': index, 'size': param.size, 'type': param.type}); - } - }); - - var onAfterInit = function(result, e) + var onAfterInit = function(result, e) { if (!result) { myDesktopApp.errorMsg(e.message); @@ -97,17 +75,24 @@ Ext.define('amdaUI.VisuUI', { return; } + me.parametersStore.removeAll(); + Ext.Array.each(result.parameters, function(param) { + if ((param.type == 0) || (param.type == 1) || (param.type == 3)) { + me.parametersStore.add(param); + } + }); + var dateConvert = function (value, rec) { if (!Ext.isDate(value)) { var valueString = new String(value); - return new Date(valueString.replace(/\-/g, '\/').replace(/[T|Z]/g, ' ')); + return new Date(valueString+'Z'); } return value; }; var fieldsConfig = []; - fieldsConfig.push({type: 'date', id: 'start', name : 'start', convert: dateConvert}); - fieldsConfig.push({type: 'date', id: 'stop', name : 'stop', convert: dateConvert}); + fieldsConfig.push({type: 'date', id: 'start', name : 'start', dateFormat: 'Y-m-d\\TH:i:s', convert: dateConvert}); + fieldsConfig.push({type: 'date', id: 'stop', name : 'stop', dateFormat: 'Y-m-d\\TH:i:s', convert: dateConvert}); me.parametersStore.each(function (param) { switch (param.get('type')) { case 0: //double @@ -125,8 +110,6 @@ Ext.define('amdaUI.VisuUI', { convert: dateConvert }); break; - case 2: //string - break; case 3: //int fieldsConfig.push({ type: 'int', @@ -141,14 +124,17 @@ Ext.define('amdaUI.VisuUI', { fields : fieldsConfig }); me.catalogStore.loadData(result.intervals); + + me.reset(); } var opt = { 'typeTT' : 'catalog', 'id' : this.object.get('id'), - 'name' : this.object.get('objName') + 'name' : this.object.get('name') }; - AmdaAction.readIntervalsForChart(opt, onAfterInit); + this.formPanel.getForm().loadRecord(this.object); + AmdaAction.readIntervalsForChart(opt, onAfterInit); }, /** @@ -161,20 +147,29 @@ Ext.define('amdaUI.VisuUI', { }, plotChart : function () { - var chart = Ext.getCmp('visu-chart'); var tabPanel = Ext.getCmp('visu-tabpanel'); + var newChartConfig = tabPanel.activeTab.items.items[0].getChartConfig(this.catalogStore); + this.replaceChart(newChartConfig); + }, + replaceChart: function(newChartConfig) { + if (!newChartConfig) { + newChartConfig = this.emptyChartConfig; + } + var chart = Ext.getCmp('visu-chart'); var chartPanel = chart.up(); chartPanel.remove(chart); - chartPanel.insert(tabPanel.activeTab.items.items[0].getChart(this.catalogStore)); - }, + chartPanel.insert(Ext.create('Ext.chart.Chart', newChartConfig)); + }, saveChart : function() { var chart = Ext.getCmp('visu-chart'); - chart.save({ - type: 'image/png', - defaultUrl : window.location - }); + if (chart) { + chart.save({ + type: 'image/png', + defaultUrl : window.location + }); + } }, initChartTypes: function() { @@ -222,15 +217,24 @@ Ext.define('amdaUI.VisuUI', { this.parametersStore = Ext.create('Ext.data.Store', { fields: [ {name: 'id', type: 'string'}, - {name: 'paramId', type: 'string'}, {name: 'name', type: 'string'}, - {name: 'index', type: 'int'}, - {name: 'size', type: 'int'}, {name: 'type', type: 'int'} ], data: [] }); + this.emptyChartConfig = { + xtype: 'chart', + region: 'center', + store: this.catalogStore, + id: 'visu-chart', + animate: false, + mask: false, + shadow: false, + theme:'Blue', + background: { fill : "#fff" } + }; + this.formPanel = Ext.create('Ext.form.Panel', { region: 'center', layout: 'border', @@ -265,17 +269,7 @@ Ext.define('amdaUI.VisuUI', { // height: 400, id: 'visu-tabpanel' }, - { - xtype: 'chart', - region: 'center', - store: this.catalogStore, - id: 'visu-chart', - animate: false, - mask: false, - shadow: false, - theme:'Blue', - background: { fill : "#fff" } - } + this.emptyChartConfig ] } ], diff --git a/php/classes/AmdaAction.php b/php/classes/AmdaAction.php index 579f470..8d4e6ec 100644 --- a/php/classes/AmdaAction.php +++ b/php/classes/AmdaAction.php @@ -1132,17 +1132,6 @@ class AmdaAction return $cacheMgr->initFromTimeTable($id, $nparams); } - - public function initForChart($id, $folderId, $name, $isTmpObject, $type) - { - if ($isTmpObject && $type == 'catalog' && $id == 'cacheCat') - return array('success' => true, 'cache' => $id); - - if ($type == 'catalog' || $type == 'sharedcatalog') $objMgr = new CatalogMgr(); - - return $objMgr->initForChart($id, $folderId, $name, $isTmpObject, $type); - } - public function initObjectCacheFromTmpObject($folderId, $name, $isCatalog = false) { if (!$isCatalog) $cacheMgr = new TimeTableCacheMgr(); @@ -1169,6 +1158,7 @@ class AmdaAction public function readIntervalsForChart($o) { $objMgr = new CatalogCacheMgr(TRUE); + $objMgr->initFromObject($o->id, $o->type); return $objMgr->getIntervalsForChart(); } diff --git a/php/classes/CatalogCacheIntervalObject.php b/php/classes/CatalogCacheIntervalObject.php index ffba8c8..2aa3197 100644 --- a/php/classes/CatalogCacheIntervalObject.php +++ b/php/classes/CatalogCacheIntervalObject.php @@ -19,7 +19,6 @@ class CatalogCacheIntervalObject extends TimeTableCacheIntervalObject // for catalog public function setParamValue($param_id, $param_value) { - error_log($param_value); $this->params[$param_id] = $param_value; } diff --git a/php/classes/CatalogCacheMgr.php b/php/classes/CatalogCacheMgr.php index ad74f7b..3a6c965 100644 --- a/php/classes/CatalogCacheMgr.php +++ b/php/classes/CatalogCacheMgr.php @@ -103,14 +103,27 @@ class CatalogCacheMgr extends TimeTableCacheMgr $parameters = $this->cache->getParametersInfo(); $parameters_to_split = array(); + $parameters_chart = array(); foreach ($parameters as $parameter) { if ($parameter['size'] > 1) { $parameters_to_split[] = $parameter; + for ($i = 0; $i < $parameter['size']; ++$i) { + $comp_param = $parameter; + $comp_param['id'] = $parameter['id'].'_COMPONENT_'.$i; + $comp_param['name'] = $parameter['name'].'['.$i.']'; + unset ($comp_param['size']); + $parameters_chart[] = $comp_param; + } + } + else { + $comp_param = $parameter; + unset ($comp_param['size']); + $parameters_chart[] = $comp_param; } } if (empty($parameters_to_split)) { - return $result; + return $result + array('parameters' => $parameters_chart); } //split parameters @@ -124,7 +137,7 @@ class CatalogCacheMgr extends TimeTableCacheMgr } } - return $result; + return $result + array('parameters' => $parameters_chart); } } ?> diff --git a/php/classes/CatalogMgr.php b/php/classes/CatalogMgr.php index 53f739d..74d390c 100644 --- a/php/classes/CatalogMgr.php +++ b/php/classes/CatalogMgr.php @@ -101,93 +101,6 @@ class CatalogMgr extends TimeTableMgr } - public function initForChart($id, $folderId, $name, $isTmpObject, $type) - { - if ($isTmpObject) - $options = array( - 'name' => $name, - 'folder' => empty($folderId) ? USERTEMPDIR : USERWORKINGDIR.$folderId, - 'type' => $type, - ); - else - $options = array( - 'id' => $id, - 'type' => $type, - ); - - $intervals_res = $this->getCatalogParamDescription($options); - - if (!$intervals_res['success']) - return $intervals_res; - - $paramHeaders = array(); - - foreach ( $intervals_res['parameters'] as $param ) { - - if ($param['size'] > 1) { - - for ($i = 0; $i < $param['size']; $i++) { - $paramComp = array(); - $paramComp['id'] = $param['id'].'_'.$i; - $paramComp['name'] = $param['name'].'_'.$i; - // $paramComp['size'] = 1; - - $paramHeaders[] = $paramComp; - } - } - else { - $paramHeaders[] = $param; - } - } - - // unset($intervals_res); - - return array('success' => true, 'parameters' => $paramHeaders, - 'totalCount' => $intervals_res['totalCount'], 'name' => $intervals_res['name']); - } - - - public function getIntervalsForChart($id, $name, $isTmpObject, $type) { - - if ($isTmpObject) - $intervals_res = $this->getTmpObject($id, $name); - else - $intervals_res = $this->loadIntervalsFromObject($id,$type); - - if (!$intervals_res['success']) - return $intervals_res; - - - $newIntervals = array(); - - foreach ($intervals_res['intervals'] as $interval) - { - $newIntervalComp = array(); - $k = 0; - - for ( $j = 0; $j < count($interval['paramTable']); $j++ ) { - - $param = $interval['paramTable'][$j]; - $tempArr = explode(',',$param); - - if (count($tempArr) > 1) { - for ($i = 0; $i < count($tempArr); $i++) { - $newIntervalComp['param'.$k] = $tempArr[$i]; - $k++; - } - } - else { - $newIntervalComp['param'.$k] = $param; - $k++; - } - } - $newIntervals[] = $newIntervalComp; - } - - return array('success' => true, 'intervals' => $newIntervals); - - } - public function getCatalogParamDescription($options) { if (!empty($options['id'])) { -- libgit2 0.21.2