Ignore:
Timestamp:
Apr 7, 2020, 11:53:58 AM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Packages/Common/Common.php

    r90 r92  
    6262
    6363    $Result = '';
    64     if(array_key_exists('all', $QueryItems))
     64    if (array_key_exists('all', $QueryItems))
    6565    {
    6666      $PageCount = 1;
     
    7373    }
    7474
    75     if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    76     if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    77     if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    78     if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     75    if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     76    if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     77    if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     78    if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    7979    $CurrentPage = $_SESSION['Page'];
    8080
     
    8282
    8383    $Result = '';
    84     if($PageCount > 1)
     84    if ($PageCount > 1)
    8585    {
    86       if($CurrentPage > 0)
     86      if ($CurrentPage > 0)
    8787      {
    8888        $QueryItems['page'] = 0;
     
    9393      $PagesMax = $PageCount - 1;
    9494      $PagesMin = 0;
    95       if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    96       if($PagesMin < ($CurrentPage - $Around))
     95      if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     96      if ($PagesMin < ($CurrentPage - $Around))
    9797      {
    9898        $Result.= ' ... ';
    9999        $PagesMin = $CurrentPage - $Around;
    100100      }
    101       for($i = $PagesMin; $i <= $PagesMax; $i++)
     101      for ($i = $PagesMin; $i <= $PagesMax; $i++)
    102102      {
    103         if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     103        if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    104104        else {
    105105         $QueryItems['page'] = $i;
     
    107107        }
    108108      }
    109       if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    110       if($CurrentPage < ($PageCount - 1))
     109      if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     110      if ($CurrentPage < ($PageCount - 1))
    111111      {
    112112        $QueryItems['page'] = ($CurrentPage + 1);
     
    117117    }
    118118    $QueryItems['all'] = '1';
    119     if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
     119    if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
    120120
    121121    $Result = '<div style="text-align: center">'.$Result.'</div>';
    122122    $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage;
    123123    $this->Page = $CurrentPage;
    124     return($Result);
     124    return $Result;
    125125  }
    126126}
Note: See TracChangeset for help on using the changeset viewer.