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";
53 $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,
54 array (strtolower ("$group_name_search%"))) ;
56 $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') ;
58 $qpa = db_construct_qpa ($qpa, ' AND status=$1', array ($status)) ;
60 $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) ;
61 $res = db_query_qpa ($qpa) ;
65 _('Project Name (click to edit)'),
76 '/admin/grouplist.php?sortorder=group_name',
77 '/admin/grouplist.php?sortorder=register_time',
78 '/admin/grouplist.php?sortorder=unix_group_name',
79 '/admin/grouplist.php?sortorder=status',
80 '/admin/grouplist.php?sortorder=is_public',
81 '/admin/grouplist.php?sortorder=license_name',
82 '/admin/grouplist.php?sortorder=members',
83 '/admin/grouplist.php?sortorder=is_template'
86 echo $HTML->listTableTop($headers, $headerLinks);
88 $public_rows = array();
89 $private_rows = array();
90 $ra = RoleAnonymous::getInstance() ;
91 while ($grp = db_fetch_array($res)) {
92 if ($ra->hasPermission('project_read', $grp['group_id'])) {
93 $grp['is_public'] = 1;
94 $public_rows[] = $grp;
96 $grp['is_public'] = 0;
97 $private_rows[] = $grp;
100 $rows = $private_rows;
101 $rows = array_merge($rows, $public_rows);
104 foreach ($rows as $grp) {
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>';
128 echo '<td>'.$grp['is_template'].'</td>';
133 echo $HTML->listTableBottom();
135 site_admin_footer(array());
139 // c-file-style: "bsd"