Changeset 92 for trunk/Packages/Common/Common.php
- Timestamp:
- Apr 7, 2020, 11:53:58 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Packages/Common/Common.php
r90 r92 62 62 63 63 $Result = ''; 64 if (array_key_exists('all', $QueryItems))64 if (array_key_exists('all', $QueryItems)) 65 65 { 66 66 $PageCount = 1; … … 73 73 } 74 74 75 if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0;76 if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1;77 if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0;78 if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1;75 if (!array_key_exists('Page', $_SESSION)) $_SESSION['Page'] = 0; 76 if (array_key_exists('page', $_GET)) $_SESSION['Page'] = $_GET['page'] * 1; 77 if ($_SESSION['Page'] < 0) $_SESSION['Page'] = 0; 78 if ($_SESSION['Page'] >= $PageCount) $_SESSION['Page'] = $PageCount - 1; 79 79 $CurrentPage = $_SESSION['Page']; 80 80 … … 82 82 83 83 $Result = ''; 84 if ($PageCount > 1)84 if ($PageCount > 1) 85 85 { 86 if ($CurrentPage > 0)86 if ($CurrentPage > 0) 87 87 { 88 88 $QueryItems['page'] = 0; … … 93 93 $PagesMax = $PageCount - 1; 94 94 $PagesMin = 0; 95 if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around;96 if ($PagesMin < ($CurrentPage - $Around))95 if ($PagesMax > ($CurrentPage + $Around)) $PagesMax = $CurrentPage + $Around; 96 if ($PagesMin < ($CurrentPage - $Around)) 97 97 { 98 98 $Result.= ' ... '; 99 99 $PagesMin = $CurrentPage - $Around; 100 100 } 101 for ($i = $PagesMin; $i <= $PagesMax; $i++)101 for ($i = $PagesMin; $i <= $PagesMax; $i++) 102 102 { 103 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> ';103 if ($i == $CurrentPage) $Result.= '<strong>'.($i + 1).'</strong> '; 104 104 else { 105 105 $QueryItems['page'] = $i; … … 107 107 } 108 108 } 109 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... ';110 if ($CurrentPage < ($PageCount - 1))109 if ($PagesMax < ($PageCount - 1)) $Result .= ' ... '; 110 if ($CurrentPage < ($PageCount - 1)) 111 111 { 112 112 $QueryItems['page'] = ($CurrentPage + 1); … … 117 117 } 118 118 $QueryItems['all'] = '1'; 119 if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>';119 if ($PageCount > 1) $Result.= ' <a href="?'.SetQueryStringArray($QueryItems).'">Vše</a>'; 120 120 121 121 $Result = '<div style="text-align: center">'.$Result.'</div>'; 122 122 $this->SQLLimit = ' LIMIT '.$CurrentPage * $ItemPerPage.', '.$ItemPerPage; 123 123 $this->Page = $CurrentPage; 124 return ($Result);124 return $Result; 125 125 } 126 126 }
Note:
See TracChangeset
for help on using the changeset viewer.