ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
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 public.
 __init (&$a_from_ilinc)
 update ()
 updates ilinc data of a record "user" and write it into ILIAS database public
 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.
 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.
 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:
class.ilObjiLincUser.php 20430 2009-07-06 09:33:20Z nkrzywon

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

Member Function Documentation

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.

References $data, and $result.

Referenced by add().

{
if (!$a_inst_id)
{
$a_inst_id = "0";
}
$chars = preg_split('//', substr($a_user_login,0,3), -1, PREG_SPLIT_NO_EMPTY);
//$chars = str_split(substr($a_user_login,0,3)); // PHP5 only
// convert non-allowed chars in login to <underscore>
// not allowed: ~!@#$%^&*()`-=+[]{};:'\|/?<>,
$result = preg_replace('@[^a-zA-Z0-9_]@','_',$chars);
$data["login"] = $result."_".$a_user_id."_".$a_inst_id."_".time();
$data["passwd"] = md5(microtime().$a_user_login.rand(10000, 32000));
$this->id = '';
$this->login = $data['login'];
$this->passwd = $data['passwd'];
return $data;
}

+ Here is the caller graph for this function:

ilObjiLincUser::__init ( $a_from_ilinc)

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

References $data, $ilDB, and $ilErr.

Referenced by ilObjiLincUser().

{
global $ilErr, $ilDB;
$r = $ilDB->queryf('
SELECT ilinc_id, ilinc_login, ilinc_passwd FROM usr_data
WHERE usr_data.usr_id = %s',
array('integer'),
array($this->user->getId()));
if ($ilDB->numRows($r) > 0)
{
$data = $ilDB->fetchAssoc($r);
$this->id = $data['ilinc_id'];
$this->login = $data['ilinc_login'];
$this->passwd = $data['ilinc_passwd'];
}
else
{
$ilErr->raiseError("<b>Error: There is no dataset with id ".
$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__.
"<br />Line: ".__LINE__, $ilErr->FATAL);
}
}

+ Here is the caller graph for this function:

ilObjiLincUser::add ( )

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

References __createLoginData(), and update().

{
include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
$this->ilincAPI = new ilnetucateXMLAPI();
// create login and passwd for iLinc account
$login_data = $this->__createLoginData($this->user->getId(),$this->user->getLogin(),$this->ilias->getSetting($inst_id));
//$this->ilincAPI->addUser($login_data,$this->user);
$this->ilincAPI->addUser($this);
$response = $this->ilincAPI->sendRequest();
if ($response->isError())
{
if (!$response->getErrorMsg())
{
$this->error_msg = "err_add_user";
}
else
{
$this->error_msg = $response->getErrorMsg();
}
return false;
}
$this->id = $response->getFirstID();
$this->login = $login_data["login"];
$this->passwd = $login_data["passwd"];
$this->update();
return true;
}

+ Here is the call graph for this function:

ilObjiLincUser::edit ( )

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

{
include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
$this->ilincAPI = new ilnetucateXMLAPI();
//$this->ilincAPI->addUser($login_data,$this->user);
$this->ilincAPI->editUser($this);
$response = $this->ilincAPI->sendRequest();
if ($response->isError())
{
if (!$response->getErrorMsg())
{
$this->error_msg = "err_edit_user";
}
else
{
$this->error_msg = $response->getErrorMsg();
}
return false;
}
return true;
}
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

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.

{
include_once ('./Modules/ILinc/classes/class.ilnetucateXMLAPI.php');
$this->ilincAPI = new ilnetucateXMLAPI();
$this->ilincAPI->findUser($a_id,$a_login,$a_fullname);
$response = $this->ilincAPI->sendRequest();
if ($response->isError())
{
if (!$response->getErrorMsg())
{
$this->error_msg = "err_find_user";
}
else
{
$this->error_msg = $response->getErrorMsg();
}
return false;
}
return $response->data;
}
ilObjiLincUser::getErrorMsg ( )

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

{
$err_msg = $this->error_msg;
$this->error_msg = "";
return $err_msg;
}
ilObjiLincUser::ilObjiLincUser ( $a_user_obj,
  $a_from_ilinc = 'false' 
)

Constructor public.

Parameters
objectilias user

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

References $lng, and __init().

{
global $ilias,$lng;
$this->ilias =& $ilias;
$this->lng =& $lng;
$this->user =& $a_user_obj;
$this->__init($a_from_ilinc);
}

+ Here is the call graph for this function:

ilObjiLincUser::setVar (   $a_varname,
  $a_value 
)

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

{
$this->$a_varname = $a_value;
}
ilObjiLincUser::syncILIAS2iLinc ( )

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

{
// for future use
}
ilObjiLincUser::synciLinc2ILIAS ( )

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

{
// for future use
}
ilObjiLincUser::update ( )

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

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

References $ilDB.

Referenced by add().

{
global $ilDB;
$statement = $ilDB->manipulateF('
UPDATE usr_data
SET last_update = %s,
ilinc_id = %s,
ilinc_login = %s,
ilinc_passwd = %s
WHERE usr_id = %s',
array('timestamp', 'integer', 'text', 'text', 'integer'),
array(date('Y-m-d H:i:s', time()), $this->id, $this->login, $this->passwd, $this->user->getId()));
return true;
}

+ Here is the caller graph for this function:


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