当前位置: 首页>>代码示例>>PHP>>正文


PHP ilObjUser::getId方法代码示例

本文整理汇总了PHP中ilObjUser::getId方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser::getId方法的具体用法?PHP ilObjUser::getId怎么用?PHP ilObjUser::getId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilObjUser的用法示例。


在下文中一共展示了ilObjUser::getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: adjust

 /**
  * @return boolean
  */
 public function adjust()
 {
     if (defined('IL_CERT_SSO')) {
         return false;
     } else {
         if (!ilContext::supportsRedirects()) {
             return false;
         } else {
             if ($this->ctrl->isAsynch()) {
                 return false;
             } else {
                 if (in_array(basename($_SERVER['PHP_SELF']), array('logout.php'))) {
                     return false;
                 } else {
                     if (!$this->user->getId() || $this->user->isAnonymous()) {
                         return false;
                     }
                 }
             }
         }
     }
     foreach ($this->cases as $case) {
         if ($case->isInFulfillment()) {
             return false;
         }
         if ($case->shouldAdjustRequest()) {
             if ($case->shouldStoreRequestTarget()) {
                 $this->storeRequest();
             }
             $case->adjust();
             return true;
         }
     }
     return false;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:38,代码来源:class.ilUserRequestTargetAdjustment.php

示例2: getUserId

 /**
  * Returns Ilias User ID. If user is anonymous, a random negative User ID
  * is created, stored in SESSION, and returned.
  *
  * @param ilObjUser $user
  * @return integer
  */
 public function getUserId()
 {
     $user_id = $this->user->getId();
     if ($this->user->isAnonymous()) {
         if (isset($_SESSION['chat'][$this->room->getRoomId()]['user_id'])) {
             return $_SESSION['chat'][$this->room->getRoomId()]['user_id'];
         } else {
             $user_id = mt_rand(-99999, -20);
             $_SESSION['chat'][$this->room->getRoomId()]['user_id'] = $user_id;
             return $user_id;
         }
     } else {
         return $user_id;
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:class.ilChatroomUser.php

示例3: 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);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:33,代码来源:class.ilDataLoader.php

示例4: __construct

 /**
  * @param $a_parent_obj
  * @param string $a_parent_cmd
  * @param ilObjUser $user The user from whom the certificates are displayed
  * @param array $options
  */
 public function __construct($a_parent_obj, $a_parent_cmd = "", ilObjUser $user, array $options = array())
 {
     $this->_user = $user;
     $options['user_id'] = $user->getId();
     $options['columns'] = isset($options['columns']) ? $options['columns'] : $this->columns;
     parent::__construct($a_parent_obj, $a_parent_cmd, $options);
 }
开发者ID:studer-raimann,项目名称:Certificate,代码行数:13,代码来源:class.srCertificateUserTableGUI.php

示例5: checkIfReminderMailShouldBeSend

 public static function checkIfReminderMailShouldBeSend(ilObjUser $user, $reminderTime)
 {
     global $ilDB;
     $query = "SELECT ts FROM " . self::TABLE_NAME . " WHERE usr_id = %s";
     $res = $ilDB->queryF($query, array('integer'), array($user->getId()));
     $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
     if ($row->ts == null) {
         self::sendReminder($user, $reminderTime);
         return true;
     }
     return false;
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:12,代码来源:class.ilCronDeleteInactiveUserReminderMail.php

示例6: initUserInstance

 /**
  */
 protected function initUserInstance()
 {
     if ($this->authorEntity instanceof ilObjUser && $this->authorEntity->getId()) {
         $this->author = $this->authorEntity;
     } else {
         if (is_numeric($this->authorEntity) && $this->authorEntity) {
             // Try to read user instance from preloaded cache array
             $this->author = ilForumAuthorInformationCache::getUserObjectById($this->authorEntity);
             if (!$this->author) {
                 // Get a user instance from forum module's cache method
                 $this->author = ilObjForumAccess::getCachedUserInstance($this->authorEntity);
             }
         }
     }
     if (!$this->author) {
         $this->author = new ilObjUser();
         $this->author->setId(0);
         $this->author->setPref('public_profile', 'n');
         $this->author->setGender('');
     }
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:23,代码来源:class.ilForumAuthorInformation.php

示例7: updateAccess

 /**
  * Update access time
  * @param ilObjUser $user
  * @return bool
  * @static
  */
 public static function updateAccess(ilObjUser $user)
 {
     /**
      * @var $ilDB      ilDB
      * @var $ilSetting ilSetting
      */
     global $ilDB, $ilSetting;
     if (null === self::$last_access_time) {
         $query = 'SELECT access_time FROM ut_online WHERE usr_id = ' . $ilDB->quote($user->getId(), 'integer');
         $res = $ilDB->query($query);
         if (!$ilDB->numRows($res)) {
             return false;
         }
         $row = $ilDB->fetchAssoc($res);
         self::$last_access_time = $row['access_time'];
     }
     $time_span = (int) $ilSetting->get('tracking_time_span', 300);
     if (($diff = time() - self::$last_access_time) <= $time_span) {
         $ilDB->manipulateF('UPDATE ut_online SET online_time = online_time + %s, access_time = %s WHERE usr_id = %s', array('integer', 'integer', 'integer'), array($diff, time(), $user->getId()));
     } else {
         $ilDB->manipulateF('UPDATE ut_online SET access_time = %s WHERE usr_id = %s', array('integer', 'integer'), array(time(), $user->getId()));
     }
     return true;
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:30,代码来源:class.ilOnlineTracking.php

示例8: create

 /**
  * Create object in database. Also invokes creating of translation objects.
  *
  * @throws ilOrgUnitTypeException
  */
 public function create()
 {
     $default_lang = $this->getDefaultLang();
     $title = $this->getTranslation('title', $default_lang);
     if (!$default_lang || !$title) {
         throw new ilOrgUnitTypeException($this->lng->txt('orgu_type_msg_missing_title_default_language'));
     }
     $this->id = $this->db->nextId(self::TABLE_NAME);
     $this->db->insert(self::TABLE_NAME, array('id' => array('integer', $this->getId()), 'default_lang' => array('text', $this->getDefaultLang()), 'owner' => array('integer', $this->user->getId()), 'icon' => array('text', $this->getIcon()), 'create_date' => array('text', date('Y-m-d H:i:s')), 'last_update' => array('text', date('Y-m-d H:i:s'))));
     // Create translation(s)
     /** @var $trans ilOrgUnitTypeTranslation */
     foreach ($this->translations as $lang => $trans) {
         $trans->setOrguTypeId($this->getId());
         $trans->create();
     }
 }
开发者ID:bheyser,项目名称:qplskl,代码行数:21,代码来源:class.ilOrgUnitType.php

示例9: trackAcceptance

 /**
  * @param ilObjUser                        $user
  * @param ilTermsOfServiceSignableDocument $document
  */
 public static function trackAcceptance(ilObjUser $user, ilTermsOfServiceSignableDocument $document)
 {
     if (self::isEnabled()) {
         $entity = self::getEntityFactory()->getByName('ilTermsOfServiceAcceptanceEntity');
         $data_gateway = self::getDataGatewayFactory()->getByName('ilTermsOfServiceAcceptanceDatabaseGateway');
         $entity->setUserId($user->getId());
         $entity->setTimestamp(time());
         $entity->setIso2LanguageCode($document->getIso2LanguageCode());
         $entity->setSource($document->getSource());
         $entity->setSourceType($document->getSourceType());
         $entity->setText($document->getContent());
         $entity->setHash(md5($document->getContent()));
         $data_gateway->trackAcceptance($entity);
         $user->writeAccepted();
         // <- Has to be refactored in future releases
         $user->hasToAcceptTermsOfServiceInSession(false);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:22,代码来源:class.ilTermsOfServiceHelper.php

示例10: getAccessPermissionTableData

 /**
  * Access Permissions Table Data
  * @return array
  */
 function getAccessPermissionTableData()
 {
     global $ilAccess, $ilObjDataCache, $objDefinition;
     // get all possible operation of current object
     $ops_list = ilRbacReview::_getOperationList($this->object->getType());
     $counter = 0;
     $result_set = array();
     // check permissions of user
     foreach ($ops_list as $ops) {
         $access = $ilAccess->doRBACCheck($ops['operation'], "info", $this->object->getRefId(), $this->user->getId(), $this->object->getType());
         $result_set[$counter]["img"] = $access ? self::IMG_OK : self::IMG_NOT_OK;
         if (substr($ops['operation'], 0, 7) == "create_" && $objDefinition->isPlugin(substr($ops['operation'], 7))) {
             $result_set[$counter]["operation"] = ilPlugin::lookupTxt("rep_robj", substr($ops['operation'], 7), 'rbac_' . $ops['operation']);
         } else {
             if ($objDefinition->isPlugin($this->object->getType())) {
                 $result_set[$counter]["operation"] = ilPlugin::lookupTxt("rep_robj", $this->object->getType(), $this->object->getType() . "_" . $ops['operation']);
             } elseif (substr($ops['operation'], 0, 7) == 'create_') {
                 $result_set[$counter]["operation"] = $this->lng->txt('rbac_' . $ops['operation']);
             } else {
                 $result_set[$counter]["operation"] = $this->lng->txt($this->object->getType() . "_" . $ops['operation']);
             }
         }
         $list_role = "";
         // Check ownership
         if ($this->user->getId() == $ilObjDataCache->lookupOwner($this->object->getId())) {
             if (substr($ops['operation'], 0, 7) != 'create_' and $ops['operation'] != 'edit_permission' and $ops['operation'] != 'edit_leanring_progress') {
                 $list_role[] = $this->lng->txt('info_owner_of_object');
             }
         }
         // get operations on object for each assigned role to user
         foreach ($this->getAssignedValidRoles() as $role) {
             if (in_array($ops['ops_id'], $role['ops'])) {
                 $list_role[] = $role['translation'];
             }
         }
         if (empty($list_role)) {
             $list_role[] = $this->lng->txt('none');
         }
         $result_set[$counter]["role_ownership"] = $list_role;
         ++$counter;
     }
     return $result_set;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:47,代码来源:class.ilObjectPermissionStatusGUI.php

示例11: 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;
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:101,代码来源:class.ilAuthContainerSOAP.php

示例12: getSkillHTML

 /**
  * Get skill presentation HTML
  *
  * @return
  */
 function getSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false, $a_tref_id = 0)
 {
     global $ilUser, $lng, $ilCtrl, $ilSetting;
     $this->tooltips = array();
     if ($a_user_id == 0) {
         $user = $ilUser;
     } else {
         $user = new ilObjUser($a_user_id);
     }
     $tpl = new ilTemplate("tpl.skill_pres.html", true, true, "Services/Skill");
     include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     $stree = new ilSkillTree();
     include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
     include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php";
     // general settings for the action drop down
     include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $act_list = new ilAdvancedSelectionListGUI();
     $act_list->setListTitle($lng->txt("actions"));
     $act_list->setSelectionHeaderClass("small");
     //		$act_list->setLinksMode("il_ContainerItemCommand2");
     $act_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
     $act_list->setUseImages(false);
     $b_skills = ilSkillTreeNode::getSkillTreeNodes($a_top_skill_id, true, $a_tref_id);
     foreach ($b_skills as $bs) {
         $path = $stree->getSkillTreePath($bs["id"], $bs["tref"]);
         // check draft
         foreach ($path as $p) {
             if ($p["draft"]) {
                 continue 2;
             }
         }
         reset($path);
         $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]);
         $level_data = $skill->getLevelData();
         if ($this->mode == "gap") {
             if ($this->getProfileId() > 0) {
                 $this->renderProfileTargetRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]);
             }
             $this->renderActualLevelsRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]);
             $this->renderGapSelfEvalRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]);
             $this->renderSuggestedResources($tpl, $level_data, $bs["id"], $bs["tref"]);
         } else {
             if ($this->getProfileId() > 0) {
                 $this->renderProfileTargetRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]);
             }
             $this->renderMaterialsRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]);
             // get date of self evaluation
             $se_date = ilPersonalSkill::getSelfEvaluationDate($user->getId(), $a_top_skill_id, $bs["tref"], $bs["id"]);
             $se_rendered = $se_date == "" ? true : false;
             // get all object triggered entries and render them
             foreach ($skill->getAllLevelEntriesOfUser($bs["tref"], $user->getId()) as $level_entry) {
                 // render the self evaluation at the correct position within the list of object triggered entries
                 if ($se_date > $level_entry["status_date"] && !$se_rendered) {
                     $this->renderSelfEvaluationRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]);
                     $se_rendered = true;
                 }
                 $this->renderObjectEvalRow($tpl, $level_data, $level_entry);
             }
             // if not rendered yet, render self evaluation now
             if (!$se_rendered) {
                 $this->renderSelfEvaluationRow($tpl, $level_data, $a_top_skill_id, $bs["id"], $bs["tref"]);
             }
         }
         $too_low = true;
         $current_target_level = 0;
         foreach ($level_data as $k => $v) {
             // level
             $tpl->setCurrentBlock("level_td");
             $tpl->setVariable("VAL_LEVEL", $v["title"]);
             $tt_id = "skmg_skl_tt_" . self::$skill_tt_cnt;
             self::$skill_tt_cnt++;
             $tpl->setVariable("TT_ID", $tt_id);
             if ($v["description"] != "") {
                 ilTooltipGUI::addTooltip($tt_id, $v["description"]);
             }
             $tpl->parseCurrentBlock();
             // profile targel level
             /*
             				foreach ($this->profile_levels as $pl)
             				{
             					if ($pl["level_id"] == $v["id"] &&
             						$pl["base_skill_id"] == $v["skill_id"])
             					{
             						$too_low = true;
             						$current_target_level = $v["id"];
             					}
             				}
             				else
             				{
             					$tpl->setVariable("VAL_SELF_EVAL", " ");
             				}
             				$tpl->parseCurrentBlock();
             				if ($v["id"] == $se_level)
             				{
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilPersonalSkillsGUI.php

示例13: testClipboard

 /**
  * Clipboard
  * @group IL_Init
  */
 public function testClipboard()
 {
     $value = "";
     // creation
     $user = new ilObjUser();
     $d = array("login" => "aatestuser3", "passwd_type" => IL_PASSWD_PLAIN, "passwd" => "password", "gender" => "f", "firstname" => "Heidi", "lastname" => "Kabel", "email" => "de@de.de");
     $user->assignData($d);
     $user->setActive(true);
     $user->create();
     $user->saveAsNew();
     $user->setLanguage("de");
     $user->writePrefs();
     $id = $user->getId();
     $user->addObjectToClipboard($id, "user", "aatestuser");
     $user->addObjectToClipboard(56, "mump", "mumpitz");
     if ($user->clipboardHasObjectsOfType("user")) {
         $value .= "clip1-";
     }
     $user->clipboardDeleteObjectsOfType("user");
     if ($user->clipboardHasObjectsOfType("mump") && !$user->clipboardHasObjectsOfType("user")) {
         $value .= "clip2-";
     }
     $objs = $user->getClipboardObjects("mump");
     if (is_array($objs) && count($objs) == 1 && $objs[0]["id"] == 56) {
         $value .= "clip3-";
     }
     $objs = $user->getClipboardChilds(56, "2008-10-10");
     $us = ilObjUser::_getUsersForClipboadObject("mump", 56);
     if (is_array($us) && count($us) == 1 && $us[0] == $id) {
         $value .= "clip4-";
     }
     $user->delete();
     $this->assertEquals("clip1-clip2-clip3-clip4-", $value);
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:38,代码来源:ilObjUserTest.php

示例14: 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;
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:73,代码来源:class.ilAuthContainerCAS.php

示例15: getSkillHTML

 /**
  * Get skill presentation HTML
  *
  * @return
  */
 function getSkillHTML($a_top_skill_id, $a_user_id = 0, $a_edit = false)
 {
     global $ilUser, $lng, $ilCtrl, $ilSetting;
     $this->tooltips = array();
     if ($a_user_id == 0) {
         $user = $ilUser;
     } else {
         $user = new ilObjUser($a_user_id);
     }
     $tpl = new ilTemplate("tpl.skill_pres.html", true, true, "Services/Skill");
     include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
     include_once "./Services/Skill/classes/class.ilSkillTree.php";
     $stree = new ilSkillTree();
     include_once "./Services/Skill/classes/class.ilSkillTreeNode.php";
     include_once "./Services/Skill/classes/class.ilSkillTreeNodeFactory.php";
     // general settings for the action drop down
     include_once "Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
     $act_list = new ilAdvancedSelectionListGUI();
     $act_list->setListTitle($lng->txt("actions"));
     $act_list->setSelectionHeaderClass("small");
     //		$act_list->setLinksMode("il_ContainerItemCommand2");
     $act_list->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
     $act_list->setUseImages(false);
     $b_skills = ilSkillTreeNode::getSkillTreeNodes($a_top_skill_id, true);
     foreach ($b_skills as $bs) {
         $path = $stree->getSkillTreePath($bs["id"], $bs["tref"]);
         // check draft
         foreach ($path as $p) {
             if ($p["draft"]) {
                 continue 2;
             }
         }
         reset($path);
         $se_level = ilPersonalSkill::getSelfEvaluation($user->getId(), $a_top_skill_id, $bs["tref"], $bs["id"]);
         $skill = ilSkillTreeNodeFactory::getInstance($bs["id"]);
         $level_data = $skill->getLevelData();
         // check, if current self eval level is in current level data
         $valid_sel_level = false;
         if ($se_level > 0) {
             foreach ($level_data as $k => $v) {
                 if ($v["id"] == $se_level) {
                     $valid_sel_level = true;
                 }
             }
         }
         reset($level_data);
         $found = false;
         foreach ($level_data as $k => $v) {
             // level
             $tpl->setCurrentBlock("level_td");
             $tpl->setVariable("VAL_LEVEL", $v["title"]);
             $tt_id = "skmg_skl_tt_" . self::$skill_tt_cnt;
             self::$skill_tt_cnt++;
             $tpl->setVariable("TT_ID", $tt_id);
             if ($v["description"] != "") {
                 ilTooltipGUI::addTooltip($tt_id, $v["description"]);
             }
             $tpl->parseCurrentBlock();
             // self evaluation
             $tpl->setCurrentBlock("self_eval_td");
             if ($valid_sel_level && !$found) {
                 $tpl->setVariable("VAL_SELF_EVAL", "x");
                 $tpl->setVariable("CLASS_SELF_EVAL", "ilSkillSelf");
             } else {
                 $tpl->setVariable("VAL_SELF_EVAL", " ");
             }
             $tpl->parseCurrentBlock();
             if ($v["id"] == $se_level) {
                 $found = true;
             }
             // assigned materials
             if ($this->use_materials) {
                 $mat_cnt = ilPersonalSkill::countAssignedMaterial($user->getId(), $bs["tref"], $v["id"]);
                 if ($mat_cnt == 0) {
                     $tpl->setCurrentBlock("material_td");
                     $tpl->setVariable("VAL_MATERIAL", " ");
                     $tpl->parseCurrentBlock();
                 } else {
                     // links to material files
                     $tpl->setCurrentBlock("material_links");
                     $mat_tt = array();
                     $cnt = 1;
                     foreach (ilPersonalSkill::getAssignedMaterial($user->getId(), $bs["tref"], $v["id"]) as $item) {
                         $mat_data = $this->getMaterialInfo($item["wsp_id"]);
                         $tpl->setVariable("URL_MATERIAL", $mat_data[1]);
                         $tpl->setVariable("TXT_MATERIAL", $cnt);
                         // tooltip
                         $mat_tt_id = "skmg_skl_tt_mat_" . self::$skill_tt_cnt;
                         self::$skill_tt_cnt++;
                         $tpl->setVariable("TOOLTIP_MATERIAL_ID", $mat_tt_id);
                         if (!$this->offline_mode) {
                             ilTooltipGUI::addTooltip($mat_tt_id, $mat_data[0]);
                         } else {
                             $this->tooltips[] = ilTooltipGUI::getTooltip($mat_tt_id, $mat_data[0]);
                         }
//.........这里部分代码省略.........
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilPersonalSkillsGUI.php


注:本文中的ilObjUser::getId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。