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

Legend:

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

    r37 r55  
    6161
    6262    $Result = '';
    63     if(array_key_exists('all', $QueryItems))
     63    if (array_key_exists('all', $QueryItems))
    6464    {
    6565      $PageCount = 1;
     
    7272    }
    7373
    74     if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    75     if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    76     if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    77     if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     74    if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     75    if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     76    if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     77    if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    7878    $CurrentPage = $_SESSION['Page'];
    7979
     
    8181
    8282    $Result = '';
    83     if($PageCount > 1)
     83    if ($PageCount > 1)
    8484    {
    85       if($CurrentPage > 0)
     85      if ($CurrentPage > 0)
    8686      {
    8787        $QueryItems['page'] = 0;
     
    9292      $PagesMax = $PageCount - 1;
    9393      $PagesMin = 0;
    94       if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    95       if($PagesMin < ($CurrentPage - $Around))
     94      if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     95      if ($PagesMin < ($CurrentPage - $Around))
    9696      {
    9797        $Result.= ' ... ';
    9898        $PagesMin = $CurrentPage - $Around;
    9999      }
    100       for($i = $PagesMin; $i <= $PagesMax; $i++)
     100      for ($i = $PagesMin; $i <= $PagesMax; $i++)
    101101      {
    102         if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     102        if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    103103        else {
    104104         $QueryItems['page'] = $i;
     
    106106        }
    107107      }
    108       if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    109       if($CurrentPage < ($PageCount - 1))
     108      if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     109      if ($CurrentPage < ($PageCount - 1))
    110110      {
    111111        $QueryItems['page'] = ($CurrentPage + 1);
     
    116116    }
    117117    $QueryItems['all'] = '1';
    118     if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
     118    if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
    119119
    120120    $Result = '<div style="text-align: center">'.$Result.'</div>';
    121121    $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage;
    122122    $this->Page = $CurrentPage;
    123     return($Result);
     123    return $Result;
    124124  }
    125125}
Note: See TracChangeset for help on using the changeset viewer.