Esempio n. 1
0
 /**
  * Constructs a new title helper instance.
  *
  * @param Erfurt_Rdf_Model $model The model instance to operate on
  */
 public function __construct(Erfurt_Rdf_Model $model = null, Erfurt_Store $store = null, $config = null)
 {
     if (null !== $model) {
         $this->_model = $model;
     }
     $this->_erfurtApp = Erfurt_App::getInstance();
     if (null !== $store) {
         $this->_store = $store;
     } else {
         $this->_store = $this->_erfurtApp->getStore();
     }
     if (null == $config) {
         $config = OntoWiki::getInstance()->config;
     }
     if (is_array($config)) {
         if (isset($config['titleHelper']['properties'])) {
             // naming properties for resources
             $this->_titleProperties = array_values($config['titleHelper']['properties']);
         } else {
             $this->_titleProperties = array();
         }
         // fetch mode
         if (isset($config['titleHelper']['searchMode'])) {
             $this->_alwaysSearchAllProperties = strtolower($config['titleHelper']['searchMode']) === 'language';
         }
     } else {
         if ($config instanceof Zend_Config) {
             //its possible to define myProperties in config.ini
             if (isset($config->titleHelper->myProperties)) {
                 $this->_titleProperties = array_values($config->titleHelper->myProperties->toArray());
             } else {
                 if (isset($config->titleHelper->properties)) {
                     // naming properties for resources
                     $this->_titleProperties = array_values($config->titleHelper->properties->toArray());
                 } else {
                     $this->_titleProperties = array();
                 }
             }
             // fetch mode
             if (isset($config->titleHelper->searchMode)) {
                 $this->_alwaysSearchAllProperties = strtolower($config->titleHelper->searchMode) == 'language';
             }
         } else {
             $this->_titleProperties = array();
         }
     }
     // always use local name for unknown resources?
     if (isset($config->titleHelper->useLocalNames)) {
         $this->_alwaysUseLocalNames = (bool) $config->titleHelper->useLocalNames;
     }
     // add localname to titleproperties
     $this->_titleProperties[] = 'localname';
     if (null === $this->_languages) {
         $this->_languages = array();
     }
     if (isset($config->languages->locale)) {
         array_unshift($this->_languages, (string) $config->languages->locale);
         $this->_languages = array_unique($this->_languages);
     }
 }
Esempio n. 2
0
 /**
  * Constructor
  */
 public function __construct($name, $context, $config)
 {
     // init view
     if (null === $this->view) {
         $viewRenderer = Zend_Controller_Action_HelperBroker::getStaticHelper('viewRenderer');
         if (null === $viewRenderer->view) {
             $viewRenderer->initView();
         }
         $this->view = clone $viewRenderer->view;
         $this->view->clearVars();
     }
     $this->_templateSuffix = '.' . ltrim($this->_templateSuffix, '.');
     $this->_owApp = OntoWiki::getInstance();
     $this->_erfurt = $this->_owApp->erfurt;
     $this->_store = $this->_erfurt->getStore();
     $this->_config = $this->_owApp->config;
     $this->_lang = $this->_config->languages->locale;
     $this->_request = Zend_Controller_Front::getInstance()->getRequest();
     $this->_name = $name;
     // set important script variables
     $this->view->themeUrlBase = $this->_config->themeUrlBase;
     $this->view->urlBase = $this->_config->urlBase;
     $this->view->moduleUrl = $this->_config->staticUrlBase . $this->_config->extensions->base . $config->extensionName . '/';
     // set the config
     $this->_privateConfig = $config->private;
     // set the context
     $this->setContext($context);
     // allow custom module initialization
     $this->init();
 }
Esempio n. 3
0
 /**
  * Getter for the Erfurt store
  *
  * @return \Erfurt_Store the Erfurt store to get
  */
 public function getStore()
 {
     return $this->erfurt->getStore();
 }