~ubuntu-branches/ubuntu/hoary/moodle/hoary

« back to all changes in this revision

Viewing changes to mod/forum/view.php

  • Committer: Bazaar Package Importer
  • Author(s): Isaac Clerencia
  • Date: 2004-12-29 00:49:52 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20041229004952-gliyqzpj2w3e7clx
Tags: 1.4.3-1
* Urgency high as upstream release fixes several security bugs
* New upstream release
* Write database creation errors and warn the user about it, 
closes: #285842, #285842

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<?PHP  // $Id: view.php,v 1.41 2004/05/19 06:43:22 moodler Exp $
 
1
<?PHP  // $Id: view.php,v 1.44.2.5 2004/12/14 11:07:07 moodler Exp $
2
2
 
3
3
    require_once("../../config.php");
4
4
    require_once("lib.php");
5
5
    require_once("$CFG->dirroot/rss/rsslib.php");
6
6
 
7
 
    optional_variable($id);            // Course Module ID
8
 
    optional_variable($f);             // Forum ID
9
 
    optional_variable($mode);          // Display mode (for single forum)
10
 
    optional_variable($search, "");    // search string
11
 
    optional_variable($showall, "");   // show all discussions on one page
12
 
    optional_variable($group, -1);     // choose the current group
 
7
    $id      = optional_param('id', 0, PARAM_INT);        // Course Module ID
 
8
    $f       = optional_param('f', 0, PARAM_INT);         // Forum ID
 
9
    $mode    = optional_param('mode', 0, PARAM_INT);      // Display mode (for single forum)
 
10
    $showall = optional_param('showall', '', PARAM_INT);  // show all discussions on one page
 
11
    $group   = optional_param('group', -1, PARAM_INT);    // choose the current group
 
12
    $page    = optional_param('page', 0, PARAM_INT);      // which page to show
 
13
    $search  = optional_param('search', '');              // search string
13
14
 
14
15
    if ($id) {
15
16
        if (! $cm = get_record("course_modules", "id", $id)) {
59
60
 
60
61
    if ($course->category) {
61
62
        require_login($course->id);
62
 
        $navigation = "<a href=\"../../course/view.php?id=$course->id\">$course->shortname</a> ->
63
 
                       <a href=\"index.php?id=$course->id\">$strforums</a> ->";
64
 
    } else {
65
 
        $navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->";
66
 
    }
 
63
    } 
 
64
    $navigation = "<a href=\"index.php?id=$course->id\">$strforums</a> ->";
67
65
 
68
66
    if ($forum->type == "teacher") {
69
67
        if (!isteacher($course->id)) {
77
75
        add_to_log($course->id, "forum", "view forum", "view.php?f=$forum->id", "$forum->id");
78
76
    }
79
77
 
80
 
    print_header("$course->shortname: $forum->name", "$course->fullname",
 
78
    print_header_simple("$forum->name", "",
81
79
                 "$navigation $forum->name", "", "", true, $buttontext, navmenu($course, $cm));
82
80
 
83
81
    if (!$cm->visible and !isteacher($course->id)) {
117
115
    }
118
116
 
119
117
 
120
 
    if ($USER) {
 
118
    if (!empty($USER->id)) {
121
119
        echo '<td align="right">';
122
120
        $SESSION->fromdiscussion = "$FULLME";
123
121
        if (forum_is_forcesubscribed($forum->id)) {
160
158
            echo "<font size=1><a title=\"$subtexttitle\" href=\"subscribe.php?id=$forum->id\">$subtext</a></font>";
161
159
        }
162
160
 
163
 
        //If rss are activated at site and forum level and this forum has rss defined, show link
164
 
        if ($CFG->enablerssfeeds && $CFG->forum_enablerssfeeds && $forum->rsstype and $forum->rssarticles) {
165
 
            echo "<br />";
166
 
            if ($forum->rsstype == 1) {
167
 
                $tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name);
168
 
            } else {
169
 
                $tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name);
170
 
            }
171
 
            rss_print_link($course->id, $USER->id, "forum", $forum->id, $tooltiptext);
172
 
        }
 
161
        echo '</td>';
 
162
    }
173
163
 
 
164
    //If rss are activated at site and forum level and this forum has rss defined, show link
 
165
    if (isset($CFG->enablerssfeeds) && isset($CFG->forum_enablerssfeeds) &&
 
166
        $CFG->enablerssfeeds && $CFG->forum_enablerssfeeds && $forum->rsstype and $forum->rssarticles) {
 
167
        echo '</tr><tr><td align="right">';
 
168
        if ($forum->rsstype == 1) {
 
169
            $tooltiptext = get_string("rsssubscriberssdiscussions","forum",$forum->name);
 
170
        } else { 
 
171
            $tooltiptext = get_string("rsssubscriberssposts","forum",$forum->name);
 
172
        }
 
173
        if (empty($USER->id)) {
 
174
            $userid = 0;
 
175
        } else {
 
176
            $userid = $USER->id;
 
177
        }
 
178
        rss_print_link($course->id, $userid, "forum", $forum->id, $tooltiptext);
174
179
        echo '</td>';
175
180
    }
176
181
 
210
215
            }
211
216
            echo '</p>';
212
217
            if (!empty($showall)) {
213
 
                forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup);
 
218
                forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup, $groupmode);
214
219
            } else {
215
 
                forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup);
 
220
                forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup, $groupmode, $page);
216
221
            }
217
222
            break;
218
223
 
219
224
        case 'teacher':
220
225
            if (!empty($showall)) {
221
 
                forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup);
 
226
                forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup, $groupmode);
222
227
            } else {
223
 
                forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup);
 
228
                forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup, $groupmode, $page);
224
229
            }
225
230
            break;
226
231
 
230
235
            }
231
236
            echo '<p>&nbsp;</p>';
232
237
            if (!empty($showall)) {
233
 
                forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup);
 
238
                forum_print_latest_discussions($forum->id, 0, 'header', '', $currentgroup, $groupmode);
234
239
            } else {
235
 
                forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup);
 
240
                forum_print_latest_discussions($forum->id, $CFG->forum_manydiscussions, 'header', '', $currentgroup, $groupmode, $page);
236
241
            }
237
242
            break;
238
243
    }