Commit 3623da12 authored by Nigel McNie's avatar Nigel McNie
Browse files

Add a link to the profile sideblock that says where you came from if you're an...

Add a link to the profile sideblock that says where you came from if you're an MNET user, and gives you the ability to jump back there.

Conflicts:

	htdocs/auth/xmlrpc/lang/en.utf8/auth.xmlrpc.php
parent 81f13973
......@@ -29,5 +29,7 @@ defined('INTERNAL') || die();
$string['title'] = 'XMLRPC';
$string['description'] = 'Authenticate by SSO from an external application';
$string['notusable'] = 'Please install the XMLRPC, Curl and OpenSSL PHP extensions';
$string['networkingdisabledonthissite'] = 'Networking is disabled on this site';
$string['youhaveloggedinfrom'] = 'You have logged in from <a href="%s">%s</a>.';
?>
......@@ -100,7 +100,7 @@ class AuthXmlrpc extends Auth {
* Grab a delegate object for auth stuff
*/
public function request_user_authorise($token, $remotewwwroot) {
global $USER;
global $USER, $SESSION;
$this->must_be_ready();
$peer = get_peer($remotewwwroot);
......@@ -366,6 +366,9 @@ class AuthXmlrpc extends Auth {
// We know who our user is now. Bring her back to life.
$USER->reanimate($user->id, $this->instanceid);
$SESSION->set('mnetuser', true);
$SESSION->set('mnetwwwroot', $peer->wwwroot);
$SESSION->set('mnetsitename', $peer->name);
return true;
}
......
......@@ -1784,13 +1784,18 @@ function display_size($size) {
* creates the profile sideblock
*/
function profile_sideblock() {
global $USER;
global $USER, $SESSION;
safe_require('notification', 'internal');
require_once('group.php');
$data = array(
'id' => $USER->get('id'),
'id' => $USER->get('id'),
'profileicon' => $USER->get('profileicon') ? $USER->get('profileicon') : 0,
);
if ($SESSION->get('mnetuser')) {
$data['mnetloggedinfrom'] = get_string('youhaveloggedinfrom', 'auth.xmlrpc',
$SESSION->get('mnetwwwroot'), $SESSION->get('mnetsitename'));
}
$data['unreadnotifications'] = call_static_method(generate_class_name('notification', 'internal'), 'unread_count', $USER->get('id'));
$data['unreadnotificationsmessage'] = $data['unreadnotifications'] == 1 ? get_string('unreadmessage') : get_string('unreadmessages');
$invitedgroups = get_invited_groups();
......
<h3><a href="{$WWWROOT}user/view.php?id={$data.id}">{$data.id|display_name|escape}</a></h3>
<div class="fr"><a href="{$WWWROOT}user/view.php?id={$data.id}"><div class="center" style="width: 50px; height: 50px;"><img src="{$WWWROOT}thumb.php?type=profileiconbyid&amp;maxwidth=50&amp;maxheight=50&amp;id={$data.profileicon}" alt=""></div></a></div>
{if $data.mnetloggedinfrom}<p>{$data.mnetloggedinfrom}</p>{/if}
<ul class="sidebar-ul-title">
{if $data.unreadnotifications}
<li>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment