コード例 #1
0
 /**
  * Find out the type of a resource.
  * @param  $resource
  * @return type of $resource
  */
 private function findType($resource)
 {
     $model = OntoWiki::getInstance()->selectedModel;
     $query = 'SELECT ?type WHERE { <' . $resource . '> a ?type }';
     $result = $model->sparqlQuery($query);
     return $result[0]['type'];
 }
コード例 #2
0
 private function executeFullHelper($matches)
 {
     $tag = $matches[0];
     $helper = strtolower($matches['helper']);
     $attributes = trim($matches['attributes']);
     // split the attributes part of the helper markup and fill it to the
     // options array
     preg_match_all($this->keyValuePattern, $attributes, $matches, PREG_SET_ORDER);
     $options = array();
     foreach ($matches as $i => $match) {
         $key = $match['key'];
         $value = $match['value'];
         $options[$key] = $value;
     }
     // pre-set some standard values
     $options['selectedResource'] = OntoWiki::getInstance()->selectedResource;
     // return the output of the helper or its error message
     try {
         $helperInstance = $this->view->getHelper($helper);
         if (!$helperInstance) {
             throw new Exception("Helper '{$helper}' not found.");
         }
         if (!$helperInstance instanceof Site_View_Helper_MarkupInterface) {
             throw new Exception("Helper '{$helper}' is not a markup helper and cannot be used in this way.");
         }
         return $this->view->{$helper}($options);
     } catch (Exception $e) {
         $message = htmlspecialchars($e->getMessage(), ENT_NOQUOTES);
         $message = str_replace('"', '', $message);
         $message = str_replace('\'', '', $message);
         return $this->returnError($message . " ({$tag})");
     }
 }
コード例 #3
0
 /**
  * search GUI to import CKAN packages into ontowiki
  * TODO: finish :)
  */
 public function browserAction()
 {
     $t = $this->_owApp->translate;
     $this->view->placeholder('main.window.title')->set($t->_('CKAN Package Browser'));
     $this->addModuleContext('main.window.ckan.browser');
     OntoWiki::getInstance()->getNavigation()->disableNavigation();
     echo "not finished yet";
     return;
     //$scriptBaseUrl = $this->_owApp->extensionManager->getComponentUrl('ckan').'ckanjs/lib/';
     //$clientScript  = $scriptBaseUrl . 'client.js';
     //$this->view->headScript()->appendFile($clientScript);
     //$newIncludePath = ONTOWIKI_ROOT . '/extensions/ckan/api/';
     //set_include_path(get_include_path() . PATH_SEPARATOR . $newIncludePath);
     //require_once('Ckan_client.php');
     //// Create CKAN object
     //// Takes optional API key parameter. Required for POST and PUT methods.
     //$ckan        = new Ckan_client();
     //$search_term = 'street';
     //$result      = $ckan->search_package($search_term, array('limit' => 5, 'tags' => 'format-rdf'));
     //$packageIds  = $result->results;
     //foreach ($packageIds as $key => $id) {
     //$package = $ckan->get_package_entity($id);
     //$data[$id] = $package;
     //}
     //$this->view->data = $data;
 }
コード例 #4
0
 /**
  * init() Method to init() normal and add tabbed Navigation
  */
 public function init()
 {
     parent::init();
     OntoWiki::getInstance()->getNavigation()->disableNavigation();
     // provide basic view data
     $action = $this->_request->getActionName();
     $this->view->placeholder('main.window.title')->set('Import Data');
     $this->view->formActionUrl = $this->_config->urlBase . 'basicimporter/' . $action;
     $this->view->formEncoding = 'multipart/form-data';
     $this->view->formClass = 'simple-input input-justify-left';
     $this->view->formMethod = 'post';
     $this->view->formName = 'importdata';
     $this->view->supportedFormats = $this->_erfurt->getStore()->getSupportedImportFormats();
     if (!$this->isSelectedModelEditable()) {
         return;
     } else {
         $this->_model = $this->_owApp->selectedModel;
     }
     // add a standard toolbar
     $toolbar = $this->_owApp->toolbar;
     $toolbar->appendButton(OntoWiki_Toolbar::SUBMIT, array('name' => 'Import Data', 'id' => 'importdata'))->appendButton(OntoWiki_Toolbar::RESET, array('name' => 'Cancel', 'id' => 'importdata'));
     $this->view->placeholder('main.window.toolbar')->set($toolbar);
     if ($this->_request->isPost()) {
         $this->_post = $this->_request->getPost();
     }
 }
