5 * Copyright 1999-2001, Tim Perdue - Sourceforge
6 * Copyright 2002, Tim Perdue - GForge, LLC
7 * Copyright 2010 (c) Franck Villaume - Capgemini
8 * Copyright (C) 2011-2012 Alain Peyrat - Alcatel-Lucent
10 * This file is part of FusionForge. FusionForge is free software;
11 * you can redistribute it and/or modify it under the terms of the
12 * GNU General Public License as published by the Free Software
13 * Foundation; either version 2 of the Licence, or (at your option)
16 * FusionForge 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 along
22 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
23 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
26 require_once('../env.inc.php');
27 require_once $gfcommon.'include/pre.php';
28 require_once $gfcommon.'forum/ForumHTML.class.php';
29 require_once $gfcommon.'forum/ForumFactory.class.php';
30 require_once $gfcommon.'forum/Forum.class.php';
32 $group_id = getIntFromRequest('group_id');
34 $g = group_get_object($group_id);
35 if (!$g || !is_object($g) || $g->isError()) {
39 $ff = new ForumFactory($g);
40 if (!$ff || !is_object($ff) || $ff->isError()) {
41 exit_error($ff->getErrorMessage(),'forums');
44 $farr = $ff->getForums();
46 if ( $farr !== false && count($farr) == 1 ) {
47 session_redirect('/forum/forum.php?forum_id='.$farr[0]->getID());
50 forum_header(array('title'=>sprintf(_('Forums for %1$s'), $g->getPublicName()) ));
53 echo '<div class="error">'. $ff->getErrorMessage().'</div>';
54 forum_footer(array());
56 } else if ( count($farr) < 1) {
57 echo '<div class="warning_msg">'.sprintf(_('No Forums Found for %1$s'), $g->getPublicName()) .'</div>';
58 forum_footer(array());
62 // echo _('<p>Choose a forum and you can browse, search, and post messages.<p>');
64 echo $HTML->printsubMenu(array(_("My Monitored Forums")), array("/forum/myforums.php?group_id=$group_id"), false);
66 plugin_hook("blocks", "forum index");
68 $tablearr=array(_('Forum'),_('Description'),_('Threads'),_('Posts'), _('Last Post'));
69 echo $HTML->listTableTop($tablearr);
72 Put the result set (list of forums for this group) into a column with folders
75 for ($j = 0; $j < count($farr); $j++) {
76 if (!is_object($farr[$j])) {
77 //just skip it - this object should never have been placed here
78 } elseif ($farr[$j]->isError()) {
79 echo $farr[$j]->getErrorMessage();
81 echo '<tr '. $HTML->boxGetAltRowStyle($j) . '><td>'.
82 '<a href="'.util_make_uri('/forum/forum.php?forum_id='.$farr[$j]->getID().'&group_id='.$group_id).'">'.
83 html_image('ic/forum20w.png') .
85 $farr[$j]->getName() .'</a></td>
86 <td>'.$farr[$j]->getDescription().'</td>
87 <td class="align-center">'.$farr[$j]->getThreadCount().'</td>
88 <td class="align-center">'. $farr[$j]->getMessageCount() .'</td>
89 <td>'. date(_('Y-m-d H:i'),$farr[$j]->getMostRecentDate()) .'</td></tr>';
92 echo $HTML->listTableBottom();
94 forum_footer(array());