Ejemplo n.º 1
0
 public function index()
 {
     // get post group_id
     //$groupId = $this->input->post('group_id');
     // not have get from session
     /*if (empty($groupId)) {
     			$groupId = $this->session->userdata('group_id');
     			if (empty($groupId)) {
     				redirect('admin/home');
     			}
     		} else {
     			$this->session->set_userdata('group_id', $groupId);
     		}*/
     $arr['page'] = 'customer';
     // id of customer
     $id = $this->input->post('id');
     if (!empty($id)) {
         $this->customer_model->delCustomer($id);
     }
     // pagination >>>
     $offset = 0;
     $cnt = $this->customer_model->countAll($this->user_id);
     $arr['dataItem'] = $this->customer_model->findPageItems($offset, ADMIN_PAGE_MAX_RECORD, $this->user_id);
     $paging_link = get_link_pagination('admin/customer', $cnt, $offset, ADMIN_PAGE_MAX_RECORD, 1, TRUE);
     $arr['paging_link'] = $paging_link;
     $arr['user_id'] = $this->user_id;
     // <<< pagination
     $this->load->view('admin/vwManageCustomer', $arr);
 }
Ejemplo n.º 2
0
 public function index()
 {
     $arr['page'] = 'company';
     $id = $this->input->post('id');
     if (!empty($id)) {
         $this->company_model->delCompany($id);
     }
     // pagination >>>
     $offset = 0;
     $cnt = $this->company_model->countAll($arrCond = array());
     $arr['dataItem'] = $this->company_model->findPageItems($offset, ADMIN_PAGE_MAX_RECORD);
     $paging_link = get_link_pagination('admin/company', $cnt, $offset, ADMIN_PAGE_MAX_RECORD, 1, TRUE);
     $arr['paging_link'] = $paging_link;
     // <<< pagination
     $this->load->view('admin/vwManageCompany', $arr);
 }
Ejemplo n.º 3
0
 public function get_group_customer_list()
 {
     $items_per_page = $this->input->post('num_items') ? $this->input->post('num_items') : 30;
     $offset = $this->input->post('offset') ? $this->input->post('offset') : 0;
     $group_id = $this->input->post('group_id') ? $this->input->post('group_id') : 0;
     $this->load->model("group_customer_model");
     $items = $this->group_customer_model->findPageItems($offset, $items_per_page, $group_id);
     $total = $this->group_customer_model->countAll($group_id);
     // Paging
     $page_link = get_link_pagination('', $total, $offset, $items_per_page, TRUE);
     $data['dataItem'] = $items;
     $html['paging_link'] = $page_link;
     $html['item_list'] = $this->load->view('admin/vwGroupEmailList', $data, TRUE);
     echo json_encode($html);
     die;
 }
Ejemplo n.º 4
0
 public function add_customer()
 {
     $this->load->model('group_customer_model');
     $this->load->model('customer_model');
     $arr['page'] = 'group';
     $arr['group_id'] = $this->setGroupId();
     $arr['user_id'] = $this->user_id;
     $arrPost = array();
     $offset = 0;
     // pagination >>>
     $cnt = $this->customer_model->countAll($this->user_id, $arr['group_id']);
     $arr['dataItem'] = $this->customer_model->findPageItems($offset, ADMIN_PAGE_MAX_RECORD, $this->user_id, $arr['group_id']);
     $paging_link = get_link_pagination('admin/group/add_customer', $cnt, $offset, ADMIN_PAGE_MAX_RECORD, 1, TRUE);
     $arr['paging_link'] = $paging_link;
     $arr['user_id'] = $this->user_id;
     // <<< pagination
     if ($this->input->post('submit')) {
         // insert select customer to group
         $arrDatas = array();
         $arrIds = $this->input->post('ids');
         if (!empty($arrIds)) {
             foreach ($arrIds as $id) {
                 $arrDatas[] = array('group_id' => $arr['group_id'], 'customer_id' => $id);
             }
             if (!empty($arrDatas)) {
                 $this->db->insert_batch('t_group_customer', $arrDatas);
             }
         }
         redirect('admin/group/customer');
     }
     $arr['isHasData'] = $cnt > 0;
     $this->load->view('admin/vwAddGroupCustomer', $arr);
 }