getInstance public $template; public $templatePath; public $COMPONENTS_WEB; public function getTemplatePath($name) { return Path::join($this->viewPath[0], 'templates', 'modern', $name); } public function getTemplateWebPath() { return Path::join($this->webPath[0], strtolower(get_class($this)), 'templates', 'modern'); } /** * @param $name Имя модели */ private function getModelPath($name) { return Path::join (CMS_PATH, "model", $name . ".php"); } /** * Создает модель * @param string $name * @return model */ public function getModel($name) { require_once 'mapper/mapper.php'; require_once ($this->getModelPath ($name)); $modelName = $name . "Mapper"; $model = new $modelName (); $model->db = $this->db; return $model; } public function options($key, $val, $res) { $result = array(); while($res->next()) { $result[] = array('value' => $res->getInt($key), 'name' => $res->getString($val)); } return $result; } public function optionsPair($list, $selected = false) { $result = array(); foreach ($list as $key => $value) { $result [] = array('value' => $key, 'name' => $value, 'selected' => $key == $selected); } return $result; } }