MDL-48933 core_message: New dialog to send a message to a user

This commit is contained in:
Frederic Massart 2015-01-15 10:53:09 +08:00
parent 4c27f52d91
commit cf4a17cb9b
17 changed files with 1972 additions and 10 deletions

View file

@ -37,7 +37,7 @@ class block_online_users extends block_base {
}
function get_content() {
global $USER, $CFG, $DB, $OUTPUT;
global $USER, $CFG, $DB, $OUTPUT, $PAGE;
if ($this->content !== NULL) {
return $this->content;
@ -167,6 +167,7 @@ class block_online_users extends block_base {
if (isloggedin() && has_capability('moodle/site:sendmessage', $this->page->context)
&& !empty($CFG->messaging) && !isguestuser()) {
$canshowicon = true;
message_messenger_requirejs();
} else {
$canshowicon = false;
}
@ -185,7 +186,11 @@ class block_online_users extends block_base {
}
if ($canshowicon and ($USER->id != $user->id) and !isguestuser($user)) { // Only when logged in and messaging active etc
$anchortagcontents = '<img class="iconsmall" src="'.$OUTPUT->pix_url('t/message') . '" alt="'. get_string('messageselectadd') .'" />';
$anchortag = '<a href="'.$CFG->wwwroot.'/message/index.php?id='.$user->id.'" title="'.get_string('messageselectadd').'">'.$anchortagcontents .'</a>';
$anchorurl = new moodle_url('/message/index.php', array('id' => $user->id));
$anchortag = html_writer::link($anchorurl, $anchortagcontents, array_merge(
message_messenger_sendmessage_link_params($user),
array('title' => get_string('messageselectadd'))
));
$this->content->text .= '<div class="message">'.$anchortag.'</div>';
}