From 56555c3ed07a6583368388d42ebe3ab8210b15a9 Mon Sep 17 00:00:00 2001 From: Paul van Schayck Date: Mon, 27 Dec 2004 23:59:30 +0000 Subject: [PATCH] Rewrite vote_menu() to use MAX_VOTES. Show the application name instead of the ID in the menu. --- include/vote.php | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/include/vote.php b/include/vote.php index 855df48..4ba839d 100644 --- a/include/vote.php +++ b/include/vote.php @@ -111,36 +111,22 @@ function vote_get_user_votes($userId = null) function vote_menu() { - global $appId; - $m = new htmlmenu("Votes","updatevote.php"); $votes = vote_get_user_votes(); - if($votes[1]) + for($i = 1;$i <= MAX_VOTES; $i++) { - $str = " App #".$votes[1]->appId.""; - $m->add(" ".$str); + if(isset($votes[$i])) + { + $appName = lookupAppName($votes[$i]->appId); + $str = " $appName"; + $m->add(" ".$str); + } + else + $m->add(" No App Selected"); } - else - $m->add(" No App Selected"); - if($votes[2]) - { - $str = " App #".$votes[2]->appId.""; - $m->add(" ".$str); - } - else - $m->add(" No App Selected"); - - if($votes[3]) - { - $str = " App #".$votes[3]->appId.""; - $m->add(" ".$str); - } - else - $m->add(" No App Selected"); - $m->addmisc(" "); $m->add("");