Merge branch 'MDL-46215-master' of git://github.com/andrewnicols/moodle

This commit is contained in:
Dan Poltawski 2014-10-27 14:51:04 +00:00
commit b5780fbd18
5 changed files with 29 additions and 9 deletions

View File

@ -234,17 +234,18 @@
echo $OUTPUT->header();
$headingvalue = format_string($forum->name);
echo $OUTPUT->heading(format_string($forum->name), 2);
echo $OUTPUT->heading(format_string($discussion->name), 3, 'discussionname');
if ((!isguestuser() && isloggedin()) && has_capability('mod/forum:viewdiscussion', $modcontext)) {
// Discussion subscription.
if (\mod_forum\subscriptions::is_subscribable($forum)) {
$headingvalue .= ' ';
$headingvalue .= html_writer::tag('span', forum_get_discussion_subscription_icon($forum, $post->discussion), array(
'class' => 'discussionsubscription',
));
echo html_writer::div(
forum_get_discussion_subscription_icon($forum, $post->discussion, null, true),
'discussionsubscription'
);
}
}
echo $OUTPUT->heading($headingvalue, 2);
/// Check to see if groups are being used in this forum

View File

@ -80,7 +80,7 @@ $string['cannotviewpostyet'] = 'You cannot read other students questions in this
$string['cannotviewusersposts'] = 'There are no posts made by this user that you are able to view.';
$string['cleanreadtime'] = 'Mark old posts as read hour';
$string['clicktounsubscribe'] = 'You are subscribed to this discussion. Click to unsubscribe.';
$string['clicktosubscribe'] = 'Not subscribed. Click to subscribe.';
$string['clicktosubscribe'] = 'You are not subscribed to this discussion. Click to subscribe.';
$string['completiondiscussions'] = 'Student must create discussions:';
$string['completiondiscussionsgroup'] = 'Require discussions';
$string['completiondiscussionshelp'] = 'requiring discussions to complete';
@ -343,6 +343,7 @@ $string['nopostsmadebyuser'] = '{$a} has made no posts';
$string['nopostsmadebyyou'] = 'You haven\'t made any posts';
$string['noquestions'] = 'There are no questions yet in this forum';
$string['nosubscribers'] = 'There are no subscribers yet for this forum';
$string['notsubscribed'] = 'Not subscribed';
$string['notexists'] = 'Discussion no longer exists';
$string['nothingnew'] = 'Nothing new for {$a}';
$string['notingroup'] = 'Sorry, but you need to be part of a group to see this forum.';

View File

@ -3768,7 +3768,7 @@ function forum_print_discussion_header(&$post, $forum, $group=-1, $datestring=""
* @param int $discussionid The discussion to create an icon for.
* @return string The generated markup.
*/
function forum_get_discussion_subscription_icon($forum, $discussionid, $returnurl = null) {
function forum_get_discussion_subscription_icon($forum, $discussionid, $returnurl = null, $includetext = false) {
global $USER, $OUTPUT, $PAGE;
if ($returnurl === null && $PAGE->url) {
@ -3803,6 +3803,10 @@ function forum_get_discussion_subscription_icon($forum, $discussionid, $returnur
));
}
if ($includetext) {
$o .= $subscriptionstatus ? get_string('subscribed', 'mod_forum') : get_string('notsubscribed', 'mod_forum');
}
return $o;
}

View File

@ -142,3 +142,17 @@ span.unread {
display: inline-block;
width: 12px;
}
.path-mod-forum .discussionsubscription {
margin-top: -10px;
text-align: right;
margin-bottom: 10px;
}
.path-mod-forum .discussionsubscription > a {
padding: 0 4px;
}
.dir-rtl .path-mod-forum .discussionsubscription {
text-align: left;
}

View File

@ -56,6 +56,6 @@ if (\mod_forum\subscriptions::is_subscribed($USER->id, $forum, $discussion->id,
}
// Now return the updated subscription icon.
$return->icon = forum_get_discussion_subscription_icon($forum, $discussion->id);
$return->icon = forum_get_discussion_subscription_icon($forum, $discussion->id, null, true);
echo json_encode($return);
die;