コード例 #5
0
ファイル: Link.php プロジェクト: cfrancois7/site.ontowiki
 public function link($options = array())
 {
     $model = OntoWiki::getInstance()->selectedModel;
     $titleHelper = new OntoWiki_Model_TitleHelper($model);
     // check for options and assign local vars or null
     $uri = isset($options['uri']) ? (string) $options['uri'] : null;
     $literal = isset($options['literal']) ? $options['literal'] : null;
     $text = isset($options['text']) ? $options['text'] : null;
     $property = isset($options['property']) ? $options['property'] : null;
     $class = isset($options['class']) ? ' class="' . $options['class'] . '"' : '';
     $prefix = isset($options['prefix']) ? $options['prefix'] : '';
     $suffix = isset($options['suffix']) ? $options['suffix'] : '';
     $iprefix = isset($options['iprefix']) ? $options['iprefix'] : '';
     $isuffix = isset($options['isuffix']) ? $options['isuffix'] : '';
     $direct = isset($options['direct']) ? true : false;
     // resolve short forms (overwrite full name values with short forms values)
     $uri = isset($options['r']) ? (string) $options['r'] : $uri;
     $literal = isset($options['l']) ? $options['l'] : $literal;
     $text = isset($options['t']) ? $options['t'] : $text;
     $property = isset($options['p']) ? $options['p'] : $property;
     // if an uri is given, we do not need to search for
     if (isset($uri)) {
         // resolve qnames and check uri input
         $uri = Erfurt_Uri::getFromQnameOrUri((string) $uri, $model);
     } else {
         // if no uri is given, we need to search by using the literal
         if (!isset($literal)) {
             throw new Exception('The link helper needs at least one parameter literal or uri');
         }
         // if a property is given, use <properyuri> instead of a variable part in the query
         $property = $property ? '<' . Erfurt_Uri::getFromQnameOrUri($property, $model) . '>' : '?property';
         // build the query including PREFIX declarations
         $query = '';
         foreach ($model->getNamespaces() as $ns => $nsprefix) {
             $query .= 'PREFIX ' . $nsprefix . ': <' . $ns . '>' . PHP_EOL;
         }
         $query .= 'SELECT DISTINCT ?resourceUri WHERE {?resourceUri ' . $property . ' ?literal
             FILTER (!isBLANK(?resourceUri))
             FILTER (REGEX(?literal, "^' . $literal . '$", "i"))
             }  LIMIT 1';
         $result = $model->sparqlQuery($query);
         if (!$result) {
             // resource not found, so return plain literal or given text
             return isset($text) ? $text : $literal;
         } else {
             $uri = $result[0]['resourceUri'];
         }
     }
     // generate the link URL from the resource URI
     if ($direct == true) {
         $url = $uri;
     } else {
         $url = new OntoWiki_Url(array('route' => 'properties'), array('r'));
         $url->setParam('r', $uri, true);
         $url = (string) $url;
     }
     // link text comes from title helper or option
     $text = isset($text) ? $text : $titleHelper->getTitle($uri);
     return "{$prefix}<a{$class} href='{$url}'>{$iprefix}{$text}{$isuffix}</a>{$suffix}";
 }
