Changeset 880 for trunk/Packages/Common/Common.php
- Timestamp:
- Apr 7, 2020, 10:15:48 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Common.php
r858 r880 59 59 60 60 $Result = ''; 61 if (array_key_exists('all', $QueryItems))61 if (array_key_exists('all', $QueryItems)) 62 62 { 63 63 $PageCount = 1; … … 70 70 } 71 71 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; 76 76 $CurrentPage = $_SESSION['Page']; 77 77 … … 79 79 80 80 $Result = ''; 81 if ($PageCount > 1)81 if ($PageCount > 1) 82 82 { 83 if ($CurrentPage > 0)83 if ($CurrentPage > 0) 84 84 { 85 85 $QueryItems['page'] = 0; … … 90 90 $PagesMax = $PageCount - 1; 91 91 $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)) 94 94 { 95 95 $Result.= ' ... '; 96 96 $PagesMin = $CurrentPage - $Around; 97 97 } 98 for ($i = $PagesMin; $i <= $PagesMax; $i++)98 for ($i = $PagesMin; $i <= $PagesMax; $i++) 99 99 { 100 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';100 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 101 101 else { 102 102 $QueryItems['page'] = $i; … … 104 104 } 105 105 } 106 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';107 if ($CurrentPage < ($PageCount - 1))106 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 107 if ($CurrentPage < ($PageCount - 1)) 108 108 { 109 109 $QueryItems['page'] = ($CurrentPage + 1); … … 114 114 } 115 115 $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>'; 117 117 118 118 $Result = '<div style="text-align: center">'.$Result.'</div>'; 119 119 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 120 120 $this->Page = $CurrentPage; 121 return ($Result);121 return $Result; 122 122 } 123 123 }
Note:
See TracChangeset
for help on using the changeset viewer.