public function search() { $this->load->library('form_validation'); $this->form_validation->allRequest(); $this->form_validation->set_rules('txt_search', 'trim|required'); $this->form_validation->set_rules('txt_imagegallery_id', 'trim|required|numeric'); $this->form_validation->set_rules('cur_page', 'trim|required|numeric'); $this->form_validation->set_rules('per_page', 'trim|required|numeric'); $this->form_validation->set_rules('txt_sortby', 'trim|option'); $this->formCheck(); $txt_search = t_Request("txt_search"); $imagegallery_id = t_Request("txt_imagegallery_id"); $cur_page = t_Request("cur_page"); $per_page = t_Request("per_page"); $txt_sortby = t_Request("txt_sortby"); $this->load->model("root_image_model"); $sortby_id = $this->root_image_model->getSortbyId($txt_sortby); $joinStr = "LEFT JOIN image_matchto_image_group ON ( image_matchto_image_group.image_id = image.image_id )"; $whereStr = " image_matchto_image_group.image_group_id = ? AND image.title LIKE ? "; $paramAr = array($imagegallery_id, "%" . $txt_search . "%"); $total_row = $this->root_image_model->getListsTotalRow($whereStr, $paramAr); $data_list_ar = $this->root_image_model->getLists($whereStr, $paramAr, $cur_page, $per_page, $sortby_id, $joinStr); $dataSend = dataListSendFormat($total_row, $data_list_ar, $cur_page, $per_page, $sortby_id); resOk($dataSend); }
public function search() { $search_txt = "title"; $cur_page = 1; $per_page = 10; $sortby_id = "product_lastest_create"; $where_str = " product_detail.title LIKE ? "; $param_ar = array("%" . $search_txt . "%"); $total_row = $this->root_trash_product_model->getListsTotalRow($where_str, $param_ar); $dataList = $this->root_trash_product_model->getLists($cur_page, $per_page, $sortby_id, $where_str, $param_ar); $dataSend = dataListSendFormat($total_row, $dataList, $cur_page, $per_page, $sortby_id); resOk($dataSend); }
public function getallproductforpackage() { $sortby_id = "update_time"; $this->load->model("root_package_model"); $package_id = 12; $where_str = " product_matchto_package.package_id = {$package_id} "; $total_row = $this->root_package_model->getListsTotalRow($where_str, $joinStr = ""); $cur_page = 1; $per_page = $total_row; $dataList = $this->root_package_model->getLists($cur_page, $per_page, $sortby_id, $where_str); $dataSend = dataListSendFormat($total_row, $dataList, $cur_page, $per_page, $sortby_id); resOk($dataSend); }
public function lists() { // authentication none // Form validation $this->form_validation->allRequest(); $this->form_validation->set_rules('cur_page', 'required|numeric'); $this->form_validation->set_rules('per_page', 'required|numeric'); // $this->form_validation->set_rules('promotion_group_id','required|numeric'); $this->formcheck(); // Receiving parameter $cur_page = t_Request('cur_page'); $per_page = t_Request('per_page'); $promotion_group_id = t_Request('promotion_group_id'); // Business logic $total_row = $this->root_promotion_group_model->getListsTotalRow($promotion_group_id); $dataList = $this->root_promotion_group_model->getLists($cur_page, $per_page, $promotion_group_id); $ProductGroupDataLIst = dataListSendFormat($total_row, $dataList, $cur_page, $per_page); // response if (!$ProductGroupDataLIst) { resdie(array(), 'can not get promotion_group data'); } resOk($dataList); }
public function lists() { // authentication none // Form validation $this->form_validation->allRequest(); $this->form_validation->set_rules('cur_page', 'required|numeric'); $this->form_validation->set_rules('per_page', 'required|numeric'); $this->form_validation->set_rules('txt_promotion_id', 'required|numeric'); $this->formcheck(); // Receiving parameter $cur_page = t_Request('cur_page'); $per_page = t_Request('per_page'); $promotion_id = t_Request('txt_promotion_id'); // Business logic $where_str = "promotion.promotion_id = {$promotion_id}"; $total_row = $this->root_promotion_model->getListsTotalRow($where_str); $dataList = $this->root_promotion_model->getLists($cur_page, $per_page, $where_str, $extend_table = true); $PromotionDataLIst = dataListSendFormat($total_row, $dataList, $cur_page, $per_page); // response if (!$PromotionDataLIst) { resdie(array(), 'can not get promotion data'); } resOk($dataList); }