コード例 #6
0
 public function onCreateMenu($event)
 {
     $modelUri = (string) $event->resource;
     $baseUrl = OntoWiki::getInstance()->config->urlBase;
     $extensionManager = OntoWiki::getInstance()->extensionManager;
     // do NOT create the menu entry ...
     switch (true) {
         // ... for resources
         case !$event->isModel:
             // ... for localhost models (can't be registered at CKAN)
         // ... for localhost models (can't be registered at CKAN)
         case substr_count($modelUri, 'http://localhost') > 0:
             // ... if the model is not part of the base url (no Linked Data)
         // ... if the model is not part of the base url (no Linked Data)
         case substr_count($modelUri, $baseUrl) !== 1:
             // ... if we do not have a linked data server online
         // ... if we do not have a linked data server online
         case !$extensionManager->isExtensionRegistered('linkeddataserver'):
             return;
     }
     // finally, create the holy menu entry and PREPEND it on top of the menu
     $url = new OntoWiki_Url(array('controller' => 'ckan', 'action' => 'register'), array('m'));
     $url->setParam('m', $modelUri);
     $event->menu->prependEntry('Register Knowledge Base @ CKAN', (string) $url);
 }
コード例 #7
0
ファイル: Query.php プロジェクト: cfrancois7/site.ontowiki
 public function query($options = array())
 {
     $this->templateData = $this->view->getHelper('Renderx')->templateData;
     $store = OntoWiki::getInstance()->erfurt->getStore();
     $model = OntoWiki::getInstance()->selectedModel;
     // check for options and assign local vars or null
     $where = isset($options['where']) ? $options['where'] : '?resourceUri a foaf:Project.';
     $template = isset($options['template']) ? $options['template'] : 'li';
     $limit = isset($options['limit']) ? $options['limit'] : 100;
     $prefix = isset($options['prefix']) ? $options['prefix'] : '';
     $suffix = isset($options['suffix']) ? $options['suffix'] : '';
     $orderby = isset($options['orderby']) ? $options['orderby'] : null;
     // create template name {site}/items/{name}.phtml
     $siteId = $this->templateData['siteId'];
     $template = $siteId . '/items/' . $template . '.phtml';
     // build the query including PREFIX declarations
     $query = '';
     foreach ($model->getNamespaces() as $ns => $usedPrefix) {
         $query .= 'PREFIX ' . $usedPrefix . ': <' . $ns . '>' . PHP_EOL;
     }
     $query .= 'SELECT DISTINCT ?resourceUri WHERE {' . PHP_EOL;
     $query .= $where . PHP_EOL;
     $query .= 'FILTER (!isBLANK(?resourceUri))' . PHP_EOL;
     $query .= '}' . PHP_EOL;
     if ($orderby !== null) {
         $query .= 'ORDER BY ' . $orderby . PHP_EOL;
     }
     $query .= 'LIMIT ' . $limit . PHP_EOL;
     // prepare the result string
     $result = $this->view->querylist($query, $template, $options);
     if ($result != '') {
         $result = $prefix . $result . $suffix;
     }
     return $result;
 }
コード例 #8
0
 public function viewAction()
 {
     $this->view->placeholder('main.window.title')->set('Historyproxy');
     $this->addModuleContext('main.window.historyproxy.search');
     OntoWiki::getInstance()->getNavigation()->disableNavigation();
     $model = $this->_owApp->selectedModel;
     $event = new Erfurt_Event('onQueryHistory');
     // $model->getModelIri()
     /**
      * Get last imports
      */
     $event->function = 'getLastImports';
     $event->parameters = array();
     $event->trigger();
     $this->view->importsFunction = $event->function;
     $this->view->importsParameters = $event->parameters;
     $this->view->importsCallback = $event->callback;
     /**
      * Get last changes
      */
     $event->function = 'getChangesFromRange';
     $event->parameters = array($model->getModelIri(), '01-01-2014', '30-01-2014');
     $event->trigger();
     $this->view->changeFunction = $event->function;
     $this->view->changeParameters = $event->parameters;
     $this->view->changeCallback = $event->callback;
 }
