3 * List of all groups in the system.
5 * Copyright 1999-2000 (c) The SourceForge Crew
7 * This file is part of GForge.
9 * GForge is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
14 * GForge is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with GForge; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 require_once('../env.inc.php');
25 require_once $gfwww.'include/pre.php';
26 require_once $gfwww.'admin/admin_utils.php';
28 site_admin_header(array('title'=>_('Group List')));
30 $form_catroot = getStringFromRequest('form_catroot');
31 $form_pending = getStringFromRequest('form_pending');
32 $sortorder = getStringFromRequest('sortorder');
33 $group_name_search = getStringFromRequest('group_name_search');
34 $status = getStringFromRequest('status');
36 // start from root if root not passed in
41 if (!isset($sortorder) || empty($sortorder)) {
42 $sortorder = "group_name";
44 if ($form_catroot == 1) {
45 if (isset($group_name_search)) {
46 echo "<p>"._('Groups that begin with'). " <strong>".$group_name_search."</strong></p>\n";
47 $res = db_query_params ('SELECT group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name,COUNT(user_group.group_id) AS members
49 LEFT JOIN user_group ON user_group.group_id=groups.group_id, licenses
50 WHERE license_id=license
51 AND lower(group_name) LIKE $1
52 AND (status=$2 OR 1!=$3)
53 GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name',
54 array (strtolower ("$group_name_search%"),
56 $form_pending ? 1 : 0)) ;
58 $res = db_query("SELECT group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name, COUNT(user_group.group_id) AS members "
59 . "FROM groups LEFT JOIN user_group ON user_group.group_id=groups.group_id, licenses "
60 . "WHERE license_id=license "
61 . ($status?"AND status='$status' ":"")
62 . "GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name "
63 . "ORDER BY $sortorder");
66 echo "<p>"._('Group List for Category:').' ';
67 echo "<strong>" . category_fullname($form_catroot) . "</strong></p>\n";
68 $res = db_query_params("SELECT groups.group_name,groups.register_time,groups.unix_group_name,groups.group_id,"
70 . "licenses.license_name,"
72 . "COUNT(user_group.group_id) AS members "
73 . "FROM groups LEFT JOIN user_group ON user_group.group_id=groups.group_id,group_category,licenses "
74 . "WHERE groups.group_id=group_category.group_id AND "
75 . "group_category.category_id=$1 AND "
76 . "licenses.license_id=groups.license "
77 . "GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name "
78 . "ORDER BY $2", array($form_catroot, $sortorder));
82 _('Group Name (click to edit)'),
92 '/admin/grouplist.php?sortorder=group_name',
93 '/admin/grouplist.php?sortorder=register_time',
94 '/admin/grouplist.php?sortorder=unix_group_name',
95 '/admin/grouplist.php?sortorder=status',
96 '/admin/grouplist.php?sortorder=is_public',
97 '/admin/grouplist.php?sortorder=license_name',
98 '/admin/grouplist.php?sortorder=members'
101 echo $HTML->listTableTop($headers, $headerLinks);
104 while ($grp = db_fetch_array($res)) {
106 if ($grp['status']=='A'){
109 if ($grp['status']=='P'){
112 if ($grp['status']=='D'){
117 if ($grp['register_time'] != 0) {
118 $time_display = date(_('Y-m-d H:i'),$grp['register_time']);
120 echo '<tr '.$HTML->boxGetAltRowStyle($i).'>';
121 echo '<td><a href="groupedit.php?group_id='.$grp['group_id'].'">'.$grp['group_name'].'</a></td>';
122 echo '<td>'.$time_display.'</td>';
123 echo '<td>'.$grp['unix_group_name'].'</td>';
124 echo '<td class="'.$status.'">'.$grp['status'].'</td>';
125 echo '<td>'.$grp['is_public'].'</td>';
126 echo '<td>'.$grp['license_name'].'</td>';
127 echo '<td>'.$grp['members'].'</td>';
132 echo $HTML->listTableBottom();
134 site_admin_footer(array());