Ignore:
Timestamp:
Apr 6, 2020, 11:17:40 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved code format.
File:
1 edited

Legend:

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

    r870 r873  
    6565
    6666    $Result = '';
    67     if(array_key_exists('all', $QueryItems))
     67    if (array_key_exists('all', $QueryItems))
    6868    {
    6969      $PageCount = 1;
     
    7676    }
    7777
    78     if(!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
    79     if(array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
    80     if($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
    81     if($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
     78    if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;
     79    if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;
     80    if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;
     81    if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;
    8282    $CurrentPage = $_SESSION['Page'];
    8383
     
    8585
    8686    $Result = '';
    87     if($PageCount > 1)
     87    if ($PageCount > 1)
    8888    {
    89       if($CurrentPage > 0)
     89      if ($CurrentPage > 0)
    9090      {
    9191        $QueryItems['page'] = 0;
     
    9696      $PagesMax = $PageCount - 1;
    9797      $PagesMin = 0;
    98       if($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
    99       if($PagesMin < ($CurrentPage - $Around))
     98      if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;
     99      if ($PagesMin < ($CurrentPage - $Around))
    100100      {
    101101        $Result.= ' ... ';
    102102        $PagesMin = $CurrentPage - $Around;
    103103      }
    104       for($i = $PagesMin; $i <= $PagesMax; $i++)
     104      for ($i = $PagesMin; $i <= $PagesMax; $i++)
    105105      {
    106         if($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
     106        if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';
    107107        else {
    108108         $QueryItems['page'] = $i;
     
    110110        }
    111111      }
    112       if($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
    113       if($CurrentPage < ($PageCount - 1))
     112      if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';
     113      if ($CurrentPage < ($PageCount - 1))
    114114      {
    115115        $QueryItems['page'] = ($CurrentPage + 1);
     
    120120    }
    121121    $QueryItems['all'] = '1';
    122     if($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
     122    if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';
    123123
    124124    $Result = '<div style="text-align: center">'.$Result.'</div>';
    125125    $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage;
    126126    $this->Page = $CurrentPage;
    127     return($Result);
     127    return ($Result);
    128128  }
    129129}
Note: See TracChangeset for help on using the changeset viewer.