コード例 #9
0
ファイル: Toc.php プロジェクト: cfrancois7/site.ontowiki
    public function toc($options = array())
    {
        // check for options and assign local vars or default
        $startlevel = isset($options['startlevel']) ? $options['startlevel'] : '1';
        $depth = isset($options['depth']) ? $options['depth'] : '2';
        $tag = isset($options['tag']) ? $options['tag'] : 'ul';
        $view = $this->view;
        $store = OntoWiki::getInstance()->erfurt->getStore();
        $model = OntoWiki::getInstance()->selectedModel;
        $titleHelper = new OntoWiki_Model_TitleHelper($model);
        $script = OntoWiki::getInstance()->getUrlBase() . 'extensions/site/js/jquery.tableofcontents.js';
        $return = PHP_EOL;
        $return .= '<script type="text/javascript" src="' . $script . '"></script>' . PHP_EOL;
        $return .= '<script type="text/javascript" charset="utf-8">
    $(document).ready(function(){
        $.TableOfContents.defaultOptions.startLevel = "' . $startlevel . '";
        $.TableOfContents.defaultOptions.depth      = "' . $depth . '";
        $("#toc").tableOfContents($("div.content[property=\'site:content\']"));
    })
</script>' . PHP_EOL;
        $return .= '<details><summary>Table of Contents</summary>';
        $return .= '<' . $tag . ' id="toc"></' . $tag . '>';
        $return .= '</details>';
        return $return;
    }
コード例 #10
0
ファイル: HttpAuth.php プロジェクト: dmj/uni-helmstedt.hab.de
 /**
  * Retieves user credentials from the current request and tries to
  * authenticate the user with Erfurt.
  *
  * @param Zend_Controller_Request_Abstract $request The current request object
  */
 public function routeShutdown(Zend_Controller_Request_Abstract $request)
 {
     if ($credentials = $this->_getAuthHeaderCredentials($request)) {
         switch ($credentials['type']) {
             case 'basic':
                 $erfurt = OntoWiki::getInstance()->erfurt;
                 $logger = OntoWiki::getInstance()->logger;
                 // authenticate
                 $authResult = $erfurt->authenticate($credentials['username'], $credentials['password']);
                 if ($authResult->isValid()) {
                     $logger = OntoWiki::getInstance()->logger;
                     $logger->info("User '{$credentials['username']}' authenticated via HTTP.");
                 } else {
                     // if authentication attempt fails, send appropriate headers
                     $front = Zend_Controller_Front::getInstance();
                     $response = $front->getResponse();
                     $response->setRawHeader('HTTP/1.1 401 Unauthorized');
                     echo 'HTTP/1.1 401 Unauthorized';
                     return;
                 }
                 break;
             case 'foaf+ssl':
                 $adapter = new Erfurt_Auth_Adapter_FoafSsl();
                 $authResult = $adapter->authenticateWithCredentials($credentials['creds']);
                 Erfurt_App::getInstance()->getAuth()->setIdentity($authResult);
                 if ($authResult->isValid()) {
                     $logger = OntoWiki::getInstance()->logger;
                     $logger->info('User authenticated with FOAF+SSL via HTTPS.');
                 }
                 break;
         }
     }
 }
コード例 #11
0
ファイル: List.php プロジェクト: dmj/uni-helmstedt.hab.de
 public function __construct()
 {
     $this->_owApp = OntoWiki::getInstance();
     if (!isset($this->_owApp->session->managedLists)) {
         $this->_owApp->session->managedLists = array();
     }
 }
コード例 #12
0
 public function postAction()
 {
     // service controller needs no view renderer
     $this->_helper->viewRenderer->setNoRender();
     // disable layout for Ajax requests
     $this->_helper->layout()->disableLayout();
     $response = $this->getResponse();
     $request = $this->_request;
     $output = false;
     try {
         $model = $this->_owApp->selectedModel;
         $store = $this->_owApp->erfurt->getStore();
         //$store->addMultipleStatements((string) $model, $activity->toRDF());
         $classname = OntoWiki::getInstance()->selectedResource;
         //$resource = $response->r;
         $manchester = $request->manchester;
         $structuredOwl = $this->initParser($manchester);
         $triples = $structuredOwl->toTriples();
         $output = array('message' => 'class saved', 'class' => 'success', 'out' => $triples);
     } catch (Exception $e) {
         // encode the exception for http response
         $output = array('message' => $e->getMessage(), 'class' => 'error');
         $response->setRawHeader('HTTP/1.1 500 Internal Server Error');
     }
     // send the response
     $response->setHeader('Content-Type', 'application/json');
     $response->setBody(json_encode($output));
 }
