3 * GForge Top-Statistics: Highest-Ranked Users
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * The rest Copyright 2002-2004 (c) GForge Team
11 * This file is part of GForge.
13 * GForge is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * (at your option) any later version.
18 * GForge is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with GForge; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
31 require_once('../env.inc.php');
32 require_once('pre.php');
34 $offset = getStringFromRequest('offset');
36 $yesterday = time()-60*60*24;
37 $yd_month = date('Ym', $yesterday);
38 $yd_day = date('d', $yesterday);
41 SELECT user_metric.ranking,users.user_name,users.realname,
42 user_metric.metric,user_metric_history.ranking AS old_ranking
43 FROM users,user_metric LEFT JOIN user_metric_history
44 ON (user_metric.user_id=user_metric_history.user_id
45 AND user_metric_history.month='$yd_month'
46 AND user_metric_history.day='$yd_day')
47 WHERE users.user_id=user_metric.user_id
52 if (!$res_top || db_numrows($res_top)<1) {
54 _('Information not available'),
55 _('Information about highest ranked users is not available.').' '
60 $HTML->header(array('title'=>_('Top users')));
62 print '<h1>'._('Top users').'</h1>
63 <br /><em>('._('Updated Daily').')</em>
65 <p><a href="'.$GLOBALS['sys_urlprefix'].'/top/">['._('View Other Top Categories').']</a></p>';
67 $tableHeaders = array(
76 echo $HTML->listTableTop($tableHeaders);
78 while ($row_top = db_fetch_array($res_top)) {
80 print '<tr '. $HTML->boxGetAltRowStyle($i) .'><td> '.$row_top['ranking']
81 .'</td><td><a href="'.$GLOBALS['sys_urlprefix'].'/users/'. $row_top['user_name'] .'/">'
82 .$row_top['user_name'].'</a></td>'
83 .'<td>'.$row_top['realname'].'</td>'
84 .'</td><td align="right">'.sprintf('%.2f', $row_top['metric'])
85 .' </td><td align="right">'.$row_top['old_ranking']
86 .' </td>'
87 .'<td align="right">';
90 $diff = $row_top["old_ranking"] - $row_top["ranking"];
91 if (!$row_top["old_ranking"] || !$row_top["ranking"]) {
94 else if ($diff == 0) {
98 print "<span class=\"up\"".sprintf(_('Up %1$s'), $diff)."</span>";
100 else if ($diff < 0) {
101 print "<span class=\"down\">".sprintf(_('Down %1$s'), (0-$diff))."</span>";
104 print ' </td></tr>
108 echo $HTML->listTableBottom();
111 <tr class="tablegetmore">
112 <td>'.(($offset>=$LIMIT)?'<a href="topusers.php?&offset='.($offset-50).'"><strong><-- More</strong></a>':' ').'</td>
113 <td align="RIGHT"><a href="topusers.php?offset='.($offset+50).'"><strong>More --></strong></a></td></tr>
116 $HTML->footer(array());
120 // c-file-style: "bsd"