]> CyberLeo.Net >> Repos - SourceForge/phpwiki.git/blob - wikilist.php
List of active wikis in Forge
[SourceForge/phpwiki.git] / wikilist.php
1 <?php
2 /**
3  * List of active wikis in Forge
4  *
5  * Copyright 2009-2011 Marc-Etienne Vargenau, Alcatel-Lucent
6  *
7  * This file is part of FusionForge.
8  *
9  * FusionForge 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.
13  *
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.
18  *
19  * You should have received a copy of the GNU General Public License
20  * along with FusionForge; if not, write to the Free Software
21  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22  */
23
24 require_once dirname(__FILE__)."/../../env.inc.php";
25 require_once $gfcommon.'include/pre.php';
26 require_once $gfwww.'admin/admin_utils.php';
27
28 $title = _('List of active wikis in Forge');
29 site_admin_header(array('title'=>$title));
30
31 $sortorder = getStringFromRequest('sortorder', 'group_name');
32 $sortorder = util_ensure_value_in_set ($sortorder, array ('group_name','register_time','unix_group_name','is_public','is_external','members')) ;
33
34 $res = db_query_params('SELECT group_name,register_time,unix_group_name,groups.group_id,is_public,is_external,status, COUNT(user_group.group_id) AS members
35                         FROM groups LEFT JOIN user_group ON user_group.group_id=groups.group_id
36             WHERE status=$1
37             GROUP BY group_name,register_time,unix_group_name,groups.group_id,is_public,is_external,status
38             ORDER BY '.$sortorder,
39                         array('A'));
40
41 $headers = array(
42     _('Project Name'),
43     _('Project Register Time'),
44     _('Unix name'),
45     _('Public?')
46 );
47 if (isset($sys_intranet) & $sys_intranet) {
48     $headers[] = _("External?");
49 }
50 $headers[] = _('Members');
51 $headers[] = _('Upgrade');
52
53 $headerLinks = array(
54     '/wiki/wikilist.php?sortorder=group_name',
55     '/wiki/wikilist.php?sortorder=register_time',
56     '/wiki/wikilist.php?sortorder=unix_group_name',
57     '/wiki/wikilist.php?sortorder=is_public');
58 if (isset($sys_intranet) & $sys_intranet) {
59     $headerLinks[] = '?sortorder=is_external';
60 }
61 $headerLinks[] = '/wiki/wikilist.php?sortorder=members';
62 $headerLinks[] = '';
63
64 echo $HTML->listTableTop($headers, $headerLinks);
65
66 $i = 0;
67 while ($grp = db_fetch_array($res)) {
68
69     $project = group_get_object($grp['group_id']);
70     if ($project->usesPlugin("wiki")) {
71         $time_display = "";
72         if ($grp['register_time'] != 0) {
73             $time_display = date(_('Y-m-d H:i'),$grp['register_time']);
74         }
75         echo '<tr '.$HTML->boxGetAltRowStyle($i).'>';
76         echo '<td><a href="/wiki/g/'.$grp['unix_group_name'].'/">'.$grp['group_name'].'</a></td>';
77         echo '<td>'.$time_display.'</td>';
78         echo '<td>'.$grp['unix_group_name']. '</td>';
79         echo '<td>'.$grp['is_public'].'</td>';
80         if (isset($sys_intranet) & $sys_intranet) {
81             echo '<td>'.$grp['is_external'].'</td>';
82         }
83         echo '<td>'.$grp['members'].'</td>';
84         echo '<td><a href="/wiki/g/'.$grp['unix_group_name'].'/?action=upgrade">'._("Upgrade").'</a></td>';
85         echo '</tr>';
86         $i++;
87     }
88 }
89
90 echo $HTML->listTableBottom();
91
92 site_admin_footer(array());
93
94 ?>