Changeset 873 for trunk/Packages/Common/Common.php
- Timestamp:
- Apr 6, 2020, 11:17:40 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Common.php
r870 r873 65 65 66 66 $Result = ''; 67 if (array_key_exists('all', $QueryItems))67 if (array_key_exists('all', $QueryItems)) 68 68 { 69 69 $PageCount = 1; … … 76 76 } 77 77 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; 82 82 $CurrentPage = $_SESSION['Page']; 83 83 … … 85 85 86 86 $Result = ''; 87 if ($PageCount > 1)87 if ($PageCount > 1) 88 88 { 89 if ($CurrentPage > 0)89 if ($CurrentPage > 0) 90 90 { 91 91 $QueryItems['page'] = 0; … … 96 96 $PagesMax = $PageCount - 1; 97 97 $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)) 100 100 { 101 101 $Result.= ' ... '; 102 102 $PagesMin = $CurrentPage - $Around; 103 103 } 104 for ($i = $PagesMin; $i <= $PagesMax; $i++)104 for ($i = $PagesMin; $i <= $PagesMax; $i++) 105 105 { 106 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';106 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 107 107 else { 108 108 $QueryItems['page'] = $i; … … 110 110 } 111 111 } 112 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';113 if ($CurrentPage < ($PageCount - 1))112 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 113 if ($CurrentPage < ($PageCount - 1)) 114 114 { 115 115 $QueryItems['page'] = ($CurrentPage + 1); … … 120 120 } 121 121 $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>'; 123 123 124 124 $Result = '<div style="text-align: center">'.$Result.'</div>'; 125 125 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 126 126 $this->Page = $CurrentPage; 127 return ($Result);127 return ($Result); 128 128 } 129 129 }
Note:
See TracChangeset
for help on using the changeset viewer.