ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
ilObjiLincUser Class Reference

Class ilObjiLincUser iLinc related user settings. More...

+ Collaboration diagram for ilObjiLincUser:

Public Member Functions

 ilObjiLincUser (&$a_user_obj, $a_from_ilinc='false')
 Constructor @access public. More...
 
 __init (&$a_from_ilinc)
 
 update ()
 updates ilinc data of a record "user" and write it into ILIAS database @access public More...
 
 syncILIAS2iLinc ()
 
 synciLinc2ILIAS ()
 
 getErrorMsg ()
 
 __createLoginData ($a_user_id, $a_user_login, $a_inst_id)
 creates login and password for ilinc login format is: <first 3 letter of ilias login> _ <user_id> _ <inst_id> _ <timestamp> some characters are not allowed in login in ilinc. More...
 
 add ()
 
 edit ()
 
 find ($a_id='', $a_login='', $a_fullname='')
 find user account on iLinc server Returns one user recordset, if an userid is given or returns a list of all the users that match a specified keyword, if a keyword in loginname or fullname is given in the order userid, loginname, fullname. More...
 
 setVar ($a_varname, $a_value)
 

Detailed Description

Class ilObjiLincUser iLinc related user settings.

Author
Sascha Hofmann sasch.nosp@m.ahof.nosp@m.mann@.nosp@m.gmx..nosp@m.de
Version
$Id$

Definition at line 35 of file class.ilObjiLincUser.php.

Member Function Documentation

◆ __createLoginData()

ilObjiLincUser::__createLoginData (   $a_user_id,
  $a_user_login,
  $a_inst_id 
)

creates login and password for ilinc login format is: <first 3 letter of ilias login> _ <user_id> _ <inst_id> _ <timestamp> some characters are not allowed in login in ilinc.

These chars will be converted to <underscore> passwd format is a random md5 hash

Definition at line 125 of file class.ilObjiLincUser.php.

126 {
127 if (!$a_inst_id)
128 {
129 $a_inst_id = "0";
130 }
131
132 $chars = preg_split('//', substr($a_user_login,0,3), -1, PREG_SPLIT_NO_EMPTY);
133 //$chars = str_split(substr($a_user_login,0,3)); // PHP5 only
134
135 // convert non-allowed chars in login to <underscore>
136 // not allowed: ~!@#$%^&*()`-=+[]{};:'\|/?<>,
137 $result = preg_replace('@[^a-zA-Z0-9_]@','_',$chars);
138
139 $data["login"] = $result."_".$a_user_id."_".$a_inst_id."_".time();
140 $data["passwd"] = md5(microtime().$a_user_login.rand(10000, 32000));
141
142 $this->id = '';
143 $this->login = $data['login'];
144 $this->passwd = $data['passwd'];
145
146 return $data;
147 }
$result

References $data, and $result.

Referenced by add().

+ Here is the caller graph for this function:

◆ __init()

ilObjiLincUser::__init ( $a_from_ilinc)

Definition at line 53 of file class.ilObjiLincUser.php.

54 {
55 global $ilErr, $ilDB;
56
57 $r = $ilDB->queryf('
58 SELECT ilinc_id, ilinc_login, ilinc_passwd FROM usr_data
59 WHERE usr_data.usr_id = %s',
60 array('integer'),
61 array($this->user->getId()));
62
63 if ($ilDB->numRows($r) > 0)
64 {
65 $data = $ilDB->fetchAssoc($r);
66
67 $this->id = $data['ilinc_id'];
68 $this->login = $data['ilinc_login'];
69 $this->passwd = $data['ilinc_passwd'];
70 }
71 else
72 {
73 $ilErr->raiseError("<b>Error: There is no dataset with id ".
74 $this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__.
75 "<br />Line: ".__LINE__, $ilErr->FATAL);
76 }
77 }
global $ilDB

References $data, $ilDB, and $ilErr.

Referenced by ilObjiLincUser().

+ Here is the caller graph for this function:

◆ add()

ilObjiLincUser::add ( )

Definition at line 150 of file class.ilObjiLincUser.php.

151 {
152 include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
153
154 $this->ilincAPI = new ilnetucateXMLAPI();
155
156 // create login and passwd for iLinc account
157 $login_data = $this->__createLoginData($this->user->getId(),$this->user->getLogin(),$this->ilias->getSetting($inst_id));
158
159 //$this->ilincAPI->addUser($login_data,$this->user);
160 $this->ilincAPI->addUser($this);
161 $response = $this->ilincAPI->sendRequest();
162
163 if ($response->isError())
164 {
165 if (!$response->getErrorMsg())
166 {
167 $this->error_msg = "err_add_user";
168 }
169 else
170 {
171 $this->error_msg = $response->getErrorMsg();
172 }
173
174 return false;
175 }
176
177 $this->id = $response->getFirstID();
178 $this->login = $login_data["login"];
179 $this->passwd = $login_data["passwd"];
180
181 $this->update();
182
183 return true;
184 }
__createLoginData($a_user_id, $a_user_login, $a_inst_id)
creates login and password for ilinc login format is: <first 3 letter of ilias login> _ <user_id> _ <...
update()
updates ilinc data of a record "user" and write it into ILIAS database @access public
API to communicate with a the CMSAPI of centra (c) Sascha Hofmann, 2004.

