本文整理汇总了PHP中ilObjUser::getEmail方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser::getEmail方法的具体用法?PHP ilObjUser::getEmail怎么用?PHP ilObjUser::getEmail使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjUser
的用法示例。
在下文中一共展示了ilObjUser::getEmail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generateUsers
/**
* Generate Users
*
* @param
* @return
*/
function generateUsers($a_login_base = "learner", $a_start = 1, $a_end = 1000, $a_firstname = "John", $a_lastname_base = "Learner", $a_pw = "learnerpw", $a_email = "de@de.de", $a_gender = "m", $a_lang = "en")
{
global $rbacadmin;
// new users
$this->log("Creating Users");
for ($i = $a_start; $i <= $a_end; $i++) {
$this->log($a_login_base . $i);
$user = new ilObjUser();
$user->setLogin($a_login_base . $i);
$user->setFirstname($a_firstname);
$user->setLastname($a_lastname_base . " " . $i);
$user->setGender($a_gender);
$user->setEmail($a_email);
$user->setAgreeDate(ilUtil::now());
$user->setPasswd($a_pw, IL_PASSWD_PLAIN);
$user->setTitle($user->getFullname());
$user->setDescription($user->getEmail());
$user->setLastPasswordChangeTS(time());
$user->setActive(true);
$user->setTimeLimitUnlimited(true);
$user->create();
$user->setLanguage($a_lang);
$user->saveAsNew(false);
$user->writePrefs();
$rbacadmin->assignUser(4, $user->getId(), true);
}
}
示例2: userDataArrayForExport
function userDataArrayForExport($user, $b_allowExportPrivacy = false)
{
$userArray = array();
if ($b_allowExportPrivacy == false) {
$userArray["user"] = $user;
} else {
global $ilUser;
$userArray["login"] = "";
$userArray["user"] = "";
$userArray["email"] = "";
$userArray["department"] = "";
if (ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
$e_user = new ilObjUser($user);
$userArray["login"] = $e_user->getLogin();
$userArray["user"] = $e_user->getLastname() . ', ' . $e_user->getFirstname();
$userArray["email"] = "" . $e_user->getEmail();
$userArray["department"] = "" . $e_user->getDepartment();
}
}
return $userArray;
}
示例3: showActionConfirmation
/**
* display activation confirmation screen
*/
function showActionConfirmation($action, $a_from_search = false)
{
$user_ids = $this->getActionUserIds();
if (!$user_ids) {
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
}
if (strcmp($action, "accessRestrict") == 0) {
return $this->setAccessRestrictionObject(null, $a_from_search);
}
if (strcmp($action, "mail") == 0) {
return $this->mailObject();
}
unset($this->data);
if (!$a_from_search) {
$cancel = "cancelUserFolderAction";
} else {
$cancel = "cancelSearchAction";
}
// display confirmation message
include_once "./Services/Utilities/classes/class.ilConfirmationGUI.php";
$cgui = new ilConfirmationGUI();
$cgui->setFormAction($this->ctrl->getFormAction($this));
$cgui->setHeaderText($this->lng->txt("info_" . $action . "_sure"));
$cgui->setCancel($this->lng->txt("cancel"), $cancel);
$cgui->setConfirm($this->lng->txt("confirm"), "confirm" . $action);
if ($a_from_search) {
$cgui->addHiddenItem("frsrch", 1);
}
foreach ($user_ids as $id) {
$user = new ilObjUser($id);
$login = $user->getLastLogin();
if (!$login) {
$login = $this->lng->txt("never");
} else {
$login = ilDatePresentation::formatDate(new ilDateTime($login, IL_CAL_DATETIME));
}
$caption = $user->getFullname() . " (" . $user->getLogin() . ")" . ", " . $user->getEmail() . " - " . $this->lng->txt("last_login") . ": " . $login;
$cgui->addItem("id[]", $id, $caption);
}
$this->tpl->setContent($cgui->getHTML());
return true;
}
示例4: loginObserver
/**
* @see ilAuthContainerBase::loginObserver()
*/
public function loginObserver($a_username, $a_auth)
{
global $ilias, $rbacadmin, $ilSetting, $ilLog, $PHPCAS_CLIENT;
$ilLog->write(__METHOD__ . ': Successful CAS login.');
// Radius with ldap as data source
include_once './Services/LDAP/classes/class.ilLDAPServer.php';
if (ilLDAPServer::isDataSourceActive(AUTH_CAS)) {
return $this->handleLDAPDataSource($a_auth, $a_username);
}
include_once "./Services/CAS/lib/CAS.php";
if ($PHPCAS_CLIENT->getUser() != "") {
$username = $PHPCAS_CLIENT->getUser();
$ilLog->write(__METHOD__ . ': Username: ' . $username);
// Authorize this user
include_once './Services/User/classes/class.ilObjUser.php';
$local_user = ilObjUser::_checkExternalAuthAccount("cas", $username);
if ($local_user != "") {
$a_auth->setAuth($local_user);
} else {
if (!$ilSetting->get("cas_create_users")) {
$a_auth->status = AUTH_CAS_NO_ILIAS_USER;
$a_auth->logout();
return false;
}
$userObj = new ilObjUser();
$local_user = ilAuthUtils::_generateLogin($username);
$newUser["firstname"] = $local_user;
$newUser["lastname"] = "";
$newUser["login"] = $local_user;
// set "plain md5" password (= no valid password)
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_MD5;
//$newUser["gender"] = "m";
$newUser["auth_mode"] = "cas";
$newUser["ext_account"] = $username;
$newUser["profile_incomplete"] = 1;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($ilSetting->get("language"));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(1);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time());
// Create user in DB
$userObj->setOwner(0);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
//insert user data in table user_data
$userObj->saveAsNew();
// setup user preferences
$userObj->writePrefs();
// to do: test this
$rbacadmin->assignUser($ilSetting->get('cas_user_default_role'), $userObj->getId(), true);
unset($userObj);
$a_auth->setAuth($local_user);
return true;
}
} else {
$ilLog->write(__METHOD__ . ': Login failed.');
// This should never occur unless CAS is not configured properly
$a_auth->status = AUTH_WRONG_LOGIN;
return false;
}
return false;
}
示例5: sendAccountMail
/**
* send account mail
*/
function sendAccountMail()
{
//var_dump($_POST["send_mail"]);
if ($_POST["send_mail"] != "" || $this->isSendMail() && $this->userObj->getEmail() != "") {
$this->acc_mail->setUser($this->userObj);
$this->acc_mail->send();
}
}
示例6: publishCreationAC
/**
* @param integer $obj_id
* @param string $title
* @param string $description
* @param ilDateTime $start_date
* @param ilDateTime $end_date
* @param string $instructions
* @param string $contact_info
* @param integer $permanent_room
* @param string $access_level
* @param integer $read_contents
* @param integer $read_records
* @param integer $folder_id
* @throws ilException
*/
public function publishCreationAC($obj_id, $title, $description, $start_date, $end_date, $instructions, $contact_info, $permanent_room, $access_level = self::ACCESS_LEVEL_PROTECTED, $read_contents, $read_records, $folder_id)
{
/**
* @var $ilDB ilDB
* */
global $ilDB;
$owner_id = ilObject::_lookupOwner($obj_id);
$ownerObj = new ilObjUser($owner_id);
// receive breeze session
$session = $this->xmlApi->getBreezeSession();
if (!$session) {
throw new ilException('xavc_connection_error');
}
// access check
if (!$this->xmlApi->login($this->adminLogin, $this->adminPass, $session)) {
throw new ilException('xavc_authentication_error');
}
// receive folder id
$this->externalLogin = $this->checkExternalUser($ownerObj->getId());
$folder_id = $this->getFolderIdByLogin($this->externalLogin);
if (!$folder_id) {
throw new ilException('xavc_folder_not_available');
}
$obj_title_suffix_enabled = ilAdobeConnectServer::getSetting('obj_title_suffix');
if ($obj_title_suffix_enabled) {
$title = $title . '_' . CLIENT_ID . '_' . $obj_id;
}
// create meeting room
$arr_meeting = $this->xmlApi->addMeeting($title, $description, date('Y-m-d', $start_date->getUnixTime()), date('H:i', $start_date->getUnixTime()), date('Y-m-d', $end_date->getUnixTime()), date('H:i', $end_date->getUnixTime()), $folder_id, $session);
$meeting_id = $arr_meeting['meeting_id'];
$meeting_url = $arr_meeting['meeting_url'];
if (!$meeting_id) {
throw new ilException('xavc_meeting_creation_error');
}
if (ilAdobeConnectServer::getSetting('user_assignment_mode') != ilAdobeConnectServer::ASSIGN_USER_SWITCH) {
//Normal Case (not SWITCH aai)
if ($this->externalLogin == NULL) {
throw new ilException('xavc_external_login_error');
} else {
$this->xmlApi->addUser($this->externalLogin, $ownerObj->getEmail(), $ownerObj->getPasswd(), $ownerObj->getFirstName(), $ownerObj->getLastName(), $session);
}
$this->xmlApi->updateMeetingParticipant($meeting_id, $this->externalLogin, $session, 'host');
} else {
//In the SWITCH aai case, every user already exists thanks to "cave"
//Add ILIAS-user himself
$this->xmlApi->addMeetingHost($meeting_id, $ownerObj->getEmail(), $session);
//Add technical user
$this->xmlApi->updateMeetingParticipant($meeting_id, ilAdobeConnectServer::getSetting('login'), $session, 'host');
}
$this->xmlApi->updatePermission($meeting_id, $session, $access_level);
$ilDB->insert('rep_robj_xavc_data', array('id' => array('integer', $obj_id), 'sco_id' => array('integer', $meeting_id), 'start_date' => array('integer', $start_date->getUnixTime()), 'end_date' => array('integer', $end_date->getUnixTime()), 'instructions' => array('text', $instructions), 'contact_info' => array('text', $contact_info), 'permanent_room' => array('integer', (int) $permanent_room), 'perm_read_contents' => array('integer', (int) $this->getReadContents()), 'perm_read_records' => array('integer', (int) $this->getReadRecords()), 'folder_id' => array('integer', $folder_id), 'url_path' => array('text', $meeting_url)));
}
示例7: add
public function add()
{
global $lng, $ilUser;
if ($_GET["mail_id"] != "") {
if (is_array($mail_data = $this->umail->getMail($_GET["mail_id"]))) {
require_once "Services/Contact/classes/class.ilAddressbook.php";
$abook = new ilAddressbook($ilUser->getId());
$tmp_user = new ilObjUser($mail_data["sender_id"]);
if ($abook->checkEntryByLogin($tmp_user->getLogin()) > 0) {
ilUtil::sendInfo($lng->txt("mail_entry_exists"));
} else {
$abook->addEntry($tmp_user->getLogin(), $tmp_user->getFirstname(), $tmp_user->getLastname(), $tmp_user->getEmail());
ilUtil::sendInfo($lng->txt("mail_entry_added"));
}
}
}
$this->showMail();
}
示例8: login
/**
* Login function
*
* @access private
* @return void
*/
function login()
{
global $ilias, $rbacadmin, $ilSetting;
if (phpCAS::getUser() != "") {
$username = phpCAS::getUser();
// Authorize this user
include_once './Services/User/classes/class.ilObjUser.php';
$local_user = ilObjUser::_checkExternalAuthAccount("cas", $username);
if ($local_user != "") {
$this->setAuth($local_user);
} else {
if (!$ilSetting->get("cas_create_users")) {
$this->status = AUTH_CAS_NO_ILIAS_USER;
$this->logout();
return;
}
$userObj = new ilObjUser();
$local_user = ilAuthUtils::_generateLogin($username);
$newUser["firstname"] = $local_user;
$newUser["lastname"] = "";
$newUser["login"] = $local_user;
// set "plain md5" password (= no valid password)
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_MD5;
//$newUser["gender"] = "m";
$newUser["auth_mode"] = "cas";
$newUser["ext_account"] = $username;
$newUser["profile_incomplete"] = 1;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($ilSetting->get("language"));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(1);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time());
// Create user in DB
$userObj->setOwner(0);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
//insert user data in table user_data
$userObj->saveAsNew();
// setup user preferences
$userObj->writePrefs();
// to do: test this
$rbacadmin->assignUser($ilSetting->get('cas_user_default_role'), $userObj->getId(), true);
unset($userObj);
$this->setAuth($local_user);
}
} else {
// This should never occur unless CAS is not configured properly
$this->status = AUTH_WRONG_LOGIN;
}
}
示例9: submitAssistanceForm
/** Reads the submitted data from the password assistance form.
*
* The following form fields are read as HTTP POST parameters:
* username
* email
*
* If the submitted username and email address matches an entry in the user data
* table, then ILIAS creates a password assistance session for the user, and
* sends a password assistance mail to the email address.
* For details about the creation of the session and the e-mail see function
* sendPasswordAssistanceMail().
*/
function submitAssistanceForm()
{
global $tpl, $ilias, $lng, $rbacadmin, $rbacreview;
require_once './Services/User/classes/class.ilObjUser.php';
require_once "./Services/Utilities/classes/class.ilUtil.php";
// Retrieve form data
$username = ilUtil::stripSlashes($_POST["username"]);
$email = ilUtil::stripSlashes($_POST["email"]);
// Retrieve a user object with matching user name and email address.
$userObj = null;
$userid = ilObjUser::getUserIdByLogin($username);
$txt_key = "pwassist_invalid_username_or_email";
if ($userid != 0) {
$userObj = new ilObjUser($userid);
if (strcasecmp($userObj->getEmail(), $email) != 0) {
$userObj = null;
} elseif (!strlen($email)) {
$userObj = null;
$txt_key = 'pwassist_no_email_found';
} else {
if ($userObj->getAuthMode(true) != AUTH_LOCAL || $userObj->getAuthMode(true) == AUTH_DEFAULT && AUTH_DEFAULT != AUTH_LOCAL) {
$userObj = null;
$txt_key = "pwassist_invalid_auth_mode";
}
}
}
// No matching user object found?
// Show the password assistance form again, and display an error message.
if ($userObj == null) {
$this->showAssistanceForm($lng->txt($txt_key), $username, $email);
} else {
// FIXME: Extend this if-statement to check whether the user
// has the permission to use the password assistance function.
// The anonymous user and users who are system administrators are
// not allowed to use this feature
if ($rbacreview->isAssigned($userObj->getID, ANONYMOUS_ROLE_ID) || $rbacreview->isAssigned($userObj->getID, SYSTEM_ROLE_ID)) {
$this->showAssistanceForm($lng->txt("pwassist_not_permitted"), $username, $email);
} else {
$this->sendPasswordAssistanceMail($userObj);
$this->showMessageForm(null, sprintf($lng->txt("pwassist_mail_sent"), $email));
}
}
}
示例10: login
/**
* Login function
*
* @access private
* @return void
*/
function login()
{
global $ilias, $rbacadmin, $ilSetting;
if (!empty($_SERVER[$ilias->getSetting('shib_login')])) {
// Store user's Shibboleth sessionID for logout
$this->session['shibboleth_session_id'] = $_SERVER['Shib-Session-ID'];
// Get loginname of user, new login name is generated if user is new
$username = $this->generateLogin();
// Authorize this user
$this->setAuth($username);
$userObj = new ilObjUser();
// Check wether this account exists already, if not create it
if (!ilObjUser::getUserIdByLogin($username)) {
$newUser["firstname"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_firstname')]);
$newUser["lastname"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_lastname')]);
$newUser["login"] = $username;
// Password must be random to prevent users from manually log in using the login data from Shibboleth users
$newUser["passwd"] = md5(end(ilUtil::generatePasswords(1)));
$newUser["passwd_type"] = IL_PASSWD_MD5;
if ($ilias->getSetting('shib_update_gender') && ($_SERVER[$ilias->getSetting('shib_gender')] == 'm' || $_SERVER[$ilias->getSetting('shib_gender')] == 'f')) {
$newUser["gender"] = $_SERVER[$ilias->getSetting('shib_gender')];
}
// Save mapping between ILIAS user and Shibboleth uniqueID
$newUser["ext_account"] = $_SERVER[$ilias->getSetting('shib_login')];
// other data
$newUser["title"] = $_SERVER[$ilias->getSetting('shib_title')];
$newUser["institution"] = $_SERVER[$ilias->getSetting('shib_institution')];
$newUser["department"] = $_SERVER[$ilias->getSetting('shib_department')];
$newUser["street"] = $_SERVER[$ilias->getSetting('shib_street')];
$newUser["city"] = $_SERVER[$ilias->getSetting('shib_city')];
$newUser["zipcode"] = $_SERVER[$ilias->getSetting('shib_zipcode')];
$newUser["country"] = $_SERVER[$ilias->getSetting('shib_country')];
$newUser["phone_office"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_phone_office')]);
$newUser["phone_home"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_phone_home')]);
$newUser["phone_mobile"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_phone_mobile')]);
$newUser["fax"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_fax')]);
$newUser["matriculation"] = $_SERVER[$ilias->getSetting('shib_matriculation')];
$newUser["email"] = $this->getFirstString($_SERVER[$ilias->getSetting('shib_email')]);
$newUser["hobby"] = $_SERVER[$ilias->getSetting('shib_hobby')];
$newUser["auth_mode"] = "shibboleth";
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
$userObj->setLanguage($this->getFirstString($_SERVER[$ilias->getSetting('shib_language')]));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(1);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time());
// Modify user data before creating the user
// Include custom code that can be used to further modify
// certain Shibboleth user attributes
if ($ilias->getSetting('shib_data_conv') && $ilias->getSetting('shib_data_conv') != '' && is_readable($ilias->getSetting('shib_data_conv'))) {
include $ilias->getSetting('shib_data_conv');
}
// Create use in DB
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
//insert user data in table user_data
$userObj->saveAsNew();
// store acceptance of user agreement
//$userObj->writeAccepted();
// Default prefs
$userObj->setPref('hits_per_page', $ilSetting->get('hits_per_page', 30));
$userObj->setPref('show_users_online', $ilSetting->get('show_users_online', 'y'));
// setup user preferences
$userObj->writePrefs();
//set role entries
#$rbacadmin->assignUser($ilias->getSetting('shib_user_default_role'), $userObj->getId(),true);
// New role assignment
include_once './Services/AuthShibboleth/classes/class.ilShibbolethRoleAssignmentRules.php';
ilShibbolethRoleAssignmentRules::doAssignments($userObj->getId(), $_SERVER);
// Authorize this user
$this->setAuth($userObj->getLogin());
} else {
// Update user account
$uid = $userObj->checkUserId();
$userObj->setId($uid);
$userObj->read($uid);
if ($ilias->getSetting('shib_update_gender') && ($_SERVER[$ilias->getSetting('shib_gender')] == 'm' || $_SERVER[$ilias->getSetting('shib_gender')] == 'f')) {
$userObj->setGender($_SERVER[$ilias->getSetting('shib_gender')]);
}
if ($ilias->getSetting('shib_update_title')) {
$userObj->setTitle($_SERVER[$ilias->getSetting('shib_title')]);
}
$userObj->setFirstname($this->getFirstString($_SERVER[$ilias->getSetting('shib_firstname')]));
$userObj->setLastname($this->getFirstString($_SERVER[$ilias->getSetting('shib_lastname')]));
$userObj->setFullname();
if ($ilias->getSetting('shib_update_institution')) {
$userObj->setInstitution($_SERVER[$ilias->getSetting('shib_institution')]);
}
if ($ilias->getSetting('shib_update_department')) {
//.........这里部分代码省略.........
示例11: createUser
/**
* create new user
*
* @access protected
*/
protected function createUser(ilECSUser $user)
{
global $ilClientIniFile, $ilSetting, $rbacadmin, $ilLog;
$userObj = new ilObjUser();
include_once './Services/Authentication/classes/class.ilAuthUtils.php';
$local_user = ilAuthUtils::_generateLogin($this->getAbreviation() . '_' . $user->getLogin());
$newUser["login"] = $local_user;
$newUser["firstname"] = $user->getFirstname();
$newUser["lastname"] = $user->getLastname();
$newUser['email'] = $user->getEmail();
$newUser['institution'] = $user->getInstitution();
// set "plain md5" password (= no valid password)
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_MD5;
$newUser["auth_mode"] = "ecs";
$newUser["profile_incomplete"] = 0;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($ilSetting->get("language"));
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(0);
$userObj->setTimeLimitFrom(time() - 5);
$userObj->setTimeLimitUntil(time() + $ilClientIniFile->readVariable("session", "expire"));
$now = new ilDateTime(time(), IL_CAL_UNIX);
$userObj->setAgreeDate($now->get(IL_CAL_DATETIME));
// Create user in DB
$userObj->setOwner(6);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
$userObj->saveAsNew();
$userObj->writePrefs();
if ($global_role = $this->getCurrentServer()->getGlobalRole()) {
$rbacadmin->assignUser($this->getCurrentServer()->getGlobalRole(), $userObj->getId(), true);
}
ilObject::_writeImportId($userObj->getId(), $user->getImportId());
$ilLog->write(__METHOD__ . ': Created new remote user with usr_id: ' . $user->getImportId());
// Send Mail
#$this->sendNotification($userObj);
return $userObj->getLogin();
}
示例12: sendAccountMail
/**
* send account mail
*/
function sendAccountMail()
{
if ($_POST["send_mail"] != "" || $this->isSendMail() && $this->userObj->getEmail() != "") {
$this->acc_mail->setUser($this->userObj);
$amail = $this->readAccountMailFromCache($this->userObj->getLanguage());
if ($amail["att_file"]) {
include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
$fs = new ilFSStorageUserFolder(USER_FOLDER_ID);
$fs->create();
$path = $fs->getAbsolutePath() . "/";
$this->acc_mail->addAttachment($path . "/" . $amail["lang"], $amail["att_file"]);
}
$this->acc_mail->send();
}
}
示例13: addCrsGrpMembers
public function addCrsGrpMembers()
{
global $ilCtrl, $lng;
$this->pluginObj->includeClass('class.ilXAVCTableGUI.php');
$this->tabs->activateTab('participants');
$this->__setSubTabs('participants');
$this->tabs->activateSubTab("addCrsGrpMembers");
$lng->loadLanguageModule('crs');
$my_tpl = new ilTemplate($this->pluginObj->getDirectory() . "/templates/default/tpl.meeting_participant_table.html", true, true);
$oParticipants = $this->object->getParticipantsObject();
/** @var $oParticipants ilGroupParticipants */
$admins = $oParticipants->getAdmins();
$tutors = $oParticipants->getTutors();
$members = $oParticipants->getMembers();
$all_crs_members = array_unique(array_merge($admins, $tutors, $members));
$counter = 0;
$f_result_1 = NULL;
foreach ($all_crs_members as $user_id) {
if ($user_id > 0) {
$tmp_user = new ilObjUser($user_id);
$firstname = $tmp_user->getFirstname();
$lastname = $tmp_user->getLastname();
if ($tmp_user->hasPublicProfile() && $tmp_user->getPref('public_email') == 'y') {
$user_mail = $tmp_user->getEmail();
} else {
$user_mail = '';
}
}
$f_result_1[$counter]['checkbox'] = ilUtil::formCheckbox('', 'usr_id[]', $user_id);
$f_result_1[$counter]['user_name'] = $lastname . ', ' . $firstname;
$f_result_1[$counter]['email'] = $user_mail;
++$counter;
}
// show Administrator Table
$tbl_admin = new ilXAVCTableGUI($this, 'addCrsGrpMembers');
$ilCtrl->setParameter($this, 'cmd', 'editParticipants');
$tbl_admin->setTitle($lng->txt("crs_members"));
$tbl_admin->setId('tbl_admins');
$tbl_admin->setRowTemplate($this->pluginObj->getDirectory() . "/templates/default/tpl.meeting_participant_row.html", false);
$tbl_admin->addColumn('', 'checkbox', '1%', true);
$tbl_admin->addColumn($this->pluginObj->txt('user_name'), 'user_name', '30%');
$tbl_admin->addColumn($lng->txt('email'), 'email');
$tbl_admin->setSelectAllCheckbox('usr_id[]');
$tbl_admin->addMultiCommand('performAddCrsGrpMembers', $this->pluginObj->txt('add_crs_grp_members'));
$tbl_admin->addCommandButton('editParticipants', $this->pluginObj->txt('cancel'));
$tbl_admin->setData($f_result_1);
$my_tpl->setVariable('ADMINS', $tbl_admin->getHTML());
$this->tpl->setContent($my_tpl->get());
}
示例14: loginObserver
//.........这里部分代码省略.........
// try to map external user via e-mail to ILIAS user
if ($this->response["email"] != "") {
//echo "2";
//var_dump ($_POST);
$email_user = ilObjUser::_getLocalAccountsForEmail($this->response["email"]);
// check, if password has been provided in user mapping screen
// (see ilStartUpGUI::showUserMappingSelection)
// FIXME
if ($_POST["LoginMappedUser"] != "") {
if (count($email_user) > 0) {
$user = ilObjectFactory::getInstanceByObjId($_POST["usr_id"]);
require_once 'Services/User/classes/class.ilUserPasswordManager.php';
if (ilUserPasswordManager::getInstance()->verifyPassword($user, ilUtil::stripSlashes($_POST["password"]))) {
// password is correct -> map user
//$this->setAuth($local_user); (use login not id)
ilObjUser::_writeExternalAccount($_POST["usr_id"], $_GET["ext_uid"]);
ilObjUser::_writeAuthMode($_POST["usr_id"], "soap");
$_GET["cmd"] = $_POST["cmd"] = $_GET["auth_stat"] = "";
$local_user = ilObjUser::_lookupLogin($_POST["usr_id"]);
$a_auth->status = '';
$a_auth->setAuth($local_user);
return true;
} else {
//echo "6"; exit;
$a_auth->status = AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL;
$a_auth->setSubStatus(AUTH_WRONG_LOGIN);
$a_auth->logout();
return false;
}
}
}
if (count($email_user) > 0 && $_POST["CreateUser"] == "") {
$_GET["email"] = $this->response["email"];
$a_auth->status = AUTH_SOAP_NO_ILIAS_USER_BUT_EMAIL;
$a_auth->logout();
return false;
}
}
$userObj = new ilObjUser();
$local_user = ilAuthUtils::_generateLogin($a_username);
$newUser["firstname"] = $this->response["firstname"];
$newUser["lastname"] = $this->response["lastname"];
$newUser["email"] = $this->response["email"];
$newUser["login"] = $local_user;
// to do: set valid password and send mail
$newUser["passwd"] = "";
$newUser["passwd_type"] = IL_PASSWD_CRYPTED;
// generate password, if local authentication is allowed
// and account mail is activated
$pw = "";
if ($ilSetting->get("soap_auth_allow_local") && $ilSetting->get("soap_auth_account_mail")) {
$pw = ilUtil::generatePasswords(1);
$pw = $pw[0];
$newUser["passwd"] = $pw;
$newUser["passwd_type"] = IL_PASSWD_PLAIN;
}
//$newUser["gender"] = "m";
$newUser["auth_mode"] = "soap";
$newUser["ext_account"] = $a_username;
$newUser["profile_incomplete"] = 1;
// system data
$userObj->assignData($newUser);
$userObj->setTitle($userObj->getFullname());
$userObj->setDescription($userObj->getEmail());
// set user language to system language
$userObj->setLanguage($lng->lang_default);
// Time limit
$userObj->setTimeLimitOwner(7);
$userObj->setTimeLimitUnlimited(1);
$userObj->setTimeLimitFrom(time());
$userObj->setTimeLimitUntil(time());
// Create user in DB
$userObj->setOwner(0);
$userObj->create();
$userObj->setActive(1);
$userObj->updateOwner();
//insert user data in table user_data
$userObj->saveAsNew(false);
// setup user preferences
$userObj->writePrefs();
// to do: test this
$rbacadmin->assignUser($ilSetting->get('soap_auth_user_default_role'), $userObj->getId(), true);
// send account mail
if ($ilSetting->get("soap_auth_account_mail")) {
include_once './Services/User/classes/class.ilObjUserFolder.php';
$amail = ilObjUserFolder::_lookupNewAccountMail($ilSetting->get("language"));
if (trim($amail["body"]) != "" && trim($amail["subject"]) != "") {
include_once "Services/Mail/classes/class.ilAccountMail.php";
$acc_mail = new ilAccountMail();
if ($pw != "") {
$acc_mail->setUserPassword($pw);
}
$acc_mail->setUser($userObj);
$acc_mail->send();
}
}
unset($userObj);
$a_auth->setAuth($local_user);
return true;
}
示例15: sendPasswordAssistanceMail
/**
* Creates (or reuses) a password assistance session, and sends a password
* assistance mail to the specified user.
* Note: To prevent DOS attacks, a new session is created only, if no session
* exists, or if the existing session has been expired.
* The password assistance mail contains an URL, which points to this script
* and contains the following URL parameters:
* client_id
* key
* @param $userObj ilObjUser
*/
public function sendPasswordAssistanceMail(ilObjUser $userObj)
{
require_once 'Services/Mail/classes/class.ilMailbox.php';
require_once 'Services/Mail/classes/class.ilMimeMail.php';
require_once 'include/inc.pwassist_session_handler.php';
// Check if we need to create a new session
$pwassist_session = db_pwassist_session_find($userObj->getId());
if (count($pwassist_session) == 0 || $pwassist_session['expires'] < time() || true) {
// Create a new session id
// #9700 - this didn't do anything before?!
// db_set_save_handler();
session_start();
$pwassist_session['pwassist_id'] = db_pwassist_create_id();
session_destroy();
db_pwassist_session_write($pwassist_session['pwassist_id'], 3600, $userObj->getId());
}
$protocol = $this->https->isDetected() ? 'https://' : 'http://';
// Compose the mail
$server_url = $protocol . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strrpos($_SERVER['PHP_SELF'], '/')) . '/';
// XXX - Werner Randelshofer - Insert code here to dynamically get the
// the delimiter. For URL's that are sent by e-mail to a user,
// it is best to use semicolons as parameter delimiter
$delimiter = '&';
$pwassist_url = $protocol . $_SERVER['HTTP_HOST'] . str_replace('ilias.php', 'pwassist.php', $_SERVER['PHP_SELF']) . '?client_id=' . $this->ilias->getClientId() . $delimiter . 'lang=' . $this->lng->getLangKey() . $delimiter . 'key=' . $pwassist_session['pwassist_id'];
$alternative_pwassist_url = $protocol . $_SERVER['HTTP_HOST'] . str_replace('ilias.php', 'pwassist.php', $_SERVER['PHP_SELF']) . '?client_id=' . $this->ilias->getClientId() . $delimiter . 'lang=' . $this->lng->getLangKey() . $delimiter . 'key=' . $pwassist_session['pwassist_id'];
$contact_address = $this->settings->get('admin_email');
$mm = new ilMimeMail();
$mm->Subject($this->lng->txt('pwassist_mail_subject'));
$mm->From($contact_address);
$mm->To($userObj->getEmail());
$mm->Body(str_replace(array("\\n", "\\t"), array("\n", "\t"), sprintf($this->lng->txt('pwassist_mail_body'), $pwassist_url, $server_url, $_SERVER['REMOTE_ADDR'], $userObj->getLogin(), 'mailto:' . $contact_address, $alternative_pwassist_url)));
$mm->Send();
}