5 * Copyright 1999-2001 (c) VA Linux Systems
6 * Copyright 2010 (c) FusionForge Team
7 * Copyright (C) 2010 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.
26 require_once '../env.inc.php';
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfwww.'stats/site_stats_utils.php';
30 session_require_global_perm ('forge_stats', 'read') ;
32 $HTML->header(array('title' => sprintf(_('%1$s I18n Statistics: Languages Distributions'), forge_get_config ('forge_name'))));
34 echo $GLOBALS['HTML']->listTableTop(array(_('Language'), _('Users'), '%'));
36 $total=db_result(db_query_params('SELECT count(user_name) AS total FROM users', array()),0,'total');
38 $res = db_query_params ('SELECT supported_languages.name AS lang,count(user_name) AS cnt
39 FROM supported_languages LEFT JOIN users ON language_id=users.language
40 GROUP BY lang,language_id,name
45 while ($lang_stat = db_fetch_array($res)) {
46 if ($lang_stat['cnt'] > 0) {
47 echo '<tr '.$GLOBALS['HTML']->boxGetAltRowStyle($i++).'><th>'.$lang_stat['lang'].'</th>'.
48 '<td class="align-right">'.$lang_stat['cnt'].' </td>'.
49 '<td class="align-right">'.sprintf("%.2f",$lang_stat['cnt']*100/$total)." </td></tr>\n";
50 if ($lang_stat['lang']!='English') $non_english+=$lang_stat['cnt'];
54 echo '<tr><td><strong>'._('Total Non-English').'</strong></td>'.
55 '<td align="right"><strong>'.$non_english.' </strong></td>'.
56 '<td align="right"><strong>'.sprintf("%.2f",$non_english*100/$total).' </strong></td></tr>';
58 echo $GLOBALS['HTML']->listTableBottom();
59 echo "<p>"._('This is a list of the preferences that users have chosen in their user preferences; it does not include languages which are selected via cookies or browser preferences')."</p>";
61 $HTML->footer( array() );
65 // c-file-style: "bsd"