References __createLoginData(), and update().

+ Here is the call graph for this function:

◆ edit()

ilObjiLincUser::edit ( )

Definition at line 187 of file class.ilObjiLincUser.php.

188 {
189 include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
190
191 $this->ilincAPI = new ilnetucateXMLAPI();
192
193 //$this->ilincAPI->addUser($login_data,$this->user);
194 $this->ilincAPI->editUser($this);
195 $response = $this->ilincAPI->sendRequest();
196
197 if ($response->isError())
198 {
199 if (!$response->getErrorMsg())
200 {
201 $this->error_msg = "err_edit_user";
202 }
203 else
204 {
205 $this->error_msg = $response->getErrorMsg();
206 }
207
208 return false;
209 }
210
211 return true;
212 }

◆ find()

ilObjiLincUser::find (   $a_id = '',
  $a_login = '',
  $a_fullname = '' 
)

find user account on iLinc server Returns one user recordset, if an userid is given or returns a list of all the users that match a specified keyword, if a keyword in loginname or fullname is given in the order userid, loginname, fullname.

Returns the recordsets of all users, if all attribut values are empty

@access public

Parameters
integerilinc_user_id
stringilinc_login
stringilinc_fullname
Returns
boolean/array false on error; array of found user record(s)

Definition at line 227 of file class.ilObjiLincUser.php.

228 {
229 include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
230
231 $this->ilincAPI = new ilnetucateXMLAPI();
232
233 $this->ilincAPI->findUser($a_id,$a_login,$a_fullname);
234 $response = $this->ilincAPI->sendRequest();
235
236 if ($response->isError())
237 {
238 if (!$response->getErrorMsg())
239 {
240 $this->error_msg = "err_find_user";
241 }
242 else
243 {
244 $this->error_msg = $response->getErrorMsg();
245 }
246
247 return false;
248 }
249
250 return $response->data;
251 }

◆ getErrorMsg()

ilObjiLincUser::getErrorMsg ( )

Definition at line 110 of file class.ilObjiLincUser.php.

111 {
112 $err_msg = $this->error_msg;
113 $this->error_msg = "";
114
115 return $err_msg;
116 }

◆ ilObjiLincUser()

ilObjiLincUser::ilObjiLincUser ( $a_user_obj,
  $a_from_ilinc = 'false' 
)

Constructor @access public.

Parameters
objectilias user

Definition at line 42 of file class.ilObjiLincUser.php.

43 {
44 global $ilias,$lng;
45
46 $this->ilias =& $ilias;
47 $this->lng =& $lng;
48 $this->user =& $a_user_obj;
49
50 $this->__init($a_from_ilinc);
51 }
__init(&$a_from_ilinc)
redirection script todo: (a better solution should control the processing via a xml file)
global $lng
Definition: privfeed.php:40

References $lng, and __init().

+ Here is the call graph for this function:

◆ setVar()

ilObjiLincUser::setVar (   $a_varname,
  $a_value 
)

Definition at line 253 of file class.ilObjiLincUser.php.

254 {
255 $this->$a_varname = $a_value;
256 }

◆ syncILIAS2iLinc()

ilObjiLincUser::syncILIAS2iLinc ( )

Definition at line 100 of file class.ilObjiLincUser.php.

101 {
102 // for future use
103 }

◆ synciLinc2ILIAS()

ilObjiLincUser::synciLinc2ILIAS ( )

Definition at line 105 of file class.ilObjiLincUser.php.

106 {
107 // for future use
108 }

◆ update()

ilObjiLincUser::update ( )

updates ilinc data of a record "user" and write it into ILIAS database @access public

Definition at line 83 of file class.ilObjiLincUser.php.

84 {
85 global $ilDB;
86
87 $statement = $ilDB->manipulateF('
88 UPDATE usr_data
89 SET last_update = %s,
90 ilinc_id = %s,
91 ilinc_login = %s,
92 ilinc_passwd = %s
93 WHERE usr_id = %s',
94 array('timestamp', 'integer', 'text', 'text', 'integer'),
95 array(date('Y-m-d H:i:s', time()), $this->id, $this->login, $this->passwd, $this->user->getId()));
96
97 return true;
98 }

References $ilDB.

Referenced by add().

+ Here is the caller graph for this function:

The documentation for this class was generated from the following file: