Merge branch '45248-27' of git://github.com/samhemelryk/moodle

This commit is contained in:
Dan Poltawski 2014-04-28 10:17:16 +08:00
commit 853c1d7169
2 changed files with 7 additions and 5 deletions

View File

@ -11,7 +11,7 @@
if ($forum = forum_get_course_forum($course->id, 'social')) {
$cm = get_coursemodule_from_instance('forum', $forum->id);
$context = context_module::instance($cm->id);
$modcontext = context_module::instance($cm->id);
/// Print forum intro above posts MDL-18483
if (trim($forum->intro) != '') {
@ -19,7 +19,7 @@
$options->para = false;
$introcontent = format_module_intro('forum', $forum, $cm->id);
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $modcontext)) {
$streditsummary = get_string('editsummary');
$introcontent .= '<div class="editinglink"><a title="'.$streditsummary.'" '.
' href="modedit.php?update='.$cm->id.'&amp;sesskey='.sesskey().'">'.
@ -29,7 +29,7 @@
echo $OUTPUT->box($introcontent, 'generalbox', 'intro');
}
echo '<div class="subscribelink">', forum_get_subscribe_link($forum, $context), '</div>';
echo '<div class="subscribelink">', forum_get_subscribe_link($forum, $modcontext), '</div>';
forum_print_latest_discussions($course, $forum, 10, 'plain', '', false);
} else {

View File

@ -282,8 +282,10 @@
echo html_writer::end_tag('div');
// Trigger course viewed event.
$eventdata = array('context' => $context);
if (!empty($section)) {
// We don't trust $context here. Course format inclusion above executes in the global space. We can't assume
// anything after that point.
$eventdata = array('context' => context_course::instance($course->id));
if (!empty($section) && (int)$section == $section) {
$eventdata['other'] = array('coursesectionid' => $section);
}
$event = \core\event\course_viewed::create($eventdata);