Changeset 634 for trunk/inc/html.php
- Timestamp:
- Sep 14, 2009, 7:53:21 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/inc/html.php
r630 r634 301 301 } 302 302 } 303 304 function GetQueryStringArray() 305 { 306 $Result = array(); 307 $Parts = explode('&', $_SERVER['QUERY_STRING']); 308 foreach($Parts as $Part) 309 { 310 if($Part != '') 311 { 312 $Item = explode('=', $Part); 313 $Result[$Item[0]] = $Item[1]; 314 } 315 } 316 return($Result); 317 } 318 319 function SetQueryStringArray($QueryStringArray) 320 { 321 $Parts = array(); 322 foreach($QueryStringArray as $Index => $Item) 323 { 324 $Parts[] = $Index.'='.$Item; 325 } 326 return(implode('&', $Parts)); 327 } 328 329 // Zobrazení číselný seznamu stránek 330 function PageList($QueryStringVar, $Page, $TotalCount, $CountPerPage, $Around = 10) 331 { 332 $QueryStringArray = $this->GetQueryStringArray(); 333 $Count = ceil($TotalCount / $CountPerPage); 334 $Result = ''; 335 if($Count > 1) 336 { 337 if($Page > 0) 338 { 339 $QueryStringArray[$QueryStringVar] = 0; 340 $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'"><<</a> '; 341 $QueryStringArray[$QueryStringVar] = $Page - 1; 342 $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'"><</a> '; 343 } 344 $PagesMax = $Count - 1; 345 $PagesMin = 0; 346 if($PagesMax > ($Page + $Around)) $PagesMax = $Page + $Around; 347 if($PagesMin < ($Page - $Around)) 348 { 349 $Result .= ' .. '; 350 $PagesMin = $Page - $Around; 351 } 352 for($i = $PagesMin; $i <= $PagesMax; $i++) 353 { 354 if($i == $Page) $Result .= '<strong>'; 355 $QueryStringArray[$QueryStringVar] = $i; 356 $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'">'.($i + 1).'</a> '; 357 if($i == $Page) $Result .= '</strong>'; 358 } 359 if($PagesMax < ($Count - 1)) $Result .= ' .. '; 360 if($Page < ($Count - 1)) 361 { 362 $QueryStringArray[$QueryStringVar] = $Page + 1; 363 $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'">></a> '; 364 $QueryStringArray[$QueryStringVar] = $Count - 1; 365 $Result .= '<a href="?'.$this->SetQueryStringArray($QueryStringArray).'">>></a>'; 366 } 367 } 368 return($Result); 369 } 303 370 } 304 371
Note:
See TracChangeset
for help on using the changeset viewer.