Вход Регистрация
Файл: system/pagination.php
Строк: 53
<?php

/* Автор класса Okula, класс модифицировал Elime */
class Pagination

    public 
$pnumber 5;
    public 
$begin;
    public 
$page;
    public 
$colp;
    public 
$url;
    public 
$prev 'Назад';
    public 
$next 'Вперед';
    public 
$separator ' | ';
    public 
$page_separator '';
    
    function 
__construct($pnumber$page$colp$url)
    {
        
$this->pnumber $pnumber;
        
$this->url $url;
        
$this->page $page;
        
$this->colp $colp;
        
$this->navi(); 
    } 
    
    
/** 
    * Готовим данные для навигации 
    */ 
    
private function navi()
    {
        if(
$this->page == 0$this->page 1;
        if(
$this->pnumber == 0$this->pnumber 10;
        if(
$this->colp $this->pnumber $this->page$this->page ceil($this->colp $this->pnumber);
        
$this->begin = ($this->page 1) * $this->pnumber;
    }
    
    
/** 
    * Постаничная навигация 
    */ 
    
function Navigation()
    {
        
$number = (int)($this->colp $this->pnumber); 
        if(
$this->colp >= ($this->pnumber 1))
        {
            if((float)(
$this->colp $this->pnumber) - $number != 0$number++; 
            
            if(
$this->page == 1$prev $this->prev;
            if(
$this->begin>0$prev '<a href="'.$this->url.($this->page 1).'">'.$this->prev.'</a>';
            
            if(
$number == $this->page$next $this->next;
            if(
$this->colp $this->begin $this->pnumber$next '<a href="'.$this->url.($this->page 1).'">'.$this->next.'</a>';
            
            
$all ceil($this->colp $this->pnumber);
            
$i 1;
            
$c '';
            
$tt $this->page;
            while(
$i <= $all)
            {
                if(
$i <= 3  || $i == $tt 1  || $i == $tt || $i == $tt 1  || $i >= $all 2)
                {
                    
$ii '<a href="'.$this->url.$i.'"><span class="navig">'.$i.'</span></a>';
                    if(
$i == $tt)
                    { 
                            if(
$i != $all)
                            {
                                
$c .= '<span class="navig">'.$i.'</span>'.$this->page_separator;
                            }
                            else
                            {
                                
$c .= '<span class="navig">'.$i.'</span>';
                            } 
                    }
                    else
                    {
                        if(
$i != $all)
                        {
                            
$c .= $ii.'';
                        }
                        else
                        {
                            
$c .= $ii;
                        } 
                    }
                }
                else
                {
                    
$c .= '';
                } 
                
$i++; 
            }
            
$c preg_replace("/[,][.]+/""..."$c);
            
$result '<div class="menu">'.$c.'</span>';
            return 
$result;
        }
    }
}
?>
Онлайн: 1
Реклама