MDL-41369 Pass viewing argument to more message screens

This commit is contained in:
Marina Glancy 2013-09-04 16:40:01 +10:00
parent fedb0325df
commit 8f0137e192
3 changed files with 10 additions and 3 deletions

View File

@ -178,6 +178,7 @@ if ($currentuser && !empty($user2) && has_capability('moodle/site:sendmessage',
$mform = new send_form();
$defaultmessage = new stdClass;
$defaultmessage->id = $user2->id;
$defaultmessage->viewing = $viewing;
$defaultmessage->message = '';
//Check if the current user has sent a message
@ -322,6 +323,7 @@ echo html_writer::start_tag('div', array('class' => 'messagearea mdl-align'));
$mform = new send_form();
$defaultmessage = new stdClass;
$defaultmessage->id = $user2->id;
$defaultmessage->viewing = $viewing;
$defaultmessage->message = '';
//$defaultmessage->messageformat = FORMAT_MOODLE;
$mform->set_data($defaultmessage);

View File

@ -1406,7 +1406,7 @@ function message_contact_link($userid, $linktype='add', $return=false, $script=n
* @return string|bool. Returns a string if $return is true. Otherwise returns a boolean.
*/
function message_history_link($userid1, $userid2, $return=false, $keywords='', $position='', $linktext='') {
global $OUTPUT;
global $OUTPUT, $PAGE;
static $strmessagehistory;
if (empty($strmessagehistory)) {
@ -1441,6 +1441,9 @@ function message_history_link($userid1, $userid2, $return=false, $keywords='', $
'resizable' => true);
$link = new moodle_url('/message/index.php?history='.MESSAGE_HISTORY_ALL."&user1=$userid1&user2=$userid2$keywords$position");
if ($PAGE->url && $PAGE->url->get_param('viewing')) {
$link->param('viewing', $PAGE->url->get_param('viewing'));
}
$action = null;
$str = $OUTPUT->action_link($link, $fulllink, $action, array('title' => $strmessagehistory));
@ -2091,7 +2094,7 @@ function message_post_message($userfrom, $userto, $message, $format) {
* @return void
*/
function message_print_contactlist_user($contact, $incontactlist = true, $isblocked = false, $selectcontacturl = null, $showactionlinks = true, $selecteduser=null) {
global $OUTPUT, $USER;
global $OUTPUT, $USER, $COURSE;
$fullname = fullname($contact);
$fullnamelink = $fullname;
@ -2115,7 +2118,7 @@ function message_print_contactlist_user($contact, $incontactlist = true, $isbloc
echo html_writer::start_tag('tr');
echo html_writer::start_tag('td', array('class' => 'pix'));
echo $OUTPUT->user_picture($contact, array('size' => 20, 'courseid' => SITEID));
echo $OUTPUT->user_picture($contact, array('size' => 20, 'courseid' => $COURSE->id));
echo html_writer::end_tag('td');
echo html_writer::start_tag('td', array('class' => 'contact'));

View File

@ -50,6 +50,8 @@ class send_form extends moodleform {
$mform->addElement('hidden', 'id');
$mform->setType('id', PARAM_INT);
$mform->addElement('hidden', 'viewing');
$mform->setType('viewing', PARAM_ALPHANUMEXT);
$mform->addElement('textarea', 'message', get_string('message', 'message'), $displayoptions, $editoroptions);