root/components/bananas.php @ 311

Revision 311, 1.0 KB (checked in by arthur, 6 years ago)

hide the old bananas

Line 
1<?php
2
3/* Banana viewing component. Looking a little obsolete since most of this is now in the members component */
4
5$banana_index = array_search("Bananas", $pathlist);
6if ((sizeof($pathlist) > $banana_index + 1) && (trim($pathlist[$banana_index + 1]) != "")) {
7    $mode = "detail";
8    $who = $pathlist[$banana_index + 1];
9} else {
10    $mode = "summary";
11}
12
13if (isset($who))
14    $smarty->assign('who', "$who");
15
16// banana admin bits
17
18
19if ($mode == "detail") {
20    $smarty->assign("awards",$DB->GetAll("SELECT *, date_trunc('second', whn) FROM awards WHERE username=? AND archive=0 ORDER BY whn DESC", array($who)));
21    if ($session->loggedin) {
22        include("../lib/banana-admin.php");
23    }
24}
25
26$users = $DB->GetAll("SELECT username, sum(score) AS sum FROM awards WHERE archive=0 GROUP BY username ORDER BY sum(score) DESC, username");
27
28$smarty->assign('mode', "$mode");
29$smarty->assign('users', $users);
30
31$result = $smarty->fetch('bananas.tpl');
32$smarty->assign('title', "Banana Awards");
33$smarty->assign('body', $result);
34
35
36
37?>
Note: See TracBrowser for help on using the browser.