示例#1
0
 private function load($data)
 {
     $pageId = ArrayHelper::getSafeFromArray($_GET, $this->paramName, $this->pageId);
     $params = array('itemData' => $data, 'perPage' => $this->itemPerPage, 'delta' => 8, 'append' => true, 'clearIfVoid' => false, 'urlVar' => $this->paramName, 'useSessions' => false, 'closeSession' => false, 'mode' => 'Jumping', 'httpMethod' => 'GET');
     $pager = \Sb\Lists\Pager\Pager::factory($params);
     $pageData = $pager->getPageData($pageId);
     $this->items = $pageData;
     $links = $pager->getLinks($pageId);
     $this->navigationBar = $links['all'];
     $offSet = $pager->getOffsetByPageId($pageId);
     if ($offSet && count($offSet) >= 2) {
         $this->firstPage = $offSet[0];
         $this->lastPage = $offSet[1];
     }
     $this->totalPages = $pager->numItems();
 }
示例#2
0
 public function prepare()
 {
     if ($this->allResults) {
         //Application des options de liste (tri, pagination, search, filering)
         $pageId = null;
         if ($this->listOptions) {
             // Sorting
             if ($this->listOptions->getSorting()) {
                 \Sb\Trace\Trace::addItem("Tri de la liste de livre ");
                 \Sb\Helpers\BooksHelper::sort($this->allResults, $this->listOptions->getSorting());
             }
             // Paging
             if ($this->listOptions->getPaging()) {
                 $pageId = $this->listOptions->getPaging()->getCurrentPageId();
             }
             // Searching
             if ($this->listOptions->getSearch()) {
                 $backedUpBooks = $this->allResults;
                 $tmpRes = \Sb\Helpers\BooksHelper::search($this->allResults, $this->listOptions->getSearch()->getValue());
                 if (!$tmpRes) {
                     \Sb\Flash\Flash::addItem(__("Aucun livre ne correspond à votre recherche.", "s1b"));
                     $this->allResults = $backedUpBooks;
                 }
             }
             // Filtering
             if ($this->listOptions->getFiltering()) {
                 \Sb\Helpers\BooksHelper::filter($this->allResults, $this->listOptions->getFiltering()->getValue(), $this->listOptions->getFiltering()->getType());
             }
         }
         $params = array('itemData' => $this->allResults, 'perPage' => $this->nbResultsPerPage, 'delta' => 8, 'append' => true, 'clearIfVoid' => false, 'urlVar' => 'pagenumber', 'useSessions' => false, 'closeSession' => false, 'mode' => 'Jumping', 'httpMethod' => 'GET');
         $pager = \Sb\Lists\Pager\Pager::factory($params);
         $pageData = $pager->getPageData($pageId);
         $this->pagerLinks = $pager->getLinks($pageId);
         $this->nbItemsTot = $pager->numItems();
         $this->shownResults = $pageData;
         $offSet = $pager->getOffsetByPageId($pageId);
         if ($offSet && count($offSet) >= 2) {
             $this->firstItemIdx = $offSet[0];
             $this->lastItemIdx = $offSet[1];
         }
         if ($this->shownResults) {
             $this->hasResults = true;
         }
     }
 }