Ejemplo n.º 1
0
 public function archive()
 {
     $this->load->model('wishlists');
     //get all wish lists
     $wishlists = Wishlists::findOnCond(array(), 20, 'count', 'DESC');
     $data['wishlists'] = $wishlists;
     $this->load->view('header');
     $this->load->view('navbar');
     $this->load->view('wishlist', $data);
     $this->load->view('modal');
     $this->load->view('footer');
 }
Ejemplo n.º 2
0
 public function add()
 {
     $post_data = $this->input->post();
     $w_id = $post_data['w_id'];
     $this->load->model('Wishlists');
     $url_array = $this->parse_url($post_data['urls']);
     $results = array();
     foreach ($url_array as $key => $value) {
         // $start = strpos($value, 'subject') + 8;
         // $end = $start;
         // for (; is_numeric($value[$end]); $end++) {}
         // $id = substr($value, $start, $end - $start);
         $temp = [];
         preg_match('/([0-9]+)/i', $value, $temp);
         $id = $temp[0];
         $results[] = $this->get_info($id);
         $wishlist = Wishlists::findByIds($w_id);
         $wishlist->is_stocked_in = 1;
         $wishlist->save(TRUE);
     }
     $this->load->model('Books');
     Books::insert_batch($results);
 }