コード例 #13
0
 public function lastchange($uri)
 {
     // TODO: fill this value with the erfurt versioning api
     $versioning = Erfurt_App::getInstance()->getVersioning();
     $history = $versioning->getLastModifiedForResource($uri, (string) OntoWiki::getInstance()->selectedModel);
     if (empty($history)) {
         return array('resourceUri' => $uri, 'resourceTitle' => '', 'timeStamp' => '', 'timeIso8601' => '', 'timeDuration' => '', 'userTitle' => '', 'userUri' => '', 'userHref' => '');
     }
     $th = new OntoWiki_Model_TitleHelper(OntoWiki::getInstance()->selectedModel);
     $th->addResource($history['useruri']);
     $th->addResource($uri);
     $return = array();
     $userUrl = new OntoWiki_Url(array('route' => 'properties'));
     $userUrl->setParam('r', $history['useruri']);
     $return['resourceUri'] = $uri;
     $return['resourceTitle'] = $th->getTitle($uri);
     $return['timeStamp'] = $history['tstamp'];
     //unix timestamp
     $return['timeIso8601'] = date('c', $history['tstamp']);
     // ISO 8601 format
     try {
         $return['timeDuration'] = OntoWiki_Utils::dateDifference($history['tstamp'], null, 3);
         // x days ago
     } catch (Exception $e) {
         $return['timeDuration'] = '';
     }
     $return['userTitle'] = $th->getTitle($history['useruri']);
     $return['userUri'] = $history['useruri'];
     $return['userHref'] = $userUrl;
     //use URI helper
     return $return;
 }
コード例 #14
0
 /**
  * Constructor
  */
 public function __construct($model, $titleHelperLimit, $dimensionElementLimit)
 {
     $this->_dimensionElementLimit = $dimensionElementLimit;
     $this->_model = $model;
     $this->_titleHelperLimit = $titleHelperLimit;
     // caching
     $this->_objectCache = OntoWiki::getInstance()->erfurt->getCache();
 }
コード例 #15
0
 public function __construct()
 {
     $this->_owApp = OntoWiki::getInstance();
     $patternManagerConfig = $this->_owApp->componentManager->getComponentPrivateConfig("patternmanager");
     $this->_engine = new PatternEngine();
     $this->_engine->setConfig($patternManagerConfig);
     $this->_engine->setBackend($this->_owApp->erfurt);
 }
コード例 #16
0
ファイル: View.php プロジェクト: dmj/uni-helmstedt.hab.de
 /**
  * Constructor
  */
 public function __construct($config = array(), $translate = null)
 {
     parent::__construct($config);
     $this->_translate = $translate;
     $this->_placeholderRegistry = Zend_View_Helper_Placeholder_Registry::getRegistry();
     if (array_key_exists('use_module_cache', $config) && (bool) $config['use_module_cache']) {
         $this->_moduleCache = OntoWiki::getInstance()->getCache();
     }
 }
コード例 #17
0
 /**
  * We enable GET authentication and test that we do not get a
  * 405 Method No Allowed response.
  */
 public function testAuthActionGetAllowed()
 {
     $config = OntoWiki::getInstance()->config;
     $config->service->allowGetAuth = true;
     $this->dispatch('/service/auth');
     $this->assertController('service');
     $this->assertAction('auth');
     $this->assertResponseCode(400);
 }
コード例 #18
0
 public function __construct()
 {
     if (Erfurt_App::getInstance()->getAc()->isActionAllowed('ExtensionConfiguration')) {
         $owApp = OntoWiki::getInstance();
         $translate = $owApp->translate;
         $url = new OntoWiki_Url(array('controller' => 'exconf', 'action' => 'list'), array());
         $extrasMenu = OntoWiki_Menu_Registry::getInstance()->getMenu('application')->getSubMenu('Extras');
         $extrasMenu->setEntry($translate->_('Configure Extensions'), (string) $url);
     }
 }
