%PDF- %PDF-
Direktori : /home/ugotscom/www/boniface/Admin/application/modules/Packages/controllers/ |
Current File : /home/ugotscom/www/boniface/Admin/application/modules/Packages/controllers/Packages.php |
<?php class Packages extends CI_Controller{ function __construct(){ parent::__construct(); if(isset($_SESSION['username'])){ }else{ redirect('login'); } $this->load->library('datatables'); //load library ignited-dataTable $this->load->model('Packages_model'); //load model crud_model } function index(){ $x['category']=$this->Packages_model->get_category(); $data['content']='emp_view'; $this->load->view('common/layout',$data); $this->load->view('packages',$x); } function offers(){ $x['category']=$this->Packages_model->get_category(); $data['content']='emp_view'; $this->load->view('common/layout',$data); $this->load->view('offers',$x); } function lead_type($id){ $x['category']=$this->Packages_model->get_category(); $data['content']='lead_type'; $data['lead_id']=$id; $this->load->view('common/layout',$data); $this->load->view('lead_type',$x); } function get_product_json() { //get product data and encode to be JSON object header('Content-Type: application/json'); echo $this->Packages_model->get_all_product(); } function get_offer() { //get product data and encode to be JSON object header('Content-Type: application/json'); echo $this->Packages_model->get_offers(); } function get_products_json($id) { //get product data and encode to be JSON object header('Content-Type: application/json'); echo $this->Packages_model->get_all_products($id); } function get_products_json_dayplanner() { //get product data and encode to be JSON object header('Content-Type: application/json'); $planner_id = $this->input->post('planner_id'); echo json_encode($this->Packages_model->get_all_products_dayplanner($planner_id)); } function save(){ //insert record method $this->Packages_model->insert_product(); redirect('emp'); } function update(){ //update record method $this->Packages_model->update_product(); redirect('emp'); } function delete(){ //delete record method $this->Packages_model->delete_product(); redirect('emp'); } public function edit($id) { $data['icities']=$this->Packages_model->icities(); $data['customer'] = $this->Packages_model->get_customer($id); $data['content'] = $this->load->view('edit',$data); $this->load->view('common/layout',$data); } public function view($id) { $data['dayplan'] = $this->Packages_model->get_dayplan($id); $data['hotels'] = $this->Packages_model->get_hotels($id); $data['customer'] = $this->Packages_model->get_customer($id); $data['content'] = $this->load->view('view',$data); $this->load->view('common/layout',$data); } function addremark(){ //insert record method $this->Packages_model->add_remark(); redirect('emp'); } public function add() { $data['icities']=$this->Packages_model->icities(); $data['content'] = $this->load->view('add',$data); $this->load->view('common/layout',$data); } public function del() { $data['content'] = $this->load->view('delete'); $this->load->view('common/layout',$data); } function savepolicies(){ //insert record method $this->Packages_model->insert_policies(); redirect('packages'); } function saveterms(){ //insert record method $this->Packages_model->insert_terms(); redirect('packages'); } function addsave(){ //insert record method $this->Packages_model->insert_package(); redirect('packages'); } function updatepackage(){ //insert record method $this->Packages_model->update_package(); redirect('packages'); } public function adddayplan() { $pid=$this->input->post('package_id'); /*here make sure your path is correct*/ $config['upload_path'] = './assets/uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = 100; $config['max_width'] = 1024; $config['max_height'] = 768; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('image')) { $error = array('error' => $this->upload->display_errors()); print_r($error);die; } else { $file_name = $this->upload->data('file_name'); $this->Packages_model->insert_dayplan($file_name); } redirect('packages/view/'.$pid); } public function addhotels() { $pid=$this->input->post('package_id'); /*here make sure your path is correct*/ $config['upload_path'] = './assets/uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = 100; $config['max_width'] = 1024; $config['max_height'] = 768; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('image')) { $error = array('error' => $this->upload->display_errors()); print_r($error);die; } else { //$data = array('upload_data' => $this->upload->data()); $file_name = $this->upload->data('file_name'); /*here assuming that your column name for image is image_name, change it not*/ $data =array( 'hotel_name'=> $this->input->post('hotel_name',TRUE), 'city'=> $this->input->post('hotel_location',TRUE), 'package_id'=> $this->input->post('package_id',TRUE), 'type'=> $this->input->post('type',TRUE), 'image_name'=> $file_name, ); $this->db->insert('package_hotels',$data); } redirect('packages/view/'.$pid); } #################################Add offers ################## public function adddoffers() { /*here make sure your path is correct*/ $config['upload_path'] = './assets/uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = 100; $config['max_width'] = 1024; $config['max_height'] = 768; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('image')) { $error = array('error' => $this->upload->display_errors()); print_r($error);die; } else { $file_name = $this->upload->data('file_name'); $this->Packages_model->insert_offers($file_name); } redirect('packages/offers/'); } ############################### Add offers ################ public function addmainbanner() { $pid=$this->input->post('package_id'); /*here make sure your path is correct*/ $config['upload_path'] = './assets/uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = 150; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('banner-image')) { $error = array('error' => $this->upload->display_errors()); print_r($error);die; } else { //$data = array('upload_data' => $this->upload->data()); $file_name = $this->upload->data('file_name'); /*here assuming that your column name for image is image_name, change it not*/ $data =array( 'main_image'=> $file_name, ); $this->db->where('package_id',$pid); $this->db->update('packages',$data); } redirect('packages/view/'.$pid); } public function addfeaturedimage() { $pid=$this->input->post('package_id'); /*here make sure your path is correct*/ $config['upload_path'] = './assets/uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = 150; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('featured-image')) { $error = array('error' => $this->upload->display_errors()); print_r($error);die; } else { //$data = array('upload_data' => $this->upload->data()); $file_name = $this->upload->data('file_name'); /*here assuming that your column name for image is image_name, change it not*/ $data =array( 'featured_image'=> $file_name, ); $this->db->where('package_id',$pid); $this->db->update('packages',$data); } redirect('packages/view/'.$pid); } public function updatedayplan() { $pid=$this->input->post('planner_id'); $packageid=$this->input->post('package_id'); /*here make sure your path is correct*/ $config['upload_path'] = './assets/uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = 100; $config['max_width'] = 1024; $config['max_height'] = 768; $this->load->library('upload', $config); if ( ! $this->upload->do_upload('image')) { $error = array('error' => $this->upload->display_errors()); print_r($error);die; } else { $file_name = $this->upload->data('file_name'); $this->Packages_model->update_dayplan($file_name,$pid,$packageid); } redirect('packages/view/'.$packageid); } }