本文整理汇总了PHP中ilObjUser::_lookupPref方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObjUser::_lookupPref方法的具体用法?PHP ilObjUser::_lookupPref怎么用?PHP ilObjUser::_lookupPref使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilObjUser
的用法示例。
在下文中一共展示了ilObjUser::_lookupPref方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showResults
public function showResults()
{
global $lng, $ilUser, $rbacreview, $ilObjDataCache;
$form = $this->initSearchForm();
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.mail_search.html", "Services/Contact");
$this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
$this->tpl->setTitle($this->lng->txt("mail"));
$this->tpl->setVariable('SEARCHFORM', $form->getHtml());
// #14109
if (strlen($_SESSION['mail_search_search']) < 3) {
if ($_GET["ref"] != "wsp") {
$this->tpl->show();
}
return;
}
$abook = new ilAddressbook($ilUser->getId());
$entries = $abook->searchUsers(addslashes(urldecode($_SESSION['mail_search_search'])));
// remove all contacts who are not registered users for personal workspace
if ($_GET["ref"] == "wsp") {
foreach ($entries as $idx => $entry) {
if (!$entry["login"]) {
unset($entries[$idx]);
}
}
}
if (count($entries)) {
$tbl_addr = new ilTable2GUI($this);
$tbl_addr->setTitle($lng->txt('mail_addressbook'));
$tbl_addr->setRowTemplate('tpl.mail_search_addr_row.html', 'Services/Contact');
$result = array();
$counter = 0;
foreach ($entries as $entry) {
if ($_GET["ref"] != "wsp") {
$result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_addr[]', $entry['login'] ? $entry['login'] : $entry['email']) . ilUtil::formCheckbox(0, 'search_name_cc[]', $entry['login'] ? $entry['login'] : $entry['email']) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $entry['login'] ? $entry['login'] : $entry['email']);
} else {
$user_id = ilObjUser::_loginExists($entry["login"]);
$result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_addr[]', $user_id);
}
$result[$counter]['login'] = $entry['login'];
$result[$counter]['firstname'] = $entry['firstname'];
$result[$counter]['lastname'] = $entry['lastname'];
$id = ilObjUser::_lookupId($entry['login']);
if (ilObjUser::_lookupPref($id, 'public_email') == 'y' || !$entry['login']) {
$has_mail_addr = true;
$result[$counter]['email'] = $entry['email'];
}
++$counter;
}
if ($_GET["ref"] != "wsp") {
$tbl_addr->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%');
} else {
$tbl_addr->addColumn("", "", "1%");
}
$tbl_addr->addColumn($this->lng->txt('login'), 'login', "15%");
$tbl_addr->addColumn($this->lng->txt('firstname'), 'firstname', "15%");
$tbl_addr->addColumn($this->lng->txt('lastname'), 'lastname', "15%");
if ($has_mail_addr) {
foreach ($result as $key => $val) {
if ($val['email'] == '') {
$result[$key]['email'] = ' ';
}
}
$tbl_addr->addColumn($this->lng->txt('email'), 'email', "15%");
}
$tbl_addr->setData($result);
$tbl_addr->setDefaultOrderField('login');
$tbl_addr->setPrefix('addr_');
$tbl_addr->enable('select_all');
$tbl_addr->setSelectAllCheckbox('search_name_to_addr');
$tbl_addr->setFormName('recipients');
$this->tpl->setVariable('TABLE_ADDR', $tbl_addr->getHTML());
}
include_once 'Services/Search/classes/class.ilQueryParser.php';
include_once 'Services/Search/classes/class.ilObjectSearchFactory.php';
include_once 'Services/Search/classes/class.ilSearchResult.php';
$all_results = new ilSearchResult();
$query_parser = new ilQueryParser(addcslashes($_SESSION['mail_search_search'], '%_'));
$query_parser->setCombination(QP_COMBINATION_AND);
$query_parser->setMinWordLength(3);
$query_parser->parse();
$user_search =& ilObjectSearchFactory::_getUserSearchInstance($query_parser);
$user_search->enableActiveCheck(true);
$user_search->setFields(array('login'));
$result_obj = $user_search->performSearch();
$all_results->mergeEntries($result_obj);
$user_search->setFields(array('firstname'));
$result_obj = $user_search->performSearch();
$all_results->mergeEntries($result_obj);
$user_search->setFields(array('lastname'));
$result_obj = $user_search->performSearch();
$all_results->mergeEntries($result_obj);
$all_results->setMaxHits(100000);
$all_results->preventOverwritingMaxhits(true);
$all_results->filter(ROOT_FOLDER_ID, true);
// Filter users (depends on setting in user accounts)
include_once 'Services/User/classes/class.ilUserFilter.php';
$users = ilUserFilter::getInstance()->filter($all_results->getResultIds());
if (count($users)) {
$tbl_users = new ilTable2GUI($this);
$tbl_users->setTitle($lng->txt('system') . ': ' . $lng->txt('persons'));
//.........这里部分代码省略.........
示例2: showMembers
/**
* Show course members
*/
public function showMembers()
{
global $lng;
if ($_GET["search_grp"] != "") {
$_POST["search_grp"] = explode(",", $_GET["search_grp"]);
}
if (!is_array($_POST["search_grp"]) || count($_POST["search_grp"]) == 0) {
ilUtil::sendInfo($lng->txt("mail_select_group"));
$this->showMyGroups();
} else {
$this->tpl->setTitle($this->lng->txt("mail_addressbook"));
include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
$context = $_GET["ref"] ? $_GET["ref"] : "mail";
$table = new ilMailSearchCoursesMembersTableGUI($this, 'grp', $context);
$table->setId('show_grps_mmbrs_tbl');
$lng->loadLanguageModule('crs');
$tableData = array();
$searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
foreach ($_POST["search_grp"] as $grp_id) {
$ref_ids = ilObject::_getAllReferences($grp_id);
$ref_id = current($ref_ids);
if (is_object($group_obj = ilObjectFactory::getInstanceByRefId($ref_id, false))) {
$grp_members = $group_obj->getGroupMemberData($group_obj->getGroupMemberIds());
foreach ($grp_members as $member) {
$tmp_usr = new ilObjUser($member['id']);
if ($tmp_usr->checkTimeLimit() == false || $tmp_usr->getActive() == false) {
unset($tmp_usr);
continue;
}
unset($tmp_usr);
$fullname = "";
if (in_array(ilObjUser::_lookupPref($member['id'], 'public_profile'), array("g", 'y'))) {
$fullname = $member['lastname'] . ', ' . $member['firstname'];
}
$rowData = array('members_id' => $member["id"], 'members_login' => $member["login"], 'members_name' => $fullname, 'members_crs_grp' => $group_obj->getTitle(), 'members_in_addressbook' => $this->abook->checkEntryByLogin($member["login"]) ? $lng->txt("yes") : $lng->txt("no"), 'search_grp' => $grp_id);
$tableData[] = $rowData;
}
}
}
$table->setData($tableData);
if (count($tableData)) {
$searchTpl->setVariable("TXT_MARKED_ENTRIES", $lng->txt("marked_entries"));
}
$searchTpl->setVariable('TABLE', $table->getHtml());
$this->tpl->setContent($searchTpl->get());
if ($_GET["ref"] != "wsp") {
$this->tpl->show();
}
}
}
示例3: 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);
}
示例4: formatNamesForOutput
/**
* Prepends the fullname of each ILIAS login name (is user has a public profile) found
* in the passed string and brackets the ILIAS login name afterwards.
*
* @param string $users String containing to, cc or bcc recipients
*
* @return string Formatted names
*
* @access public
*/
public function formatNamesForOutput($users = '')
{
$users = trim($users);
if ($users) {
if (strstr($users, ',')) {
$rcp_to_array = array();
$recipients = explode(',', $users);
foreach ($recipients as $recipient) {
$recipient = trim($recipient);
if ($uid = ilObjUser::_lookupId($recipient)) {
if (in_array(ilObjUser::_lookupPref($uid, 'public_profile'), array("y", "g"))) {
$tmp_obj = self::getCachedUserInstance($uid);
$rcp_to_array[] = $tmp_obj->getFullname() . ' [' . $recipient . ']';
} else {
$rcp_to_array[] = $recipient;
}
} else {
$rcp_to_array[] = $recipient;
}
}
return trim(implode(', ', $rcp_to_array));
} else {
if ($uid = ilObjUser::_lookupId($users)) {
if (in_array(ilObjUser::_lookupPref($uid, 'public_profile'), array("y", "g"))) {
$tmp_obj = self::getCachedUserInstance($uid);
return $tmp_obj->getFullname() . ' [' . $users . ']';
} else {
return $users;
}
} else {
return $users;
}
}
} else {
return $this->lng->txt('not_available');
}
}
示例5: _getNewsItemsOfUser
/**
* Get all news items for a user.
*/
static function _getNewsItemsOfUser($a_user_id, $a_only_public = false, $a_prevent_aggregation = false, $a_per = 0, &$a_cnt = NULL)
{
global $ilAccess;
$news_item = new ilNewsItem();
$news_set = new ilSetting("news");
$per = $a_per;
include_once "./Services/News/classes/class.ilNewsSubscription.php";
include_once "./Services/Block/classes/class.ilBlockSetting.php";
// this is currently not used
$ref_ids = ilNewsSubscription::_getSubscriptionsOfUser($a_user_id);
if (ilObjUser::_lookupPref($a_user_id, "pd_items_news") != "n") {
// get all items of the personal desktop
$pd_items = ilObjUser::_lookupDesktopItems($a_user_id);
foreach ($pd_items as $item) {
if (!in_array($item["ref_id"], $ref_ids)) {
$ref_ids[] = $item["ref_id"];
}
}
// get all memberships
include_once 'Services/Membership/classes/class.ilParticipants.php';
$crs_mbs = ilParticipants::_getMembershipByType($a_user_id, 'crs');
$grp_mbs = ilParticipants::_getMembershipByType($a_user_id, 'grp');
$items = array_merge($crs_mbs, $grp_mbs);
foreach ($items as $i) {
$item_references = ilObject::_getAllReferences($i);
if (is_array($item_references) && count($item_references)) {
foreach ($item_references as $ref_id) {
if (!in_array($ref_id, $ref_ids)) {
$ref_ids[] = $ref_id;
}
}
}
}
}
$data = array();
foreach ($ref_ids as $ref_id) {
if (!$a_only_public) {
// this loop should not cost too much performance
$acc = $ilAccess->checkAccessOfUser($a_user_id, "read", "", $ref_id);
if (!$acc) {
continue;
}
}
if (ilNewsItem::getPrivateFeedId() != false) {
global $rbacsystem;
$acc = $rbacsystem->checkAccessOfUser(ilNewsItem::getPrivateFeedId(), "read", $ref_id);
if (!$acc) {
continue;
}
}
$obj_id = ilObject::_lookupObjId($ref_id);
$obj_type = ilObject::_lookupType($obj_id);
$news = $news_item->getNewsForRefId($ref_id, $a_only_public, false, $per, $a_prevent_aggregation, false, false, false, $a_user_id);
// counter
if (!is_null($a_cnt)) {
$a_cnt[$ref_id] = count($news);
}
$data = ilNewsItem::mergeNews($data, $news);
}
$data = ilUtil::sortArray($data, "creation_date", "desc", false, true);
return $data;
}
示例6: showMembers
/**
* Show course members
*/
public function showMembers()
{
global $lng, $ilUser, $ilObjDataCache;
include_once 'Modules/Course/classes/class.ilCourseParticipants.php';
if ($_GET["search_crs"] != "") {
$_POST["search_crs"] = explode(",", $_GET["search_crs"]);
$_GET["search_crs"] = "";
} else {
if ($_SESSION["search_crs"] != "") {
$_POST["search_crs"] = explode(",", $_SESSION["search_crs"]);
$_SESSION["search_crs"] = "";
}
}
if (!is_array($_POST["search_crs"]) || count($_POST["search_crs"]) == 0) {
ilUtil::sendInfo($lng->txt("mail_select_course"));
$this->showMyCourses();
} else {
foreach ($_POST['search_crs'] as $crs_id) {
$oTmpCrs = ilObjectFactory::getInstanceByObjId($crs_id);
if ($oTmpCrs->getShowMembers() == $oTmpCrs->SHOW_MEMBERS_DISABLED) {
unset($_POST['search_crs']);
ilUtil::sendInfo($lng->txt('mail_crs_list_members_not_available_for_at_least_one_crs'));
return $this->showMyCourses();
}
unset($oTmpCrs);
}
$this->tpl->setTitle($this->lng->txt("mail_addressbook"));
$this->ctrl->setParameter($this, "view", "crs_members");
if ($_GET["ref"] != "") {
$this->ctrl->setParameter($this, "ref", $_GET["ref"]);
}
if (is_array($_POST["search_crs"])) {
$this->ctrl->setParameter($this, "search_crs", implode(",", $_POST["search_crs"]));
}
$this->tpl->setVariable("ACTION", $this->ctrl->getFormAction($this));
$this->ctrl->clearParameters($this);
$lng->loadLanguageModule('crs');
include_once 'Services/Contact/classes/class.ilMailSearchCoursesMembersTableGUI.php';
$context = $_GET["ref"] ? $_GET["ref"] : "mail";
$table = new ilMailSearchCoursesMembersTableGUI($this, 'crs', $context);
$table->setId('show_crs_mmbrs_tbl');
$tableData = array();
$searchTpl = new ilTemplate('tpl.mail_search_template.html', true, true, 'Services/Contact');
foreach ($_POST["search_crs"] as $crs_id) {
$members_obj = ilCourseParticipants::_getinstanceByObjId($crs_id);
$tmp_members = $members_obj->getParticipants();
$course_members = ilUtil::_sortIds($tmp_members, 'usr_data', 'lastname', 'usr_id');
foreach ($course_members as $member) {
$tmp_usr = new ilObjUser($member);
if ($tmp_usr->checkTimeLimit() == false || $tmp_usr->getActive() == false) {
unset($tmp_usr);
continue;
}
unset($tmp_usr);
$name = ilObjUser::_lookupName($member);
$login = ilObjUser::_lookupLogin($member);
$fullname = "";
if (in_array(ilObjUser::_lookupPref($member, 'public_profile'), array("g", 'y'))) {
$fullname = $name['lastname'] . ', ' . $name['firstname'];
}
$rowData = array('members_id' => $member, 'members_login' => $login, 'members_name' => $fullname, 'members_crs_grp' => $ilObjDataCache->lookupTitle($crs_id), 'members_in_addressbook' => $this->abook->checkEntryByLogin($login) ? $lng->txt("yes") : $lng->txt("no"), 'search_crs' => $crs_id);
$tableData[] = $rowData;
}
}
$table->setData($tableData);
if (count($tableData)) {
$searchTpl->setVariable("TXT_MARKED_ENTRIES", $lng->txt("marked_entries"));
}
$searchTpl->setVariable('TABLE', $table->getHtml());
$this->tpl->setContent($searchTpl->get());
if ($_GET["ref"] != "wsp") {
$this->tpl->show();
}
}
}
示例7: showMail
/**
* Detail view of a mail
*/
public function showMail()
{
/**
* @var $ilUser ilObjUser
* @var $ilToolbar ilToolbarGUI
* @var $ilTabs ilTabsGUI
*/
global $ilUser, $ilToolbar, $ilTabs;
if ($_SESSION['mail_id']) {
$_GET['mail_id'] = $_SESSION['mail_id'];
$_SESSION['mail_id'] = '';
}
$ilTabs->clearTargets();
$ilTabs->setBackTarget($this->lng->txt('back_to_folder'), $this->ctrl->getFormAction($this, 'showFolder'));
$this->umail->markRead(array((int) $_GET['mail_id']));
$mailData = $this->umail->getMail((int) $_GET['mail_id']);
$this->tpl->setTitle($this->lng->txt('mail_mails_of'));
require_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
$form = new ilPropertyFormGUI();
$form->setPreventDoubleSubmission(false);
$form->setTableWidth('100%');
$this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
$form->setFormAction($this->ctrl->getFormAction($this, 'showMail'));
$this->ctrl->clearParameters($this);
$form->setTitle($this->lng->txt('mail_mails_of'));
if ('tree' == ilSession::get(ilMailGUI::VIEWMODE_SESSION_KEY)) {
$this->tpl->setVariable('FORM_TARGET', ilFrameTargetInfo::_getFrame('MainContent'));
}
include_once 'Services/Accessibility/classes/class.ilAccessKeyGUI.php';
/**
* @var $sender ilObjUser
*/
$sender = ilObjectFactory::getInstanceByObjId($mailData['sender_id'], false);
if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) {
$this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']);
$this->ctrl->setParameterByClass('ilmailformgui', 'type', 'reply');
$this->ctrl->clearParametersByClass('iliasmailformgui');
$ilToolbar->addButton($this->lng->txt('reply'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::REPLY);
$this->ctrl->clearParameters($this);
}
$this->ctrl->setParameterByClass('ilmailformgui', 'mail_id', (int) $_GET['mail_id']);
$this->ctrl->setParameterByClass('ilmailformgui', 'type', 'forward');
$this->ctrl->clearParametersByClass('iliasmailformgui');
$ilToolbar->addButton($this->lng->txt('forward'), $this->ctrl->getLinkTargetByClass('ilmailformgui'), '', ilAccessKey::FORWARD_MAIL);
$this->ctrl->clearParameters($this);
$this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
$ilToolbar->addButton($this->lng->txt('print'), $this->ctrl->getLinkTarget($this, 'printMail'), '_blank');
$this->ctrl->clearParameters($this);
$this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
$this->ctrl->setParameter($this, 'selected_cmd', 'deleteMails');
$ilToolbar->addButton($this->lng->txt('delete'), $this->ctrl->getLinkTarget($this), '', ilAccessKey::DELETE);
$this->ctrl->clearParameters($this);
if ($sender && $sender->getId() && $sender->getId() != ANONYMOUS_USER_ID) {
$linked_fullname = $sender->getPublicName();
$picture = ilUtil::img($sender->getPersonalPicturePath('xsmall'), $sender->getPublicName());
$add_to_addb_button = '';
if (in_array(ilObjUser::_lookupPref($sender->getId(), 'public_profile'), array('y', 'g'))) {
$this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
$this->ctrl->setParameter($this, 'user', $sender->getId());
$linked_fullname = '<br /><a href="' . $this->ctrl->getLinkTarget($this, 'showUser') . '" title="' . $linked_fullname . '">' . $linked_fullname . '</a>';
$this->ctrl->clearParameters($this);
}
if ($sender->getId() != $ilUser->getId()) {
require_once 'Services/Contact/classes/class.ilAddressbook.php';
$abook = new ilAddressbook($ilUser->getId());
if ($abook->checkEntryByLogin($sender->getLogin()) == 0) {
$tplbtn = new ilTemplate('tpl.buttons.html', true, true);
$tplbtn->setCurrentBlock('btn_cell');
$this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']);
$tplbtn->setVariable('BTN_LINK', $this->ctrl->getLinkTarget($this, 'add'));
$this->ctrl->clearParameters($this);
$tplbtn->setVariable('BTN_TXT', $this->lng->txt('mail_add_to_addressbook'));
$tplbtn->parseCurrentBlock();
$add_to_addb_button = '<br />' . $tplbtn->get();
}
}
$from = new ilCustomInputGUI($this->lng->txt('from'));
$from->setHtml($picture . ' ' . $linked_fullname . $add_to_addb_button);
$form->addItem($from);
} else {
if (!$sender || !$sender->getId()) {
$from = new ilCustomInputGUI($this->lng->txt('from'));
$from->setHtml($mailData['import_name'] . ' (' . $this->lng->txt('user_deleted') . ')');
$form->addItem($from);
} else {
$from = new ilCustomInputGUI($this->lng->txt('from'));
$from->setHtml(ilUtil::img(ilUtil::getImagePath('HeaderIconAvatar.svg'), ilMail::_getIliasMailerName()) . '<br />' . ilMail::_getIliasMailerName());
$form->addItem($from);
}
}
$to = new ilCustomInputGUI($this->lng->txt('mail_to'));
$to->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_to']), false));
$form->addItem($to);
if ($mailData['rcp_cc']) {
$cc = new ilCustomInputGUI($this->lng->txt('cc'));
$cc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_cc']), false));
$form->addItem($cc);
//.........这里部分代码省略.........
示例8: getProfileLink
/**
* Get link to personal profile
* Return empty string in case of not public profile
* @param type $a_usr_id
* @return string
*/
public static function getProfileLink($a_usr_id)
{
$public_profile = ilObjUser::_lookupPref($a_usr_id, 'public_profile');
if ($public_profile != 'y' and $public_profile != 'g') {
return '';
}
$GLOBALS['ilCtrl']->setParameterByClass('ilpublicuserprofilegui', 'user', $a_usr_id);
return $GLOBALS['ilCtrl']->getLinkTargetByClass('ilpublicuserprofilegui', 'getHTML');
}
示例9: _getFeedPass
/**
* Lookup news feed password for user
* @param integer user_id
* @return string feed_password md5-encoded, or false
*/
function _getFeedPass($a_user_id)
{
global $ilDB;
if ($a_user_id > 0) {
return ilObjUser::_lookupPref($a_user_id, "priv_feed_pass");
}
return false;
}
示例10: fillRow
/**
* get flat bookmark list for personal desktop
*/
function fillRow($a_set)
{
global $ilUser, $ilCtrl, $lng, $ilSetting, $rbacsetting, $rbacsystem;
// mail link
$a_set["mail_to"] = "";
if ($this->mail_allowed && $rbacsystem->checkAccessOfUser($a_set['id'], 'internal_mail', ilMailGlobalServices::getMailObjectRefId())) {
$a_set['mail_url'] = ilMailFormCall::getLinkTarget($this->topGuiObj, '', array(), array('type' => 'new', 'rcp_to' => urlencode($a_set['login'])));
}
// check for profile
$a_set["profile"] = in_array(ilObjUser::_lookupPref($a_set["id"], "public_profile"), array("y", "g"));
// user image
if ($this->getCurrentDetailLevel() > 2) {
if ($a_set["mail_url"] != "") {
$this->tpl->setCurrentBlock("mailto_link");
$this->tpl->setVariable("TXT_MAIL", $lng->txt("mail"));
$this->tpl->setVariable("MAIL_URL", $a_set["mail_url"]);
$this->tpl->parseCurrentBlock();
}
$chatSettings = new ilSetting('chatroom');
if ($chatSettings->get('chat_enabled')) {
if (!$this->__showActiveChatsOfUser($a_set["id"])) {
// Show invite to chat
$this->__showChatInvitation($a_set["id"]);
}
global $rbacsystem;
include_once './Modules/Chatroom/classes/class.ilObjChatroom.php';
if ($a_set["id"] == $ilUser->getId() && $rbacsystem->checkAccess('read', ilObjChatroom::_getPublicRefId())) {
$this->tpl->setCurrentBlock('chat_link');
$this->tpl->setVariable('TXT_CHAT_INVITE', $lng->txt('chat_enter_public_room'));
$this->tpl->setVariable('TXT_CHAT_INVITE_TOOLTIP', $lng->txt('chat_enter_public_room_tooltip'));
// $this->tpl->setVariable('CHAT_LINK','./ilias.php?baseClass=ilChatPresentationGUI&ref_id='.ilObjChat::_getPublicChatRefId());
$this->tpl->setVariable('CHAT_LINK', './ilias.php?baseClass=ilRepositoryGUI&cmd=view&ref_id=' . ilObjChatroom::_getPublicRefId());
$this->tpl->parseCurrentBlock();
}
}
// user image
$this->tpl->setCurrentBlock("usr_image");
$this->tpl->setVariable("USR_IMAGE", ilObjUser::_getPersonalPicturePath($a_set["id"], "xxsmall"));
$this->tpl->setVariable("USR_ALT", $lng->txt("personal_picture"));
$this->tpl->parseCurrentBlock();
$this->tpl->touchBlock("usr_image_space");
$pd_set = new ilSetting("pd");
$osi_server = $pd_set->get("osi_host");
// if (trim($osi_server) != "")
// {
// instant messengers
// 1 indicates to use online status check
$im_arr = array("icq" => 0, "yahoo" => 1, "msn" => 0, "aim" => 0, "skype" => 1, "jabber" => 0, "voip" => 0);
// use onlinestatus.org
// when enabled all instant messengers are checked online and ignores settings above
if (trim($osi_server) != "") {
$osi_enable = true;
}
// removed calls to external servers due to
// bug 10583, alex 8 Mar 2013
foreach ($im_arr as $im_name => $im_check) {
if ($im_id = ilObjUser::_lookupIm($a_set["id"], $im_name)) {
$im_url = "";
switch ($im_name) {
case "icq":
$im_url = "http://http://www.icq.com/people/" . $im_id;
break;
case "yahoo":
$im_url = "http://edit.yahoo.com/config/send_webmesg?target=" . $im_id . "&src=pg";
break;
case "msn":
$im_url = "http://messenger.live.com";
break;
case "aim":
//$im_url = "aim:GoIM?screenname=".$im_id;
$im_url = "http://aimexpress.aim.com";
break;
case "skype":
$im_url = "skype:" . $im_id . "?call";
break;
}
$im_img = ilUtil::getImagePath($im_name . 'online.png');
if ($im_url != "") {
$this->tpl->setCurrentBlock("im_link_start");
$this->tpl->setVariable("URL_IM", $im_url);
$this->tpl->parseCurrentBlock();
$this->tpl->touchBlock("im_link_end");
}
$this->tpl->setCurrentBlock("instant_messengers");
$this->tpl->setVariable("IMG_IM_ICON", $im_img);
$this->tpl->setVariable("TXT_IM_ICON", $lng->txt("im_" . $im_name));
$icon_id = "im_" . $im_name . "_usr_" . $a_set["id"];
$this->tpl->setVariable("ICON_ID", $icon_id);
include_once "./Services/UIComponent/Tooltip/classes/class.ilTooltipGUI.php";
ilTooltipGUI::addTooltip($icon_id, $lng->txt("im_" . $im_name) . ": " . $im_id, "", "top center", "bottom center");
$this->tpl->parseCurrentBlock();
}
}
// }
}
// username
if (!$a_set["profile"]) {
//.........这里部分代码省略.........
示例11: checkAccessUserImage
/**
* Check access rights for user images
*
* Due to privacy this will be checked for a truly identified user
* (IP based checking is not recommended user images)
*
* @param int usr_id
* @return boolean access given (true/false)
*/
private function checkAccessUserImage($usr_id)
{
global $ilUser, $ilSetting;
// check if own image is viewed
if ($usr_id == $ilUser->getId()) {
return true;
}
// check if image is in the public profile
$public_upload = ilObjUser::_lookupPref($usr_id, 'public_upload');
if ($public_upload != 'y') {
return false;
}
// check the publication status of the profile
$public_profile = ilObjUser::_lookupPref($usr_id, 'public_profile');
if ($public_profile == 'g' and $ilSetting->get('enable_global_profiles') and $ilSetting->get('pub_section')) {
// globally public
return true;
} elseif (($public_profile == 'y' or $public_profile == 'g') and $ilUser->getId() != ANONYMOUS_USER_ID) {
// public for logged in users
return true;
} else {
// not public
return false;
}
}