コード例 #19
0
ファイル: Cron.php プロジェクト: dmj/uni-helmstedt.hab.de
 /**
  * sleeps an amount of time and calls the next job
  *
  * @param mixed $load       the load of the next job
  * @param int   $inXSeconds time in seconds when the next job is called
  *
  * @return void
  */
 private function _next($load = null, $inXSeconds = 2)
 {
     if ((int) $inXSeconds > 0) {
         sleep((int) $inXSeconds);
     }
     if ($load == null) {
         OntoWiki::getInstance()->callJob('cron');
     } else {
         OntoWiki::getInstance()->callJob('cron', $load);
     }
 }
コード例 #20
0
 public function setUpExtensionIntegrationTest()
 {
     $this->setUpIntegrationTest();
     if (null !== $this->_extensionName) {
         $extensionManager = OntoWiki::getInstance()->extensionManager;
         if (!$extensionManager->isExtensionActive($this->_extensionName)) {
             Erfurt_Event_Dispatcher::reset();
             $this->markTestSkipped('extension is not active');
         }
     }
 }
コード例 #21
0
 public function testMessagesActionMultipleMessages()
 {
     $owApp = OntoWiki::getInstance();
     $owApp->appendMessage(new OntoWiki_Message('Test Message 123', OntoWiki_Message::INFO));
     $owApp->appendMessage(new OntoWiki_Message('Error Message 456', OntoWiki_Message::ERROR));
     $this->dispatch('/index/messages');
     $this->assertController('index');
     $this->assertAction('messages');
     $this->assertQueryContentContains('p.messagebox.info', 'Test Message 123');
     $this->assertQueryContentContains('p.messagebox.error', 'Error Message 456');
 }
コード例 #22
0
 /**
  * Returns the content
  */
 public function getContents()
 {
     $from = $this->_owApp->selectedModel;
     $classname = OntoWiki::getInstance()->selectedResource;
     $structured = Erfurt_Owl_Structured_Util_Owl2Structured::mapOWL2Structured(array((string) $from), (string) $classname);
     $data = new StdClass();
     $formUrl = new OntoWiki_Url(array('controller' => 'manchester', 'action' => 'post'), array());
     $data->formUrl = (string) $formUrl;
     $data->manchesterString = (string) $structured;
     $content = $this->render('modules/manchester', $data, 'data');
     return $content;
 }
コード例 #23
0
 /**
  *
  */
 public function __construct()
 {
     $owApp = OntoWiki::getInstance();
     $translate = $owApp->translate;
     $extrasMenu = OntoWiki_Menu_Registry::getInstance()->getMenu('application')->getSubMenu('Extras');
     // If a model is selected, add entry to analyze action
     if (true === isset(OntoWiki::getInstance()->selectedModel)) {
         $extrasMenu->setEntry($translate->_('ApplicationExtrasMenu_Label'), (string) new OntoWiki_Url(array('controller' => 'cubeviz', 'action' => 'analyze'), array()));
     }
     // add entry to comparing action
     $extrasMenu->setEntry($translate->_('ApplicationExtrasMenu_ComparingLabel'), (string) new OntoWiki_Url(array('controller' => 'cubeviz', 'action' => 'compare'), array()));
 }
コード例 #24
0
 public function getContents()
 {
     $this->view->infoMessage = 'Use this Bookmarklet to add content to this Knowledge Base.';
     $this->view->rdfAuthorBase = $this->_config->libraryUrlBase . 'RDFauthor/';
     $this->view->defaultGraph = (string) OntoWiki::getInstance()->selectedModel;
     $this->view->defaultUpdateService = $this->_config->urlBase . 'update/';
     $this->view->defaultQueryService = $this->_config->urlBase . 'sparql/';
     $this->view->ontoWikiUrl = $this->_config->urlBase;
     $frontController = Zend_Controller_Front::getInstance();
     $request = $frontController->getRequest();
     return $this->render('bookmarklet');
 }
