mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 00:12:56 +02:00
Merge branch 'wip-MDL-41369-master' of git://github.com/marinaglancy/moodle
This commit is contained in:
commit
259dfc2521
@ -2182,9 +2182,12 @@ class global_navigation extends navigation_node {
|
||||
}
|
||||
|
||||
if (!empty($CFG->messaging)) {
|
||||
$messageargs = null;
|
||||
$messageargs = array('user1' => $USER->id);
|
||||
if ($USER->id != $user->id) {
|
||||
$messageargs = array('user1' => $user->id);
|
||||
$messageargs['user2'] = $user->id;
|
||||
}
|
||||
if ($course->id != $SITE->id) {
|
||||
$messageargs['viewing'] = MESSAGE_VIEW_COURSE. $course->id;
|
||||
}
|
||||
$url = new moodle_url('/message/index.php',$messageargs);
|
||||
$usernode->add(get_string('messages', 'message'), $url, self::TYPE_SETTING, null, 'messages');
|
||||
|
@ -83,9 +83,6 @@ if ($viewing != MESSAGE_VIEW_UNREAD_MESSAGES) {
|
||||
|
||||
$PAGE->set_url($url);
|
||||
|
||||
$navigationurl = new moodle_url('/message/index.php', array('user1' => $user1id));
|
||||
navigation_node::override_active_url($navigationurl);
|
||||
|
||||
// Disable message notification popups while the user is viewing their messages
|
||||
$PAGE->set_popup_notification_allowed(false);
|
||||
|
||||
@ -125,9 +122,21 @@ if (!message_current_user_is_involved($user1, $user2) && !has_capability('moodle
|
||||
print_error('accessdenied','admin');
|
||||
}
|
||||
|
||||
$PAGE->set_context(context_user::instance($user1->id));
|
||||
$PAGE->set_pagelayout('course');
|
||||
$PAGE->navigation->extend_for_user($user1);
|
||||
if (substr($viewing, 0, 7) == MESSAGE_VIEW_COURSE) {
|
||||
$courseid = intval(substr($viewing, 7));
|
||||
require_login($courseid);
|
||||
require_capability('moodle/course:viewparticipants', context_course::instance($courseid));
|
||||
$PAGE->set_pagelayout('incourse');
|
||||
} else {
|
||||
$PAGE->set_pagelayout('course');
|
||||
$PAGE->set_context(context_user::instance($user1->id));
|
||||
}
|
||||
if (!empty($user1->id) && $user1->id != $USER->id) {
|
||||
$PAGE->navigation->extend_for_user($user1);
|
||||
}
|
||||
if (!empty($user2->id) && $user2->id != $USER->id) {
|
||||
$PAGE->navigation->extend_for_user($user2);
|
||||
}
|
||||
|
||||
/// Process any contact maintenance requests there may be
|
||||
if ($addcontact and confirm_sesskey()) {
|
||||
|
@ -342,7 +342,11 @@ echo "</div></div>"; // Closing desriptionbox and userprofilebox.
|
||||
if (isloggedin() && has_capability('moodle/site:sendmessage', $usercontext)
|
||||
&& !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && ($USER->id != $user->id)) {
|
||||
echo '<div class="messagebox">';
|
||||
echo '<a href="'.$CFG->wwwroot.'/message/index.php?id='.$user->id.'">'.get_string('messageselectadd').'</a>';
|
||||
$sendmessageurl = new moodle_url('/message/index.php', array('id' => $user->id));
|
||||
if ($courseid) {
|
||||
$sendmessageurl->param('viewing', MESSAGE_VIEW_COURSE. $courseid);
|
||||
}
|
||||
echo html_writer::link($sendmessageurl, get_string('messageselectadd'));
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user