Merge branch 'MDL-51998_master' of https://github.com/nadavkav/moodle

This commit is contained in:
Andrew Nicols 2017-04-05 09:56:29 +08:00
commit 04056e715b
3 changed files with 21 additions and 7 deletions

View File

@ -286,6 +286,8 @@ Users with the capability to reply to locked discussions can unlock a discussion
$string['longpost'] = 'Long post';
$string['mailnow'] = 'Send forum post notifications with no editing-time delay';
$string['manydiscussions'] = 'Discussions per page';
$string['managesubscriptionsoff'] = 'Finish managing subscriptions';
$string['managesubscriptionson'] = 'Manage subscriptions';
$string['markalldread'] = 'Mark all posts in this discussion read.';
$string['markallread'] = 'Mark all posts in this forum read.';
$string['markasreadonnotification'] = 'When sending forum post notifications';

View File

@ -6074,17 +6074,22 @@ function forum_update_subscriptions_button($courseid, $forumid) {
global $CFG, $USER;
if (!empty($USER->subscriptionsediting)) {
$string = get_string('turneditingoff');
$string = get_string('managesubscriptionsoff', 'forum');
$edit = "off";
} else {
$string = get_string('turneditingon');
$string = get_string('managesubscriptionson', 'forum');
$edit = "on";
}
return "<form method=\"get\" action=\"$CFG->wwwroot/mod/forum/subscribers.php\">".
"<input type=\"hidden\" name=\"id\" value=\"$forumid\" />".
"<input type=\"hidden\" name=\"edit\" value=\"$edit\" />".
"<input type=\"submit\" value=\"$string\" /></form>";
$subscribers = html_writer::start_tag('form', array('action' => $CFG->wwwroot . '/mod/forum/subscribers.php',
'method' => 'get', 'class' => 'form-inline'));
$subscribers .= html_writer::empty_tag('input', array('type' => 'submit', 'value' => $string,
'class' => 'btn btn-secondary'));
$subscribers .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'id', 'value' => $forumid));
$subscribers .= html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'edit', 'value' => $edit));
$subscribers .= html_writer::end_tag('form');
return $subscribers;
}
// Functions to do with read tracking.

View File

@ -104,12 +104,16 @@ if (has_capability('mod/forum:managesubscriptions', $context) && \mod_forum\subs
if ($edit != -1) {
$USER->subscriptionsediting = $edit;
}
$PAGE->set_button(forum_update_subscriptions_button($course->id, $id));
$updatesubscriptionsbutton = forum_update_subscriptions_button($course->id, $id);
} else {
$updatesubscriptionsbutton = '';
unset($USER->subscriptionsediting);
}
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('forum', 'forum').' '.$strsubscribers);
if (!empty($updatesubscriptionsbutton)) {
echo \html_writer::div($updatesubscriptionsbutton, 'pull-right');
}
if (empty($USER->subscriptionsediting)) {
$subscribers = \mod_forum\subscriptions::fetch_subscribed_users($forum, $currentgroup, $context);
if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
@ -119,6 +123,9 @@ if (empty($USER->subscriptionsediting)) {
} else {
echo $forumoutput->subscriber_selection_form($existingselector, $subscriberselector);
}
if (!empty($updatesubscriptionsbutton)) {
echo $updatesubscriptionsbutton;
}
echo $OUTPUT->footer();
/**