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