Example #1
0
 /**
  * {@inheritdoc}
  */
 public function getCurrent()
 {
     if ($this->current === null) {
         $page = $this->request->getPage();
         $total = $this->getTotal();
         $this->current = $page > $total ? $total : $page;
     }
     return $this->current;
 }
 /**
  * {@inheritdoc}
  */
 public function getData(RequestInterface $request)
 {
     $offset = $request->getLimit() * ($request->getPage() - 1);
     $criteria = new Criteria();
     $criteria->setMaxResults($request->getLimit());
     $criteria->setFirstResult($offset);
     $this->processOrder($criteria, $request);
     $this->processSearch($criteria, $request);
     $this->processGlobalSearch($criteria, $request);
     $result = $this->collection->matching($criteria);
     return $this->processData($result);
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function getData(RequestInterface $request)
 {
     $data = new \SplDoublyLinkedList();
     $source = array_slice($this->source, $request->getLimit() * ($request->getPage() - 1), $request->getLimit());
     foreach ($source as $rowData) {
         $row = new Row();
         foreach ($rowData as $cellData) {
             $row->appendCell(new Cell($cellData));
         }
         $data[] = $row;
     }
     return $data;
 }
Example #4
0
 /**
  * {@inheritdoc}
  */
 public function getPage()
 {
     return $this->request->getPage();
 }