$event->trigger(); } unset($SESSION->fromdiscussion); if ($mode) { set_user_preference('anonforum_displaymode', $mode); } $displaymode = get_user_preferences('anonforum_displaymode', $CFG->anonforum_displaymode); if ($parent) { // If flat AND parent, then force nested display this time if ($displaymode == ANONFORUM_MODE_FLATOLDEST or $displaymode == ANONFORUM_MODE_FLATNEWEST) { $displaymode = ANONFORUM_MODE_NESTED; } } else { $parent = $discussion->firstpost; } if (!($post = anonforum_get_post_full($parent))) { print_error("notexists", 'anonforum', "{$CFG->wwwroot}/mod/anonforum/view.php?f={$anonforum->id}"); } if (!anonforum_user_can_see_post($anonforum, $discussion, $post, null, $cm)) { print_error('noviewdiscussionspermission', 'anonforum', "{$CFG->wwwroot}/mod/anonforum/view.php?id={$anonforum->id}"); } if ($mark == 'read' or $mark == 'unread') { if ($CFG->anonforum_usermarksread && anonforum_tp_can_track_anonforums($anonforum) && anonforum_tp_is_tracked($anonforum)) { if ($mark == 'read') { anonforum_tp_add_read_record($USER->id, $postid); } else { // unread anonforum_tp_delete_read_records($USER->id, $postid); } } }
} if (!empty($anonforum->blockafter) && !empty($anonforum->blockperiod)) { $a = new stdClass(); $a->blockafter = $anonforum->blockafter; $a->blockperiod = get_string('secondstotime' . $anonforum->blockperiod); echo $OUTPUT->notification(get_string('thisanonforumisthrottled', 'anonforum', $a)); } if ($anonforum->type == 'qanda' && !has_capability('moodle/course:manageactivities', $context)) { echo $OUTPUT->notification(get_string('qandanotify', 'anonforum')); } switch ($anonforum->type) { case 'single': if (!empty($discussions) && count($discussions) > 1) { echo $OUTPUT->notification(get_string('warnformorepost', 'anonforum')); } if (!($post = anonforum_get_post_full($discussion->firstpost))) { print_error('cannotfindfirstpost', 'anonforum'); } if ($mode) { set_user_preference("anonforum_displaymode", $mode); } $canreply = anonforum_user_can_post($anonforum, $discussion, $USER, $cm, $course, $context); $canrate = has_capability('mod/anonforum:rate', $context); $displaymode = get_user_preferences("anonforum_displaymode", $CFG->anonforum_displaymode); echo ' '; // This should fix the floating in FF. anonforum_print_discussion($course, $cm, $anonforum, $discussion, $post, $displaymode, $canreply, $canrate); break; case 'eachuser': echo '<p class="mdl-align">'; if (anonforum_user_can_post_discussion($anonforum, null, -1, $cm)) {