Main Page | Directories | File List | File Members

stats/general.php

Go to the documentation of this file.
00001 <?php
00002 # This file is part of the Savane project
00003 # <http://gna.org/projects/savane/>
00004 #
00005 # $Id: general.php 4837 2005-09-22 09:02:53Z yeupou $
00006 #
00007 #  Copyright 2004-2004 (c) Mathieu Roy <yeupou--at--gnu.org>
00008 #                          Yves Perrin <yves.perrin--at--cern.ch>
00009 #
00010 # The Savane project is free software; you can redistribute it and/or
00011 # modify it under the terms of the GNU General Public License
00012 # as published by the Free Software Foundation; either version 2
00013 # of the License, or (at your option) any later version.
00014 #
00015 # The Savane project is distributed in the hope that it will be useful,
00016 # but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 # GNU General Public License for more details.
00019 #
00020 # You should have received a copy of the GNU General Public License
00021 # along with the Savane project; if not, write to the Free Software
00022 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
00023 
00024 function stats_get_generic($sql) 
00025 {
00026   $res_count = db_query($sql);
00027   if (db_numrows($res_count) > 0) 
00028     {
00029       $row_count = db_fetch_array($res_count);
00030       return $row_count['count'];
00031     } 
00032   else 
00033     {
00034       return _("Error");
00035     }
00036 }
00037 
00038 function stats_getprojects_active($type_id="") 
00039 {
00040   return stats_getprojects($type_id);
00041 }
00042 
00043 function stats_getprojects_bytype_active($type_id) 
00044 {
00045   return stats_getprojects_active($type_id);
00046 }
00047 
00048 function stats_getprojects_pending() 
00049 {
00050   return stats_get_generic("SELECT count(*) AS count FROM groups WHERE status='P'");
00051 }
00052 
00053 function stats_getprojects_total() 
00054 {
00055   return stats_getprojects();
00056 }
00057 
00058 function stats_getprojects($type_id="", $is_public="",$period="") 
00059 {
00060   if ($type_id)
00061     { $type_id = " AND type='$type_id'"; }
00062   if ($is_public != "")
00063     { $is_public = " AND is_public='$is_public'"; }
00064   if ($period)
00065     { $period = " AND $period"; }
00066 
00067   return stats_get_generic("SELECT count(*) AS count FROM groups WHERE status='A' $type_id $is_public $period");
00068 }
00069 
00070 function stats_getusers($period="") 
00071 {
00072   if ($period)
00073     { $period = " AND $period"; }
00074 
00075   return stats_get_generic("SELECT count(*) AS count FROM user WHERE status='A' $period");
00076 }
00077 
00078 function stats_getitems($tracker, $only_open="",$period="")
00079 {
00080   if ($only_open)
00081     { $only_open = " AND status_id='$only_open'"; }
00082   else
00083     { unset($only_open); }
00084 
00085   if ($period)
00086     { $period = " AND $period"; }
00087   
00088  
00089   return stats_get_generic("SELECT count(*) AS count FROM $tracker WHERE group_id<>'100' $only_open $period");
00090 }
00091 
00092 function stats_getthemeusers($theme="") 
00093 {
00094   return stats_get_generic("SELECT count(*) AS count FROM user WHERE status='A' AND theme='$theme'");
00095 }
00096 
00097 
00098 ?>

Generated on Sun Feb 26 13:23:04 2006 for Savane PHP Frontend Developer Reference by  doxygen 1.4.4