5 * Copyright 1999-2000, Tim Perdue/Sourceforge
6 * Copyright 2002, Tim Perdue/GForge, LLC
7 * Copyright 2009, Roland Mas
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 require_once $gfcommon.'include/Error.class.php';
26 require_once $gfcommon.'forum/Forum.class.php';
27 require_once $gfcommon.'include/User.class.php';
29 class ForumsForUser extends Error {
41 * @param object The Group object to which this forum is associated.
43 function ForumsForUser(&$user) {
53 * @return Forum[] The array of Forums
56 function getMonitoredForums() {
58 $result = db_query_params ('SELECT groups.group_name,groups.group_id,forum_group_list.group_forum_id,forum_group_list.forum_name
59 FROM groups,forum_group_list,forum_monitored_forums
60 WHERE groups.group_id=forum_group_list.group_id AND groups.status=$1
61 AND forum_group_list.group_forum_id=forum_monitored_forums.forum_id
62 AND forum_monitored_forums.user_id=$2
63 ORDER BY group_name DESC',
65 $this->User->getID())) ;
66 $rows=db_numrows($result);
71 for ($i=0; $i<$rows; $i++) {
72 $group_id = db_result($result,$i,'group_id');
73 $forum_id = db_result($result,$i,'group_forum_id');
74 $group = group_get_object($group_id);
75 $forum = new Forum($group,$forum_id);
76 if ($forum->isError()) {
77 $this->setError($forum->getErrorMessage());
89 // c-file-style: "bsd"