Anzeige aller NPC, Aufteilung in Seiten hinzugefügt!

main
radiskull 13 years ago
parent 87723ea10f
commit 38c5d9893b

@ -11,6 +11,7 @@
<?php <?php
include_once(ROOT_PATH.'/include/attackenset.inc.php'); include_once(ROOT_PATH.'/include/attackenset.inc.php');
include_once(ROOT_PATH.'/include/erstellfunctions.inc.php'); include_once(ROOT_PATH.'/include/erstellfunctions.inc.php');
include_once(ROOT_PATH.'/include/designfunctions.inc.php');
defineIfNotDefined('ACTION_EDIT', 'edit'); defineIfNotDefined('ACTION_EDIT', 'edit');
defineIfNotDefined('ACTION_CREATE', 'create'); defineIfNotDefined('ACTION_CREATE', 'create');
@ -277,12 +278,11 @@ function deleteNPC($charid) {
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc">NPC Übersicht</a></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc">NPC Übersicht</a></td></tr>'."\n";
} }
function displayNPCOverview() { function displayNPCOverview($page) {
$d_array = array('id', 'name', 'level'); $d_array = array('id', 'name', 'level');
$desc_array = array('id', 'Name', 'Level'); $desc_array = array('id', 'Name', 'Level');
$sql = 'SELECT '.join($d_array,',').' from chars where rasse = \'NPC\' ORDER BY level'; $sql = 'SELECT '.join($d_array,',').' from chars where rasse = \'NPC\' ORDER BY level, Name LIMIT '.($page*20).', 20';
//$qry = mysql_query($sql.' LIMIT '.($page*20).', 20');
$qry = mysql_query($sql); $qry = mysql_query($sql);
//$anzahlSeiten = ceil(mysql_num_rows(mysql_query($sql))/20); //$anzahlSeiten = ceil(mysql_num_rows(mysql_query($sql))/20);
$colspan = count($d_array); $colspan = count($d_array);
@ -312,6 +312,9 @@ function displayNPCOverview() {
echo "\t".'</tr>'."\n"; echo "\t".'</tr>'."\n";
} }
$total = mysql_num_rows(mysql_query('SELECT '.join($d_array,',').' from chars where rasse = \'NPC\''));
$url = '<a href="'.$_SERVER['PHP_SELF'].'?choose=npc&page=###PAGE###">###LABEL###</a>';
echo "\t".'<tr><td colspan="'.$colspan.'">'.displayPagelinksNew(20, $total, $page, $url).'</td></tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc&action=create">Create a new NPC</a></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'?choose=npc&action=create">Create a new NPC</a></td></tr>'."\n";
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><hr></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><hr></td></tr>'."\n";
@ -345,7 +348,7 @@ function displayNPC($action, $task, $charid, $table, $page, $data, $att_ids){
displayDeleteNPC($charid); displayDeleteNPC($charid);
} }
} else{ } else{
displayNPCOverview(); displayNPCOverview($page);
} }
echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'">Zum Hauptmenu</a></td></tr>'."\n"; echo "\t".'<tr><td colspan="'.$colspan.'" style="text-align:center"><a href="'.$_SERVER['PHP_SELF'].'">Zum Hauptmenu</a></td></tr>'."\n";
echo "\t".'</table>'."\n"; echo "\t".'</table>'."\n";

Loading…
Cancel
Save