Избавляемся от констант и глобальных переменных
This commit is contained in:
parent
8b38b2a3cc
commit
f041488554
10 changed files with 39 additions and 33 deletions
|
|
@ -52,7 +52,6 @@ class Action
|
|||
public $param = array(); // Параметры для ссылки
|
||||
|
||||
public /*.Registry.*/$_registry; // Ссылка на реестр
|
||||
public $_shortcut;
|
||||
public $modulePrefix = '';
|
||||
public $iconPath = '';
|
||||
|
||||
|
|
@ -69,10 +68,12 @@ class Action
|
|||
}
|
||||
|
||||
public function loadConfig($name) {
|
||||
$filename = Shortcut::getUrl('config', $name);
|
||||
$basePath = $this->settings['base'];
|
||||
|
||||
$filename = Path::join($basePath, 'modules', $name);
|
||||
$settings = [];
|
||||
if (file_exists($filename)) {
|
||||
include($filename);
|
||||
$settings = include($filename);
|
||||
} else {
|
||||
throw new Exception('Невозможно загрузить файл настроек ' . $name);
|
||||
}
|
||||
|
|
@ -86,7 +87,8 @@ class Action
|
|||
|
||||
public function installPath($name)
|
||||
{
|
||||
return Path::join(CMS_PATH, "modules", $name);
|
||||
$basePath = $this->settings['base'];
|
||||
return Path::join($basePath, "modules", $name);
|
||||
}
|
||||
|
||||
public function addSuggest(View $view, $name)
|
||||
|
|
@ -110,13 +112,16 @@ class Action
|
|||
* @param $viewClass String
|
||||
* @return View_Composite
|
||||
*/
|
||||
public function getView($name, $viewClass = 'View_Composite')
|
||||
public function getView($name, $viewClass = 'ctiso\\View\\Composite')
|
||||
{
|
||||
$file = $name . self::TEMPLATE_EXTENSION;
|
||||
|
||||
$basePath = $this->settings['base'];
|
||||
$webPath = $this->settings['web'];
|
||||
|
||||
$list = array(
|
||||
Path::join($this->viewPath, TEMPLATES, $this->viewPathPrefix) => Path::join(WWW_PATH, "modules", $this->name, TEMPLATES, $this->viewPathPrefix),
|
||||
Path::join(CMS_PATH, "templates") => Path::join(WWW_PATH, "templates")
|
||||
Path::join($this->viewPath, 'templates', $this->viewPathPrefix) => Path::join($webPath, "modules", $this->name, 'templates', $this->viewPathPrefix),
|
||||
Path::join($basePath, "templates") => Path::join($webPath, "templates")
|
||||
);
|
||||
|
||||
// Поиск файла для шаблона
|
||||
|
|
@ -127,7 +132,7 @@ class Action
|
|||
|
||||
/*.View_Composite.*/$tpl = new $viewClass($template);
|
||||
|
||||
$assets = Path::join(enableHttps(WWW_PATH), "assets", "css");
|
||||
$assets = Path::join($webPath, "assets", "css");
|
||||
$tpl->set('icons', $this->iconPath); // Путь к файлам текущей темы
|
||||
$tpl->set('media', $this->themePath); // Путь к файлам текущей темы
|
||||
$tpl->set('assets', $assets);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue