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')); $tbl_users->setRowTemplate('tpl.mail_search_users_row.html', 'Services/Contact'); $result = array(); $counter = 0; foreach ($users as $user) { $login = ilObjUser::_lookupLogin($user); if ($_GET["ref"] != "wsp") { $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_usr[]', $login) . ilUtil::formCheckbox(0, 'search_name_cc[]', $login) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $login); } else { $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_usr[]', $user); } $result[$counter]['login'] = $login; if (in_array(ilObjUser::_lookupPref($user, 'public_profile'), array('y', "g"))) { $name = ilObjUser::_lookupName($user); $result[$counter]['firstname'] = $name['firstname']; $result[$counter]['lastname'] = $name['lastname']; } else { $result[$counter]['firstname'] = ''; $result[$counter]['lastname'] = ''; } if (ilObjUser::_lookupPref($user, 'public_email') == 'y') { $has_mail_usr = true; $result[$counter]['email'] = ilObjUser::_lookupEmail($user); } ++$counter; } if ($_GET["ref"] != "wsp") { $tbl_users->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%'); } else { $tbl_users->addColumn("", "", "1%"); } $tbl_users->addColumn($this->lng->txt('login'), 'login', '15%'); $tbl_users->addColumn($this->lng->txt('firstname'), 'firstname', '15%'); $tbl_users->addColumn($this->lng->txt('lastname'), 'lastname', '15%'); if ($has_mail_usr == true) { foreach ($result as $key => $val) { if ($val['email'] == '') { $result[$key]['email'] = ' '; } } $tbl_users->addColumn($this->lng->txt('email'), 'email', '15%'); } $tbl_users->setData($result); $tbl_users->setDefaultOrderField('login'); $tbl_users->setPrefix('usr_'); $tbl_users->enable('select_all'); $tbl_users->setSelectAllCheckbox('search_name_to_usr'); $tbl_users->setFormName('recipients'); $this->tpl->setVariable('TABLE_USERS', $tbl_users->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'; include_once 'Services/Membership/classes/class.ilParticipants.php'; $group_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(); $search = ilObjectSearchFactory::_getObjectSearchInstance($query_parser); $search->setFilter(array('grp')); $result = $search->performSearch(); $group_results->mergeEntries($result); $group_results->setMaxHits(PHP_INT_MAX); $group_results->preventOverwritingMaxhits(true); $group_results->setRequiredPermission('read'); $group_results->filter(ROOT_FOLDER_ID, true); $visible_groups = array(); if ($group_results->getResults()) { $tbl_grp = new ilTable2GUI($this); $tbl_grp->setTitle($lng->txt('system') . ': ' . $lng->txt('groups')); $tbl_grp->setRowTemplate('tpl.mail_search_groups_row.html', 'Services/Contact'); $result = array(); $counter = 0; $ilObjDataCache->preloadReferenceCache(array_keys($group_results->getResults())); $groups = $group_results->getResults(); foreach ($groups as $grp) { if (!ilParticipants::hasParticipantListAccess($grp['obj_id'])) { continue; } if ($_GET["ref"] != "wsp") { $members = array(); $roles = $rbacreview->getAssignableChildRoles($grp['ref_id']); foreach ($roles as $role) { if (substr($role['title'], 0, 14) == 'il_grp_member_' || substr($role['title'], 0, 13) == 'il_grp_admin_') { // does not work if Pear is enabled and Mailbox Address contain special chars!! //array_push($members, $rbacreview->getRoleMailboxAddress($role['obj_id'])); // FIX for Mantis: 7523 array_push($members, '#' . $role['title']); } } $str_members = implode(',', $members); $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_grp[]', $str_members) . ilUtil::formCheckbox(0, 'search_name_cc[]', $str_members) . ilUtil::formCheckbox(0, 'search_name_bcc[]', $str_members); } else { $result[$counter]['check'] = ilUtil::formCheckbox(0, 'search_name_to_grp[]', $grp['obj_id']); } $result[$counter]['title'] = $ilObjDataCache->lookupTitle($grp['obj_id']); $result[$counter]['description'] = $ilObjDataCache->lookupDescription($grp['obj_id']); ++$counter; $visible_groups[] = $grp; } if ($visible_groups) { $tbl_grp->setData($result); if ($_GET["ref"] != "wsp") { $tbl_grp->addColumn($this->lng->txt('mail_to') . '/' . $this->lng->txt('cc') . '/' . $this->lng->txt('bc'), 'check', '10%'); } else { $tbl_grp->addColumn("", "", "1%"); } $tbl_grp->addColumn($this->lng->txt('title'), 'title', '15%'); $tbl_grp->addColumn($this->lng->txt('description'), 'description', '15%'); $tbl_grp->setDefaultOrderField('title'); $tbl_grp->setPrefix('grp_'); $tbl_grp->enable('select_all'); $tbl_grp->setSelectAllCheckbox('search_name_to_grp'); $tbl_grp->setFormName('recipients'); $this->tpl->setVariable('TABLE_GRP', $tbl_grp->getHTML()); } } if (count($users) || count($visible_groups) || count($entries)) { $this->tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.svg")); $this->tpl->setVariable("ALT_ARROW", ''); if ($_GET["ref"] != "wsp") { $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('adopt')); } else { $this->tpl->setVariable('BUTTON_ADOPT', $this->lng->txt('wsp_share_with_users')); } } else { $this->lng->loadLanguageModule('search'); ilUtil::sendInfo($this->lng->txt('search_no_match')); } if ($_GET["ref"] != "wsp") { $this->tpl->show(); } }
/** * 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(); } } }
/** * 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" => "*****@*****.**", "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); }
/** * 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'); } }
/** * 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; }
/** * 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(); } } }
/** * 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); } if ($mailData['rcp_bcc']) { $bcc = new ilCustomInputGUI($this->lng->txt('bc')); $bcc->setHtml(ilUtil::htmlencodePlainString($this->umail->formatNamesForOutput($mailData['rcp_bcc']), false)); $form->addItem($bcc); } $subject = new ilCustomInputGUI($this->lng->txt('subject')); $subject->setHtml(ilUtil::htmlencodePlainString($mailData['m_subject'], true)); $form->addItem($subject); $date = new ilCustomInputGUI($this->lng->txt('date')); $date->setHtml(ilDatePresentation::formatDate(new ilDateTime($mailData['send_time'], IL_CAL_DATETIME))); $form->addItem($date); $message = new ilCustomInputGUI($this->lng->txt('message')); $message->setHtml(ilUtil::htmlencodePlainString($mailData['m_message'], true)); $form->addItem($message); if ($mailData['attachments']) { $att = new ilCustomInputGUI($this->lng->txt('attachments')); $radiog = new ilRadioGroupInputGUI('', 'filename'); foreach ($mailData['attachments'] as $file) { $radiog->addOption(new ilRadioOption($file, md5($file))); } $att->setHtml($radiog->render()); $form->addCommandButton('deliverFile', $this->lng->txt('download')); $form->addItem($att); } $isTrashFolder = false; if ($this->mbox->getTrashFolder() == $_GET['mobj_id']) { $isTrashFolder = true; } $current_folder_data = $this->mbox->getFolderData((int) $_GET['mobj_id']); $selectOptions = array(); $actions = $this->mbox->getActions((int) $_GET["mobj_id"]); foreach ($actions as $key => $action) { if ($key == 'moveMails') { $folders = $this->mbox->getSubFolders(); foreach ($folders as $folder) { if (($folder["type"] != 'trash' || !$isTrashFolder) && $folder['obj_id'] != $current_folder_data['obj_id']) { $optionText = ''; if ($folder['type'] != 'user_folder') { $optionText = $action . ' ' . $this->lng->txt('mail_' . $folder['title']) . ($folder['type'] == 'trash' ? ' (' . $this->lng->txt('delete') . ')' : ''); } else { $optionText = $action . ' ' . $folder['title']; } $selectOptions[$folder['obj_id']] = $optionText; } } } } if ($current_folder_data['type'] == 'user_folder') { $txt_folder = $current_folder_data['title']; } else { $txt_folder = $this->lng->txt('mail_' . $current_folder_data['title']); } $ilToolbar->addSeparator(); $ilToolbar->addText(sprintf($this->lng->txt('current_folder'), $txt_folder)); if (is_array($selectOptions) && count($selectOptions)) { include_once 'Services/Form/classes/class.ilSelectInputGUI.php'; $actions = new ilSelectInputGUI('', 'selected_cmd'); $actions->setOptions($selectOptions); $this->ctrl->setParameter($this, 'mail_id', (int) $_GET['mail_id']); $ilToolbar->setFormAction($this->ctrl->getFormAction($this, 'showMail')); $ilToolbar->addInputItem($actions); $ilToolbar->addFormButton($this->lng->txt('submit'), 'changeFolder'); } // Navigation $prevMail = $this->umail->getPreviousMail((int) $_GET['mail_id']); $nextMail = $this->umail->getNextMail((int) $_GET['mail_id']); if (is_array($prevMail) || is_array($nextMail)) { $ilToolbar->addSeparator(); if ($prevMail['mail_id']) { $this->ctrl->setParameter($this, 'mail_id', $prevMail['mail_id']); $ilToolbar->addButton($this->lng->txt('previous'), $this->ctrl->getLinkTarget($this, 'showMail')); $this->ctrl->clearParameters($this); } if ($nextMail['mail_id']) { $this->ctrl->setParameter($this, 'mail_id', $nextMail['mail_id']); $ilToolbar->addButton($this->lng->txt('next'), $this->ctrl->getLinkTarget($this, 'showMail')); $this->ctrl->clearParameters($this); } } $this->tpl->setContent($form->getHTML()); $this->tpl->show(); }
/** * 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'); }
/** * 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; }
/** * 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"]) { $this->tpl->setVariable("USR_LOGIN", $a_set["login"]); } else { if ($this->getCurrentDetailLevel() > 2) { $this->tpl->setVariable("USR_LOGIN", "<br />" . $a_set["login"]); } else { $this->tpl->setVariable("USR_LOGIN", " [" . $a_set["login"] . "]"); } } // profile link if ($a_set["profile"]) { include_once "Services/User/classes/class.ilUserUtil.php"; $user_name = ilUserUtil::getNamePresentation($a_set["id"], false, false, "", false, true, false); $this->tpl->setCurrentBlock("profile_link"); $this->tpl->setVariable("TXT_VIEW", $lng->txt("profile")); // see ilPersonalProfileGUI::getProfilePortfolio() $has_prtf = false; if ($ilSetting->get('user_portfolios')) { include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php"; $has_prtf = ilObjPortfolio::getDefaultPortfolio($a_set["id"]); } if (!$has_prtf) { // (simple) profile: center column $ilCtrl->setParameter($this, "user", $a_set["id"]); $this->tpl->setVariable("LINK_PROFILE", $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML")); } else { // portfolio: fullscreen include_once "Services/Link/classes/class.ilLink.php"; $this->tpl->setVariable("LINK_PROFILE", ilLink::_getLink($a_set["id"], "usr")); $this->tpl->setVariable("LINK_TARGET", "_blank"); } $this->tpl->setVariable("USR_ID", $a_set["id"]); $this->tpl->setVariable("LINK_FULLNAME", $user_name); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setVariable("USR_FULLNAME", ""); } }
/** * 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; } }