Get the categories HTML

@param null $category
@return string
194012
private function categoriesHTML($category = null)
    {
        $categories = $this->eloqentCategory()->all();
        $total = $this->eloqent()->active()->count();

        $categoryId = 0;
        if ($category) {
            $categoryId = $category->id;
        }

        // get the relationship name - same as view
        $relationship = $this->view;
        $title = 'All <span>(' . $total . ')</span>';
        $html = '<li><a href="' . $this->URLPrefix . '" class="' . ($categoryId == 0 ? 'active' : '') . '">' . $title . '</a></li>';
        foreach ($categories as $k => $category) {

            // get total items for relationship / category
            $total = $category->{$relationship}()->count();

            if ($total > 0) {
                $active = $category->id == $categoryId ? 'active' : '';
                $title = $category->title . ' <span>(' . $total . ')</span>';
                $html .= '<li><a href="' . $this->URLPrefix . $category->url . '" class="' . $active . '">' . $title . ' </a></li>';
            }
        }

        return $html;
    }
691284
public function load_parent_category() {
        if (empty($this->parent_category) && !empty($this->parent)) {
            $this->parent_category = $this->get_parent_category();
        }
        return $this->parent_category;
    }
1237070
public function getSubCategories($category)
    {
        $ds = DIRECTORY_SEPARATOR;
        $categoryPath = str_replace('/', $ds, $category);

        $basePath = app_path().$ds.'lablog'.$ds;

        $path = $basePath.$categoryPath;

        if (!$this->exists($category)) {
            return array();
        }

        $categories = $this->fs->directories($path);

        $allCategories = array();

        foreach ($categories as $category) {
            $cat = str_replace($basePath, '', $category);
            $allCategories[] = $this->getCategory($cat);
        }

        return $allCategories;
    }
86982
private function showList($category = null)
    {
        // eloquent model - VirtualTour::class
        $eloquent = $this->eloqent();

        // base builder
        $builder = $eloquent::with('category')->active();

        // if we need to filter by category
        if ($category && strlen($category) > 2) {

            $category = $this->eloqentCategory()->where('slug', $category)->first();

            if (!$category) {
                return redirect($this->URLPrefix);
            }

            // increment (dont increment on ajax pagination)
            if (!$this->request->ajax()) {

                // prefix the category in title
                $this->title = $category->title;

                // increment total views
                $category->increment('total_views');
                if ($category->getTable() == 'categories') {
                    $category->increment("views_" . $eloquent->getTable());
                }
            }

            // filter by category
            $builder->where('category_id', $category->id);
        }

        // order by date desc, paginate
        $items = $builder->orderBy('active_from', 'DESC')->paginate($this->paginate);

        // if ajax - paginate the articles
        if ($this->request->ajax()) {

            $view = "website.partials.content.pagination";
            if ($this->view == 'photographies') {
                $view = "website.partials.$this->view.pagination";
            }

            return response()->json(view()->make($view, compact('items'))->render());
        }

        $categories = $this->categoriesHTML($category);
        if ($category) {
            $this->addBreadcrumbLink($category->title, '/content/' . $category->url);
        }

        return $this->view("content.$this->view", compact('categories', 'items'));
    }
460096
protected static function loggerCategory($category): string
    {
        /** @noinspection PhpUndefinedFieldInspection */
        $prefix = static::$category ?? '';

        if (empty($category)) {
            return $prefix;
        }

        return ($prefix ? $prefix . ':' : '') . $category;
    }
1000546
public function getHTML( $type = null )
	{
		$html = '';
		$param = '?v=';

		if( strpos( $this->_baseURL, '?' ) !== false ) {
			$param = '&v=';
		}

		foreach ( $this->_registeredPackages as $filetype => $packageList )
		{
			if( $type !== null && $filetype !== $type ) {
				continue;
			}

			foreach( $packageList as $package )
			{
				$packageFile = $this->_deployDir . $package->file;
				$packageFileFilesystem = $this->_basePath . $packageFile;
				$packageFileTime = 0;
				$timestamp = 0;

				if( DIRECTORY_SEPARATOR !== '/' ) {
					$packageFileFilesystem = str_replace( '/', DIRECTORY_SEPARATOR, $packageFileFilesystem );
				}

				if( is_file( $packageFileFilesystem ) ) {
					$packageFileTime = filemtime( $packageFileFilesystem );
				}

				$filesToDisplay = $this->_getFileUrls( $this->_baseURL, $this->_basePath, $param, $package, $timestamp );

				if( $packageFileTime >= $timestamp ) {
					$filesToDisplay = array( $this->_baseURL . $packageFile . $param . $packageFileTime );
				}

				$html .= $this->_createHtml( $filesToDisplay, $filetype );
			}
		}

		return $html;
	}
