Ejemplo n.º 1
0
 public static function getDOMForSingleItemPageFromTree($key)
 {
     $mainTag = new Div();
     $mainTag->addStyleClasses(["catalog_tree"]);
     $treeUtils = new TreeUtils();
     $mainTree = $treeUtils->buildTreeByLeafs();
     $path = $treeUtils->getTreePath($mainTree, $key);
     $data = [self::getArrayItemForDefaultLink()];
     for ($pathIndex = 1; $pathIndex < count($path); $pathIndex++) {
         $item = [];
         $trimText = Utils::trimStr($path[$pathIndex]->value, Constants::DEFAULT_TEXT_LENGTH_FOR_CATALOG_PATH_LINK);
         if ($pathIndex == count($path) - 1) {
             $pageNumber = Utils::getFromGET(UrlParameters::PAGE_NUM);
             $itemsCount = Utils::getFromGET(UrlParameters::ITEMS_COUNT);
             $item[0] = $trimText;
             $item[1] = URLBuilder::getSingleItemLinkBack($pageNumber, $itemsCount);
         } else {
             $item[0] = $trimText;
             $item[1] = URLBuilder::getCatalogLinkForTree($path[$pathIndex]->key);
         }
         array_push($data, $item);
     }
     $mainTag->addChildList(self::buildPathLink($data));
     return $mainTag;
 }