3 * List of all groups in the system.
5 * Copyright 1999-2000 (c) The SourceForge Crew
7 * This file is part of FusionForge. FusionForge is free software;
8 * you can redistribute it and/or modify it under the terms of the
9 * GNU General Public License as published by the Free Software
10 * Foundation; either version 2 of the Licence, or (at your option)
13 * FusionForge is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 require_once('../env.inc.php');
24 require_once $gfcommon.'include/pre.php';
25 require_once $gfwww.'admin/admin_utils.php';
27 site_admin_header(array('title'=>_('Project List')));
29 $sortorder = getStringFromRequest('sortorder');
30 $group_name_search = getStringFromRequest('group_name_search');
31 $status = getStringFromRequest('status');
33 $sortorder = util_ensure_value_in_set ($sortorder,
43 $sqlsortorder = $sortorder;
45 if ($sortorder == 'is_public') {
46 $sortorder = 'group_name' ;
47 } elseif ($sortorder == 'is_template') {
48 $sortorder = 'is_template DESC' ;
51 if ($group_name_search != '') {
52 echo "<p>"._('Projects that begin with'). " <strong>".$group_name_search."</strong></p>\n";
54 $res = db_query_params ('SELECT group_name,register_time,unix_group_name,groups.group_id,groups.is_template,status,license_name,COUNT(DISTINCT(pfo_user_role.user_id)) AS members FROM groups LEFT OUTER JOIN pfo_role ON pfo_role.home_group_id=groups.group_id LEFT OUTER JOIN pfo_user_role ON pfo_user_role.role_id=pfo_role.role_id, licenses WHERE license_id=license AND lower(group_name) LIKE $1 GROUP BY group_name,register_time,unix_group_name,groups.group_id,groups.is_template,status,license_name ORDER BY '.$sqlsortorder,
55 array (strtolower ("$group_name_search%"))) ;
57 $res = db_query_params ('SELECT group_name,register_time,unix_group_name,groups.group_id,groups.is_public,groups.is_template,status,license_name,COUNT(user_group.group_id) AS members
59 LEFT JOIN user_group ON user_group.group_id=groups.group_id, licenses
60 WHERE license_id=license
61 AND lower(group_name) LIKE $1
62 GROUP BY group_name,register_time,unix_group_name,groups.group_id,groups.is_public,groups.is_template,status,license_name
63 ORDER BY '.$sortorder,
64 array (strtolower ("$group_name_search%"))) ;
68 $qpa = db_construct_qpa (false, 'SELECT group_name,register_time,unix_group_name,groups.group_id,groups.is_template,status,license_name,COUNT(DISTINCT(pfo_user_role.user_id)) AS members FROM groups LEFT OUTER JOIN pfo_role ON pfo_role.home_group_id=groups.group_id LEFT OUTER JOIN pfo_user_role ON pfo_user_role.role_id=pfo_role.role_id, licenses WHERE license_id=license') ;
70 $qpa = db_construct_qpa ($qpa, ' AND status=$1', array ($status)) ;
72 $qpa = db_construct_qpa ($qpa, ' GROUP BY group_name,register_time,unix_group_name,groups.group_id,groups.is_template,status,license_name ORDER BY '.$sqlsortorder) ;
73 $res = db_query_qpa ($qpa) ;
75 $qpa = db_construct_qpa (false, 'SELECT group_name,register_time,unix_group_name,groups.group_id,groups.is_public,groups.is_template,status,license_name,COUNT(user_group.group_id) AS members
77 LEFT JOIN user_group ON user_group.group_id=groups.group_id, licenses
78 WHERE license_id=license',
81 $qpa = db_construct_qpa ($qpa, ' AND status=$1', array ($status)) ;
83 $qpa = db_construct_qpa ($qpa, ' GROUP BY group_name,register_time,unix_group_name,groups.group_id,groups.is_public,groups.is_template,status,license_name ORDER BY '.$sortorder) ;
84 $res = db_query_qpa ($qpa) ;
89 _('Project Name (click to edit)'),
100 '/admin/grouplist.php?sortorder=group_name',
101 '/admin/grouplist.php?sortorder=register_time',
102 '/admin/grouplist.php?sortorder=unix_group_name',
103 '/admin/grouplist.php?sortorder=status',
104 '/admin/grouplist.php?sortorder=is_public',
105 '/admin/grouplist.php?sortorder=license_name',
106 '/admin/grouplist.php?sortorder=members',
107 '/admin/grouplist.php?sortorder=is_template'
110 echo $HTML->listTableTop($headers, $headerLinks);
113 $public_rows = array();
114 $private_rows = array();
115 $ra = RoleAnonymous::getInstance() ;
116 while ($grp = db_fetch_array($res)) {
117 if ($ra->hasPermission('project_read', $row['group_id'])) {
118 $grp['is_public'] = 1;
119 $public_rows[] = $grp;
121 $grp['is_public'] = 0;
122 $private_rows[] = $grp;
125 $rows = $private_rows;
126 array_merge($rows, $public_rows);
129 while ($grp = db_fetch_array($res)) {
135 foreach ($rows as $grp) {
137 if ($grp['status']=='A'){
140 if ($grp['status']=='P'){
143 if ($grp['status']=='D'){
148 if ($grp['register_time'] != 0) {
149 $time_display = date(_('Y-m-d H:i'),$grp['register_time']);
151 echo '<tr '.$HTML->boxGetAltRowStyle($i).'>';
152 echo '<td><a href="groupedit.php?group_id='.$grp['group_id'].'">'.$grp['group_name'].'</a></td>';
153 echo '<td>'.$time_display.'</td>';
154 echo '<td>'.$grp['unix_group_name'].'</td>';
155 echo '<td class="'.$status.'">'.$grp['status'].'</td>';
156 echo '<td>'.$grp['is_public'].'</td>';
157 echo '<td>'.$grp['license_name'].'</td>';
158 echo '<td>'.$grp['members'].'</td>';
159 echo '<td>'.$grp['is_template'].'</td>';
164 echo $HTML->listTableBottom();
166 site_admin_footer(array());
170 // c-file-style: "bsd"