Exemplo n.º 1
0
 protected function createGeneralContent()
 {
     $mainTag = new Div();
     $mainTag->addAttribute("style", "margin: 1px 0px 0px 3px;");
     $items = new Items();
     $catalogLinks = new CatalogLinks();
     if (array_key_exists(UrlParameters::PAGE_NAME, $_GET)) {
         $pageNumber = Constants::DEFAULT_PAGE_NUMBER;
         $itemsCount = Labels::VIEW_MODE_NUMERIC_DEF;
         if (array_key_exists(UrlParameters::PAGE_NUM, $_GET)) {
             $pageNumber = Utils::getFromGET(UrlParameters::PAGE_NUM);
         }
         if (array_key_exists(UrlParameters::ITEMS_COUNT, $_GET)) {
             $itemsCount = Utils::getFromGET(UrlParameters::ITEMS_COUNT);
         }
         if (array_key_exists(UrlParameters::SEARCH_VALUE, $_GET)) {
             $itemsType = new CatalogLoader();
             $searchValue = Utils::getFromGET(UrlParameters::SEARCH_VALUE);
             $itemsType->getItemSearchData($pageNumber, $itemsCount, $searchValue);
             if ($itemsType->dataTotalCount == 0) {
                 return "";
             }
             $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'top'));
             $mainTag->addChild($items->getItemsTable($pageNumber, $itemsCount, $itemsType->data, '', $searchValue));
             $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'bottom'));
         } else {
             if (array_key_exists(UrlParameters::KEY, $_GET)) {
                 $itemsType = new CatalogLoader();
                 $keyValue = Utils::getFromGET(UrlParameters::KEY);
                 $itemsType->getItemsMenuData($pageNumber, $itemsCount, $keyValue);
                 $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'top'));
                 $mainTag->addChild($items->getItemsTable($pageNumber, $itemsCount, $itemsType->data, $keyValue, ''));
                 $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'bottom'));
             } else {
                 $itemsType = new CatalogLoader();
                 $itemsType->getItemsMainData($pageNumber, $itemsCount);
                 $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'top'));
                 $mainTag->addChild($items->getItemsTable($pageNumber, $itemsCount, $itemsType->data, '', ''));
                 $mainTag->addChild($catalogLinks->getPaginationLinks($pageNumber, $itemsCount, $itemsType->dataTotalCount, 'bottom'));
             }
         }
     }
     return $mainTag;
 }