public function action_edit() { $this->title = 'Редактировать страницу'; $id = $this->params[2]; $errors = []; if (isset($_POST['update'])) { $fields = Arr::extract($_POST, ['id_parent', 'url', 'title', 'content', 'base_template', 'inner_template']); if ($this->model->edit($id, $fields)) { header('Location: /' . ADMIN_URL . '/page/'); exit; } else { $errors = $this->model->errors(); } } else { $fields = $this->model->one($this->params[2]); } $this->scripts[] = 'ckeditor/ckeditor'; $this->scripts[] = 'url_page'; $this->scripts[] = 'ck_init'; $this->content = View::template('page/v_edit.php', ['fields' => $fields, 'errors' => $errors, 'pages' => $this->model->tree(), 'base_templates' => Template::all('base'), 'inner_templates' => Template::all('inner')]); }