/** * Returns the content */ public function getContents() { $q = new DataCube_Query($this->_owApp->selectedModel, $this->_titleHelperLimit, $this->_dimensionElementLimit); if (false === $q->containsDataCubeInformation()) { return false; } /** * Set paths */ $basePath = $this->view->basePath = $this->_config->staticUrlBase . 'extensions/cubeviz/'; $baseCssPath = $basePath . 'public/css/'; $baseImagesPath = $basePath . 'public/images/'; $baseJavascriptPath = $basePath . 'public/javascript/'; /** * Including javascript files for this action */ $this->view->headScript()->appendFile($baseJavascriptPath . 'libraries/CryptoJS_Md5.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/json2.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/underscore.js', 'text/javascript')->appendFile($baseJavascriptPath . 'libraries/underscore.string.js', 'text/javascript')->appendScript('_.mixin(_.str.exports());')->appendFile($basePath . 'ChartConfig.js', 'text/javascript'); // If this module is in the "development" context if ('development' === $this->_privateConfig->get('context')) { $this->view->headScript()->appendFile($baseJavascriptPath . 'libraries/munit.js', 'text/javascript')->appendFile($baseJavascriptPath . 'Test.js', 'text/javascript')->appendFile($baseJavascriptPath . 'Main.js', 'text/javascript'); // otherwise it is in "production" context } else { $this->view->headScript()->appendFile($baseJavascriptPath . 'Main-production.js', 'text/javascript'); } /** * Including css files for this action */ $this->view->headLink()->prependStylesheet($baseCssPath . 'foreign/FontAwesome/css/font-awesome.min.css')->prependStylesheet($baseCssPath . 'main.css')->prependStylesheet($baseCssPath . 'DataselectionModule/attribute.css')->prependStylesheet($baseCssPath . 'DataselectionModule/component.css')->prependStylesheet($baseCssPath . 'DataselectionModule/dataSelectionModule.css')->prependStylesheet($baseCssPath . 'DataselectionModule/dataSet.css')->prependStylesheet($baseCssPath . 'DataselectionModule/footer.css')->prependStylesheet($baseCssPath . 'DataselectionModule/measure.css')->prependStylesheet($baseCssPath . 'DataselectionModule/slice.css'); // IE specific CSS for fontawesome if (strpos($_SERVER['HTTP_USER_AGENT'], '(compatible; MSIE ') !== FALSE) { $this->view->headLink()->appendStylesheet($baseCssPath . 'foreign/FontAwesome/css/font-awesome-ie7.min.css'); } /** * Model information */ $model = $this->_owApp->selectedModel; $modelIri = $model->getModelIri(); $modelStore = $model->getStore(); $serviceUrl = true === isset($_SESSION['ONTOWIKI']['serviceUrl']) ? $_SESSION['ONTOWIKI']['serviceUrl'] : null; CubeViz_ViewHelper::$isCubeVizDataselectionModuleLoaded = true; // init cubeVizApp $config = CubeViz_ViewHelper::initApp($this->view, $model, $this->_owApp->getConfig()->store->backend, $this->_privateConfig->get('context'), $modelIri, $serviceUrl, $this->_config->staticUrlBase, $baseImagesPath, $this->_request->getParam('cv_dataHash'), $this->_request->getParam('cv_uiHash'), $this->_titleHelperLimit, $this->_dimensionElementLimit); if (null !== $config) { $this->view->headScript()->appendScript('cubeVizApp._ = ' . json_encode($config, JSON_FORCE_OBJECT) . ';')->appendScript('cubeVizApp._.backend.chartConfig = CubeViz_ChartConfig;'); } $this->view->translate = $this->_owApp->translate; /** * fill template with content and give generated HTML back */ return $this->render('public/templates/cubeviz/DataselectionModule'); }
/** * */ public static function initApp(&$view, &$model, $backend, $context, $modelIri, $serviceUrl, $staticUrlBase, $baseImagesPath, $dataHash, $uiHash, $titleHelperLimit, $dimensionElementLimit) { // if cubeVizApp was not loaded yet if (false === CubeViz_ViewHelper::$isCubeVizAppLoaded) { // get information about the selected model $modelStore = $model->getStore(); $modelInformation = CubeViz_ViewHelper::getModelInformation($modelStore, $model, $modelIri); /** * Set view and some of its properties. */ $view->cubevizImagesPath = $baseImagesPath; /** * Get hashes from parameter list */ // hash for data if (null == $dataHash) { $dataHash = null; } // hash for ui if (null == $uiHash) { $uiHash = null; } $view->isCubeVizDataselectionModuleLoaded = false === isset($view->isCubeVizDataselectionModuleLoaded) ? false : $view->isCubeVizDataselectionModuleLoaded; /** * Read information from files according to given hashes */ $c = new CubeViz_ConfigurationLink($model, $titleHelperLimit, $dimensionElementLimit); $config = array(); $generatedDataHash = ''; $generatedUiHash = ''; list($config['data'], $generatedDataHash) = $c->read($dataHash, 'data'); list($config['ui'], $generatedUiHash) = $c->read($uiHash, 'ui'); $config['backend'] = array('context' => $context, 'database' => $backend, 'dataHash' => $generatedDataHash, 'imagesPath' => $baseImagesPath, 'modelInformation' => $modelInformation, 'modelUrl' => $modelIri, 'serviceUrl' => $serviceUrl, 'uiHash' => $generatedUiHash, 'uiParts' => array('dataselectionModule' => array('isLoaded' => CubeViz_ViewHelper::$isCubeVizDataselectionModuleLoaded), 'index' => array('isLoaded' => CubeViz_ViewHelper::$isCubeVizIndexLoaded)), 'uiSettings' => array(), 'url' => $staticUrlBase . 'cubeviz/'); CubeViz_ViewHelper::$isCubeVizAppLoaded = true; return $config; } return null; }
/** * */ public function modelinfoAction() { if (true === isset($this->_request->m)) { // reset resource/class unset($this->_owApp->selectedResource); unset($this->_owApp->selectedClass); unset($this->_session->hierarchyOpen); } $on = $this->_owApp->getNavigation(); $on->disableNavigation(); // disable OntoWiki's Navigation /** * Load model information */ $graph = $this->_owApp->selectedModel; $resource = $this->_owApp->selectedResource; $erfurt = $this->_owApp->erfurt; $store = $this->_owApp->erfurt->getStore(); /** * Load model information */ $model = $this->_owApp->selectedModel; $modelIri = $model->getModelIri(); $modelStore = $model->getStore(); $modelInformation = CubeViz_ViewHelper::getModelInformation($modelStore, $model, $modelIri); $modelInformation['rdfs:label'] = true === isset($modelInformation['http://www.w3.org/2000/01/rdf-schema#label']) ? $modelInformation['http://www.w3.org/2000/01/rdf-schema#label']['content'] : $modelIri; $this->view->sparqlService = $erfurt->getConfig()->store->sparql->serviceUrl; $this->view->modelTitle = $modelInformation['rdfs:label']; $this->view->modelDescriptions = array(); foreach ($modelInformation as $url => $entry) { if ('http://www.w3.org/2004/02/skos/core#description' == $url || 'http://www.w3.org/2000/01/rdf-schema#comment' == $url) { $this->view->modelDescriptions[] = $entry['content']; } } // check for DataCube information $query = new DataCube_Query($model, $this->_titleHelperLimit, $this->_dimensionElementLimit); $this->view->containsDataCubeInformation = $query->containsDataCubeInformation(); }