mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 00:46:50 +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
|
@ -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