Esempio n. 1
0
 /**
  * Get important context data as an array (useful for template hydratation)
  */
 public function getDataArray()
 {
     $array = array();
     try {
         $array['module'] = array();
         $array['module']['name'] = \Orion::module()->getName();
         $array['module']['path'] = \Orion\Core\Context::getModulePath();
         $array['module']['url'] = \Orion\Core\Context::getModuleURL(\Orion::module()->getName());
         $array['module']['uri'] = \Orion\Core\Context::getModuleURI();
         $array['module']['fulluri'] = \Orion\Core\Context::getFullURI();
         $array['template'] = array();
         $array['template']['name'] = \Orion::module()->getTemplate();
         $array['template']['path'] = \Orion\Core\Context::getTemplatePath(\Orion::module()->getTemplate());
         $array['template']['abspath'] = \Orion\Core\Context::getTemplateAbsolutePath(\Orion::module()->getTemplate());
         if (\Orion::config()->defined(strtoupper(\Orion::getMode()) . '_MENU')) {
             $array['menu'] = \Orion::config()->get(strtoupper(\Orion::getMode()) . '_MENU');
         }
         $array['title'] = \Orion::config()->get('SITE_NAME');
         $array['description'] = \Orion::config()->get('SITE_DESC');
         $array['author'] = \Orion::config()->get('SITE_AUTHOR');
         $array['baseurl'] = \Orion::config()->get('BASE_URL');
         $array['mode'] = \Orion::getMode();
         $array['logged'] = \Orion\Core\Auth::logged() ? 'yes' : 'no';
         if (\Orion\Core\Auth::user() != null) {
             $array['user'] = array();
             $array['user']['login'] = \Orion\Core\Auth::user()->login;
             $array['user']['hasadmin'] = \Orion\Core\Auth::user()->is('moderator', true);
         }
     } catch (Exception $e) {
         $array['error'] = 'Unable to retreive all data.';
     }
     return $array;
 }