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);
 }
Exemple #2
0
 public function index()
 {
     $categories = new \Models\Category();
     $allCategories = $categories->find();
     $products = new \Models\Product();
     $allProducts = $products->getProductsWithDiscount();
     $data = array();
     $data[] = $allCategories;
     $data[] = $allProducts;
     $this->view->appendToLayout('body', 'index');
     $this->view->display('layouts.default', $data);
 }
Exemple #3
0
 public function category()
 {
     $category_id = $this->input->get(0);
     $productDb = new \Models\Product();
     $products = $productDb->getByCategory($category_id);
     $categories = new \Models\Category();
     $allCategories = $categories->find();
     $data = array();
     $data[] = $allCategories;
     $data[] = $products;
     $this->view->appendToLayout('body', 'index');
     $this->view->display('layouts.default', $data);
 }
Exemple #4
0
 public function index()
 {
     if (!isset($_SESSION['userId'])) {
         header('Location: /php_project/application/public/');
         exit;
     }
     $categories = new \Models\Category();
     $allCategories = $categories->find();
     $products = new \Models\Product();
     $allProducts = $products->getProductsWithDiscount();
     $data = array();
     $data[] = $allCategories;
     $data[] = $allProducts;
     $this->view->appendToLayout('body', 'index');
     $this->view->display('layouts.default', $data);
 }
Exemple #5
0
 public function index()
 {
     if (!isset($_SESSION['userId']) && $_SESSION['editor'] != true && $_SESSION['admin'] != true) {
         header('Location: /php_project/application/public/');
         exit;
     }
     $categories = new \Models\Category();
     $allCategories = $categories->find();
     $products = new \Models\Product();
     $allProducts = $products->find();
     $promotionDb = new \Models\Promotion();
     $allPromos = $promotionDb->find();
     $data = array();
     $data[] = $allCategories;
     $data[] = $allProducts;
     $data[] = $allPromos;
     $this->view->appendToLayout('body', 'editorIndex');
     $this->view->display('layouts.default', $data);
 }