Esempio n. 1
0
 public function action_edit()
 {
     $this->title = "Редактирование галереи";
     $id = $this->params[2];
     if (isset($_POST['update'])) {
         $fields = Arr::extract($_POST, ['name', 'comment']);
         if ($this->gallery->edit($id, $fields) !== false) {
             header('Location: /' . ADMIN_URL . '/gallery/all');
             exit;
         }
     } else {
         $fields = $this->gallery->one($id);
     }
     $this->content = View::template('gallery/v_edit.php', ['fields' => $fields]);
 }
Esempio n. 2
0
 public function action_edit()
 {
     $this->title = "Редактирование привилегии";
     $errors = [];
     $id = $this->params[2];
     if (isset($_POST['update'])) {
         $fields = Arr::extract($_POST, ['name', 'description']);
         if ($this->priv->edit($id, $fields) !== false) {
             header('Location: /' . ADMIN_URL . '/priv/all');
             exit;
         } else {
             $errors = $this->priv->errors();
         }
     } else {
         $fields = $this->priv->one($id);
     }
     $this->content = View::template('priv/v_edit.php', ['fields' => $fields, 'errors' => $errors]);
 }
Esempio n. 3
0
 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')]);
 }
Esempio n. 4
0
 public function action_edit()
 {
     $this->title = 'Редактировать пользователя';
     $id = $this->params[2];
     $errors = [];
     $roles = $this->role->all();
     if (isset($_POST['update'])) {
         $fields = Arr::extract($_POST, ['name', 'email', 'id_role', 'role', 'datebirth']);
         if ($this->user->edit($id, $fields, $_FILES['file']) !== false) {
             //die();
             header('Location: /' . ADMIN_URL . '/user/one/' . $id);
             exit;
         }
     } else {
         $fields = $this->user->one($id);
         $errors = $this->user->errors();
     }
     $this->content = View::template('user/v_edit.php', ['fields' => $fields, 'roles' => $roles, 'errors' => $errors]);
 }
Esempio n. 5
0
 public function action_edit()
 {
     $this->title = 'Редактировать роль';
     $id = $this->params[2];
     $errors = [];
     $privs = $this->priv->all();
     if (isset($_POST['update'])) {
         $fields = Arr::extract($_POST, ['name', 'description']);
         $privs = $_POST['privs'];
         if ($this->role->edit($id, $fields, $privs) !== false) {
             //die();
             header('Location: /' . ADMIN_URL . '/role/one/' . $id);
             exit;
         }
     } else {
         $fields = $this->role->one($id);
         $fields['privs'] = $this->priv->getIdPrivsForOne($id);
         $errors = $this->role->errors();
     }
     $this->content = View::template('role/v_edit.php', ['fields' => $fields, 'privs' => $privs, 'errors' => $errors]);
 }
Esempio n. 6
0
 public function action_edit()
 {
     $this->title = 'Редактировать пост';
     $id = $this->params[2];
     $errors = [];
     $tags = $this->tag->all();
     // 3
     if (isset($_POST['update'])) {
         $fields = Arr::extract($_POST, ['title', 'text']);
         $tags = $_POST['tags'];
         if ($this->post->edit($id, $fields, $tags, $_FILES['file']) !== false) {
             //die();
             header('Location: /' . ADMIN_URL . '/post/one/' . $id);
             exit;
         }
     } else {
         $fields = $this->post->one($id);
         $fields['tags'] = $this->tag->getIdTagsForOne($id);
         $errors = $this->post->errors();
         //var_dump($fields);
         //$tags = Tags::app()->all();
     }
     $this->scripts[] = 'ckeditor/ckeditor';
     $this->scripts[] = 'ck_init';
     $this->content = View::template('post/v_edit.php', ['fields' => $fields, 'tags' => $tags, 'errors' => $errors]);
 }