Exemple #1
0
 public function edit($parameter)
 {
     $item_id = $parameter[0];
     $this->data['title'] = 'Add Item';
     $this->data['page_section'] = 'edit';
     $category_model = new \Models\Category();
     $this->data['category'] = $category_model->find($item_id);
     if (isset($_POST) && !empty($_POST)) {
         $category_title = $_POST['category_title'];
         $category_slug = $_POST['category_slug'];
         $category_modified = time();
         $update_array = array('category_title' => $category_title, 'category_modified' => $category_created);
         $update_array = Gump::xss_clean($update_array);
         $update_array = Gump::sanitize($update_array);
         $update_id = $category_model->updateId($update_array, $item_id);
         if ($update_id > 0) {
             Session::set('success', 'category edited');
             Url::redirect('category');
         }
     }
     View::rendertemplate('header', $this->data);
     View::rendertemplate('sidebar', $this->data);
     View::render('category/category.add', $this->data);
     View::rendertemplate('footer', $this->data);
 }