Class ilObjiLincUser iLinc related user settings. More...
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) | |
Class ilObjiLincUser iLinc related user settings.
Definition at line 35 of file class.ilObjiLincUser.php.
| 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 122 of file class.ilObjiLincUser.php.
References $data, and login().
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 call graph for this function:
Here is the caller graph for this function:| ilObjiLincUser::__init | ( | &$ | a_from_ilinc | ) |
Definition at line 53 of file class.ilObjiLincUser.php.
References $data, $ilErr, and login().
Referenced by ilObjiLincUser().
{
global $ilErr, $ilDB;
$q = "SELECT ilinc_id,ilinc_login,ilinc_passwd FROM usr_data ".
"WHERE usr_data.usr_id = ".$ilDB->quote($this->user->getId());
$r = $ilDB->query($q);
if ($r->numRows() > 0)
{
$data = $r->fetchRow(DB_FETCHMODE_ASSOC);
$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 call graph for this function:
Here is the caller graph for this function:| ilObjiLincUser::add | ( | ) |
Definition at line 147 of file class.ilObjiLincUser.php.
References __createLoginData(), login(), and update().
{
include_once ('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 184 of file class.ilObjiLincUser.php.
{
include_once ('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
| integer | ilinc_user_id | |
| string | ilinc_login | |
| string | ilinc_fullname |
Definition at line 224 of file class.ilObjiLincUser.php.
{
include_once ('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 107 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.
| object | ilias user |
Definition at line 42 of file class.ilObjiLincUser.php.
References $ilias, $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 250 of file class.ilObjiLincUser.php.
{
$this->$a_varname = $a_value;
}
| ilObjiLincUser::syncILIAS2iLinc | ( | ) |
Definition at line 97 of file class.ilObjiLincUser.php.
{
// for future use
}
| ilObjiLincUser::synciLinc2ILIAS | ( | ) |
Definition at line 102 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 81 of file class.ilObjiLincUser.php.
References login(), and ilUtil::prepareDBString().
Referenced by add().
{
global $ilDB;
$q = "UPDATE usr_data SET ".
"last_update=now(), ".
"ilinc_id = ".$ilDB->quote(ilUtil::prepareDBString($this->id)).", ".
"ilinc_login = ".$ilDB->quote(ilUtil::prepareDBString($this->login)).", ".
"ilinc_passwd = ".$ilDB->quote(ilUtil::prepareDBString($this->passwd))." ".
"WHERE usr_id = ".$ilDB->quote($this->user->getId());
$this->ilias->db->query($q);
return true;
}
Here is the call graph for this function:
Here is the caller graph for this function:
1.7.1