diff --git a/src/Controller/Action.php b/src/Controller/Action.php index 99391a6..998f735 100644 --- a/src/Controller/Action.php +++ b/src/Controller/Action.php @@ -26,6 +26,7 @@ class Action // Параметры устанавливаются при создании контроллера public $name = ''; // Имя модуля + public $front; public $modulePath = null; // Путь к модулю public $moduleTitle = ''; diff --git a/src/Controller/Component.php b/src/Controller/Component.php index 4fb8fba..e4b54da 100644 --- a/src/Controller/Component.php +++ b/src/Controller/Component.php @@ -171,8 +171,9 @@ class Component */ public function getModel($name) { - $modelName = "Mapper_" . $name; + $modelName = "App\\Mapper\\" . $name; $model = new $modelName(); + $model->config = $this->config; $model->db = $this->db; return $model; } @@ -260,7 +261,7 @@ class Component } else { $component = new $className(); - $template = $component->getTemplateName($registry); + $template = $component->getTemplateName($site->config); $component->viewPath = array( // Сначало ищем локально diff --git a/src/Controller/Front.php b/src/Controller/Front.php index b8c3bae..2e1cc1d 100644 --- a/src/Controller/Front.php +++ b/src/Controller/Front.php @@ -67,6 +67,7 @@ class Front extends Action $module->config = $this->config; $module->db = $this->db; $module->user = $this->user; + $module->front = $this; // Ведение лога $logger = new ActionLogger($module, $logPath, $this->user); $logger->before = $this->loadSettings(Path::join($modPath, 'filter', 'logger.php')); diff --git a/src/Controller/SiteInterface.php b/src/Controller/SiteInterface.php index 205e5ea..1125601 100644 --- a/src/Controller/SiteInterface.php +++ b/src/Controller/SiteInterface.php @@ -3,6 +3,7 @@ namespace ctiso\Controller; interface SiteInterface { + function getResource(); function loadComponent($expression); function getDatabase(); function getConfig(); diff --git a/src/Registry.php b/src/Registry.php index c9c9fac..21e08eb 100644 --- a/src/Registry.php +++ b/src/Registry.php @@ -48,20 +48,4 @@ class Registry { function set($ns, $key, $value) { $this->namespace[$ns]['data'][$key] = $value; } - - /** - * Список модулей - */ - public function getModules() - { - return array_keys($this->data); - } - - /** - * Проверка наличия модуля - */ - public function hasModule($name) - { - return isset($this->data[$name]); - } } diff --git a/src/Settings.php b/src/Settings.php index c7c96b1..1325830 100644 --- a/src/Settings.php +++ b/src/Settings.php @@ -156,11 +156,6 @@ class Settings $name = array_shift($key); unset($data[$name]); } - - public function getOwner() - { - return array_keys($this->data); - } /** * Запись настроек в файл (Может переименовать в store) @@ -195,4 +190,20 @@ class Settings function import($data) { $this->data = $data; } + + /** + * Список модулей/ключей + */ + public function getKeys() + { + return array_keys($this->data); + } + + /** + * Проверка наличия ключа + */ + public function hasKey($name) + { + return isset($this->data[$name]); + } } diff --git a/src/Validator/Rule/Match.php b/src/Validator/Rule/MatchRule.php similarity index 92% rename from src/Validator/Rule/Match.php rename to src/Validator/Rule/MatchRule.php index 7f8b999..d54f448 100644 --- a/src/Validator/Rule/Match.php +++ b/src/Validator/Rule/MatchRule.php @@ -7,7 +7,7 @@ namespace ctiso\Validator\Rule; use ctiso\Validator\Rule\AbstractRule, ctiso\Collection; -class Match extends AbstractRule +class MatchRule extends AbstractRule { public $same; diff --git a/src/Validator/Validator.php b/src/Validator/Validator.php index 0529662..88fd870 100644 --- a/src/Validator/Validator.php +++ b/src/Validator/Validator.php @@ -28,19 +28,19 @@ class Validator public function addRuleList(array $input) { $type = array( - 'date' => 'Validator_Rule_Date', - 'email' => 'Validator_Rule_Email', - 'emaillist'=> 'Validator_Rule_EmailList', - 'match' => 'Validator_Rule_Match', - 'time' => 'Validator_Rule_Time', - 'alpha' => 'Validator_Rule_Alpha', - 'require' => 'Validator_Rule_Notnull', - 'numeric' => 'Validator_Rule_Numeric', - 'unique' => 'Validator_Rule_Unique', - 'filename' => 'Validator_Rule_FileName', - 'count' => 'Validator_Rule_Count', - 'isfile' => 'Validator_Rule_IsFile', - 'code' => 'Validator_Rule_Code' + 'date' => 'ctiso\\Validator\\Rule\\Date', + 'email' => 'ctiso\\Validator\\Rule\\Email', + 'emaillist'=> 'ctiso\\Validator\\Rule\\EmailList', + 'match' => 'ctiso\\Validator\\Rule\\MatchRule', + 'time' => 'ctiso\\Validator\\Rule\\Time', + 'alpha' => 'ctiso\\Validator\\Rule\\Alpha', + 'require' => 'ctiso\\Validator\\Rule\\Notnull', + 'numeric' => 'ctiso\\Validator\\Rule\\Numeric', + 'unique' => 'ctiso\\Validator\\Rule\\Unique', + 'filename' => 'ctiso\\Validator\\Rule\\FileName', + 'count' => 'ctiso\\Validator\\Rule\\Count', + 'isfile' => 'ctiso\\Validator\\Rule\\IsFile', + 'code' => 'ctiso\\Validator\\Rule\\Code' ); // Разбор правила проверки diff --git a/src/View/View.php b/src/View/View.php index 54000d8..088cd43 100644 --- a/src/View/View.php +++ b/src/View/View.php @@ -31,9 +31,9 @@ class View * Связывет переменную с вложенным шаблоном * * @param string $section переменная шаблона - * @param CompositeView $view вложенный шаблон + * @param View|string $view вложенный шаблон */ - public function setView($section, /*View_View|string*/ $view) + public function setView($section, $view/*: View|string*/) { $this->_section [$section] = $view; if (is_object($view)) {