From 5db29f49f22a69104f84607b1d6a4ac47bad4a6f Mon Sep 17 00:00:00 2001 From: David Mudrak Date: Thu, 1 Jul 2010 12:56:31 +0000 Subject: [PATCH] MNet: Fixed remote user profile display Fixed SQL, strings usage, CSS class. In the future, we can distinguish information displayed for the owner and for the others, as well as what to display in the course profile (user/view.php) and public profile (user/profile.php). --- lang/en/mnet.php | 1 + lang/en/moodle.php | 2 -- theme/standard/style/core.css | 3 ++- user/profile.php | 25 +++++++++---------------- user/view.php | 25 +++++++++---------------- 5 files changed, 21 insertions(+), 35 deletions(-) diff --git a/lang/en/mnet.php b/lang/en/mnet.php index b5a46d30446..aa98b3d4090 100644 --- a/lang/en/mnet.php +++ b/lang/en/mnet.php @@ -210,6 +210,7 @@ $string['remoteenrolhosts_desc'] = 'Enrol and unenrol users from your Moodle ins $string['remotehost'] = 'Remote Hub'; $string['remotehosts'] = 'Remote hosts'; $string['remotemoodles'] = 'Remote Moodles'; +$string['remoteuserinfo'] = 'Remote {$a->remotetype} user - profile fetched from {$a->remotename}'; $string['requiresopenssl'] = 'Networking requires the OpenSSL extension'; $string['restore'] = 'Restore'; $string['returnvalue'] = 'Return value'; diff --git a/lang/en/moodle.php b/lang/en/moodle.php index 80d1a20cb0a..8024ec9cf01 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -491,7 +491,6 @@ $string['editorfontsize'] = 'Default font-size'; $string['editorresettodefaults'] = 'Reset to default values'; $string['editorsettings'] = 'Editor settings'; $string['editorshortcutkeys'] = 'Editor shortcut keys'; -$string['editremoteprofile'] = 'Edit remote profile'; $string['editsummary'] = 'Edit summary'; $string['editthisactivity'] = 'Edit this activity'; $string['editthiscategory'] = 'Edit this category'; @@ -723,7 +722,6 @@ $string['general'] = 'General'; $string['geolocation'] = 'latitude - longitude'; $string['gettheselogs'] = 'Get these logs'; $string['go'] = 'Go'; -$string['gotoyourserver'] = '(Links back to your server)'; $string['gpl'] = 'Copyright (C) 1999 onwards Martin Dougiamas (http://moodle.com) This program is free software; you can redistribute it and/or modify diff --git a/theme/standard/style/core.css b/theme/standard/style/core.css index 2833214ce0e..7df5f5a1cb6 100644 --- a/theme/standard/style/core.css +++ b/theme/standard/style/core.css @@ -186,7 +186,7 @@ form.popupform label {margin-right: 0.5em;} .arrow_button {margin-top:3em;} .arrow_button input {padding:0.3em;} -/** +/** * User **/ #userselector_options {font-size: 0.75em;} @@ -200,6 +200,7 @@ form.popupform label {margin-right: 0.5em;} #page-user-index h2 {text-align: center;} #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;} /** * Moodle Forms diff --git a/user/profile.php b/user/profile.php index aa439f3f55d..bd158289ecd 100644 --- a/user/profile.php +++ b/user/profile.php @@ -184,25 +184,18 @@ echo '
'; echo $OUTPUT->heading(fullname($user)); if (is_mnet_remote_user($user)) { - $sql = " - SELECT DISTINCT h.id, h.name, h.wwwroot, - a.name as application, a.display_name - FROM {mnet_host} h, {mnet_application} a - WHERE h.id = ? AND h.applicationid = a.id - ORDER BY a.display_name, h.name"; + $sql = "SELECT h.id, h.name, h.wwwroot, + a.name as application, a.display_name + FROM {mnet_host} h, {mnet_application} a + WHERE h.id = ? AND h.applicationid = a.id"; $remotehost = $DB->get_record_sql($sql, array($user->mnethostid)); + $a = new stdclass(); + $a->remotetype = $remotehost->display_name; + $a->remotename = $remotehost->name; + $a->remoteurl = $remotehost->wwwroot; - echo '

'.get_string('remoteappuser', $remotehost->application)."
\n"; - if ($currentuser) { - if ($remotehost->application =='moodle') { - echo "Remote {$remotehost->display_name}: wwwroot}/user/edit.php\">{$remotehost->name} ".get_string('editremoteprofile')."

\n"; - } else { - echo "Remote {$remotehost->display_name}: wwwroot}/\">{$remotehost->name} ".get_string('gotoyourserver')."

\n"; - } - } else { - echo "Remote {$remotehost->display_name}: wwwroot}/\">{$remotehost->name}

\n"; - } + echo $OUTPUT->box(get_string('remoteuserinfo', 'mnet', $a), 'remoteuserinfo'); } echo '
'; diff --git a/user/view.php b/user/view.php index 79be3cf8d0d..2d09615867d 100644 --- a/user/view.php +++ b/user/view.php @@ -190,25 +190,18 @@ if (has_capability('moodle/user:viewhiddendetails', $coursecontext)) { } if (is_mnet_remote_user($user)) { - $sql = " - SELECT DISTINCT h.id, h.name, h.wwwroot, - a.name as application, a.display_name - FROM {mnet_host} h, {mnet_application} a - WHERE h.id = ? AND h.applicationid = a.id - ORDER BY a.display_name, h.name"; + $sql = "SELECT h.id, h.name, h.wwwroot, + a.name as application, a.display_name + FROM {mnet_host} h, {mnet_application} a + WHERE h.id = ? AND h.applicationid = a.id"; $remotehost = $DB->get_record_sql($sql, array($user->mnethostid)); + $a = new stdclass(); + $a->remotetype = $remotehost->display_name; + $a->remotename = $remotehost->name; + $a->remoteurl = $remotehost->wwwroot; - echo '

'.get_string('remoteappuser', $remotehost->application)."
\n"; - if ($currentuser) { - if ($remotehost->application =='moodle') { - echo "Remote {$remotehost->display_name}: wwwroot}/user/edit.php\">{$remotehost->name} ".get_string('editremoteprofile')."

\n"; - } else { - echo "Remote {$remotehost->display_name}: wwwroot}/\">{$remotehost->name} ".get_string('gotoyourserver')."

\n"; - } - } else { - echo "Remote {$remotehost->display_name}: wwwroot}/\">{$remotehost->name}

\n"; - } + echo $OUTPUT->box(get_string('remoteuserinfo', 'mnet', $a), 'remoteuserinfo'); } echo '
';