Ignore:
Timestamp:
Apr 14, 2020, 11:13:32 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

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

    r1 r7  
    6060
    6161    $Result = '';
    62     if(array_key_exists('all', $QueryItems))
     62    if (array_key_exists('all', $QueryItems))
    6363    {
    6464      $PageCount = 1;
     
    7171    }
    7272
    73     if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    74     if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    75     if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    76     if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     73    if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     74    if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     75    if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     76    if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    7777    $CurrentPage = $_SESSION['Page'];
    7878
     
    8080
    8181    $Result = '';
    82     if($PageCount > 1)
     82    if ($PageCount > 1)
    8383    {
    84       if($CurrentPage > 0)
     84      if ($CurrentPage > 0)
    8585      {
    8686        $QueryItems['page'] = 0;
     
    9191      $PagesMax = $PageCount - 1;
    9292      $PagesMin = 0;
    93       if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    94       if($PagesMin < ($CurrentPage - $Around))
     93      if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     94      if ($PagesMin < ($CurrentPage - $Around))
    9595      {
    9696        $Result.= ' ... ';
    9797        $PagesMin = $CurrentPage - $Around;
    9898      }
    99       for($i = $PagesMin; $i <= $PagesMax; $i++)
     99      for ($i = $PagesMin; $i <= $PagesMax; $i++)
    100100      {
    101         if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     101        if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    102102        else {
    103103         $QueryItems['page'] = $i;
     
    105105        }
    106106      }
    107       if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    108       if($CurrentPage < ($PageCount - 1))
     107      if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     108      if ($CurrentPage < ($PageCount - 1))
    109109      {
    110110        $QueryItems['page'] = ($CurrentPage + 1);
     
    115115    }
    116116    $QueryItems['all'] = '1';
    117     if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
     117    if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
    118118
    119119    $Result = '<div style="text-align: center">'.$Result.'</div>';
    120120    $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage;
    121121    $this->Page = $CurrentPage;
    122     return($Result);
     122    return $Result;
    123123  }
    124124}
Note: See TracChangeset for help on using the changeset viewer.