Ignore:
Timestamp:
Apr 7, 2020, 10:15:48 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code formatting.
File:
1 edited

Legend:

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

    r858 r880  
    5959
    6060    $Result = '';
    61     if(array_key_exists('all', $QueryItems))
     61    if (array_key_exists('all', $QueryItems))
    6262    {
    6363      $PageCount = 1;
     
    7070    }
    7171
    72     if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    73     if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    74     if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    75     if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     72    if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     73    if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     74    if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     75    if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    7676    $CurrentPage = $_SESSION['Page'];
    7777
     
    7979
    8080    $Result = '';
    81     if($PageCount > 1)
     81    if ($PageCount > 1)
    8282    {
    83       if($CurrentPage > 0)
     83      if ($CurrentPage > 0)
    8484      {
    8585        $QueryItems['page'] = 0;
     
    9090      $PagesMax = $PageCount - 1;
    9191      $PagesMin = 0;
    92       if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    93       if($PagesMin < ($CurrentPage - $Around))
     92      if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     93      if ($PagesMin < ($CurrentPage - $Around))
    9494      {
    9595        $Result.= ' ... ';
    9696        $PagesMin = $CurrentPage - $Around;
    9797      }
    98       for($i = $PagesMin; $i <= $PagesMax; $i++)
     98      for ($i = $PagesMin; $i <= $PagesMax; $i++)
    9999      {
    100         if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     100        if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    101101        else {
    102102         $QueryItems['page'] = $i;
     
    104104        }
    105105      }
    106       if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    107       if($CurrentPage < ($PageCount - 1))
     106      if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     107      if ($CurrentPage < ($PageCount - 1))
    108108      {
    109109        $QueryItems['page'] = ($CurrentPage + 1);
     
    114114    }
    115115    $QueryItems['all'] = '1';
    116     if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
     116    if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
    117117
    118118    $Result = '<div style="text-align: center">'.$Result.'</div>';
    119119    $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage;
    120120    $this->Page = $CurrentPage;
    121     return($Result);
     121    return $Result;
    122122  }
    123123}
Note: See TracChangeset for help on using the changeset viewer.