예제 #1
0
 /**
  * @param $totalRecords
  * @return string
  */
 public function createLinks($totalRecords)
 {
     $currentPage = $this->configHelper->getCurrentPage();
     $totalPages = $this->configHelper->getTotalPages($totalRecords);
     $pages = $this->getPages($totalRecords, $this->configHelper->getLimit(), $currentPage, $this->configHelper->getMaximumPages());
     $prevLiClass = 'prev';
     $prevLinkHref = 'javascript:void(0)';
     if ($currentPage == 1) {
         $prevLiClass = 'disabled';
     } else {
         $prevLinkHref = $this->buildQueryString($currentPage - 1);
     }
     $nextLiClass = 'next';
     $nextLinkHref = 'javascript:void(0)';
     if ($currentPage == $totalPages) {
         $nextLiClass = 'disabled';
     } else {
         $nextLinkHref = $this->buildQueryString($currentPage + 1);
     }
     $output = '<ul class="pagination">';
     $output .= '<li class="' . $prevLiClass . '"><a href="' . $prevLinkHref . '">&laquo;</a></li>';
     foreach ($pages as $page) {
         $currentClass = $page == $currentPage ? 'active current' : '';
         $output .= '<li class="' . $currentClass . '"><a href="' . $this->buildQueryString($page) . '">' . $page . '</a></li>';
     }
     $output .= '<li class="' . $nextLiClass . '"><a href="' . $nextLinkHref . '">&raquo;</a></li>';
     $output .= '</ul>';
     return $this->addInfiniteScroll($output);
 }