本文整理汇总了PHP中ilObjUser::getFirstname方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser::getFirstname方法的具体用法?PHP ilObjUser::getFirstname怎么用?PHP ilObjUser::getFirstname使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjUser
的用法示例。
在下文中一共展示了ilObjUser::getFirstname方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: replaceBillingMailPlaceholders
public static function replaceBillingMailPlaceholders($a_message, $a_user_id)
{
global $lng;
$user = new ilObjUser($a_user_id);
// determine salutation
switch ($user->getGender()) {
case 'f':
$gender_salut = $lng->txt('salutation_f');
break;
case 'm':
$gender_salut = $lng->txt('salutation_m');
break;
}
$a_message = str_replace('[MAIL_SALUTATION]', $gender_salut, $a_message);
$a_message = str_replace('[LOGIN]', $user->getLogin(), $a_message);
$a_message = str_replace('[FIRST_NAME]', $user->getFirstname(), $a_message);
$a_message = str_replace('[LAST_NAME]', $user->getLastname(), $a_message);
$a_message = str_replace('[ILIAS_URL]', ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID, $a_message);
$a_message = str_replace('[CLIENT_NAME]', CLIENT_NAME, $a_message);
include_once './Services/Payment/classes/class.ilShopLinkBuilder.php';
$shopLB = new ilShopLinkBuilder();
$bought_objects_url = $shopLB->buildLink('ilShopBoughtObjectsGUI');
$shop_url = $shopLB->buildLink('ilShopGUI');
$a_message = str_replace('[SHOP_BOUGHT_OBJECTS_URL]', $bought_objects_url, $a_message);
$a_message = str_replace('[SHOP_URL]', $shop_url, $a_message);
unset($user);
return $a_message;
}
示例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: parse
public function parse($userSelected, $report, $reports)
{
global $ilCtrl, $lng;
$lng->loadLanguageModule("scormtrac");
$this->form = new ilPropertyFormGUI();
$this->form->setFormAction($ilCtrl->getFormAction($this->parent_obj));
$options = array("all" => $lng->txt("all"));
include_once "Services/Tracking/classes/class.ilTrQuery.php";
$users = ilTrQuery::getParticipantsForObject($this->parent_obj->object->ref_id);
include_once './Services/PrivacySecurity/classes/class.ilPrivacySettings.php';
$privacy = ilPrivacySettings::_getInstance();
$allowExportPrivacy = $privacy->enabledExportSCORM();
//$users = $this->parent_obj->object->getTrackedUsers("");
foreach ($users as $user) {
if (ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
if ($allowExportPrivacy == true) {
$e_user = new ilObjUser($user);
$options[$user] = $e_user->getLastname() . ", " . $e_user->getFirstname();
} else {
$options[$user] = 'User Id: ' . $user;
}
}
}
$si = new ilSelectInputGUI($lng->txt("user"), "userSelected");
$si->setOptions($options);
$si->setValue($userSelected);
$this->form->addItem($si);
$options = array("choose" => $lng->txt("please_choose"));
for ($i = 0; $i < count($reports); $i++) {
$options[$reports[$i]] = $lng->txt(strtolower($reports[$i]));
}
$si = new ilSelectInputGUI($lng->txt("report"), "report");
$si->setOptions($options);
$si->setValue($report);
$this->form->addItem($si);
$this->form->addCommandButton($this->parent_cmd, $lng->txt("apply_filter"));
}
示例4: testCreateSetLookupDelete
/**
* Creates a user, sets preferences, lookups data, delete user
* @group IL_Init
*/
public function testCreateSetLookupDelete()
{
include_once "./Services/User/classes/class.ilObjUser.php";
// delete all aatestuser from previous runs
while (($i = ilObjUser::_lookupId("aatestuser")) > 0) {
$user = new ilObjUser($i);
$user->delete();
}
$user = new ilObjUser();
// creation
$d = array("login" => "aatestuser", "passwd_type" => IL_PASSWD_PLAIN, "passwd" => "password", "gender" => "m", "firstname" => "Max", "lastname" => "Mutzke", "email" => "de@de.de", "client_ip" => "1.2.3.4", "ext_account" => "ext_mutzke");
$user->assignData($d);
$user->create();
$user->saveAsNew();
$user->setLanguage("no");
$user->writePrefs();
$id = $user->getId();
$value .= $user->getFirstname() . "-";
// update
$user->setFirstname("Maxi");
$user->update();
$value .= $user->getFirstname() . "-";
// other update methods
$user->refreshLogin();
// lookups
$value .= ilObjUser::_lookupEmail($id) . "-";
$value .= ilObjUser::_lookupGender($id) . "-";
$value .= ilObjUser::_lookupClientIP($id) . "-";
$n = ilObjUser::_lookupName($id);
$value .= $n["lastname"] . "-";
ilObjUser::_lookupFields($id);
$value .= ilObjUser::_lookupLogin($id) . "-";
$value .= ilObjUser::_lookupExternalAccount($id) . "-";
$value .= ilObjUser::_lookupId("aatestuser") . "-";
ilObjUser::_lookupLastLogin($id);
$value .= ilObjUser::_lookupLanguage($id) . "-";
ilObjUser::_readUsersProfileData(array($id));
if (ilObjUser::_loginExists("aatestuser")) {
$value .= "le-";
}
// preferences...
$user->writePref("testpref", "pref1");
$value .= ilObjUser::_lookupPref($id, "testpref") . "-";
$user->deletePref("testpref");
if (ilObjUser::_lookupPref($id, "testpref") == "") {
$value .= "pref2" . "-";
}
// activation
$user->setActive(false);
if (!ilObjUser::getStoredActive($id)) {
}
$value .= "act1-";
$user->setActive(true);
if (ilObjUser::getStoredActive($id)) {
}
$value .= "act2-";
ilObjUser::_toggleActiveStatusOfUsers(array($id), false);
if (!ilObjUser::getStoredActive($id)) {
}
$value .= "act3-";
// deletion
$user->delete();
$this->assertEquals("Max-Maxi-de@de.de-m-1.2.3.4-Mutzke-aatestuser-ext_mutzke-{$id}-no-le-" . "pref1-pref2-act1-act2-act3-", $value);
}
示例5: buildShortname
/**
* Returns first letter of users firstname, followed by dot lastname
*
* @return string
*/
public function buildShortname()
{
$firstname = $this->user->getFirstname();
return $firstname[0] . '. ' . $this->user->getLastname();
}
示例6: setRowForUser
protected function setRowForUser(&$set, $user_id)
{
$user = new ilObjUser($user_id);
$set["first_name"] = $user->getFirstname();
$set["last_name"] = $user->getLastname();
$set["user_object"] = $user;
$set["user_id"] = $user_id;
if ($this->recursive) {
$set["org_units"] = ilObjOrgUnitTree::_getInstance()->getOrgUnitOfUser($user_id, (int) $_GET['ref_id']);
}
}
示例7: getUserDataFromActiveId
/**
* Returns the user information from an active_id (survey_finished.finished_id)
*
* @param integer $active_id The active id of the user
* @return array An array containing the user data
* @access public
*/
function getUserDataFromActiveId($active_id)
{
global $ilDB;
$surveySetting = new ilSetting("survey");
$use_anonymous_id = array_key_exists("use_anonymous_id", $_GET) ? $_GET["use_anonymous_id"] : $surveySetting->get("use_anonymous_id");
$result = $ilDB->queryF("SELECT * FROM svy_finished WHERE finished_id = %s", array('integer'), array($active_id));
$row = array();
$foundrows = $result->numRows();
if ($foundrows) {
$row = $ilDB->fetchAssoc($result);
}
$name = $use_anonymous_id ? $row["anonymous_id"] : $this->lng->txt("anonymous");
$userdata = array("fullname" => $name, "sortname" => $name, "firstname" => "", "lastname" => "", "login" => "", "gender" => "", "active_id" => "{$active_id}");
if ($foundrows) {
if ($row["user_fi"] > 0 && $row["user_fi"] != ANONYMOUS_USER_ID && $this->getAnonymize() == 0) {
include_once './Services/User/classes/class.ilObjUser.php';
if (strlen(ilObjUser::_lookupLogin($row["user_fi"])) == 0) {
$userdata["fullname"] = $userdata["sortname"] = $this->lng->txt("deleted_user");
} else {
$user = new ilObjUser($row["user_fi"]);
$userdata["fullname"] = $user->getFullname();
$gender = $user->getGender();
if (strlen($gender) == 1) {
$gender = $this->lng->txt("gender_{$gender}");
}
$userdata["gender"] = $gender;
$userdata["firstname"] = $user->getFirstname();
$userdata["lastname"] = $user->getLastname();
$userdata["sortname"] = $user->getLastname() . ", " . $user->getFirstname();
$userdata["login"] = $user->getLogin();
}
}
}
return $userdata;
}
示例8: verifyEndTag
/**
* handler for end of element when in verify mode.
*/
function verifyEndTag($a_xml_parser, $a_name)
{
global $lng, $ilAccess, $ilSetting, $ilObjDataCache;
switch ($a_name) {
case "Role":
$this->roles[$this->current_role_id]["name"] = $this->cdata;
$this->roles[$this->current_role_id]["type"] = $this->current_role_type;
$this->roles[$this->current_role_id]["action"] = $this->current_role_action;
break;
case "User":
$this->userObj->setFullname();
if ($this->user_id != -1 && $this->action == "Update") {
$user_exists = !is_null(ilObjUser::_lookupLogin($this->user_id));
} else {
$user_exists = ilObjUser::getUserIdByLogin($this->userObj->getLogin()) != 0;
}
if (is_null($this->userObj->getLogin())) {
$this->logFailure("---", sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Login", "Insert"));
}
switch ($this->action) {
case "Insert":
if ($user_exists and $this->conflict_rule == IL_FAIL_ON_CONFLICT) {
$this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_insert"));
}
if (is_null($this->userObj->getGender()) && $this->isFieldRequired("gender")) {
$this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Gender", "Insert"));
}
if (is_null($this->userObj->getFirstname())) {
$this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Firstname", "Insert"));
}
if (is_null($this->userObj->getLastname())) {
$this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Lastname", "Insert"));
}
if (count($this->roles) == 0) {
$this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Role", "Insert"));
} else {
$has_global_role = false;
foreach ($this->roles as $role) {
if ($role['type'] == 'Global') {
$has_global_role = true;
break;
}
}
if (!$has_global_role) {
$this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_global_role_for_action_required"), "Insert"));
}
}
break;
case "Update":
if (!$user_exists) {
$this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_update"));
} elseif ($this->user_id != -1 && !is_null($this->userObj->getLogin())) {
$someonesId = ilObjUser::_lookupId($this->userObj->getLogin());
if (is_numeric($someonesId) && $someonesId != $this->user_id) {
$this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_login_is_not_unique"));
}
}
break;
case "Delete":
if (!$user_exists) {
$this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_delete"));
}
break;
}
// init role array for next user
$this->roles = array();
break;
case "Login":
if (array_key_exists($this->cdata, $this->logins)) {
$this->logWarning($this->cdata, $lng->txt("usrimport_login_is_not_unique"));
} else {
$this->logins[$this->cdata] = $this->cdata;
}
$this->userObj->setLogin($this->cdata);
break;
case "Password":
switch ($this->currPasswordType) {
case "ILIAS2":
$this->userObj->setPasswd($this->cdata, IL_PASSWD_CRYPT);
break;
case "ILIAS3":
$this->userObj->setPasswd($this->cdata, IL_PASSWD_MD5);
break;
case "PLAIN":
$this->userObj->setPasswd($this->cdata, IL_PASSWD_PLAIN);
$this->acc_mail->setUserPassword($this->currPassword);
break;
default:
$this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"), "Type", "Password", $this->currPasswordType));
break;
}
break;
case "Firstname":
$this->userObj->setFirstname($this->cdata);
break;
case "Lastname":
$this->userObj->setLastname($this->cdata);
//.........这里部分代码省略.........
示例9: deleteTrackingForUser
/**
* display deletion confirmation screen
*/
function deleteTrackingForUser()
{
if (!isset($_POST["user"])) {
$this->ilias->raiseError($this->lng->txt("no_checkbox"), $this->ilias->error_obj->MESSAGE);
}
// 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_delete_sure"));
$cgui->setCancel($this->lng->txt("cancel"), "cancelDeleteTracking");
$cgui->setConfirm($this->lng->txt("confirm"), "confirmedDeleteTracking");
foreach ($_POST["user"] as $id) {
if (ilObject::_exists($id) && ilObject::_lookUpType($id) == "usr") {
$user = new ilObjUser($id);
$caption = ilUtil::getImageTagByType("sahs", $this->tpl->tplPath) . " " . $this->lng->txt("cont_tracking_data") . ": " . $user->getLastname() . ", " . $user->getFirstname();
$cgui->addItem("user[]", $id, $caption);
}
}
$this->tpl->setContent($cgui->getHTML());
}
示例10: getBannedUsers
/**
* Returns an multidimensional array containing userdata from users
* having an entry in banTable with matching roomId.
*
* @global ilDBMySQL $ilDB
* @return array
*/
public function getBannedUsers()
{
global $ilDB;
$query = 'SELECT * FROM ' . self::$banTable . ' WHERE room_id = %s ';
$types = array('integer');
$values = array($this->getRoomId());
$rset = $ilDB->queryF($query, $types, $values);
$result = array();
if ($rset) {
while ($row = $ilDB->fetchAssoc($rset)) {
if ($row['user_id'] > 0) {
$user = new ilObjUser($row['user_id']);
$userdata = array('user_id' => $user->getId(), 'firstname' => $user->getFirstname(), 'lastname' => $user->getLastname(), 'login' => $user->getLogin(), 'remark' => $row['remark']);
$result[] = $userdata;
} else {
//@todo anonymous user
}
}
}
return $result;
}
示例11: 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();
}
示例12: exportSelected
function exportSelected($a_exportall = 0, $a_user = array())
{
global $ilDB, $ilUser;
$scos = array();
//get all SCO's of this object
$query = 'SELECT cp_node.cp_node_id ' . 'FROM cp_node, cp_resource, cp_item ' . 'WHERE cp_item.cp_node_id = cp_node.cp_node_id ' . 'AND cp_item.resourceid = cp_resource.id AND scormtype = %s ' . 'AND nodename = %s AND cp_node.slm_id = %s';
$res = $ilDB->queryF($query, array('text', 'text', 'integer'), array('sco', 'item', $this->getId()));
while ($row = $ilDB->fetchAssoc($res)) {
$scos[] = $row['cp_node_id'];
}
$csv = null;
//a module is completed when all SCO's are completed
$user_array = array();
if ($a_exportall == 1) {
$query = 'SELECT user_id ' . 'FROM cmi_node, cp_node ' . 'WHERE cmi_node.cp_node_id = cp_node.cp_node_id AND cp_node.slm_id = %s ' . 'GROUP BY user_id';
$res = $ilDB->queryF($query, array('integer'), array($this->getId()));
while ($row = $ilDB->fetchAssoc($res)) {
$user_array[] = $row['user_id'];
}
} else {
$user_array = $a_user;
}
foreach ($user_array as $user) {
$scos_c = $scos;
//copy SCO_array
//check if all SCO's are completed
for ($i = 0; $i < count($scos); $i++) {
$query = 'SELECT * FROM cmi_node ' . 'WHERE user_id = %s AND cp_node_id = %s ' . 'AND completion_status = %s OR success_status = %s';
$res = $ilDB->queryF($query, array('integer', 'integer', 'text', 'text'), array($user, $scos[$i], 'completed', 'passed'));
$data = $ilDB->fetchAssoc($res);
if (is_array($data) && count($data)) {
//delete from array
$key = array_search($scos[$i], $scos_c);
unset($scos_c[$key]);
}
}
//check for completion
if (count($scos_c) == 0) {
$completion = 1;
} else {
$completion = 0;
}
//write export entry
if (ilObject::_exists($user) && ilObject::_lookUpType($user) == 'usr') {
$e_user = new ilObjUser($user);
$login = $e_user->getLogin();
$firstname = $e_user->getFirstname();
$lastname = $e_user->getLastname();
$email = $e_user->getEmail();
$department = $e_user->getDepartment();
$query = 'SELECT user_id, MAX(c_timestamp) exp_date ' . 'FROM cmi_node, cp_node ' . 'WHERE cmi_node.cp_node_id = cp_node.cp_node_id ' . 'AND cp_node.slm_id = %s ' . 'GROUP BY user_id';
$res = $ilDB->queryF($query, array('integer'), array($this->getId()));
$data = $ilDB->fetchAssoc($res);
if (is_array($data) && count($data)) {
$validDate = false;
$datetime = explode(' ', $data['exp_date']);
if (count($datetime) == 2) {
$date = explode('-', $datetime[0]);
if (count($date) == 3 && checkdate($date[1], $date[2], $date[0])) {
$validDate = true;
}
}
if ($validDate) {
$date = date('d.m.Y', strtotime($data['exp_date']));
} else {
$date = '';
}
} else {
$date = '';
}
$csv = $csv . "{$department};{$login};{$lastname};{$firstname};{$email};{$date};{$completion}\n";
}
}
$header = "Department;Login;Lastname;Firstname;Email;Date;Status\n";
$this->sendExportFile($header, $csv);
}
示例13: loadFromUser
/**
* Load user data from ilias user object
* @param stdclass $user
* @param ilObjUser $iu
*/
private function loadFromUser($user, ilObjUser $iu)
{
$prefix = ilViteroSettings::getInstance()->getUserPrefix();
$user->username = $prefix . $iu->getLogin();
$user->surname = $iu->getLastname();
$user->firstname = $iu->getFirstname();
$user->email = $iu->getEmail();
$user->company = $iu->getInstitution();
$user->locale = in_array($iu->getLanguage(), $this->available_locales) ? $iu->getLanguage() : "en";
#$user->timezone = trim($iu->getTimeZone());
$GLOBALS['ilLog']->write(__METHOD__ . ': Time zone is ' . $iu->getTimeZone());
$user->phone = $iu->getPhoneOffice();
$user->fax = $iu->getFax();
$user->mobile = $iu->getPhoneMobile();
$user->country = $iu->getCountry();
$user->zip = $iu->getZipcode();
$user->city = $iu->getCity();
$user->street = $iu->getStreet();
}
示例14: parseUserPlaceholders
/**
* Return all Placeholders of user data
*
* @param ilObjUser $user
* @return array
*/
protected function parseUserPlaceholders(ilObjUser $user)
{
return array('USER_LOGIN' => $this->anonymized ? 'johndoe' : $user->getLogin(), 'USER_TITLE' => $this->anonymized ? 'Mister' : $user->getUTitle(), 'USER_FULLNAME' => $this->anonymized ? 'John Doe' : $user->getFullname(), 'USER_FIRSTNAME' => $this->anonymized ? 'John' : $user->getFirstname(), 'USER_LASTNAME' => $this->anonymized ? 'Doe' : $user->getLastname(), 'USER_BIRTHDAY' => $user->getBirthday(), 'USER_INSTITUTION' => $user->getInstitution(), 'USER_DEPARTMENT' => $user->getDepartment(), 'USER_STREET' => $this->anonymized ? 'Manhattan Street' : $user->getStreet(), 'USER_CITY' => $this->anonymized ? 'New York' : $user->getCity(), 'USER_ZIPCODE' => $this->anonymized ? 10026 : $user->getZipcode(), 'USER_COUNTRY' => $this->anonymized ? 'USA' : $user->getCountry());
}
示例15: stopUserOfflineMode
/**
* Stop offline mode for selected users
*/
protected function stopUserOfflineMode()
{
if (!count((array) $_POST['user'])) {
ilUtil::sendFailure($this->lng->txt('select_one'), true);
$this->ctrl->redirect($this, 'offlineModeManager');
}
// 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_stop_offline_mode_sure"));
$cgui->setCancel($this->lng->txt("cancel"), "cancelStopUserOfflineMode");
$cgui->setConfirm($this->lng->txt("confirm"), "confirmedStopUserOfflineMode");
foreach ($_POST["user"] as $id) {
if (ilObject::_exists($id) && ilObject::_lookUpType($id) == "usr") {
$user = new ilObjUser($id);
$caption = ilUtil::getImageTagByType("sahs_offline", $this->tpl->tplPath) . " " . $this->lng->txt("stop_user_offline_mode_for_user") . ": " . $user->getLastname() . ", " . $user->getFirstname();
$cgui->addItem("user[]", $id, $caption);
}
}
$this->tpl->setContent($cgui->getHTML());
}