示例#1
0
 function listAll($parent_cat = 0)
 {
     $dis['base_url'] = base_url();
     $dis['nav_menu'] = array(array("type" => "add", "text" => "Thêm danh mục", "link" => "{$this->admin_url}productcats/edit/", "onclick" => ""));
     //create productCat object
     $productcat = new Productcat();
     $productcat->order_by('position', 'asc');
     //if search
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $searchKey = $this->input->post('searchName');
         $productcat->like("name_vietnamese", $searchKey);
         $dis['title'] = "Kết quả tìm kiếm";
         $dis['searchKey'] = $searchKey;
         $dis['isSearch'] = true;
     } else {
         $dis['searchKey'] = "";
         $dis['isSearch'] = false;
         //if list all sub category
         if ($parent_cat != 0) {
             $parentCat = new Productcat($parent_cat);
             $productcat->where("parentcat_id", $parent_cat);
             $dis['title'] = "Danh mục con của '" . $parentCat->name . "'";
             array_push($dis['nav_menu'], array("type" => "back", "text" => "Quay lại", "link" => "{$this->admin_url}productcats/listAll/" . $parentCat->parentcat->id, "onclick" => ""));
         } else {
             $productcat->where("parentcat_id", NULL);
             $dis['title'] = "Danh mục sản phẩm";
         }
     }
     $productcat->get_iterated();
     $dis['view'] = 'productcats/list';
     $dis['menu_active'] = 'Danh mục sản phẩm';
     $dis['productcat'] = $productcat;
     $dis['base_url'] = base_url();
     $this->viewadmin($dis);
 }
示例#2
0
 function productCatDialog()
 {
     $category = new Productcat();
     $dis['searchKey'] = "";
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         $searchKey = $this->input->post('searchName');
         $category->like("name_vietnamese", $searchKey);
         $category->or_like_related_parentcat('name_vietnamese', $searchKey);
         $dis['searchKey'] = $searchKey;
         $dis['isSearch'] = true;
     }
     $category->order_by("parentcat_id", 'asc');
     $category->order_by("name_vietnamese", "asc");
     $category->get_iterated();
     $this->firephp->log($category->check_last_query('', true));
     $dis['base_url'] = base_url();
     $dis['category'] = $category;
     $this->load->view("admin/layout/dialogContent/productCategoryDialogContent", $dis);
 }