ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilECSUser.php
Go to the documentation of this file.
1<?php
2/*
3 +-----------------------------------------------------------------------------+
4 | ILIAS open source |
5 +-----------------------------------------------------------------------------+
6 | Copyright (c) 1998-2006 ILIAS open source, University of Cologne |
7 | |
8 | This program is free software; you can redistribute it and/or |
9 | modify it under the terms of the GNU General Public License |
10 | as published by the Free Software Foundation; either version 2 |
11 | of the License, or (at your option) any later version. |
12 | |
13 | This program is distributed in the hope that it will be useful, |
14 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | GNU General Public License for more details. |
17 | |
18 | You should have received a copy of the GNU General Public License |
19 | along with this program; if not, write to the Free Software |
20 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21 +-----------------------------------------------------------------------------+
22*/
23
36{
37 protected $source;
38
39 public $login;
40 public $email;
41 public $firstname;
42 public $lastname;
44 public $uid_hash;
45
52 public function __construct($a_data)
53 {
54 $this->source = $a_data;
55 if (is_object($a_data)) {
56 $this->loadFromObject();
57 } elseif (is_array($a_data)) {
58 $this->loadFromGET();
59 } else {
60 $this->loadFromJSON();
61 }
62 }
63
70 public function getLogin()
71 {
72 return $this->login;
73 }
74
81 public function getFirstname()
82 {
83 return $this->firstname;
84 }
85
91 public function getLastname()
92 {
93 return $this->lastname;
94 }
95
101 public function getEmail()
102 {
103 return $this->email;
104 }
111 public function getInstitution()
112 {
113 return $this->institution;
114 }
115
122 public function getImportId()
123 {
124 return $this->uid_hash;
125 }
126
133 public function loadFromObject()
134 {
135 global $DIC;
136
137 $ilSetting = $DIC['ilSetting'];
138
139 $this->login = $this->source->getLogin();
140 $this->firstname = $this->source->getFirstname();
141 $this->lastname = $this->source->getLastname();
142 $this->email = $this->source->getEmail();
143 $this->institution = $this->source->getInstitution();
144
145 $this->uid_hash = 'il_' . $ilSetting->get('inst_id', 0) . '_usr_' . $this->source->getId();
146 }
147
154 public function loadFromJSON()
155 {
156 $this->source = json_decode(urldecode($this->source));
157
158 $this->login = $this->source->login();
159 $this->firstname = $this->source->firstname();
160 $this->lastname = $this->source->lastname();
161 $this->email = $this->source->email();
162 $this->institution = $this->source->institution();
163
164 $this->uid_hash = $this->source->uid_hash;
165 }
166
173 public function loadFromGET()
174 {
175 $this->login = ilUtil::stripSlashes(urldecode($_GET['ecs_login']));
176 $this->firstname = ilUtil::stripSlashes(urldecode($_GET['ecs_firstname']));
177 $this->lastname = ilUtil::stripSlashes(urldecode($_GET['ecs_lastname']));
178 $this->email = ilUtil::stripSlashes(urldecode($_GET['ecs_email']));
179 $this->institution = ilUtil::stripSlashes(urldecode($_GET['ecs_institution']));
180
181 if ($_GET['ecs_uid_hash']) {
182 $this->uid_hash = ilUtil::stripSlashes(urldecode($_GET['ecs_uid_hash']));
183 } elseif ($_GET['ecs_uid']) {
184 $this->uid_hash = ilUtil::stripSlashes(urldecode($_GET['ecs_uid']));
185 }
186 }
187
195 public function toJSON()
196 {
197 return urlencode(json_encode($this));
198 }
199
206 public function toGET()
207 {
208 return '&ecs_login=' . urlencode((string) $this->login) .
209 '&ecs_firstname=' . urlencode((string) $this->firstname) .
210 '&ecs_lastname=' . urlencode((string) $this->lastname) .
211 '&ecs_email=' . urlencode((string) $this->email) .
212 '&ecs_institution=' . urlencode((string) $this->institution) .
213 '&ecs_uid_hash=' . urlencode((string) $this->uid_hash);
214 '&ecs_uid=' . urlencode((string) $this->uid_hash);
215 }
216
221 public function toREALM()
222 {
223 return
224 (string) $this->login . '' .
225 (string) $this->firstname . '' .
226 (string) $this->lastname . '' .
227 (string) $this->email . '' .
228 (string) $this->institution . '' .
229 (string) $this->uid_hash;
230 }
231}
$_GET["client_id"]
An exception for terminatinating execution or to throw for unit testing.
Stores relevant user data.
loadFromObject()
load from object
getFirstname()
get firstname
getLastname()
getLastname
getLogin()
get login
loadFromGET()
load user data from GET parameters
toREALM()
Concatenate all attributes to one string.
getImportId()
get Email
loadFromJSON()
load from json
toGET()
get GET parameter string
__construct($a_data)
Constructor.
getEmail()
get email
getInstitution()
get institution
toJSON()
@access public
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
global $ilSetting
Definition: privfeed.php:17
login()
Definition: login.php:2
$DIC
Definition: xapitoken.php:46