Exemple #1
0
 public function item()
 {
     $this->data['title'] = 'Add Item';
     $category_model = new \Models\Category();
     $this->data['category_groups'] = $category_model->groupByCol('category_slug');
     if (isset($_POST) && !empty($_POST)) {
         $category_title = $_POST['category_title'];
         $category_slug = $_POST['category_slug'];
         $category_created = time();
         $insert_array = array('category_title' => $category_title, 'category_slug' => $category_slug, 'category_created' => $category_created);
         $insert_array = Gump::xss_clean($insert_array);
         $insert_array = Gump::sanitize($insert_array);
         $insert_post_id = $category_model->create($insert_array);
         if ($insert_post_id > 0) {
             Session::set('success', 'category added');
             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);
 }