mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 08:56:36 +02:00
MDL-48933 core_message: New dialog to send a message to a user
This commit is contained in:
parent
4c27f52d91
commit
cf4a17cb9b
17 changed files with 1972 additions and 10 deletions
|
@ -107,6 +107,13 @@ $PAGE->set_context($context);
|
|||
$PAGE->set_pagelayout('mypublic');
|
||||
$PAGE->set_pagetype('user-profile');
|
||||
|
||||
// Load the JS to send a message.
|
||||
$cansendmessage = isloggedin() && has_capability('moodle/site:sendmessage', $context)
|
||||
&& !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && ($USER->id != $user->id);
|
||||
if ($cansendmessage) {
|
||||
message_messenger_requirejs();
|
||||
}
|
||||
|
||||
// Set up block editing capabilities.
|
||||
if (isguestuser()) { // Guests can never edit their profile.
|
||||
$USER->editing = $edit = 0; // Just in case.
|
||||
|
@ -230,7 +237,6 @@ $event->trigger();
|
|||
echo $OUTPUT->header();
|
||||
echo '<div class="userprofile">';
|
||||
|
||||
|
||||
// Print the standard content of this page, the basic profile info.
|
||||
echo $OUTPUT->heading(fullname($user));
|
||||
|
||||
|
@ -462,10 +468,10 @@ echo "</div></div>"; // Closing desriptionbox and userprofilebox.
|
|||
echo $OUTPUT->custom_block_region('content');
|
||||
|
||||
// Print messaging link if allowed.
|
||||
if (isloggedin() && has_capability('moodle/site:sendmessage', $context)
|
||||
&& !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && ($USER->id != $user->id)) {
|
||||
if ($cansendmessage) {
|
||||
$sendurl = new moodle_url('/message/index.php', array('id' => $user->id));
|
||||
echo '<div class="messagebox">';
|
||||
echo '<a href="'.$CFG->wwwroot.'/message/index.php?id='.$user->id.'">'.get_string('messageselectadd').'</a>';
|
||||
echo html_writer::link($sendurl, get_string('messageselectadd'), message_messenger_sendmessage_link_params($user));
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
|
|
@ -83,6 +83,12 @@ $PAGE->set_other_editing_capability('moodle/course:manageactivities');
|
|||
// of inhereting the pagetype will lead to an incorrect docs location.
|
||||
$PAGE->set_docs_path('user/profile');
|
||||
|
||||
$cansendmessage = isloggedin() && has_capability('moodle/site:sendmessage', $usercontext)
|
||||
&& !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && ($USER->id != $user->id);
|
||||
if ($cansendmessage) {
|
||||
message_messenger_requirejs();
|
||||
}
|
||||
|
||||
$isparent = false;
|
||||
|
||||
if (!$currentuser and !$user->deleted
|
||||
|
@ -387,14 +393,13 @@ if (has_capability('moodle/user:viewlastip', $usercontext) && !isset($hiddenfiel
|
|||
echo html_writer::end_tag('dl');
|
||||
echo "</div></div>"; // Closing desriptionbox and userprofilebox.
|
||||
// Print messaging link if allowed.
|
||||
if (isloggedin() && has_capability('moodle/site:sendmessage', $usercontext)
|
||||
&& !empty($CFG->messaging) && !isguestuser() && !isguestuser($user) && ($USER->id != $user->id)) {
|
||||
if ($cansendmessage) {
|
||||
echo '<div class="messagebox">';
|
||||
$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 html_writer::link($sendmessageurl, get_string('messageselectadd'), message_messenger_sendmessage_link_params($user));
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue