From f59d8e45dbf2de50eb1fb72d18bf5af722873d80 Mon Sep 17 00:00:00 2001 From: Martin Dougiamas Date: Mon, 12 Jul 2010 13:31:32 +0000 Subject: [PATCH] MDL-22320 Added a 'Send a message' link to the main profile page, linking to messaging --- lang/en/moodle.php | 6 +++--- theme/base/style/user.css | 1 + theme/standard/style/core.css | 3 ++- user/profile.php | 9 +++++++++ 4 files changed, 15 insertions(+), 4 deletions(-) diff --git a/lang/en/moodle.php b/lang/en/moodle.php index e764dd1a3a9..f2d7ff7bf94 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -989,8 +989,8 @@ $string['messageprovider:notices'] = 'Notices about minor problems'; $string['messageprovider:notices_help'] = 'These are notices that an administrator might be interested in seeing.'; $string['messageprovider:instantmessage'] = 'Personal messages between users'; $string['messageprovider:instantmessage_help'] = 'This section configures what happens to messages that are sent to you directly from other users on this site.'; -$string['messageselect'] = 'Select this user as an email recipient'; -$string['messageselectadd'] = 'Add / send message'; +$string['messageselect'] = 'Select this user as a message recipient'; +$string['messageselectadd'] = 'Send a message'; $string['migratinggrades'] = 'Migrating grades'; $string['min'] = 'min'; $string['mins'] = 'mins'; @@ -1766,7 +1766,7 @@ $string['windowclosing'] = 'This window should close automatically. If not, plea $string['withchosenfiles'] = 'With chosen files'; $string['withoutuserdata'] = 'without user data'; $string['withselectedusers'] = 'With selected users...'; -$string['withselectedusers_help'] = '* Add / send message - For sending a message to one or more participants +$string['withselectedusers_help'] = '* Send message - For sending a message to one or more participants * Add a new note - For adding a note to a selected participant * Add a common note - For adding the same note to more than one participant * Extend enrolment (individual) - For extending a selected student\'s access to the course, even when an enrolment period is set diff --git a/theme/base/style/user.css b/theme/base/style/user.css index c47f881a950..600d0d44e47 100644 --- a/theme/base/style/user.css +++ b/theme/base/style/user.css @@ -40,3 +40,4 @@ .userselector div label {margin-right: 0.3em;} #userselector_options .collapsibleregioncaption {font-weight: bold;} #userselector_options p {margin:0.2em 0;text-align:left;} +#page-user-profile .messagebox {text-align:center;margin-left:auto;margin-right:auto;} diff --git a/theme/standard/style/core.css b/theme/standard/style/core.css index 360816c932a..88c139c155c 100644 --- a/theme/standard/style/core.css +++ b/theme/standard/style/core.css @@ -201,6 +201,7 @@ form.popupform label {margin-right: 0.5em;} #page-user-index #longtimenosee, #page-user-index #showall {text-align: center;} #page-user-profile .remoteuserinfo, #page-user-view .remoteuserinfo{background-color:#D2EBFF;text-align:center;padding:3px;} +#page-user-profile .messagebox {text-align:center;margin-left:auto;margin-right:auto;padding:5px;} /** * Moodle Forms @@ -441,4 +442,4 @@ table#tag-management-list {margin: 10px auto;width: 80%;} .path-enrol .enrolusersbutton, .path-enrol .enrolcohortbutton {float:left;} .path-enrol .enrolusersbutton.instance1, -.path-enrol .enrolcohortbutton.instance1 {float:right;} \ No newline at end of file +.path-enrol .enrolcohortbutton.instance1 {float:right;} diff --git a/user/profile.php b/user/profile.php index 584f9cab67a..18936adc8df 100644 --- a/user/profile.php +++ b/user/profile.php @@ -215,6 +215,7 @@ if ($user->description && !isset($hiddenfields['description'])) { } echo ''; + // Print all the little details in a list echo ''; @@ -371,6 +372,14 @@ echo "
"; echo $OUTPUT->blocks_for_region('content'); +// Print messaging link if allowed +if (isloggedin() && has_capability('moodle/site:sendmessage', $context) + && !empty($CFG->messaging) && !isguestuser() && ($user->username != 'guest') && ($USER->id != $user->id)) { + echo '
'; + echo ''.get_string('messageselectadd').''; + echo '
'; +} + if ($CFG->debugdisplay && debugging('', DEBUG_DEVELOPER) && $currentuser) { // Show user object echo '


'; echo $OUTPUT->heading('DEBUG MODE: User session variables');