本文整理汇总了PHP中ilObjUser类的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser类的具体用法?PHP ilObjUser怎么用?PHP ilObjUser使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ilObjUser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __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);
}
示例2: preloadUserObjects
/**
* @static
* @param array $usr_ids
*/
public static function preloadUserObjects(array $usr_ids)
{
/**
* @var $ilDB ilDB
*/
global $ilDB;
$usr_ids_to_request = array_diff($usr_ids, self::$requested_usr_ids);
self::$requested_usr_ids = array_merge(self::$requested_usr_ids, $usr_ids_to_request);
self::$requested_usr_ids_key_map = array_flip(self::$requested_usr_ids);
if ($usr_ids_to_request) {
$in = $ilDB->in('ud.usr_id', $usr_ids_to_request, false, 'integer');
$query = "\n\t\t\t\tSELECT ud.usr_id, login, firstname, lastname, title, gender, pprof.value public_profile,pup.value public_upload, pupgen.value public_gender\n\t\t\t\tFROM usr_data ud\n\t\t\t\tLEFT JOIN usr_pref pprof ON pprof.usr_id = ud.usr_id AND pprof.keyword = %s\n\t\t\t\tLEFT JOIN usr_pref pupgen ON pupgen.usr_id = ud.usr_id AND pupgen.keyword = %s\n\t\t\t\tLEFT JOIN usr_pref pup ON pup.usr_id = ud.usr_id AND pup.keyword = %s\n\t\t\t\tWHERE {$in}\n\t\t\t";
$res = $ilDB->queryF($query, array('text', 'text', 'text'), array('public_profile', 'public_gender', 'public_upload'));
while ($row = $ilDB->fetchAssoc($res)) {
$user = new ilObjUser();
$user->setId($row['usr_id']);
$user->setLogin($row['login']);
$user->setGender($row['gender']);
$user->setTitle($row['title']);
$user->setFirstname($row['firstname']);
$user->setLastname($row['lastname']);
$user->setPref('public_profile', $row['public_profile']);
$user->setPref('public_upload', $row['public_upload']);
$user->setPref('public_gender', $row['public_gender']);
self::$user_instances[$row['usr_id']] = $user;
}
}
}
示例3: fillRow
/**
* Standard Version of Fill Row. Most likely to
* be overwritten by derived class.
*/
protected function fillRow($a_set)
{
global $lng, $ilCtrl, $ilAccess;
$news_set = new ilSetting("news");
$enable_internal_rss = $news_set->get("enable_rss_for_internal");
// user
if ($a_set["user_id"] > 0) {
$this->tpl->setCurrentBlock("user_info");
$user_obj = new ilObjUser($a_set["user_id"]);
$this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
$this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
$this->tpl->parseCurrentBlock();
}
// access
if ($enable_internal_rss) {
$this->tpl->setCurrentBlock("access");
$this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $a_set["context_obj_id"])) {
$this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
} else {
$this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
}
$this->tpl->parseCurrentBlock();
}
// last update
if ($a_set["creation_date"] != $a_set["update_date"]) {
$this->tpl->setCurrentBlock("ni_update");
$this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
$this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME)));
$this->tpl->parseCurrentBlock();
}
// creation date
$this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME)));
$this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
// title
$this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
// content
if ($a_set["content"] != "") {
$this->tpl->setCurrentBlock("content");
$this->tpl->setVariable("VAL_CONTENT", ilUtil::shortenText($a_set["content"], 80, true, true), true);
$this->tpl->parseCurrentBlock();
}
$perm_ref_id = $this->perm_ref_id > 0 ? $this->perm_ref_id : $a_set["ref_id"];
if ($ilAccess->checkAccess("write", "", $perm_ref_id)) {
$this->tpl->setCurrentBlock("edit");
$this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
$ilCtrl->setParameterByClass("ilnewsitemgui", "news_item_id", $a_set["id"]);
$this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNewsItem"));
$this->tpl->parseCurrentBlock();
}
// context
$this->tpl->setVariable("CONTEXT", $lng->txt("obj_" . $a_set["context_obj_type"]) . ":<br />" . ilObject::_lookupTitle($a_set["context_obj_id"]));
$this->tpl->setVariable("VAL_ID", $a_set["id"]);
}
示例4: 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;
}
示例5: run
public function run()
{
if (!$this->enabled) {
return;
}
global $rbacreview;
$usr_ids = ilObjUser::_getUserIdsByInactivationPeriod($this->period);
foreach ($usr_ids as $usr_id) {
if ($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) {
continue;
}
$continue = true;
foreach ($this->include_roles as $role_id) {
if ($rbacreview->isAssigned($usr_id, $role_id)) {
$continue = false;
break;
}
}
if ($continue) {
continue;
}
$user = ilObjectFactory::getInstanceByObjId($usr_id);
$user->delete();
}
}
示例6: ilEphorusReportHeaderTableGUI
function ilEphorusReportHeaderTableGUI($a_parent_obj, $a_parent_cmd, $document)
{
global $ilCtrl, $lng;
parent::__construct($a_parent_obj, $a_parent_cmd);
$this->setTopCommands(false);
$this->addColumn($lng->txt("rep_robj_xeph_document_info"));
$this->addColumn("");
$this->setEnableHeader(true);
$this->setRowTemplate("tpl.eph_report_header.html", "Customizing/global/plugins/Services/Repository/RepositoryObject/Ephorus");
$this->disable("footer");
$member = ilObjUser::_lookupName($document->user_id);
$a_data = array();
$student = array();
$student["key"] = "student";
$student["value"] = $member["firstname"] . " " . $member["lastname"];
array_push($a_data, $student);
$ilCtrl->setParameter($this->parent_obj, "filename", $document->filename);
$ilCtrl->setParameter($this->parent_obj, "filetitle", $document->filetitle);
$ilCtrl->setParameter($this->parent_obj, "part_id", $document->user_id);
$doc = array();
$doc["key"] = "document";
$doc["value"] = "<a href=\"" . $ilCtrl->getLinkTarget($this->parent_obj, "downloadSubmittedFile") . "\">" . $document->filetitle . "</a>";
array_push($a_data, $doc);
$ilCtrl->setParameter($this->parent_obj, "filename", "");
$ilCtrl->setParameter($this->parent_obj, "filetitle", "");
$submission_date = array();
$submission_date["key"] = "submission_date";
$submission_date["value"] = ilDatePresentation::formatDate(new ilDateTime($document->date_created, IL_CAL_DATETIME));
array_push($a_data, $submission_date);
$this->setData($a_data);
}
示例7: changeOwner
function changeOwner()
{
global $rbacsystem, $ilObjDataCache;
if (!($user_id = ilObjUser::_lookupId($_POST['owner']))) {
ilUtil::sendFailure($this->lng->txt('user_not_known'));
$this->owner();
return true;
}
// no need to change?
if ($user_id != $this->gui_obj->object->getOwner()) {
$this->gui_obj->object->setOwner($user_id);
$this->gui_obj->object->updateOwner();
$ilObjDataCache->deleteCachedEntry($this->gui_obj->object->getId());
include_once "Services/AccessControl/classes/class.ilRbacLog.php";
if (ilRbacLog::isActive()) {
ilRbacLog::add(ilRbacLog::CHANGE_OWNER, $this->gui_obj->object->getRefId(), array($user_id));
}
}
ilUtil::sendSuccess($this->lng->txt('owner_updated'), true);
if (!$rbacsystem->checkAccess("edit_permission", $this->gui_obj->object->getRefId())) {
$this->ctrl->redirect($this->gui_obj);
return true;
}
$this->ctrl->redirect($this, 'owner');
return true;
}
示例8: loginObserver
/**
* Called from fetchData after successful login.
*
* @param string username
*/
public function loginObserver($a_username, $a_auth)
{
$GLOBALS['ilLog']->write('Called login observer');
$name = ilObjUser::_lookupName($this->current_user_id);
$a_auth->setAuth($name['login']);
return true;
}
示例9: run
public function run()
{
global $rbacreview;
$status = ilCronJobResult::STATUS_NO_ACTION;
$usr_ids = ilObjUser::_getUserIdsByInactivityPeriod($this->period);
$counter = 0;
foreach ($usr_ids as $usr_id) {
if ($usr_id == ANONYMOUS_USER_ID || $usr_id == SYSTEM_USER_ID) {
continue;
}
$continue = true;
foreach ($this->include_roles as $role_id) {
if ($rbacreview->isAssigned($usr_id, $role_id)) {
$continue = false;
break;
}
}
if ($continue) {
continue;
}
$user = ilObjectFactory::getInstanceByObjId($usr_id);
$user->delete();
$counter++;
}
if ($counter) {
$status = ilCronJobResult::STATUS_OK;
}
$result = new ilCronJobResult();
$result->setStatus($status);
return $result;
}
示例10: fillRow
protected function fillRow($a_set)
{
$this->tpl->setVariable("DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["created"], IL_CAL_UNIX)));
$name = ilObjUser::_lookupName($a_set["user_id"]);
$this->tpl->setVariable("LASTNAME", $name["lastname"]);
$this->tpl->setVariable("FIRSTNAME", $name["firstname"]);
$this->tpl->setVariable("LOGIN", $name["login"]);
$this->tpl->setVariable("ACTION", $this->action_map[$a_set["action"]]);
if ($a_set["action"] == ilRbacLog::CHANGE_OWNER) {
$user = ilObjUser::_lookupFullname($a_set["data"][0]);
$changes = array(array("action" => $this->lng->txt("rbac_log_changed_owner"), "operation" => $user));
} else {
if ($a_set["action"] == ilRbacLog::EDIT_TEMPLATE) {
$changes = $this->parseChangesTemplate($a_set["data"]);
} else {
$changes = $this->parseChangesFaPa($a_set["data"]);
}
}
$this->tpl->setCurrentBlock("changes");
foreach ($changes as $change) {
$this->tpl->setVariable("CHANGE_ACTION", $change["action"]);
$this->tpl->setVariable("CHANGE_OPERATION", $change["operation"]);
$this->tpl->parseCurrentBlock();
}
}
示例11: ilObjectStatusGUI
/**
* Constructor
* @access public
*/
function ilObjectStatusGUI(&$a_obj)
{
global $ilUser, $ilCtrl, $ilias, $ilErr, $lng, $rbacreview;
$this->ctrl =& $ilCtrl;
$this->object =& $a_obj;
$this->tpl = new ilTemplate("tpl.info_layout.html", false, false, "Services/AccessControl");
$this->tpl->setVariable("INFO_REMARK_INTERRUPTED", $lng->txt('info_remark_interrupted'));
if (empty($_POST['Fuserid'])) {
$this->user =& $ilUser;
} else {
if ($_POST['Fselect_type'] == "id") {
$this->user = $ilias->obj_factory->getInstanceByObjId($_POST['Fuserid'], false);
} else {
include_once 'Services/User/classes/class.ilObjUser.php';
$user_id = ilObjUser::_lookupId($_POST['Fuserid']);
$this->user = $ilias->obj_factory->getInstanceByObjId($user_id, false);
}
if ($this->user === false or $this->user->getType() != 'usr') {
$this->user =& $ilUser;
ilUtil::sendFailure($lng->txt('info_err_user_not_exist'));
} else {
ilUtil::sendInfo($lng->txt('info_user_view_changed'));
}
}
// get all user roles and all valid roles in scope
$this->user_roles = $rbacreview->assignedRoles($this->user->getId());
$this->global_roles = $rbacreview->getGlobalRoles();
$this->valid_roles = $rbacreview->getParentRoleIds($this->object->getRefId());
$this->assigned_valid_roles = $this->getAssignedValidRoles();
$this->getPermissionInfo();
$this->getRoleAssignmentInfo();
$this->getObjectSummary();
}
示例12: send
public function send()
{
switch ($this->getType()) {
case self::TYPE_NOTIFICATION_ACTIVATION:
$additional_information = $this->getAdditionalInformation();
/**
* @var $user ilObjUser
*/
$user = $additional_information['usr'];
foreach ($this->getRecipients() as $rcp) {
try {
$this->handleCurrentRecipient($rcp);
} catch (ilMailException $e) {
continue;
}
$this->initMimeMail();
$this->setSubject($this->getLanguage()->txt('reg_mail_subject_confirmation'));
$this->setBody($this->getLanguage()->txt('reg_mail_body_salutation') . ' ' . $user->getFullname() . ',');
$this->appendBody("\n\n");
$this->appendBody($this->getLanguage()->txt('reg_mail_body_confirmation'));
$this->appendBody("\n");
$this->appendBody(ILIAS_HTTP_PATH . '/confirmReg.php?client_id=' . CLIENT_ID . '&rh=' . ilObjUser::_generateRegistrationHash($user->getId()));
$this->appendBody("\n\n");
$this->appendBody(sprintf($this->getLanguage()->txt('reg_mail_body_2_confirmation'), ilFormat::_secondsToString($additional_information['hash_lifetime'])));
$this->appendBody("\n\n");
$this->appendBody($this->getLanguage()->txt('reg_mail_body_3_confirmation'));
$this->appendBody(ilMail::_getInstallationSignature());
$this->sendMimeMail($this->getCurrentRecipient());
}
break;
}
}
示例13: getItems
/**
* Get all completed tests
*/
protected function getItems()
{
$data = array();
foreach (ilExAssignment::getTeamLog($this->team_id) as $item) {
switch ($item["action"]) {
case ilExAssignment::TEAM_LOG_CREATE_TEAM:
$mess = "create_team";
break;
case ilExAssignment::TEAM_LOG_ADD_MEMBER:
$mess = "add_member";
break;
case ilExAssignment::TEAM_LOG_REMOVE_MEMBER:
$mess = "remove_member";
break;
case ilExAssignment::TEAM_LOG_ADD_FILE:
$mess = "add_file";
break;
case ilExAssignment::TEAM_LOG_REMOVE_FILE:
$mess = "remove_file";
break;
}
$details = $this->lng->txt("exc_team_log_" . $mess);
if ($item["details"]) {
$details = sprintf($details, $item["details"]);
}
$data[] = array("tstamp" => $item["tstamp"], "user" => ilObjUser::_lookupFullname($item["user_id"]), "details" => $details);
}
$this->setData($data);
}
示例14: 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;
}
示例15: replaceOwnerCallback
/**
* Replace owner callback (preg_replace_callback)
*/
protected function replaceOwnerCallback($matches)
{
if (isset($matches[2])) {
if ($usr_id = ilObjUser::_loginExists($matches[2])) {
return $matches[1] . $usr_id;
}
}
return $matches[0];
}