<?php
#-----------------------------------------------------------------------------------------------------------------------
# PAGING
#-----------------------------------------------------------------------------------------------------------------------
function nav_leiste($sql,$self,$now_page,$rowsPerPage=10) {
global $_SQL;
$pageNum = 1;
$frm_link = $self;
if(isset($now_page))
{
$pageNum = $now_page;
}
$offset = ($pageNum - 1) * $rowsPerPage;
$numrows = $_SQL->GetOne($sql);
if($numrows == 0) return false;
$maxPage = ceil($numrows/$rowsPerPage);
if($maxPage > 1) {
for($i = 1; $i <= $maxPage; $i ++) {
$sel = ($i == $pageNum) ? selected : ;
$options .= <option value='.$i.' .$sel.>.$i.</option>;
}
}
if ($pageNum > 1)
{
$page = $pageNum - 1;
$prev = <a href=\$self&page=$page\ title=\Eine Seite zur&uuml;ck\><img src='new_style/bilder/prev.gif'></a> ;
$first = <a href=\$self&page=1\ title=\Zur ersten Seite\><img src='new_style/bilder/first.gif'></a> ;
}
else
{
$prev =-> <strong style=color:#333333>&nbsp;</strong>->;
$first =-> <strong style=color:#333333>&nbsp;</strong>->;
}
if ($pageNum < $maxPage)
{
$page = $pageNum + 1;
$next = <a href=\$self&page=$page\ title=\Eine Seite weiter\><img src='new_style/bilder/next.gif'></a> ;
$last = <a href=\$self&page=$maxPage\ title=\Zur letzten Seite\><img src='new_style/bilder/last.gif'></a> ;
}
else
{
$next =-> <strong style=color:#333333>&nbsp;</strong>->;
$last =-> <strong style=color:#333333>&nbsp;</strong>->;
}
$text = <span style='color:#333333'>&nbsp;Zeige Seite <strong>$pageNum</strong> von <strong>$maxPage</strong> Seiten&nbsp;</span>;
$table =->
<table align=center width= cellpadding=0 cellspacing=0>
<tr>
<td width=30px align=center>'.$first.'</td>
<td width=30px align=center>'.$prev.'</td>
<td width= align=center nowrap>'.$text.'</td>
<td width=30px align=center>'.$next.'</td>
<td width=30px align=center>'.$last.'</td>
<td width=80px align=center>&nbsp;&nbsp;&nbsp;Gehe zu:&nbsp;</td>
<td width=50px align=center>
<form method=post action='.$frm_link.' name=frm_goto>
<select name=page onChange=document.frm_goto.submit()>
<option>---</option>
->.$options.'
</select>
</form>
</td>
</tr>
</table>
';
$arr = array(offset => $offset, rowsPerPage => $rowsPerPage, table => $table);
return $arr;
}
?>