コード例 #25
0
 public function __construct()
 {
     $owApp = OntoWiki::getInstance();
     // if a model has been selected
     if ($owApp->selectedModel) {
         // register with extras menu
         $translate = $owApp->translate;
         $url = new OntoWiki_Url(array('controller' => 'queries', 'action' => 'editor'));
         $extrasMenu = OntoWiki_Menu_Registry::getInstance()->getMenu('application')->getSubMenu('Extras');
         $extrasMenu->setEntry($translate->_('Queries'), (string) $url);
         //$extrasMenu->setEntry('Query Builder', (string) $url);
     }
 }
コード例 #26
0
 private function importModels()
 {
     // read config for models to import
     $owApp = OntoWiki::getInstance();
     $models = $this->_privateConfig->setup->model->toArray();
     foreach ($models as $info) {
         // import models
         $path = ONTOWIKI_ROOT . '/' . $info['path'];
         $uri = $info['uri'];
         $hidden = $info['hidden'];
         $this->_import($uri, $path);
     }
 }
コード例 #27
0
 /**
  * Constructor
  *
  * @see OntoWiki_Model_Abstract
  */
 public function __construct(Erfurt_Store $store, $graph, array $options = array())
 {
     parent::__construct($store, $graph);
     $this->_options = array_merge($this->_options, $options);
     $this->_current = (string) OntoWiki::getInstance()->selectedResource;
     $this->_session = OntoWiki::getInstance()->session;
     // HACK: if the graph itself is one that is normally ignored in other
     // models, don't ignore it
     if (in_array($this->_graph, $this->_options['ignore_ns'])) {
         // TODO: remove only graph and imported namespaces
         $this->_options['ignore_ns'] = array();
     }
 }
コード例 #28
0
 /**
  * Returns the message of the module
  *
  * @return array
  */
 public function getMessage()
 {
     if ($authResult = $this->_owApp->authResult) {
         // Translate partial messages before creation of message box
         $translate = OntoWiki::getInstance()->translate;
         $message = $translate->translate($authResult[0]);
         $message .= '<a href="' . $this->view->urlBase . 'account/recover"> ' . $translate->translate('Forgot your password?') . ' </a>';
         // create messagebox for loginbox (no escape for html code)
         $message = new OntoWiki_Message($message, OntoWiki_Message::ERROR, array('escape' => false, 'translate' => false));
         unset($this->_owApp->authResult);
         return $message;
     }
 }
コード例 #29
0
 public function init()
 {
     /*
      * check for $request->getParam('mode') == 'multi' if tab should also be displayed for
      * multiple resources/lists ($request->getActionName() == 'instances')
      * And set 'mode' => 'multi' to tell the controller the multi mode
      *
      * Multi mode was disabled because it doesn't seam to work
      */
     $owApp = OntoWiki::getInstance();
     if ($owApp->lastRoute == 'properties' && $owApp->selectedResource != null) {
         $owApp->getNavigation()->register('community', array('controller' => 'community', 'action' => 'list', 'name' => 'Community', 'mode' => 'single', 'priority' => 50));
     }
 }
コード例 #30
0
ファイル: RDFSClass.php プロジェクト: FTeichmann/Erfurt
 public function __construct(Erfurt_Sparql_Query2_IriRef $iri, $withChilds = false)
 {
     $this->iri = $iri;
     if ($withChilds) {
         // TODO what the heck???
         $owApp = OntoWiki::getInstance();
         $store = $owApp->erfurt->getStore();
         $graph = $owApp->selectedModel;
         $types = array_keys($store->getTransitiveClosure($graph->getModelIri(), EF_RDFS_SUBCLASSOF, array($iri->getIri()), true));
         foreach ($types as $type) {
             $this->subclasses[] = new Erfurt_Sparql_Query2_IriRef($type);
         }
     }
 }