902018
public function showCategory($category, $pagenumber = 1)
    {
        if (!$this->category->exists($category)) {
            return \Response::view($this->theme.'.404', array('global' => $this->global), 404);
        }

        $categoryObject = $this->category->getCategory($category);
        $parent = $this->category->getParentCategory($category);
        $subCategories = $this->category->getSubCategories($category);
        $posts = $this->post->getAll($category);

        $viewParamaters = array(
            'global' => $this->global,
            'category' => $categoryObject,
            'parent' => $parent,
            'subCategories' => $subCategories,
            'posts' => $posts,
            'pageNumber' => $pagenumber
        );

        return \View::make($this->theme.'.category', $viewParamaters);
    }
1052642
private static function _get_children_recursion($category) {

        $children_array = array();
        foreach ($category->children as $sortorder=>$child) {

            if (array_key_exists('itemtype', $child)) {
                $grade_item = new grade_item($child, false);

                if (in_array($grade_item->itemtype, array('course', 'category'))) {
                    $type  = $grade_item->itemtype.'item';
                    $depth = $category->depth;

                } else {
                    $type  = 'item';
                    $depth = $category->depth; // we use this to set the same colour
                }
                $children_array[$sortorder] = array('object'=>$grade_item, 'type'=>$type, 'depth'=>$depth);

            } else {
                $children = grade_category::_get_children_recursion($child);
                $grade_category = new grade_category($child, false);

                if (empty($children)) {
                    $children = array();
                }
                $children_array[$sortorder] = array('object'=>$grade_category, 'type'=>'category', 'depth'=>$grade_category->depth, 'children'=>$children);
            }
        }

        // sort the array
        ksort($children_array);

        return $children_array;
    }
1127812
private function getCategory()
    {
        $storeId    = $this->getStoreId();
        $categoryId = $this->getCategoryId();
        $category   = null;

        if ($this->getCategoryId()) {
            $category = $this->categoryRepository->get($categoryId, $storeId);
        }

        return $category;
    }
816007
public function getCategory() : ?string 
    {
        if ( ! $this->hasCategory()) {
            $this->setCategory($this->getDefaultCategory());
        }
        return $this->category;
    }
463472
public function htmlUlList ($attributes = null , $ul = true)
    {
        return $this->category->getUlListCategories($attributes , $ul);
    }
1036283
protected function _loadArticles($category)
    {
        $config = \OxidEsales\Eshop\Core\Registry::getConfig();

        $numberOfCategoryArticles = (int) $config->getConfigParam('iNrofCatArticles');
        $numberOfCategoryArticles = $numberOfCategoryArticles ? $numberOfCategoryArticles : 1;

        // load only articles which we show on screen
        $articleList = oxNew(\OxidEsales\Eshop\Application\Model\ArticleList::class);
        $articleList->setSqlLimit($numberOfCategoryArticles * $this->_getRequestPageNr(), $numberOfCategoryArticles);
        $articleList->setCustomSorting($this->getSortingSql($this->getSortIdent()));

        if ($category->isPriceCategory()) {
            $priceFrom = $category->oxcategories__oxpricefrom->value;
            $priceTo = $category->oxcategories__oxpriceto->value;

            $this->_iAllArtCnt = $articleList->loadPriceArticles($priceFrom, $priceTo, $category);
        } else {
            $sessionFilter = \OxidEsales\Eshop\Core\Registry::getSession()->getVariable('session_attrfilter');

            $activeCategoryId = $category->getId();
            $this->_iAllArtCnt = $articleList->loadCategoryArticles($activeCategoryId, $sessionFilter);
        }

        $this->_iCntPages = ceil($this->_iAllArtCnt / $numberOfCategoryArticles);

        return $articleList;
    }
1056226
protected function magic_get_category() {
        $this->ensure_category_loaded();
        if (!empty($this->_categories)) {
            return reset($this->_categories);
        } else {
            return null;
        }
    }
59277
public function getCategories() {
    $cid = __METHOD__;
    if ($cache = $this->cache->get($cid)) {
      return $cache->data;
    }

    $link = $this->getUrlFromOpenyProgramsSearchSettings('get_categories_path');
    $result = $this->scrapeCategoryList($link);
    $data = array_combine(array_values($result), array_values($result));

    $this->cache->set($cid, $data);
    return $data;
  }
2443
public function category()
    {
        $category   = $this->param('category_id', 0);
        $categoryId = explode(':', $category)[0];

        return Category::query()->findOrNew($categoryId);
    }
193473
public function getCategoryTitle()
    {
        $this->categoryTitle = $this->category ? $this->category->getTitle() : null;

        return $this->categoryTitle;
    }
624152
protected function getConstants($category = null)
    {
        if (!$category) {
            return \get_defined_constants();
        }

        $consts = \get_defined_constants(true);

        if ($category === 'internal') {
            unset($consts['user']);

            return \call_user_func_array('array_merge', $consts);
        }

        return isset($consts[$category]) ? $consts[$category] : [];
    }