3 * List of all groups in the system.
5 * Copyright 1999-2000 (c) The SourceForge Crew
9 * This file is part of GForge.
11 * GForge is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
16 * GForge 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
22 * along with GForge; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26 require_once('../env.inc.php');
27 require_once('pre.php');
28 require_once('www/admin/admin_utils.php');
30 site_admin_header(array('title'=>$Language->getText('admin_grouplist','group_list')));
32 $form_catroot = getStringFromRequest('form_catroot');
33 $form_pending = getStringFromRequest('form_pending');
34 $sortorder = getStringFromRequest('sortorder');
35 $group_name_search = getStringFromRequest('group_name_search');
36 $status = getStringFromRequest('status');
38 // start from root if root not passed in
43 if (!isset($sortorder) || empty($sortorder)) {
44 $sortorder = "group_name";
46 if ($form_catroot == 1) {
47 if (isset($group_name_search)) {
48 echo "<p>".$Language->getText('admin_grouplist','groups_that_begin_with'). " <strong>".$group_name_search."</strong></p>\n";
49 $sql = "SELECT group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name,COUNT(user_group.group_id) AS members ";
50 if ($sys_database_type == "mysql") {
51 $sql.="FROM groups LEFT JOIN user_group ON user_group.group_id=groups.group_id, licenses WHERE license_id=license AND group_name LIKE '$group_name_search%' ";
53 $sql.="FROM groups LEFT JOIN user_group ON user_group.group_id=groups.group_id, licenses WHERE license_id=license AND group_name ILIKE '$group_name_search%' ";
55 $sql.="GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name "
56 . ($form_pending?"AND WHERE status='P' ":"")
57 . " ORDER BY $sortorder";
58 $res = db_query($sql);
60 $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 "
61 . "FROM groups LEFT JOIN user_group ON user_group.group_id=groups.group_id, licenses "
62 . "WHERE license_id=license "
63 . ($status?"AND status='$status' ":"")
64 . "GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name "
65 . "ORDER BY $sortorder");
68 echo "<p>".$Language->getText('admin_grouplist','group_list_for_category').' ';
69 echo "<strong>" . category_fullname($form_catroot) . "</strong></p>\n";
70 $res = db_query("SELECT groups.group_name,groups.register_time,groups.unix_group_name,groups.group_id,"
72 . "licenses.license_name,"
74 . "COUNT(user_group.group_id) AS members "
75 . "FROM groups LEFT JOIN user_group ON user_group.group_id=groups.group_id,group_category,licenses "
76 . "WHERE groups.group_id=group_category.group_id AND "
77 . "group_category.category_id=".$form_catroot." AND "
78 . "licenses.license_id=groups.license "
79 . "GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,status,license_name "
80 . "ORDER BY $sortorder");
84 $Language->getText('admin_grouplist','group_name_click_to_edit'),
85 $Language->getText('admin_grouplist','register_time'),
86 $Language->getText('admin_grouplist','unix_name'),
87 $Language->getText('admin_grouplist','status'),
88 $Language->getText('admin_grouplist','public'),
89 $Language->getText('admin_grouplist','license'),
90 $Language->getText('admin_grouplist','members')
94 '?sortorder=group_name',
95 '?sortorder=register_time',
96 '?sortorder=unix_group_name',
98 '?sortorder=is_public',
99 '?sortorder=license_name',
103 echo $HTML->listTableTop($headers, $headerLinks);
106 while ($grp = db_fetch_array($res)) {
108 if ($grp['status']=='A'){
111 if ($grp['status']=='P'){
114 if ($grp['status']=='D'){
119 if ($grp['register_time'] != 0) {
120 $time_display = date($sys_datefmt,$grp['register_time']);
122 echo '<tr '.$HTML->boxGetAltRowStyle($i).'>';
123 echo '<td><a href="groupedit.php?group_id='.$grp['group_id'].'">'.$grp['group_name'].'</a></td>';
124 echo '<td>'.$time_display.'</td>';
125 echo '<td>'.$grp['unix_group_name'].'</td>';
126 echo '<td class="'.$status.'">'.$grp['status'].'</td>';
127 echo '<td>'.$grp['is_public'].'</td>';
128 echo '<td>'.$grp['license_name'].'</td>';
129 echo '<td>'.$grp['members'].'</td>';
134 echo $HTML->listTableBottom();
136 site_admin_footer(array());