Example #1
0
 /**
  * Calcs pagination info
  *
  * @intellisense
  */
 function buildPagination()
 {
     //	hide colunm headers if needed
     if ($this->pageSize && $this->pageSize != -1) {
         $this->maxPages = ceil($this->numRowsFromSQL / $this->pageSize);
     }
     if ($this->myPage > $this->maxPages) {
         $this->myPage = $this->maxPages;
     }
     if ($this->myPage < 1) {
         $this->myPage = 1;
     }
     $this->recordsOnPage = $this->numRowsFromSQL - ($this->myPage - 1) * $this->pageSize;
     if ($this->recordsOnPage > $this->pageSize && $this->pageSize != -1) {
         $this->recordsOnPage = $this->pageSize;
     }
     $this->colsOnPage = $this->recsPerRowList;
     if ($this->colsOnPage > $this->recordsOnPage && $this->listGridLayout != gltVERTICAL) {
         $this->colsOnPage = $this->recordsOnPage;
     }
     if ($this->colsOnPage < 1) {
         $this->colsOnPage = 1;
     }
     //	 Pagination:
     if (!$this->numRowsFromSQL && $this->deleteMessage == '') {
         $this->rowsFound = false;
         $message = ($this->is508 == true ? "<a name=\"skipdata\"></a>" : "") . "No records found";
         $message = "<span name=\"notfound_message" . $this->id . "\">" . $message . "</span>";
         $this->xt->assign("message", $message);
         $this->xt->assign("message_block", true);
         if ($this->listAjax || $this->mode == LIST_LOOKUP) {
             $this->xt->assign("pagination_block", true);
             $this->xt->displayBrickHidden("pagination");
         }
     } else {
         $this->rowsFound = true;
         $this->xt->assign("message_block", false);
         if ($this->listAjax || $this->mode == LIST_LOOKUP) {
             $this->xt->assign("message_block", true);
             $this->xt->displayBrickHidden("message");
         } else {
             if ($this->deleteMessage != '') {
                 $this->xt->assign("message_block", true);
             }
         }
         $this->xt->assign("records_found", $this->numRowsFromSQL);
         $this->jsSettings["tableSettings"][$this->tName]['maxPages'] = $this->maxPages;
         $this->xt->assign("page", $this->myPage);
         $this->xt->assign("maxpages", $this->maxPages);
         $this->xt->assign("pagination_block", false);
         //	write pagination
         if ($this->maxPages > 1) {
             $this->xt->assign("pagination_block", true);
             $pagination = '';
             $counterstart = $this->myPage - 9;
             if ($this->myPage % 10 != 0) {
                 $counterstart = $this->myPage - $this->myPage % 10 + 1;
             }
             $counterend = $counterstart + 9;
             if ($counterend > $this->maxPages) {
                 $counterend = $this->maxPages;
             }
             if ($counterstart != 1) {
                 $pagination .= $this->getPaginationLink(1, "First") . "&nbsp;:&nbsp;";
                 $pagination .= $this->getPaginationLink($counterstart - 1, "Previous") . "&nbsp;";
             }
             $pagination .= "<b>[</b>";
             if (isRTL()) {
                 for ($counter = $counterend; $counter >= $counterstart; $counter--) {
                     if ($counter != $this->myPage) {
                         $pagination .= "&nbsp;" . $this->getPaginationLink($counter, $counter, true);
                     } else {
                         $pagination .= "&nbsp;<b>" . $counter . "</b>";
                     }
                 }
             } else {
                 for ($counter = $counterstart; $counter <= $counterend; $counter++) {
                     if ($counter != $this->myPage) {
                         $pagination .= "&nbsp;" . $this->getPaginationLink($counter, $counter, true);
                     } else {
                         $pagination .= "&nbsp;<b>" . $counter . "</b>";
                     }
                 }
             }
             $pagination .= "&nbsp;<b>]</b>";
             if ($counterend != $this->maxPages) {
                 $pagination .= "&nbsp;" . $this->getPaginationLink($counterend + 1, "Next") . "&nbsp;:&nbsp;";
                 $pagination .= $this->getPaginationLink($this->maxPages, "Last");
             }
             $pagination = "<div data-function=\"pagination" . $this->id . "\">" . $pagination . "</div>";
             $this->xt->assign("pagination", $pagination);
         } else {
             if ($this->listAjax || $this->mode == LIST_LOOKUP) {
                 $this->xt->assign("pagination_block", true);
                 $this->xt->displayBrickHidden("pagination");
             }
         }
     }
 }
 /**
  * Calcs pagination info
  *
  */
 function buildPagination()
 {
     //	hide colunm headers if needed
     $this->recordsOnPage = $this->numRowsFromSQL - ($this->myPage - 1) * $this->pageSize;
     if ($this->recordsOnPage > $this->pageSize && $this->pageSize != -1) {
         $this->recordsOnPage = $this->pageSize;
     }
     $this->colsOnPage = $this->recsPerRowList;
     if ($this->colsOnPage > $this->recordsOnPage) {
         $this->colsOnPage = $this->recordsOnPage;
     }
     if ($this->colsOnPage < 1) {
         $this->colsOnPage = 1;
     }
     //	 Pagination:
     if (!$this->numRowsFromSQL && $this->deleteMessage == '') {
         $this->rowsFound = false;
         $message = ($this->is508 == true ? "<a name=\"skipdata\"></a>" : "") . mlang_message("NO_RECORDS");
         $message = "<span name=\"notfound_message" . $this->id . "\">" . $message . "</span>";
         $this->xt->assign("message", $message);
         $this->xt->assign("message_block", true);
     } else {
         $this->rowsFound = true;
         $maxRecords = $this->numRowsFromSQL;
         $this->xt->assign("message_block", false);
         if ($this->listAjax) {
             $this->xt->assign("message_block", true);
             $this->xt->displayBrickHidden("message");
         } else {
             if ($this->deleteMessage != '') {
                 $this->xt->assign("message_block", true);
             }
         }
         $this->xt->assign("records_found", $this->numRowsFromSQL);
         if ($this->pageSize && $this->pageSize != -1) {
             $this->maxPages = ceil($maxRecords / $this->pageSize);
         }
         if ($this->myPage > $this->maxPages) {
             $this->myPage = $this->maxPages;
         }
         if ($this->myPage < 1) {
             $this->myPage = 1;
         }
         $this->jsSettings["tableSettings"][$this->tName]['maxPages'] = $this->maxPages;
         $this->maxRecs = $this->pageSize;
         $this->xt->assign("page", $this->myPage);
         $this->xt->assign("maxpages", $this->maxPages);
         $this->xt->assign("pagination_block", false);
         //	write pagination
         if ($this->maxPages > 1) {
             $this->xt->assign("pagination_block", true);
             $pagination = "<table rows='1' cols='1' align='center' width='auto' border='0' name='paginationTable" . $this->id . "'>";
             $pagination .= "<tr valign='center'><td align='center'>";
             $counterstart = $this->myPage - 9;
             if ($this->myPage % 10) {
                 $counterstart = $this->myPage - $this->myPage % 10 + 1;
             }
             $counterend = $counterstart + 9;
             if ($counterend > $this->maxPages) {
                 $counterend = $this->maxPages;
             }
             if ($counterstart != 1) {
                 $pagination .= $this->getPaginationLink(1, mlang_message("FIRST")) . "&nbsp;:&nbsp;";
                 $pagination .= $this->getPaginationLink($counterstart - 1, mlang_message("PREVIOUS")) . "&nbsp;";
             }
             $pagination .= "<b>[</b>";
             for ($counter = $counterstart; $counter <= $counterend; $counter++) {
                 if ($counter != $this->myPage) {
                     $pagination .= "&nbsp;" . $this->getPaginationLink($counter, $counter, true);
                 } else {
                     $pagination .= "&nbsp;<b>" . $counter . "</b>";
                 }
             }
             $pagination .= "&nbsp;<b>]</b>";
             if ($counterend != $this->maxPages) {
                 $pagination .= "&nbsp;" . $this->getPaginationLink($counterend + 1, mlang_message("NEXT")) . "&nbsp;:&nbsp;";
                 $pagination .= "&nbsp;" . $this->getPaginationLink($this->maxPages, mlang_message("LAST"));
             }
             $pagination .= "</td></tr></table>";
             $this->xt->assign("pagination", $pagination);
         } elseif ($this->listAjax) {
             $this->xt->assign("pagination_block", true);
             $this->xt->displayBrickHidden("pagination");
         }
     }
 }