Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
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).
  • Loading branch information
mudrd8mz committed Jul 1, 2010
1 parent d992f53 commit 5db29f4
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 35 deletions.
1 change: 1 addition & 0 deletions lang/en/mnet.php
Expand Up @@ -210,6 +210,7 @@
$string['remotehost'] = 'Remote Hub';
$string['remotehosts'] = 'Remote hosts';
$string['remotemoodles'] = 'Remote Moodles';
$string['remoteuserinfo'] = 'Remote {$a->remotetype} user - profile fetched from <a href="{$a->remoteurl}">{$a->remotename}</a>';
$string['requiresopenssl'] = 'Networking requires the OpenSSL extension';
$string['restore'] = 'Restore';
$string['returnvalue'] = 'Return value';
Expand Down
2 changes: 0 additions & 2 deletions lang/en/moodle.php
Expand Up @@ -491,7 +491,6 @@
$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';
Expand Down Expand Up @@ -723,7 +722,6 @@
$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
Expand Down
3 changes: 2 additions & 1 deletion theme/standard/style/core.css
Expand Up @@ -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;}
Expand All @@ -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
Expand Down
25 changes: 9 additions & 16 deletions user/profile.php
Expand Up @@ -184,25 +184,18 @@
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">';
Expand Down
25 changes: 9 additions & 16 deletions user/view.php
Expand Up @@ -190,25 +190,18 @@
}

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">';
Expand Down

0 comments on commit 5db29f4

Please sign in to comment.