currentPage = $currentPage; $this->currentPageQueryString = ''; $pos = strpos( $pageURL, '?' ); if ( !( $pos === false ) ) $this->currentPageQueryString = substr( $pageURL, $pos + 1 ); $this->itemsPerPage = $itemsPerPage; $this->itemsCount = $itemsCount; $this->pageURL = $pageURL; $this->pageURLparameter = $pageURLparameter; } // return: array( 'start' => .., 'end' => .. ) public function getItemsRangeForCurrentPage() { $start = $this->currentPage * $this->itemsPerPage; $end = $start + $this->itemsPerPage; if ( $end > $this->itemsCount ) $end = $this->itemsCount; $range = array(); $range['start'] = $start; $range['end'] = $end; return $range; } // return: array( 'pages' => '', 'firstPage' => .., 'prevPage' => .., 'nextPage' => .., 'lastPage' => .. ) public function getPages( $reverse = false ) { $pages = ''; $firstPage = ''; $prevPage = ''; $nextPage = ''; $lastPage = ''; $maxPages = ceil( $this->itemsCount / $this->itemsPerPage ); for ( $i = 1; $i <= $maxPages; $i++ ) { if ( $this->pageURL == '' ) { $pageHref = $_SERVER['REDIRECT_URL']; } else { $pageHref = $this->pageURL; } if ( ( $i > 1 ) || ( $this->currentPageQueryString != '' ) ) { if ( $this->currentPageQueryString == '' ) { $pageHref .= '?' . $this->pageURLparameter . '=' . $i; } else { $params = explode( '&', $this->currentPageQueryString ); $pageHref = '?'; foreach ( $params as $param ) { $pos = strpos( $param, $this->pageURLparameter . '=' ); if ( $pos === false ) $pageHref .= $param . '&'; } $pageHref .= $this->pageURLparameter . '=' . $i; } } // first page if ( ( $i == 1 ) && ( $i != $this->currentPage + 1 ) ) $firstPage = '
<<
'; // previous page if ( ( $this->currentPage + 1 ) == ( $i + 1 ) ) $prevPage = '
<
'; // current page if ( ( $this->currentPage + 1 ) == $i ) { if ( $reverse ) $pages = '
' . $i. '
'. $pages; else $pages .= '
' . $i. '
'; } // other pages else { if ( $reverse ) $pages = '
' . $i. '
' . $pages; else $pages .= '
' . $i. '
'; } // last page if ( ( $i == $maxPages ) && ( $i != $this->currentPage + 1 ) ) $lastPage = '
>>
'; // next page if ( ( $this->currentPage + 1 ) == ( $i - 1 ) ) $nextPage = '
>
'; // separator //if ( $i < $maxPages ) // $pages .= ' | '; } $paginator = array(); $paginator['pages'] = $pages; if ( $reverse ) { $paginator['firstPage'] = $lastPage; $paginator['prevPage'] = $nextPage; $paginator['nextPage'] = $prevPage; $paginator['lastPage'] = $firstPage; } else { $paginator['firstPage'] = $firstPage; $paginator['prevPage'] = $prevPage; $paginator['nextPage'] = $nextPage; $paginator['lastPage'] = $lastPage; } return $paginator; } } ?>
Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /hosting/www/tridvajedna.cz/3d-video/class.db.php:15 Stack trace: #0 /hosting/www/tridvajedna.cz/3d-video/init-db.php(6): db->__construct() #1 /hosting/www/tridvajedna.cz/3d-video/init-general.php(22): include('/hosting/www/tr...') #2 /hosting/www/tridvajedna.cz/3d-video/index.php(3): include('/hosting/www/tr...') #3 {main} thrown in /hosting/www/tridvajedna.cz/3d-video/class.db.php on line 15