示例#1
0
文件: Cell.php 项目: roarbb/datagrid
 private function getSortingAnchor()
 {
     $httpService = new HttpService();
     $anchor = $this->html->el('a');
     $attributes = array();
     $attributes['href'] = $httpService->getSortUrl($this->getColumnName());
     $anchor->addAttributes($attributes);
     $anchor->setText($this->getCellData());
     return $anchor;
 }
示例#2
0
 private function startPaginator(HttpService $httpService, array $rows)
 {
     $this->paginator->setPage($httpService->getPaginatorPage());
     if (is_null($this->paginator->getItemCount())) {
         $this->paginator->setItemCount(count($rows));
     }
     return array_slice($rows, $this->paginator->offset, $this->paginator->itemsPerPage);
 }
示例#3
0
 private function buildPaginatorPages(Html $unorderedList)
 {
     $actualPage = $this->paginator->page;
     for ($i = 1; $i <= $this->paginator->pageCount; $i++) {
         if ($this->shouldSkipThisPaginationPage($i)) {
             continue;
         }
         $httpService = new HttpService();
         $paginationUrl = $httpService->getUrlWithPaginator($i);
         $listItem = $this->html->el('li');
         $anchor = $this->html->el('a')->addAttributes(array('href' => $paginationUrl))->setText($i);
         if ($actualPage == $i) {
             $listItem->addAttributes(array('class' => 'active'));
         }
         $listItem->add($anchor);
         $unorderedList->add($listItem);
     }
 }