コード例 #1
0
ファイル: categories.php プロジェクト: benji1979/teszt1
 /**
  * 
  * @return object with data
  */
 function getCategories()
 {
     $categoryService = new JBusinessDirectorCategoryLib();
     $categoryTable = $this->getTable();
     $categories = $categoryTable->getAllCategories();
     $categories = $categoryService->processCategories($categories);
     //$categories = $categories[1]["subCategories"];
     $startingLevel = 0;
     $path = array();
     $level = 0;
     $categories["maxLevel"] = $categoryService->setCategoryLevel($categories, $startingLevel, $level, $path);
     return $categories;
 }
コード例 #2
0
ファイル: search.php プロジェクト: benji1979/teszt1
 function getSearchFilter()
 {
     $companiesTable = $this->getTable("Company");
     $searchDetails = $this->getSearchParams();
     $searchDetails["categoriesIds"] = null;
     $categoriesTotal = $companiesTable->getTotalCompaniesByCategories($searchDetails);
     $categoryService = new JBusinessDirectorCategoryLib();
     $category = array();
     if (!empty($this->categoryId) && $this->appSettings->search_type != 1) {
         $category = $categoryService->getCompleteCategoryById($this->categoryId);
     } else {
         $category["subCategories"] = $categoryService->getCategories();
         $category["path"] = array();
         //dump($category["subCategories"]);
     }
     $subcategories = '';
     $enableSelection = false;
     $this->searchFilter["path"] = $category["path"];
     if (isset($category["subCategories"]) && count($category["subCategories"]) > 0) {
         $subcategories = $category["subCategories"];
     } else {
         $parentCategories = $category["path"];
         // 			dump($parentCategories);
         if (count($parentCategories) > 0) {
             $categoryId = $parentCategories[count($parentCategories)][0];
             //dump($categoryId);
             $parentCategory = $categoryService->getCompleteCategoryById($categoryId);
             $subcategories = $parentCategory["subCategories"];
             $this->searchFilter["enableSelection"] = 1;
             $enableSelection = true;
         }
     }
     $categories = array();
     if (isset($subcategories) && $subcategories != '') {
         foreach ($subcategories as $cat) {
             if (!is_array($cat)) {
                 continue;
             }
             $childCategoryIds = $categoryService->getCategoryChilds($cat);
             if (count($childCategoryIds) == 0) {
                 $childCategoryIds = array($cat[0]->id);
             } else {
                 $mainCat = array($cat[0]->id);
                 $childCategoryIds = array_merge($mainCat, $childCategoryIds);
             }
             $companies = array();
             foreach ($categoriesTotal as $categoryTotal) {
                 if (in_array($categoryTotal->id, $childCategoryIds)) {
                     $cmp = explode(",", $categoryTotal->listings_ids);
                     $companies = array_merge($companies, $cmp);
                     $companies = array_unique($companies);
                 }
             }
             $companiesNumber = count($companies);
             if ($companiesNumber > 0 || $enableSelection) {
                 $this->searchFilter["categories"][] = array($cat, $companiesNumber);
             }
         }
     }
     return $this->searchFilter;
 }
コード例 #3
0
ファイル: offers.php プロジェクト: benji1979/teszt1
 function getCategories()
 {
     $categoryService = new JBusinessDirectorCategoryLib();
     return $categoryService->getCategories();
 }