viewPath[0], 'templates', 'modern', $name); } public function getTemplateWebPath() { return Path::join($this->webPath[0], strtolower(get_class($this)), 'templates', 'modern'); } /** * @param string $name Имя модели */ private function getModelPath($name) { return Path::join ($this->config->get('system', 'path'), "model", $name . ".php"); } /** * Создает модель * @param string $name * @return BaseMapper */ public function getModel($name) { require_once ($this->getModelPath ($name)); $modelName = $name . "Mapper"; $model = new $modelName (); $model->db = $this->db; return $model; } /** * @param string $key * @param string $val * @param PDOStatement $res */ public function options($key, $val, $res) { $result = []; while($res->next()) { $result[] = ['value' => $res->getInt($key), 'name' => $res->getString($val)]; } return $result; } public function optionsPair($list, $selected = false) { $result = []; foreach ($list as $key => $value) { $result [] = ['value' => $key, 'name' => $value, 'selected' => $key == $selected]; } return $result; } function getInfo() { $filename = Path::join($this->viewPath[0], 'install.json'); if (file_exists($filename)) { $settings = json_decode(File::getContents($filename), true); return $settings; } return []; } }