3 * List of all groups in the system.
5 * Copyright 1999-2000 (c) The SourceForge Crew
6 * Copyright 2013, Franck Villaume - TrivialDev
8 * This file is part of FusionForge. FusionForge is free software;
9 * you can redistribute it and/or modify it under the terms of the
10 * GNU General Public License as published by the Free Software
11 * Foundation; either version 2 of the Licence, or (at your option)
14 * FusionForge 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 along
20 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
21 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
24 require_once '../env.inc.php';
25 require_once $gfcommon.'include/pre.php';
26 require_once $gfwww.'admin/admin_utils.php';
28 site_admin_header(array('title'=>_('Project List')));
30 $sortorder = getStringFromRequest('sortorder');
31 $group_name_search = getStringFromRequest('group_name_search');
32 $status = getStringFromRequest('status');
34 $sortorder = util_ensure_value_in_set($sortorder,
44 if ($sortorder == 'is_public') {
45 $sortorder = 'group_name';
46 } elseif ($sortorder == 'is_template' || $sortorder == 'members') {
47 $sortorder .= ' DESC';
51 $sqlsortorder = $sortorder;
53 if ($group_name_search != '') {
54 echo "<p>"._('Projects that begin with'). " <strong>".$group_name_search."</strong></p>\n";
55 $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,
56 array(strtolower ("$group_name_search%")));
58 $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') ;
60 $qpa = db_construct_qpa($qpa, ' AND status=$1', array($status));
62 $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);
63 $res = db_query_qpa($qpa);
78 '/admin/grouplist.php?sortorder=group_name',
79 '/admin/grouplist.php?sortorder=register_time',
80 '/admin/grouplist.php?sortorder=unix_group_name',
81 '/admin/grouplist.php?sortorder=status',
82 '/admin/grouplist.php?sortorder=is_public',
83 '/admin/grouplist.php?sortorder=license_name',
84 '/admin/grouplist.php?sortorder=members',
85 '/admin/grouplist.php?sortorder=is_template'
100 _('Order by project name.'),
101 _('Order by register time.'),
102 _('Order by unix name.'),
103 _('Order by status.'),
104 _('Order by public visibility.'),
105 _('Order by licence type.'),
106 _('Order by number of members.'),
107 _('Order by is the project a template.')
110 echo $HTML->listTableTop($headers, $headerLinks, '', '', $headerClass, $headerTitle);
113 $private_rows = array();
114 $public_rows = array();
115 $ra = RoleAnonymous::getInstance();
116 while ($grp = db_fetch_array($res)) {
117 if ($ra->hasPermission('project_read', $grp['group_id'])) {
118 $grp['is_public'] = 1;
119 if (getStringFromRequest('sortorder') == 'is_public') {
120 $public_rows[] = $grp;
123 $grp['is_public'] = 0;
124 if (getStringFromRequest('sortorder') == 'is_public') {
125 $private_rows[] = $grp;
128 if (getStringFromRequest('sortorder') != 'is_public') {
133 if (getStringFromRequest('sortorder') == 'is_public') {
134 $rows = array_merge($public_rows, $private_rows);
138 foreach ($rows as $grp) {
140 if ($grp['status']=='A'){
143 if ($grp['status']=='P'){
146 if ($grp['status']=='D'){
151 if ($grp['register_time'] != 0) {
152 $time_display = date(_('Y-m-d H:i'),$grp['register_time']);
154 echo '<tr '.$HTML->boxGetAltRowStyle($i).'>';
155 echo '<td><a class="tabtitle-w" title="'._('Click to edit this project.').'" href="groupedit.php?group_id='.$grp['group_id'].'">'.$grp['group_name'].'</a></td>';
156 echo '<td>'.$time_display.'</td>';
157 echo '<td>'.$grp['unix_group_name'].'</td>';
158 echo '<td class="'.$status.'">'.$grp['status'].'</td>';
159 echo '<td>'.$grp['is_public'].'</td>';
160 echo '<td>'.$grp['license_name'].'</td>';
161 echo '<td>'.$grp['members'].'</td>';
162 echo '<td>'.$grp['is_template'].'</td>';
167 echo $HTML->listTableBottom();
169 site_admin_footer(array());
173 // c-file-style: "bsd"