/[gentoo-src]/gentoo-stats/profiles.php
Gentoo

Contents of /gentoo-stats/profiles.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Tue Apr 29 16:54:52 2003 UTC (11 years, 2 months ago) by mksoft
Branch: MAIN
CVS Tags: HEAD
profile and graph additions

1 <?php
2 /**
3 * Gentoo stats
4 * Written by Meir Kriheli <mksoft@gentoo.org>
5 * Based on gentoo-stats by Maik Schreiber <blizzy@gentoo.org>
6 *
7 * $Id$
8 *
9 * vim: set tabstop=4 shiftwidth=4:
10 */
11
12 require_once('stats.inc.php');
13
14 $updated_systems = getActiveUsers();
15 $known_profiles = getKnownProfilesCount();
16
17 $smarty->assign('page_title','Gentoo Profiles');
18 $smarty->assign('updated_systems',number_format($updated_systems));
19 $smarty->assign('known_profiles',number_format($known_profiles));
20
21 if ((int)$known_profiles) {
22 // let the db gather the query stats for us
23 $sql= "SELECT count(u.pr_id) as pr_count, u.pr_id, p.pr_name FROM t_users u, t_profiles p " .
24 "WHERE (u.pr_id IS NOT NULL) AND (u.pr_id=p.pr_id) AND (u.u_last_update IS NOT NULL) " .
25 "AND (TO_DAYS(NOW()) - TO_DAYS(u.u_last_update) <= $active_days) " .
26 "GROUP BY u.pr_id";
27
28 $profile_stats = $db->getAll($sql,DB_FETCHMODE_ASSOC);
29
30 if (!DB::isError($profile_stats)) {
31 // loop the associative array and format/add info
32 for ($i=0; $i<count($profile_stats);$i++) {
33 $pr_count = $profile_stats[$i]['pr_count'];
34 $profile_stats[$i]['pr_count'] = number_format( $pr_count);
35 $profile_stats[$i]['pr_percent'] = number_format($pr_count * 100/$known_profiles,2);
36 $profile_stats[$i]['bar_width'] = (int)($pr_count * $bar_width/$known_profiles);
37 $profile_stats[$i]['bar_empty_width'] = $bar_width - $profile_stats[$i]['bar_width'];
38 }
39
40 $smarty->assign('profile_stats',$profile_stats);
41 }
42 }
43
44 $smarty->display('profiles.tpl');
45 ?>

  ViewVC Help
Powered by ViewVC 1.1.20