mirror of
https://github.com/moodle/moodle.git
synced 2025-04-13 20:42:22 +02:00
MDL-46215 mod_forum: Improve style of subscription state
With the implementation of per-discussion subscription, the current discussion's subscription state must be shown. Since this state belongs to the discussion rather than the forum, it should be shown accordingly. This change therefore includes the addition of the discussion name as a heading on the page.
This commit is contained in:
parent
42b6b39136
commit
517e17826b
@ -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
|
||||
|
@ -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.';
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user