Example #1
0
 /**
  * Index Page for this controller.
  *
  * Maps to the following URL
  * 		http://example.com/index.php/welcome
  *	- or -
  * 		http://example.com/index.php/welcome/index
  *	- or -
  * Since this controller is set as the default controller in
  * config/routes.php, it's displayed at http://example.com/
  *
  * So any other public methods not prefixed with an underscore will
  * map to /index.php/welcome/<method_name>
  * @see http://codeigniter.com/user_guide/general/urls.html
  */
 public function index()
 {
     $this->load->model('wish_list');
     $data = array(array('user_id' => 2, 'link' => '123'), array('user_id' => 2, 'link' => 456));
     Wish_list::insert_batch($data);
 }
 public function item($id = '')
 {
     require_once '../app/models/Product.php';
     $product = Product::findByProductVersionId($id);
     if ($product) {
         $catagory = ucfirst($product['product_catagory']);
         require_once '../app/models/' . $catagory . '.php';
         $model = new $catagory();
         $product = $model->splitListsToArray($product);
         $productVersions = Product::findProductVersions($product['base_product_id']);
         require_once '../app/models/Wish_list.php';
         $view = new View('products/item');
         $view->set_title($product['product_name']);
         session_start();
         if (isset($_SESSION['user_id'])) {
             $wishLists = Wish_list::findByUserId($_SESSION['user_id']);
             $view->pass_data('wishLists', $wishLists);
         }
         $view->pass_data('product', $product);
         $view->pass_data('productVersions', $productVersions);
     } else {
         $view = new View('products/not_found');
         $view->set_title('Product not found');
     }
     $view->load_page();
 }
 public function removeItem()
 {
     Wish_list::removeItem($_POST['productVersionId'], $_POST['wishListId']);
     $this->redirect_to('wish_lists/show/' . $_POST['wishListId']);
 }