Файл: top_reit/rustats.su/system/classes/Navig.class.php
Строк: 25
<?php
class Navig{
private $all; // Всего пунктов
public $num_pages; // Страниц
private $page; // Номер страницы
public $start; // Начало вывода
public function __construct($all = 1){
$this -> all = $all;
$page = isset($_GET['p']) ? Protect::num($_GET['p']) : 1;
$num_pages = ceil($this -> all/10);
$start = $page * 10 - 10;
$this -> num_pages = $num_pages;
$this -> page = $page;
$this -> start = $start;
if ($this -> page > $this -> num_pages or $this -> page < 1){
$this -> page = 1;
$this -> start = 0;
}
}
public function str($link){
if($this -> num_pages > 1){
echo '<div class="navi"><img src ="/style/img/lll.png">';
for($pr = '', $i = 1; $i <= $this -> num_pages; $i++){
echo $pr=(($i == 1 || $i == $this -> num_pages || Protect::num($i - $this -> page) < 2) ? ($i == $this -> page ? " <span class = pages> $i</span> " : '<span class = "pages"> <a href="'.$link.'p='.$i.'"> '.$i.'</a></span>') : (($pr == ' .. ' || $pr == '')? '' : ' .. '));
}
echo '<img src ="/style/img/rrr.png"></div>';
}
}
}
?>