public function getItemsMenuData($pageNumber, $num, $key) { $goods = new DBGoodsType(); $navKeys = new DBNavKeyType(); $treeUtils = new TreeUtils(); $navKeys->executeRequest('', '', DB::TABLE_ORDER); $tree = $treeUtils->buildTreeByLeafs(); $keys = $treeUtils->getTreeLeafesForKey($tree, $key); $goods->getGoodsKeyCount($keys); $this->dataTotalCount = $goods->getTotalCount(); $limitBegin = ($pageNumber - 1) * $num; $limitEnd = $num; if ($this->isAdminOrderEnabled()) { $goods->getUserSortedForMenu($keys, $limitBegin, $limitEnd); } else { $str = implode('|', $keys); $goods->executeRequestRegExpWithLimit(DB::TABLE_NAV_KEY__KEY_ITEM, "^(" . $str . "){1}", DB::TABLE_GOODS___ORDER, DB::ASC, $limitBegin, $limitEnd); } $this->data = $goods->getResponse(); $this->dataCount = $goods->getResponseSize(); }
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; }
public function TreeView() { $treeUtils = new TreeUtils(); $this->mainTree = $treeUtils->buildTreeByLeafs(); }
public static function getGood($id) { $goodsType = new DBGoodsType(); $row = $goodsType->get($id); $ret = null; $ret[DB::TABLE_GOODS__ID] = $row[DB::TABLE_GOODS__ID]; $ret[DB::TABLE_GOODS__KEY_ITEM] = $row[DB::TABLE_GOODS__KEY_ITEM]; $ret[DB::TABLE_GOODS__NAME] = $row[DB::TABLE_GOODS__NAME]; $ret[DB::TABLE_GOODS__PERSON] = $row[DB::TABLE_GOODS__PERSON]; $ret[DB::TABLE_GOODS__INDIVIDUAL] = $row[DB::TABLE_GOODS__INDIVIDUAL]; $ret[DB::TABLE_GOODS__DESCRIPTION] = $row[DB::TABLE_GOODS__DESCRIPTION]; $ret[DB::TABLE_GOODS__IMAGE_PATH] = $row[DB::TABLE_GOODS__IMAGE_PATH]; $ret[DB::TABLE_GOODS__GOD_TYPE] = $row[DB::TABLE_GOODS__GOD_TYPE]; $treeUtils = new TreeUtils(); $tree = $treeUtils->buildTreeByLeafs(); $keyItem = $ret[DB::TABLE_GOODS__KEY_ITEM]; $ret['_tree'] = self::getTreePath($treeUtils, $tree, $keyItem); return $ret; }