Example #1
0
File: Access.php Project: arhcmf/1
 /**
  * Возвращает массив с правами доступа
  * @param string $key
  * @return mixed
  */
 public function get($key)
 {
     if (isset(self::$access[$key])) {
         return self::$access[$key];
     } else {
         $this->Exception->error('Попытка получить несуществующие права доступа');
     }
 }
Example #2
0
 /**
  * Возвращает значение настройки
  * @param string $key
  * @param string $name
  * @return string
  */
 public function value($key, $name)
 {
     if (empty($name)) {
         $this->Exception->error('Не указано имя настройки');
     }
     if (isset(self::$settings[$key][$name])) {
         return self::$settings[$key][$name];
     } else {
         $this->Exception->error('Запрошена несуществующая настройка');
     }
 }
Example #3
0
File: Modules.php Project: arhcmf/1
 /**
  * Возвращает или устанавливает активный модуль
  * @param string|null $name
  * @return mixed
  */
 public function current($name = null)
 {
     if ($name) {
         $mod = $this->get($name);
         if (!empty($mod)) {
             self::$current = $mod;
             return true;
         } else {
             $this->Exception->error('Попытка переключить активный модуль на несуществующий');
         }
     } else {
         return self::$current;
     }
 }
Example #4
0
File: Tpl.php Project: arhcmf/1
 /**
  * Получение пути к файлу шаблона
  * @param bool|false $tpl
  * @return bool|string
  */
 public function getPath($tpl = false)
 {
     $mod = $this->Modules->current();
     $template = 'default';
     if (!empty($mod['name'])) {
         if (file_exists($tpl)) {
             return $tpl;
         } elseif (file_exists($this->ROOT_DIR . '/templates/' . $template . '/modules/' . $mod['name'] . '/' . $tpl)) {
             return $this->ROOT_DIR . '/templates/' . $template . '/modules/' . $mod['name'] . '/' . $tpl;
         } elseif (file_exists($this->ROOT_DIR . '/modules/' . $mod['name'] . '/template/' . $tpl)) {
             return $this->ROOT_DIR . '/modules/' . $mod['name'] . '/template/' . $tpl;
         } else {
             $this->Exception->error('Запрашиваемый шаблон не существует');
         }
     } else {
         $this->Exception->error('Не существует активного модуля');
     }
 }