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).
This commit is contained in:
David Mudrak 2010-07-01 12:56:31 +00:00
parent d992f53d8c
commit 5db29f49f2
5 changed files with 21 additions and 35 deletions

View file

@ -184,25 +184,18 @@ echo '<div class="userprofile">';
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 '<p class="errorboxcontent">'.get_string('remoteappuser', $remotehost->application)." <br />\n";
if ($currentuser) {
if ($remotehost->application =='moodle') {
echo "Remote {$remotehost->display_name}: <a href=\"{$remotehost->wwwroot}/user/edit.php\">{$remotehost->name}</a> ".get_string('editremoteprofile')." </p>\n";
} else {
echo "Remote {$remotehost->display_name}: <a href=\"{$remotehost->wwwroot}/\">{$remotehost->name}</a> ".get_string('gotoyourserver')." </p>\n";
}
} else {
echo "Remote {$remotehost->display_name}: <a href=\"{$remotehost->wwwroot}/\">{$remotehost->name}</a></p>\n";
}
echo $OUTPUT->box(get_string('remoteuserinfo', 'mnet', $a), 'remoteuserinfo');
}
echo '<div class="userprofilebox clearfix"><div class="profilepicture">';

View file

@ -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 '<p class="errorboxcontent">'.get_string('remoteappuser', $remotehost->application)." <br />\n";
if ($currentuser) {
if ($remotehost->application =='moodle') {
echo "Remote {$remotehost->display_name}: <a href=\"{$remotehost->wwwroot}/user/edit.php\">{$remotehost->name}</a> ".get_string('editremoteprofile')." </p>\n";
} else {
echo "Remote {$remotehost->display_name}: <a href=\"{$remotehost->wwwroot}/\">{$remotehost->name}</a> ".get_string('gotoyourserver')." </p>\n";
}
} else {
echo "Remote {$remotehost->display_name}: <a href=\"{$remotehost->wwwroot}/\">{$remotehost->name}</a></p>\n";
}
echo $OUTPUT->box(get_string('remoteuserinfo', 'mnet', $a), 'remoteuserinfo');
}
echo '<div class="userprofilebox clearfix"><div class="profilepicture">';