protected function processConfig ( &$config ) { // TODO Services casts everything to array not objects $config = (object) $config; $config->model = (object) $config->model; $metamodel = data_controller_get_metamodel(); if ( !empty($config->model->datasets) ) { foreach ( $config->model->datasets as $key => $datasetIdentifier ) { $dataset = GD_DatasetMetaModelLoaderHelper::findDatasetByUUID($this->datasets,$datasetIdentifier); if (!isset($dataset)) { $datasetName = NameSpaceHelper::addNameSpace(gd_datasource_get_active(), $datasetIdentifier); $dataset = $metamodel->getDataset($datasetName); } $config->model->datasets[$key] = $dataset->name; } } // update columns if ( !empty($config->model->columns) ) { foreach ( $config->model->columns as $key => $value ) { $config->model->columns[$key] = DatasetImportHelper::getNewColumnName($value,$this->datasets); } } // update column configs if ( !empty($config->columnConfigs) ) { foreach ( $config->columnConfigs as $key => $value ) { $config->columnConfigs[$key]->columnId = DatasetImportHelper::getNewColumnName($value->columnId,$this->datasets); } } // update column orders if ( !empty($config->model->columnOrder) ) { foreach ( $config->model->columnOrder as $key => $value ) { $config->model->columnOrder[$key] = DatasetImportHelper::getNewColumnName($value,$this->datasets); } } // update column sorts if ( !empty($config->model->orderBy) ) { foreach ( $config->model->orderBy as $key => $value ) { $config->model->orderBy[$key]->column = DatasetImportHelper::getNewColumnName($value->column,$this->datasets); } } // update filters if ( !empty($config->model->filters) ) { foreach ( $config->model->filters as $key => $value ) { $config->model->filters[$key]->column = DatasetImportHelper::getNewColumnName($value->column,$this->datasets); } } // update visual series if ( !empty($config->visual->series) ) { $newSeries = array(); foreach ( $config->visual->series as $key => $value ) { $newSeries[DatasetImportHelper::getNewColumnName($key,$this->datasets)] = $value; } $config->visual->series = $newSeries; } // update traffic column if ( !empty($config->visual->trafficColumn) ) { $config->visual->trafficColumn = DatasetImportHelper::getNewColumnName($config->visual->trafficColumn,$this->datasets); } // update color column if ( !empty($config->visual->useColumnDataForColor) ) { $config->visual->useColumnDataForColor = DatasetImportHelper::getNewColumnName($config->visual->useColumnDataForColor,$this->datasets); } // update traffic columns if ( !empty($config->visual->traffic) ) { $newTraffic = array(); foreach ( $config->visual->traffic as $key => $value ) { $newName = DatasetImportHelper::getNewColumnName($key,$this->datasets); $value->trafficColumn = $newName; $newTraffic[$newName] = $value; } $config->visual->traffic = $newTraffic; } }
protected function processConfigReports (&$config) { // TODO Services casts everything to array not objects $config = (object) $config; // dashboard reports foreach ( $config->items as $key => $item ) { // TODO Services casts everything to array not objects $item = (object) $item; if ( $item->type == 'report' ) { $reportNode = gd_report_get_by_uuid($item->content,$this->datasourceName); // TODO Services casts everything to array not objects $config->items[$key] = (object) $config->items[$key]; $config->items[$key]->content = $reportNode->nid; } } // drill down reports foreach ( $config->drilldowns as $key => $drilldown ) { // TODO Services casts everything to array not objects $config->drilldowns[$key] = (object) $config->drilldowns[$key]; // report nid update $reportNode = gd_report_get_by_uuid($drilldown->report,$this->datasourceName); $config->drilldowns[$key]->report = (int) $reportNode->nid; // column name update $config->drilldowns[$key]->column = DatasetImportHelper::getNewColumnName($drilldown->column,$this->datasets); } }