3 * GForge Forums Facility
5 * Copyright 2002 GForge, LLC
13 By Tim Perdue, Sourceforge, 11/99
15 Massive rewrite by Tim Perdue 7/2000 (nested/views/save)
17 Complete OO rewrite by Tim Perdue 12/2002
20 require_once('../env.inc.php');
21 require_once $gfwww.'include/pre.php';
22 require_once $gfwww.'forum/include/ForumHTML.class.php';
23 require_once $gfcommon.'forum/ForumFactory.class.php';
24 require_once $gfcommon.'forum/Forum.class.php';
26 $group_id = getIntFromRequest('group_id');
28 $g =& group_get_object($group_id);
29 if (!$g || !is_object($g) || $g->isError()) {
33 $ff=new ForumFactory($g);
34 if (!$ff || !is_object($ff) || $ff->isError()) {
35 exit_error(_('Error'),$ff->getErrorMessage());
38 $farr =& $ff->getForums();
40 if ( $farr !== false && count($farr) == 1 ) {
41 Header("Location: ".util_make_url ("/forum/forum.php?forum_id=".$farr[0]->getID()));
45 forum_header(array('title'=>sprintf(_('Forums for %1$s'), $g->getPublicName()) ));
46 echo '<h1>'.sprintf(_('Forums for %1$s'), $g->getPublicName()) .'</h1>';
48 if ($ff->isError() || count($farr) < 1) {
49 echo '<div class="warning_msg">'.sprintf(_('No Forums Found for %1$s'), $g->getPublicName()) .'</div>';
51 echo $ff->getErrorMessage();
53 forum_footer(array());
58 // echo _('<p>Choose a forum and you can browse, search, and post messages.<p>');
60 echo $HTML->subMenu(array(_("My Monitored Forums")),array("/forum/myforums.php?group_id=$group_id"));
62 plugin_hook ("blocks", "forum index");
64 $tablearr=array(_('Forum'),_('Description'),_('Threads'),_('Posts'), _('Last Post'),_('Moderation Level'));
65 echo $HTML->listTableTop($tablearr);
68 Put the result set (list of forums for this group) into a column with folders
71 for ($j = 0; $j < count($farr); $j++) {
72 if (!is_object($farr[$j])) {
73 //just skip it - this object should never have been placed here
74 } elseif ($farr[$j]->isError()) {
75 echo $farr[$j]->getErrorMessage();
77 switch ($farr[$j]->getModerationLevel()) {
78 case 0 : $modlvl = _('No Moderation');break;
79 case 1 : $modlvl = _('Anonymous & Non Group Users');break;
80 case 2 : $modlvl = _('All Except Admins');break;
82 echo '<tr '. $HTML->boxGetAltRowStyle($j) . '><td><a href="forum.php?forum_id='. $farr[$j]->getID() .
83 '&group_id=' . $group_id . '">'.
84 html_image("ic/forum20w.png","20","20",array("border"=>"0")) .
86 $farr[$j]->getName() .'</a></td>
87 <td>'.$farr[$j]->getDescription().'</td>
88 <td style="text-align:center">'.$farr[$j]->getThreadCount().'</td>
89 <td style="text-align:center">'. $farr[$j]->getMessageCount() .'</td>
90 <td>'. date(_('Y-m-d H:i'),$farr[$j]->getMostRecentDate()) .'</td>
91 <td style="text-align:center">'. $modlvl .'</td></tr>';
94 echo $HTML->listTableBottom();
96 forum_footer(array());