3 * Top-Statistics: Highest-Ranked Users
5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2002-2004 (c) GForge Team
7 * Copyright (C) 2011 Alain Peyrat - Alcatel-Lucent
8 * http://fusionforge.org/
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
29 require_once('../env.inc.php');
30 require_once $gfcommon.'include/pre.php';
32 $offset = getStringFromRequest('offset');
34 $yesterday = time()-60*60*24;
35 $yd_month = date('Ym', $yesterday);
36 $yd_day = date('d', $yesterday);
38 $res_top = db_query_params ('SELECT user_metric.ranking,users.user_name,users.user_id,users.realname,
39 user_metric.metric,user_metric_history.ranking AS old_ranking
40 FROM users,user_metric LEFT JOIN user_metric_history
41 ON (user_metric.user_id=user_metric_history.user_id
42 AND user_metric_history.month=$1
43 AND user_metric_history.day=$2)
44 WHERE users.user_id=user_metric.user_id
45 ORDER BY ranking ASC',
51 if (!$res_top || db_numrows($res_top)<1) {
52 exit_error( _('Information about highest ranked users is not available.').' ' .db_error(),'');
55 $HTML->header(array('title'=>_('Top users')));
57 print '<br /><em>('._('Updated Daily').')</em>
59 <p>'.util_make_link ('/top/','['._('View Other Top Categories').']').'</p>';
61 $tableHeaders = array(
70 echo $HTML->listTableTop($tableHeaders);
73 while ($row_top = db_fetch_array($res_top)) {
75 print '<tr '. $HTML->boxGetAltRowStyle($i) .'><td> '.$row_top['ranking']
76 .'</td><td>'.util_make_link_u ($row_top['user_name'],$row_top['user_id'],$row_top['user_name']).'</td>'
77 .'<td>'.$row_top['realname'].'</td>'
78 .'</td><td align="right">'.sprintf('%.2f', $row_top['metric'])
79 .' </td><td align="right">'.$row_top['old_ranking']
80 .' </td>'
81 .'<td align="right">';
84 $diff = $row_top["old_ranking"] - $row_top["ranking"];
85 if (!$row_top["old_ranking"] || !$row_top["ranking"]) {
88 else if ($diff == 0) {
92 print "<span class=\"up\"".sprintf(_('Up %1$s'), $diff)."</span>";
95 print "<span class=\"down\">".sprintf(_('Down %1$s'), (0-$diff))."</span>";
98 print ' </td></tr>
102 echo $HTML->listTableBottom();
105 <tr class="tablegetmore">
106 <td>'.(($offset>=$LIMIT)?'<a href="topusers.php?&offset='.($offset-50).'"><strong><-- More</strong></a>':' ').'</td>
107 <td align="RIGHT"><a href="topusers.php?offset='.($offset+50).'"><strong>More --></strong></a></td></tr>
110 $HTML->footer(array());
114 // c-file-style: "bsd"