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