/** * Standard Version of Fill Row. Most likely to * be overwritten by derived class. */ protected function fillRow($a_set) { global $lng, $ilCtrl, $ilAccess; // rollback command if ($a_set["nr"] > 0) { $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]); $this->tpl->setCurrentBlock("command"); $this->tpl->setVariable("TXT_COMMAND", $lng->txt("cont_rollback")); $this->tpl->setVariable("HREF_COMMAND", $ilCtrl->getLinkTarget($this->getParentObject(), "rollbackConfirmation")); $this->tpl->parseCurrentBlock(); $ilCtrl->setParameter($this->getParentObject(), "old_nr", ""); } if (!$this->rselect) { $this->tpl->setVariable("RSELECT", 'checked="checked"'); $this->rselect = true; } else { if (!$this->lselect) { $this->tpl->setVariable("LSELECT", 'checked="checked"'); $this->lselect = true; } } $this->tpl->setVariable("NR", $a_set["nr"]); $this->tpl->setVariable("TXT_HDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["hdate"], IL_CAL_DATETIME))); $ilCtrl->setParameter($this->getParentObject(), "old_nr", $a_set["nr"]); $ilCtrl->setParameter($this->getParentObject(), "history_mode", "1"); $this->tpl->setVariable("HREF_OLD_PAGE", $ilCtrl->getLinkTarget($this->getParentObject(), "preview")); $ilCtrl->setParameter($this->getParentObject(), "history_mode", ""); if (ilObject::_exists($a_set["user"])) { // user name $user = ilObjUser::_lookupName($a_set["user"]); $login = ilObjUser::_lookupLogin($a_set["user"]); //$this->tpl->setVariable("TXT_LINKED_USER", // $user["lastname"].", ".$user["firstname"]." [".$login."]"); // profile link include_once "./Services/User/classes/class.ilUserUtil.php"; $name_pres = ilUserUtil::getNamePresentation($a_set["user"], true, true, $ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd())); //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "user", $a_set["user"]); //$ilCtrl->setParameterByClass("ilpublicuserprofilegui", "back_url", // rawurlencode($ilCtrl->getLinkTarget($this->getParentObject(), $this->getParentCmd()))); //$this->tpl->setVariable("USER_LINK", // $ilCtrl->getLinkTargetByClass("ilpublicuserprofilegui", "getHTML")); //$img = ilObjUser::_getPersonalPicturePath($a_set["user"], "xxsmall"); //$this->tpl->setVariable("IMG_USER", $img); $this->tpl->setVariable("TXT_USER", $name_pres); } $ilCtrl->setParameter($this->getParentObject(), "old_nr", ""); }
function owner() { $this->__initSubTabs("owner"); include_once "Services/Form/classes/class.ilPropertyFormGUI.php"; $form = new ilPropertyFormGUI(); $form->setFormAction($this->ctrl->getFormAction($this, "owner")); $form->setTitle($this->lng->txt("info_owner_of_object")); $login = new ilTextInputGUI($this->lng->txt("login"), "owner"); $login->setDataSource($this->ctrl->getLinkTargetByClass(array(get_class($this), 'ilRepositorySearchGUI'), 'doUserAutoComplete', '', true)); $login->setRequired(true); $login->setSize(50); $login->setInfo($this->lng->txt("chown_warning")); $login->setValue(ilObjUser::_lookupLogin($this->gui_obj->object->getOwner())); $form->addItem($login); $form->addCommandButton("changeOwner", $this->lng->txt("change_owner")); $this->tpl->setContent($form->getHTML()); }
/** * show send mail * * @access public * @param * @return */ public function sendMailToSelectedUsers() { if (isset($_GET['member_id'])) { $_POST['participants'] = array($_GET['member_id']); } else { $_POST['participants'] = array_unique(array_merge((array) $_POST['admins'], (array) $_POST['tutors'], (array) $_POST['members'], (array) $_POST['roles'], (array) $_POST['waiting'], (array) $_POST['subscribers'])); } if (!count($_POST['participants'])) { ilUtil::sendFailure($GLOBALS['lng']->txt("no_checkbox"), TRUE); $this->ctrl->returnToParent($this); return false; } foreach ($_POST['participants'] as $usr_id) { $rcps[] = ilObjUser::_lookupLogin($usr_id); } require_once 'Services/Mail/classes/class.ilMailFormCall.php'; ilUtil::redirect(ilMailFormCall::getRedirectTarget($this->getCurrentObject(), 'members', array(), array('type' => 'new', 'rcp_to' => implode(',', $rcps), 'sig' => $this->createMailSignature()))); return true; }
/** * Take over course members to addressbook */ public function adoptMembers() { global $lng; $ids = (int) $_GET['search_members'] ? array((int) $_GET['search_members']) : $_POST['search_members']; if ($ids) { foreach ($ids as $member) { $login = ilObjUser::_lookupLogin($member); if (!$this->abook->checkEntry($login)) { $name = ilObjUser::_lookupName($member); $email = ''; if (ilObjUser::_lookupPref((int) $member, 'public_email') == 'y') { $email = ilObjUser::_lookupEmail($member); } $this->abook->addEntry($login, $name["firstname"], $name["lastname"], $email); } } ilUtil::sendInfo($lng->txt("mail_members_added_addressbook")); } else { ilUtil::sendInfo($lng->txt("mail_select_one_entry")); } $this->showMembers(); }
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(); } }
/** * get member list data */ function getMemberListData($a_eph_id, $a_ass_id) { global $ilDB; $mem = array(); // first get list of members from member table $set = $ilDB->query("SELECT * FROM rep_robj_xeph_members " . "WHERE obj_id = " . $ilDB->quote($a_eph_id, "integer")); while ($rec = $ilDB->fetchAssoc($set)) { if (ilObject::_exists($rec["user_id"]) && ilObject::_lookupType($rec["user_id"]) == "usr") { $name = ilObjUser::_lookupName($rec["user_id"]); $login = ilObjUser::_lookupLogin($rec["user_id"]); $mem[$rec["user_id"]] = array("name" => $name["lastname"] . ", " . $name["firstname"], "login" => $login, "user_id" => $rec["user_id"], "lastname" => $name["lastname"], "firstname" => $name["firstname"]); } } $q = "SELECT * FROM rep_robj_xeph_ass_stat " . "WHERE ass_id = " . $ilDB->quote($a_ass_id, "integer"); $set = $ilDB->query($q); while ($rec = $ilDB->fetchAssoc($set)) { if (isset($mem[$rec["user_id"]])) { $mem[$rec["user_id"]]["sent_time"] = $rec["sent_time"]; $mem[$rec["user_id"]]["submission"] = ilEphAssignment::getLastSubmission($a_ass_id, $rec["user_id"]); $mem[$rec["user_id"]]["status_time"] = $rec["status_time"]; $mem[$rec["user_id"]]["feedback_time"] = $rec["feedback_time"]; $mem[$rec["user_id"]]["notice"] = $rec["notice"]; $mem[$rec["user_id"]]["status"] = $rec["status"]; } } return $mem; }
/** * 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); }
/** * Get all managed consultation hours users for current users * @return array */ public static function getManagedUsers() { global $ilDB, $ilUser; $all = array(); $set = $ilDB->query('SELECT user_id FROM cal_ch_settings' . ' WHERE admin_id = ' . $ilDB->quote($ilUser->getId(), 'integer')); while ($row = $ilDB->fetchAssoc($set)) { $all[$row['user_id']] = ilObjUser::_lookupLogin($row['user_id']); } return $all; }
/** * @param $a_action * @param $a_table_id * @param null $a_record_id */ public static function sendNotification($a_action, $a_table_id, $a_record_id = NULL) { global $ilUser, $ilAccess; // If coming from trash, never send notifications and don't load dcl Object if ($_GET['ref_id'] == SYSTEM_FOLDER_ID) { return; } $dclObj = new ilObjDataCollection($_GET['ref_id']); if ($dclObj->getNotification() != 1) { return; } $obj_table = ilDataCollectionCache::getTableCache($a_table_id); $obj_dcl = $obj_table->getCollectionObject(); // recipients require_once './Services/Notification/classes/class.ilNotification.php'; $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_DATA_COLLECTION, $obj_dcl->getId(), true); if (!sizeof($users)) { return; } ilNotification::updateNotificationTime(ilNotification::TYPE_DATA_COLLECTION, $obj_dcl->getId(), $users); //FIXME $_GET['ref_id] require_once './Services/Link/classes/class.ilLink.php'; $link = ilLink::_getLink($_GET['ref_id']); // prepare mail content // use language of recipient to compose message require_once './Services/Language/classes/class.ilLanguageFactory.php'; // send mails require_once './Services/Mail/classes/class.ilMail.php'; require_once './Services/User/classes/class.ilObjUser.php'; require_once './Services/Language/classes/class.ilLanguageFactory.php'; require_once './Services/User/classes/class.ilUserUtil.php'; require_once './Services/User/classes/class.ilUserUtil.php'; require_once './Modules/DataCollection/classes/class.ilDataCollectionTable.php'; foreach (array_unique($users) as $idx => $user_id) { // the user responsible for the action should not be notified // FIXME $_GET['ref_id] if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $_GET['ref_id'])) { // use language of recipient to compose message $ulng = ilLanguageFactory::_getLanguageOfUser($user_id); $ulng->loadLanguageModule('dcl'); $subject = sprintf($ulng->txt('dcl_change_notification_subject'), $obj_dcl->getTitle()); // update/delete $message = $ulng->txt("dcl_hello") . " " . ilObjUser::_lookupFullname($user_id) . ",\n\n"; $message .= $ulng->txt('dcl_change_notification_dcl_' . $a_action) . ":\n\n"; $message .= $ulng->txt('obj_dcl') . ": " . $obj_dcl->getTitle() . "\n\n"; $message .= $ulng->txt('dcl_table') . ": " . $obj_table->getTitle() . "\n\n"; $message .= $ulng->txt('dcl_record') . ":\n"; $message .= "------------------------------------\n"; if ($a_record_id) { $record = ilDataCollectionCache::getRecordCache($a_record_id); if (!$record->getTableId()) { $record->setTableId($a_table_id); } // $message .= $ulng->txt('dcl_record_id').": ".$a_record_id.":\n"; $t = ""; foreach ($record->getTable()->getVisibleFields() as $field) { if ($record->getRecordField($field->getId())) { $t .= $field->getTitle() . ": " . $record->getRecordField($field->getId())->getPlainText() . "\n"; } } $message .= $t . "\n"; } $message .= "------------------------------------\n"; $message .= $ulng->txt('dcl_changed_by') . ": " . $ilUser->getFullname() . " " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n"; $message .= $ulng->txt('dcl_change_notification_link') . ": " . $link . "\n\n"; $message .= $ulng->txt('dcl_change_why_you_receive_this_email'); $mail_obj = new ilMail(ANONYMOUS_USER_ID); $mail_obj->appendInstallationSignature(true); $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system")); } else { unset($users[$idx]); } } }
/** * parse table * * @access public * @return */ public function parse() { $this->init(); foreach ($this->getParticipants() as $participant_id) { $usr_data = $this->session_participants->getUser($participant_id); $tmp_data['id'] = $participant_id; $name = ilObjUser::_lookupName($participant_id); $tmp_data['name'] = $name['lastname']; $tmp_data['lastname'] = $name['lastname']; $tmp_data['firstname'] = $name['firstname']; $tmp_data['login'] = ilObjUser::_lookupLogin($participant_id); $tmp_data['mark'] = $usr_data['mark']; $tmp_data['comment'] = $usr_data['comment']; $tmp_data['participated'] = $this->session_participants->hasParticipated($participant_id); $tmp_data['registered'] = $this->session_participants->isRegistered($participant_id); $part[] = $tmp_data; } $this->setData($part ? $part : array()); }
/** * 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); break; case "Title": $this->userObj->setUTitle($this->cdata); break; case "Gender": if ($this->cdata != "m" && $this->cdata != "f") { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "Gender", $this->cdata)); } $this->userObj->setGender($this->cdata); break; case "Email": $this->userObj->setEmail($this->cdata); break; case "Institution": $this->userObj->setInstitution($this->cdata); break; case "Street": $this->userObj->setStreet($this->cdata); break; case "City": $this->userObj->setCity($this->cdata); break; case "PostalCode": $this->userObj->setZipCode($this->cdata); break; case "Country": $this->userObj->setCountry($this->cdata); break; case "PhoneOffice": $this->userObj->setPhoneOffice($this->cdata); break; case "PhoneHome": $this->userObj->setPhoneHome($this->cdata); break; case "PhoneMobile": $this->userObj->setPhoneMobile($this->cdata); break; case "Fax": $this->userObj->setFax($this->cdata); break; case "Hobby": $this->userObj->setHobby($this->cdata); break; case "Comment": $this->userObj->setComment($this->cdata); break; case "Department": $this->userObj->setDepartment($this->cdata); break; case "Matriculation": $this->userObj->setMatriculation($this->cdata); break; case "ExternalAccount": //echo "-".$this->userObj->getAuthMode()."-".$this->userObj->getLogin()."-"; $am = $this->userObj->getAuthMode() == "default" || $this->userObj->getAuthMode() == "" ? ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode')) : $this->userObj->getAuthMode(); $loginForExternalAccount = trim($this->cdata) == "" ? "" : ilObjUser::_checkExternalAuthAccount($am, trim($this->cdata)); switch ($this->action) { case "Insert": if ($loginForExternalAccount != "") { $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_insert_ext_account_exists") . " (" . $this->cdata . ")"); } break; case "Update": if ($loginForExternalAccount != "") { $externalAccountHasChanged = trim($this->cdata) != ilObjUser::_lookupExternalAccount($this->user_id); if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) { $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_update_ext_account_exists") . " (" . $this->cdata . " for " . $loginForExternalAccount . ")"); } } break; } if ($externalAccountHasChanged) { $this->userObj->setExternalAccount(trim($this->cdata)); } break; case "Active": if ($this->cdata != "true" && $this->cdata != "false") { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "Active", $this->cdata)); } $this->currActive = $this->cdata; break; case "TimeLimitOwner": if (!preg_match("/\\d+/", $this->cdata)) { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata)); } elseif (!$ilAccess->checkAccess('cat_administrate_users', '', $this->cdata)) { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata)); } elseif ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 'cat' && !(int) $this->cdata == USER_FOLDER_ID) { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata)); } $this->userObj->setTimeLimitOwner($this->cdata); break; case "TimeLimitUnlimited": switch (strtolower($this->cdata)) { case "true": case "1": $this->userObj->setTimeLimitUnlimited(1); break; case "false": case "0": $this->userObj->setTimeLimitUnlimited(0); break; default: $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitUnlimited", $this->cdata)); break; } break; case "TimeLimitFrom": // Accept datetime or Unix timestamp if (strtotime($this->cdata) === false && !is_numeric($this->cdata)) { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitFrom", $this->cdata)); } $this->userObj->setTimeLimitFrom($this->cdata); break; case "TimeLimitUntil": // Accept datetime or Unix timestamp if (strtotime($this->cdata) === false && !is_numeric($this->cdata)) { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitUntil", $this->cdata)); } $this->userObj->setTimeLimitUntil($this->cdata); break; case "TimeLimitMessage": switch (strtolower($this->cdata)) { case "1": $this->userObj->setTimeLimitMessage(1); break; case "0": $this->userObj->setTimeLimitMessage(0); break; default: $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitMessage", $this->cdata)); break; } break; case "ApproveDate": // Accept datetime or Unix timestamp if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00") { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "ApproveDate", $this->cdata)); } break; case "AgreeDate": // Accept datetime or Unix timestamp if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00") { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "AgreeDate", $this->cdata)); } break; case "iLincID": if (!preg_match("/\\d+/", $this->cdata)) { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "iLincID", $this->cdata)); } break; case "iLincUser": if (!preg_match("/\\w+/", $this->cdata)) { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "iLincUser", $this->cdata)); } break; case "iLincPasswd": if (!preg_match("/\\w+/", $this->cdata)) { $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "iLincPasswd", $this->cdata)); } break; case "Pref": if ($this->currentPrefKey != null) { $this->verifyPref($this->currentPrefKey, $this->cdata); } $this->currentPrefKey == null; } }
/** * Returns the login for the specified user id, or null if * the user does not exist. */ protected function getLogin($userId) { $login = ilObjUser::_lookupLogin($userId); $this->writelog('getLogin(' . $userId . '):' . var_export($login, true)); return $login; }
/** * list sessions of all user * * @access public * @param * @return */ public function eventsListObject() { global $ilErr, $ilAccess, $ilUser, $tree; if (!$ilAccess->checkAccess('write', '', $this->object->getRefId())) { $ilErr->raiseError($this->lng->txt('msg_no_perm_read'), $ilErr->MESSAGE); } $this->tpl->addBlockFile('ADM_CONTENT', 'adm_content', 'tpl.sess_list.html', 'Modules/Session'); $this->__showButton($this->ctrl->getLinkTarget($this, 'exportCSV'), $this->lng->txt('event_csv_export')); include_once 'Modules/Session/classes/class.ilEventParticipants.php'; $this->tpl->addBlockfile("EVENTS_TABLE", "events_table", "tpl.table.html"); $this->tpl->addBlockfile('TBL_CONTENT', 'tbl_content', 'tpl.sess_list_row.html', 'Modules/Session'); $members_obj = $this->initContainer(true); $members = $members_obj->getParticipants(); $members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id'); // Table $tbl = new ilTableGUI(); $tbl->setTitle($this->lng->txt("event_overview"), 'icon_usr.png', $this->lng->txt('obj_usr')); $this->ctrl->setParameter($this, 'offset', (int) $_GET['offset']); $course_ref_id = $tree->checkForParentType($this->object->getRefId(), 'crs'); $events = array(); foreach ($tree->getSubtree($tree->getNodeData($course_ref_id), false, 'sess') as $event_id) { $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false); if (!is_object($tmp_event) or $tmp_event->getType() != 'sess') { continue; } $events[] = $tmp_event; } $headerNames = array(); $headerVars = array(); $colWidth = array(); $headerNames[] = $this->lng->txt('name'); $headerVars[] = "name"; $colWidth[] = '20%'; for ($i = 1; $i <= count($events); $i++) { $headerNames[] = $i; $headerVars[] = "event_" . $i; $colWidth[] = 80 / count($events) . "%"; } $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this)); $tbl->setHeaderNames($headerNames); $tbl->setHeaderVars($headerVars, $this->ctrl->getParameterArray($this, 'eventsList')); $tbl->setColumnWidth($colWidth); $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setOffset($_GET["offset"]); $tbl->setLimit($ilUser->getPref("hits_per_page")); $tbl->setMaxCount(count($members)); $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); $sliced_users = array_slice($members, $_GET['offset'], $_SESSION['tbl_limit']); $tbl->disable('sort'); $tbl->render(); $counter = 0; foreach ($sliced_users as $user_id) { foreach ($events as $event_obj) { $this->tpl->setCurrentBlock("eventcols"); $event_part = new ilEventParticipants($this->object->getId()); $this->tpl->setVariable("IMAGE_PARTICIPATED", $event_part->hasParticipated($user_id) ? ilUtil::getImagePath('icon_ok.png') : ilUtil::getImagePath('icon_not_ok.png')); $this->tpl->setVariable("PARTICIPATED", $event_part->hasParticipated($user_id) ? $this->lng->txt('event_participated') : $this->lng->txt('event_not_participated')); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_content"); $name = ilObjUser::_lookupName($user_id); $this->tpl->setVariable("CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2')); $this->tpl->setVariable("LASTNAME", $name['lastname']); $this->tpl->setVariable("FIRSTNAME", $name['firstname']); $this->tpl->setVariable("LOGIN", ilObjUser::_lookupLogin($user_id)); $this->tpl->parseCurrentBlock(); } $this->tpl->setVariable("HEAD_TXT_LEGEND", $this->lng->txt("legend")); $this->tpl->setVariable("HEAD_TXT_DIGIT", $this->lng->txt("event_digit")); $this->tpl->setVariable("HEAD_TXT_EVENT", $this->lng->txt("event")); $this->tpl->setVariable("HEAD_TXT_LOCATION", $this->lng->txt("event_location")); $this->tpl->setVariable("HEAD_TXT_DATE_TIME", $this->lng->txt("event_date_time")); $i = 1; foreach ($events as $event_obj) { $this->tpl->setCurrentBlock("legend_loop"); $this->tpl->setVariable("LEGEND_CSS_ROW", ilUtil::switchColor($counter++, 'tblrow1', 'tblrow2')); $this->tpl->setVariable("LEGEND_DIGIT", $i++); $this->tpl->setVariable("LEGEND_EVENT_TITLE", $event_obj->getTitle()); $this->tpl->setVariable("LEGEND_EVENT_DESCRIPTION", $event_obj->getDescription()); $this->tpl->setVariable("LEGEND_EVENT_LOCATION", $event_obj->getLocation()); $this->tpl->setVariable("LEGEND_EVENT_APPOINTMENT", $event_obj->getFirstAppointment()->appointmentToString()); $this->tpl->parseCurrentBlock(); } }
public function showUser() { global $ilCtrl, $ilToolbar; $this->ctrl->setParameter($this, "mail_id", $_GET["mail_id"]); $this->tpl->setTitle($this->lng->txt("mail")); //$ilToolbar->addButton($this->lng->txt("back"), $this->ctrl->getLinkTarget($this, "showMail")); $this->tpl->setVariable("TBL_TITLE", $this->lng->txt("profile_of") . " " . ilObjUser::_lookupLogin($_GET["user"])); $this->tpl->setVariable("TBL_TITLE_IMG", ilUtil::getImagePath("icon_usr.svg")); $this->tpl->setVariable("TBL_TITLE_IMG_ALT", $this->lng->txt("public_profile")); include_once './Services/User/classes/class.ilPublicUserProfileGUI.php'; $profile_gui = new ilPublicUserProfileGUI($_GET["user"]); $profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, "showMail")); $this->tpl->setContent($ilCtrl->getHTML($profile_gui)); $this->tpl->show(); return true; }
/** * Events List CSV Export * * @access public * @param * */ public function exportCSV() { global $tree, $ilAccess; include_once 'Services/Utilities/classes/class.ilCSVWriter.php'; include_once 'Modules/Session/classes/class.ilEventParticipants.php'; $members = $this->members_obj->getParticipants(); $members = ilUtil::_sortIds($members, 'usr_data', 'lastname', 'usr_id'); $events = array(); foreach ($tree->getSubtree($tree->getNodeData($this->course_ref_id), false, 'sess') as $event_id) { $tmp_event = ilObjectFactory::getInstanceByRefId($event_id, false); if (!is_object($tmp_event) or !$ilAccess->checkAccess('write', '', $event_id)) { continue; } $events[] = $tmp_event; } $this->csv = new ilCSVWriter(); $this->csv->addColumn($this->lng->txt("lastname")); $this->csv->addColumn($this->lng->txt("firstname")); $this->csv->addColumn($this->lng->txt("login")); foreach ($events as $event_obj) { // TODO: do not export relative dates $this->csv->addColumn($event_obj->getTitle() . ' (' . $event_obj->getFirstAppointment()->appointmentToString() . ')'); } $this->csv->addRow(); foreach ($members as $user_id) { $name = ilObjUser::_lookupName($user_id); $this->csv->addColumn($name['lastname']); $this->csv->addColumn($name['firstname']); $this->csv->addColumn(ilObjUser::_lookupLogin($user_id)); foreach ($events as $event_obj) { $event_part = new ilEventParticipants((int) $event_obj->getId()); $this->csv->addColumn($event_part->hasParticipated($user_id) ? $this->lng->txt('event_participated') : $this->lng->txt('event_not_participated')); } $this->csv->addRow(); } $date = new ilDate(time(), IL_CAL_UNIX); ilUtil::deliverData($this->csv->getCSVString(), $date->get(IL_CAL_FKT_DATE, 'Y-m-d') . "_course_events.csv", "text/csv"); }
/** * set feedback status for member and redirect to mail screen */ function redirectFeedbackMail() { if ($_GET["member_id"] != "") { ilEphAssignment::updateStatusFeedbackForUser((int) $_GET["ass_id"], (int) $_GET["member_id"], 1); $login = ilObjUser::_lookupLogin((int) $_GET["member_id"]); require_once 'Services/Mail/classes/class.ilMailFormCall.php'; ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, 'showSubmissions', array(), array('type' => 'new', 'rcp_to' => urlencode($login)))); } else { if (count($_POST["member"]) > 0) { include_once './Services/User/classes/class.ilObjUser.php'; $logins = array(); foreach ($_POST["member"] as $member => $val) { $logins[] = ilObjUser::_lookupLogin($member); ilEphAssignment::updateStatusFeedbackForUser((int) $_GET["ass_id"], $member, 1); } $logins = implode($logins, ","); require_once 'Services/Mail/classes/class.ilMailFormCall.php'; ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, 'showSubmissions', array(), array('type' => 'new', 'rcp_to' => $logins))); } } ilUtil::sendFailure($this->lng->txt("no_checkbox"), true); $this->ctrl->redirect($this, "showSubmissions"); }
/** * get history table */ function getHistoryTable($a_header_params, $a_user_comment = false) { $ref_id = $a_header_params["ref_id"]; require_once "./Services/Table/classes/class.ilTableGUI.php"; $tbl = new ilTableGUI(0, false); // table header $tbl->setTitle($this->lng->txt("history")); $tbl->setHeaderNames(array($this->lng->txt("date") . "/" . $this->lng->txt("user"), $this->lng->txt("action"))); $tbl->setColumnWidth(array("40%", "60%")); $cols = array("date_user", "action"); if ($a_header_params == "") { $a_header_params = array(); } $header_params = $a_header_params; $tbl->setHeaderVars($cols, $header_params); // table variables $tbl->setOrderColumn($_GET["sort_by"]); $tbl->setOrderDirection($_GET["sort_order"]); $tbl->setLimit($_GET["limit"]); $tbl->setOffset($_GET["offset"]); $tbl->setMaxCount($this->maxcount); // ??? $tbl->disable("header"); // footer $tbl->setFooter("tblfooter", $this->lng->txt("previous"), $this->lng->txt("next")); // get history entries $entries = ilHistory::_getEntriesForObject($this->obj_id, $this->obj_type); $tbl->setMaxCount(count($entries)); $entries = array_slice($entries, $_GET["offset"], $_GET["limit"]); $this->tpl =& $tbl->getTemplateObject(); $this->tpl->addBlockfile("TBL_CONTENT", "tbl_content", "tpl.history_row.html", "Services/History"); if (count($entries) > 0) { $i = 0; foreach ($entries as $entry) { $this->tpl->setCurrentBlock("tbl_content"); $css_row = $css_row != "tblrow1" ? "tblrow1" : "tblrow2"; $this->tpl->setVariable("CSS_ROW", $css_row); $this->tpl->setVariable('TXT_DATE', ilDatePresentation::formatDate(new ilDateTime($entry["date"], IL_CAL_DATETIME))); $name = ilObjUser::_lookupName($entry["user_id"]); $login = ilObjUser::_lookupLogin($entry["user_id"]); $this->tpl->setVariable("TXT_USER", $name["title"] . " " . $name["firstname"] . " " . $name["lastname"] . " [" . $login . "]"); $info_params = explode(",", $entry["info_params"]); // not so nice if ($this->obj_type != "lm" && $this->obj_type != "dbk") { $info_text = $this->lng->txt("hist_" . str_replace(":", "_", $this->obj_type) . "_" . $entry["action"]); } else { $info_text = $this->lng->txt("hist_" . str_replace(":", "_", $entry["obj_type"]) . "_" . $entry["action"]); } $i = 1; foreach ($info_params as $info_param) { $info_text = str_replace("%" . $i, $info_param, $info_text); $i++; } $this->tpl->setVariable("TXT_ACTION", $info_text); if ($this->obj_type == "lm" || $this->obj_type == "dbk") { $obj_arr = explode(":", $entry["obj_type"]); switch ($obj_arr[1]) { case "st": $img_type = "st"; $class = "ilstructureobjectgui"; $cmd = "view"; break; case "pg": $img_type = "pg"; $class = "illmpageobjectgui"; $cmd = "edit"; break; default: $img_type = $obj_arr[0]; $class = ""; $cmd = "view"; break; } $this->tpl->setCurrentBlock("item_icon"); $this->tpl->setVariable("SRC_ICON", ilUtil::getImagePath("icon_" . $img_type . ".png")); $this->tpl->parseCurrentBlock(); if ($class != "") { $this->tpl->setCurrentBlock("item_link"); $this->ctrl->setParameterByClass($class, "obj_id", $entry["obj_id"]); $this->tpl->setVariable("HREF_LINK", $this->ctrl->getLinkTargetByClass($class, $cmd)); $this->tpl->setVariable("TXT_LINK", $entry["title"]); $this->tpl->parseCurrentBlock(); } else { $this->tpl->setCurrentBlock("item_title"); $this->tpl->setVariable("TXT_TITLE", ilObject::_lookupTitle($entry["obj_id"])); $this->tpl->parseCurrentBlock(); } } if ($a_user_comment && $entry["user_comment"] != "") { $this->tpl->setCurrentBlock("user_comment"); $this->tpl->setVariable("TXT_COMMENT", $this->lng->txt("comment")); $this->tpl->setVariable("TXT_USER_COMMENT", $entry["user_comment"]); $this->tpl->parseCurrentBlock(); } $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->setCurrentBlock("tbl_content"); $this->tpl->parseCurrentBlock(); } } else { $this->tpl->setCurrentBlock("tbl_content_cell"); $this->tpl->setVariable("TBL_CONTENT_CELL", $this->lng->txt("hist_no_entries")); $this->tpl->setVariable("TBL_COL_SPAN", 4); $this->tpl->parseCurrentBlock(); $this->tpl->setCurrentBlock("tbl_content_row"); $this->tpl->setVariable("ROWCOLOR", "tblrow1"); $this->tpl->parseCurrentBlock(); } $tbl->render(); //$this->tpl->parseCurrentBlock(); return $this->tpl->get(); }
/** * init form * * @access protected * @param string mode ('edit' | 'create') * @return */ protected function initForm($a_mode, $a_as_milestone = false, $a_edit_single_app = false) { global $ilUser, $tpl; include_once './Services/Form/classes/class.ilPropertyFormGUI.php'; include_once './Services/Calendar/classes/class.ilCalendarRecurrenceGUI.php'; include_once './Services/Calendar/classes/class.ilCalendarCategories.php'; include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; $this->form = new ilPropertyFormGUI(); include_once './Services/YUI/classes/class.ilYuiUtil.php'; ilYuiUtil::initDomEvent(); $resp_info = false; switch ($a_mode) { case 'create': $this->ctrl->saveParameter($this, array('seed', 'idate')); $this->form->setFormAction($this->ctrl->getFormAction($this)); if ($a_as_milestone) { $this->form->setTitle($this->lng->txt('cal_new_ms')); $this->form->addCommandButton('saveMilestone', $this->lng->txt('cal_add_milestone')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); } else { $this->form->setTitle($this->lng->txt('cal_new_app')); $this->form->addCommandButton('save', $this->lng->txt('cal_add_appointment')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); } break; case 'edit': if ($a_as_milestone) { $this->form->setTitle($this->lng->txt('cal_edit_milestone')); } else { $this->form->setTitle($this->lng->txt('cal_edit_appointment')); } $this->ctrl->saveParameter($this, array('seed', 'app_id', 'idate')); $this->form->setFormAction($this->ctrl->getFormAction($this)); $ass = new ilCalendarCategoryAssignments($this->app->getEntryId()); $cat = $ass->getFirstAssignment(); include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; $cat_info = ilCalendarCategories::_getInstance()->getCategoryInfo($cat); $type = ilObject::_lookupType($cat_info['obj_id']); if ($a_as_milestone && $cat_info['type'] == ilCalendarCategory::TYPE_OBJ && ($type == "grp" || $type == "crs")) { $resp_info = true; $this->form->addCommandButton('editResponsibleUsers', $this->lng->txt('cal_change_responsible_users')); } $this->form->addCommandButton('update', $this->lng->txt('save')); // $this->form->addCommandButton('askDelete',$this->lng->txt('delete')); $this->form->addCommandButton('cancel', $this->lng->txt('cancel')); break; } // title $title = new ilTextInputGUI($this->lng->txt('title'), 'title'); $title->setValue($this->app->getTitle()); $title->setRequired(true); $title->setMaxLength(128); $title->setSize(32); $this->form->addItem($title); // calendar selection $calendar = new ilSelectInputGUI($this->lng->txt('cal_category_selection'), 'calendar'); if ($_POST['category']) { $calendar->setValue((int) $_POST['calendar']); $selected_calendar = (int) $_POST['calendar']; } else { if ($_GET['category_id']) { $calendar->setValue((int) $_GET['category_id']); $selected_calendar = (int) $_GET['category_id']; } elseif ($a_mode == 'edit') { $ass = new ilCalendarCategoryAssignments($this->app->getEntryId()); $cat = $ass->getFirstAssignment(); $calendar->setValue($cat); $selected_calendar = $cat; } elseif (isset($_GET['ref_id'])) { include_once './Services/Calendar/classes/class.ilCalendarCategories.php'; $obj_cal = ilObject::_lookupObjId($_GET['ref_id']); $calendar->setValue(ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal)); $selected_calendar = ilCalendarCategories::_lookupCategoryIdByObjId($obj_cal); } } $calendar->setRequired(true); $cats = ilCalendarCategories::_getInstance($ilUser->getId()); $calendar->setOptions($cats->prepareCategoriesOfUserForSelection()); include_once './Services/Calendar/classes/class.ilCalendarSettings.php'; if (ilCalendarSettings::_getInstance()->isNotificationEnabled()) { $notification_cals = $cats->getNotificationCalendars(); $notification_cals = count($notification_cals) ? implode(',', $notification_cals) : ''; $calendar->addCustomAttribute("onchange=\"ilToggleNotification(new Array(" . $notification_cals . "));\""); } $this->form->addItem($calendar); if (!$a_as_milestone) { include_once './Services/Form/classes/class.ilDateDurationInputGUI.php'; $tpl->addJavaScript('./Services/Form/js/date_duration.js'); $dur = new ilDateDurationInputGUI($this->lng->txt('cal_fullday'), 'event'); $dur->setStartText($this->lng->txt('cal_start')); $dur->setEndText($this->lng->txt('cal_end')); $dur->enableToggleFullTime($this->lng->txt('cal_fullday_title'), $this->app->isFullday() ? true : false); $dur->setShowTime(true); $dur->setStart($this->app->getStart()); $dur->setEnd($this->app->getEnd()); $this->form->addItem($dur); // recurrence include_once './Services/Calendar/classes/Form/class.ilRecurrenceInputGUI.php'; $rec = new ilRecurrenceInputGUI($this->lng->txt('cal_recurrences'), 'frequence'); $rec->setRecurrence($this->rec); $this->form->addItem($rec); // location $where = new ilTextInputGUI($this->lng->txt('cal_where'), 'location'); $where->setValue($this->app->getLocation()); $where->setMaxLength(128); $where->setSize(32); $this->form->addItem($where); } else { $deadline = new ilDateTimeInputGUI($this->lng->txt('cal_deadline'), 'event[start]'); $deadline->setDate($this->app->getStart()); $deadline->setShowTime(false); $deadline->setMinuteStepSize(5); $this->form->addItem($deadline); // completion $completion_vals = array(); for ($i = 0; $i <= 100; $i += 5) { $completion_vals[$i] = $i . " %"; } $compl = new ilSelectInputGUI($this->lng->txt('cal_task_completion'), 'completion'); $compl->setOptions($completion_vals); $compl->setValue($this->app->getCompletion()); $this->form->addItem($compl); } $desc = new ilTextAreaInputGUI($this->lng->txt('description'), 'description'); $desc->setValue($this->app->getDescription()); $desc->setRows(5); $this->form->addItem($desc); if ($a_as_milestone && $a_mode == "edit" && $resp_info) { // users responsible $users = $this->app->readResponsibleUsers(); $resp = new ilNonEditableValueGUI($this->lng->txt('cal_responsible'), $users); $delim = ""; foreach ($users as $r) { $value .= $delim . $r["lastname"] . ", " . $r["firstname"] . " [" . $r["login"] . "]"; $delim = "<br />"; } if (count($users) > 0) { $resp->setValue($value); } else { $resp->setValue("-"); } $this->form->addItem($resp); } if (ilCalendarSettings::_getInstance()->isUserNotificationEnabled()) { $notu = new ilTextWizardInputGUI($this->lng->txt('cal_user_notification'), 'notu'); $notu->setInfo($this->lng->txt('cal_user_notification_info')); $notu->setSize(20); $notu->setMaxLength(64); $values = array(); foreach ($this->notification->getRecipients() as $rcp) { switch ($rcp['type']) { case ilCalendarUserNotification::TYPE_USER: $values[] = ilObjUser::_lookupLogin($rcp['usr_id']); break; case ilCalendarUserNotification::TYPE_EMAIL: $values[] = $rcp['email']; break; } } if (count($values)) { $notu->setValues($values); } else { $notu->setValues(array('')); } $this->form->addItem($notu); } // Notifications include_once './Services/Calendar/classes/class.ilCalendarSettings.php'; if (ilCalendarSettings::_getInstance()->isNotificationEnabled() and count($cats->getNotificationCalendars())) { $selected_cal = new ilCalendarCategory($selected_calendar); $disabled = true; if ($selected_cal->getType() == ilCalendarCategory::TYPE_OBJ) { if (ilObject::_lookupType($selected_cal->getObjId()) == 'crs' or ilObject::_lookupType($selected_cal->getObjId()) == 'grp') { $disabled = false; } } $tpl->addJavaScript('./Services/Calendar/js/toggle_notification.js'); $not = new ilCheckboxInputGUI($this->lng->txt('cal_cg_notification'), 'not'); $not->setInfo($this->lng->txt('cal_notification_info')); $not->setValue(1); $not->setChecked($this->app->isNotificationEnabled()); $not->setDisabled($disabled); $this->form->addItem($not); } }
/** * render attendance list * * @return string */ public function getHTML() { $tpl = new ilTemplate('tpl.attendance_list_print.html', true, true, 'Services/Membership'); // title $time = ilFormat::formatUnixTime(time(), true); $tpl->setVariable('TXT_TITLE', $this->title); if ($this->description) { $tpl->setVariable('TXT_DESCRIPTION', $this->description . " (" . $time . ")"); } else { $tpl->setVariable('TXT_DESCRIPTION', $time); } // header $tpl->setCurrentBlock('head_item'); foreach ($this->presets as $id => $item) { if ($item[1]) { $tpl->setVariable('TXT_HEAD', $item[0]); $tpl->parseCurrentBlock(); } } if ($this->blank_columns) { foreach ($this->blank_columns as $blank) { $tpl->setVariable('TXT_HEAD', $blank); $tpl->parseCurrentBlock(); } } // handle members $member_ids = array(); if ($this->show_admins) { $member_ids = array_merge((array) $member_ids, $this->participants->getAdmins()); } if ($this->show_tutors) { $member_ids = array_merge((array) $member_ids, $this->participants->getTutors()); } if ($this->show_members) { $member_ids = array_merge((array) $member_ids, $this->participants->getMembers()); } $member_ids = ilUtil::_sortIds((array) $member_ids, 'usr_data', 'lastname', 'usr_id'); // rows foreach ($member_ids as $user_id) { if ($this->callback) { $user_data = call_user_func_array($this->callback, array($user_id)); $tpl->setCurrentBlock("row_preset"); foreach ($this->presets as $id => $item) { if ($item[1]) { switch ($id) { case "name": if (!$user_data[$id]) { $name = ilObjUser::_lookupName($user_id); $value = $name["lastname"] . ", " . $name["firstname"]; break; } case "email": if (!$user_data[$id]) { $value = ilObjUser::_lookupEmail($user_id); break; } case "login": if (!$user_data[$id]) { $value = ilObjUser::_lookupLogin($user_id); break; } default: $value = (string) $user_data[$id]; break; } $tpl->setVariable("TXT_PRESET", $value); $tpl->parseCurrentBlock(); } } } if ($this->blank_columns) { for ($loop = 0; $loop < sizeof($this->blank_columns); $loop++) { $tpl->touchBlock('row_blank'); } } $tpl->touchBlock("member_row"); } return $tpl->get(); }
function __parseId($a_id) { global $ilias; $fields = explode('_', $a_id); if (!is_array($fields) or $fields[0] != 'il' or !is_numeric($fields[1]) or $fields[2] != 'usr' or !is_numeric($fields[3])) { return false; } if ($id = ilObjUser::_getImportedUserId($a_id)) { return array('imported' => true, 'local' => false, 'usr_id' => $id); } if ($fields[1] == $ilias->getSetting('inst_id', 0) and strlen(ilObjUser::_lookupLogin($fields[3]))) { return array('imported' => false, 'local' => true, 'usr_id' => $fields[3]); } return false; }
/** * Read responsible users */ function readResponsibleUsers() { global $ilDB; $set = $ilDB->queryF("SELECT * FROM cal_entry_responsible WHERE cal_id = %s", array("integer"), array($this->getEntryId())); $return = array(); while ($rec = $ilDB->fetchAssoc($set)) { $n = ilObjUser::_lookupName($rec["user_id"]); $return[] = array_merge($n, array("login" => ilObjUser::_lookupLogin($rec["user_id"]))); } return $return; }
// Temporary Fix setcookie("ilClientId", $_GET["client_id"], 0, $cookie_path, $cookie_domain); $_COOKIE["ilClientId"] = $_GET["client_id"]; } include_once "Services/Context/classes/class.ilContext.php"; ilContext::init(ilContext::CONTEXT_RSS_AUTH); require_once "Services/Init/classes/class.ilInitialisation.php"; ilInitialisation::initILIAS(); global $lng, $ilSetting; $feed_set = new ilSetting("news"); if (!isset($_SERVER['PHP_AUTH_PW']) || !isset($_SERVER['PHP_AUTH_USER'])) { Header("WWW-Authenticate: Basic realm=\"ILIAS Newsfeed\""); Header("HTTP/1.0 401 Unauthorized"); exit; } else { if ($_GET["user_id"] != "" && ilObjUser::_getFeedPass($_GET["user_id"]) != "" && (md5($_SERVER['PHP_AUTH_PW']) == ilObjUser::_getFeedPass($_GET["user_id"]) && $_SERVER['PHP_AUTH_USER'] == ilObjUser::_lookupLogin($_GET["user_id"])) && $feed_set->get("enable_private_feed")) { include_once "./Services/Feeds/classes/class.ilUserFeedWriter.php"; // Third parameter is true for private feed $writer = new ilUserFeedWriter($_GET["user_id"], $_GET["hash"], true); $writer->showFeed(); } else { if ($_GET["ref_id"] != "" && md5($_SERVER['PHP_AUTH_PW']) == ilObjUser::_getFeedPass(ilObjUser::_lookupId($_SERVER['PHP_AUTH_USER']))) { include_once "./Services/Feeds/classes/class.ilObjectFeedWriter.php"; // Second parameter is optional to pass on to database-level to get news for logged-in users $writer = new ilObjectFeedWriter($_GET["ref_id"], ilObjUser::_lookupId($_SERVER['PHP_AUTH_USER'])); $writer->showFeed(); } else { // send appropriate header, if password is wrong, otherwise // there is no chance to re-enter it (unless, e.g. the browser is closed) if (md5($_SERVER['PHP_AUTH_PW']) != ilObjUser::_getFeedPass(ilObjUser::_lookupId($_SERVER['PHP_AUTH_USER']))) { Header("WWW-Authenticate: Basic realm=\"ILIAS Newsfeed\"");
static function sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment = null) { global $ilUser, $ilObjDataCache, $ilAccess; include_once "./Services/Notification/classes/class.ilNotification.php"; include_once "./Modules/Wiki/classes/class.ilObjWiki.php"; include_once "./Modules/Wiki/classes/class.ilWikiPage.php"; $wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id); $wiki = new ilObjWiki($a_wiki_ref_id, true); $page = new ilWikiPage($a_page_id); // #11138 $ignore_threshold = $a_action == "comment"; // 1st update will be converted to new - see below if ($a_action == "new") { return; } if ($a_type == ilNotification::TYPE_WIKI_PAGE) { $users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold); $wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold); $users = array_merge($users, $wiki_users); if (!sizeof($users)) { return; } ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI_PAGE, $a_page_id, $users); } else { $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold); if (!sizeof($users)) { return; } } ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_id); // #15192 - should always be present if ($a_page_id) { include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php"; $link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle()); } else { include_once "./Services/Link/classes/class.ilLink.php"; $link = ilLink::_getLink($a_wiki_ref_id); } include_once "./Services/Mail/classes/class.ilMail.php"; include_once "./Services/User/classes/class.ilObjUser.php"; include_once "./Services/Language/classes/class.ilLanguageFactory.php"; include_once "./Services/User/classes/class.ilUserUtil.php"; // see ilBlogPostingGUI::getSnippet() // see ilBlogPosting::getNotificationAbstract() include_once "Modules/Wiki/classes/class.ilWikiPageGUI.php"; $pgui = new ilWikiPageGUI($page->getId()); $pgui->setRawPageContent(true); $pgui->setAbstractOnly(true); $pgui->setFileDownloadLink("."); $pgui->setFullscreenLink("."); $pgui->setSourcecodeDownloadScript("."); $snippet = $pgui->showPage(); $snippet = ilPageObject::truncateHTML($snippet, 500, "..."); // making things more readable $snippet = str_replace('<br/>', "\n", $snippet); $snippet = str_replace('<br />', "\n", $snippet); $snippet = str_replace('</p>', "\n", $snippet); $snippet = str_replace('</div>', "\n", $snippet); $snippet = trim(strip_tags($snippet)); // "fake" new (to enable snippet - if any) $current_version = array_shift($page->getHistoryEntries()); $current_version = $current_version["nr"]; if (!$current_version) { $a_type = ilNotification::TYPE_WIKI; $a_action = "new"; } foreach (array_unique($users) as $idx => $user_id) { if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id)) { // use language of recipient to compose message $ulng = ilLanguageFactory::_getLanguageOfUser($user_id); $ulng->loadLanguageModule('wiki'); $subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle(), $page->getTitle()); $message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n"; if ($a_type == ilNotification::TYPE_WIKI_PAGE) { // update/delete $message .= $ulng->txt('wiki_change_notification_page_body_' . $a_action) . ":\n\n"; $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n"; $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n"; $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n"; if ($snippet) { $message .= "\n" . $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n"; } // include comment/note text if ($a_comment) { $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n"; } $message .= "\n" . $ulng->txt('wiki_change_notification_page_link') . ": " . $link; } else { // new $message .= $ulng->txt('wiki_change_notification_body_' . $a_action) . ":\n\n"; $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n"; $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n"; $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n"; if ($snippet) { $message .= $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n\n"; } $message .= $ulng->txt('wiki_change_notification_link') . ": " . $link; } $mail_obj = new ilMail(ANONYMOUS_USER_ID); $mail_obj->appendInstallationSignature(true); $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system")); } else { unset($users[$idx]); } } }
/** * Send notification about team status * * @param int $a_exc_ref_id * @param int $a_user_id * @param string $a_action */ public function sendNotification($a_exc_ref_id, $a_user_id, $a_action) { global $ilUser; // no need to notify current user if ($ilUser->getId() == $a_user_id) { return; } include_once "./Services/Mail/classes/class.ilMail.php"; include_once "./Services/User/classes/class.ilObjUser.php"; include_once "./Services/Language/classes/class.ilLanguageFactory.php"; include_once "./Services/User/classes/class.ilUserUtil.php"; include_once "./Services/Link/classes/class.ilLink.php"; $link = ilLink::_getStaticLink($a_exc_ref_id); // use language of recipient to compose message $ulng = ilLanguageFactory::_getLanguageOfUser($a_user_id); $ulng->loadLanguageModule('exc'); $subject = sprintf($ulng->txt('exc_team_notification_subject_' . $a_action), $this->getTitle()); $message = sprintf($ulng->txt('exc_team_notification_salutation'), ilObjUser::_lookupFullname($a_user_id)) . "\n\n"; $message .= $ulng->txt('exc_team_notification_body_' . $a_action) . "\n\n"; $message .= $ulng->txt('obj_exc') . ": " . ilObject::_lookupTitle($this->getExerciseId()) . "\n"; $message .= $ulng->txt('exc_assignment') . ": " . $this->getTitle() . "\n"; $message .= $ulng->txt('exc_team_notification_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n"; $message .= $ulng->txt('exc_team_notification_link') . ": " . $link; $mail_obj = new ilMail(ANONYMOUS_USER_ID); $mail_obj->appendInstallationSignature(true); $ret = $mail_obj->sendMail(ilObjUser::_lookupLogin($a_user_id), "", "", $subject, $message, array(), array("system")); // var_dump($ret); }
/** * Send news mail for 1 object and 1 user * * @param int $a_user_id * @param int $a_ref_id * @param array $news */ public function sendMail($a_user_id, $a_ref_id, array $news) { global $lng, $ilUser; $obj_id = ilObject::_lookupObjId($a_ref_id); $obj_type = ilObject::_lookupType($obj_id); $this->initLanguage($a_user_id); $this->getLanguage()->loadLanguageModule("crs"); $this->getLanguage()->loadLanguageModule("news"); // needed for ilNewsItem $lng = $this->getLanguage(); $this->initMail(); $obj_title = $this->getLanguageText($obj_type) . " \"" . ilObject::_lookupTitle($obj_id) . "\""; $this->setRecipients($a_user_id); $this->setSubject(sprintf($this->getLanguageText("crs_subject_course_group_notification"), $obj_title)); $this->setBody(ilMail::getSalutation($a_user_id, $this->getLanguage())); $this->appendBody("\n\n"); $this->appendBody(sprintf($this->getLanguageText("crs_intro_course_group_notification_for"), $obj_title)); $this->appendBody("\n\n"); // ilDatePresentation::setUseRelativeDates(false); // news summary $counter = 1; foreach ($news as $item) { $title = ilNewsItem::determineNewsTitle($item["context_obj_type"], $item["title"], $item["content_is_lang_var"], $item["agg_ref_id"], $item["aggregation"]); $content = ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"]); /* process sub-item info if($item["aggregation"]) { $sub = array(); foreach($item["aggregation"] as $subitem) { $sub_id = ilObject::_lookupObjId($subitem["ref_id"]); $sub_title = ilObject::_lookupTitle($sub_id); // to include posting title if($subitem["context_obj_type"] == "frm") { $sub_title = ilNewsItem::determineNewsTitle($subitem["context_obj_type"], $subitem["title"], $subitem["content_is_lang_var"]); } $sub[] = $sub_title; $sub_content = ilNewsItem::determineNewsContent($subitem["context_obj_type"], $subitem["content"], $subitem["content_text_is_lang_var"]); if($sub_content) { $sub[] = strip_tags($sub_content); } } $content .= "\n".implode("\n\n", $sub); } */ $obj_id = ilObject::_lookupObjId($item["ref_id"]); $obj_title = ilObject::_lookupTitle($obj_id); // path include_once './Services/Locator/classes/class.ilLocatorGUI.php'; $cont_loc = new ilLocatorGUI(); $cont_loc->addContextItems($item["ref_id"], true); $cont_loc->setTextOnly(true); // #9954/#10044 // see ilInitialisation::requireCommonIncludes() @(include_once "HTML/Template/ITX.php"); // new implementation if (class_exists("HTML_Template_ITX")) { include_once "./Services/UICore/classes/class.ilTemplateHTMLITX.php"; } else { include_once "HTML/ITX.php"; // old implementation include_once "./Services/UICore/classes/class.ilTemplateITX.php"; } require_once "./Services/UICore/classes/class.ilTemplate.php"; $loc = "[" . $cont_loc->getHTML() . "]"; $this->appendBody("----------------------------------------------------------------------------------------------"); $this->appendBody("\n\n"); $this->appendBody('#' . $counter . " - " . $loc . " " . $obj_title . "\n\n"); $this->appendBody($title); if ($content) { $this->appendBody("\n"); $this->appendBody($content); } $this->appendBody("\n\n"); ++$counter; } $this->appendBody("----------------------------------------------------------------------------------------------"); $this->appendBody("\n\n"); // link to object $this->appendBody($this->getLanguageText("crs_course_group_notification_link")); $this->appendBody("\n"); $object_link = ilUtil::_getHttpPath(); $object_link .= "/goto.php?target=" . $obj_type . "_" . $a_ref_id . "&client_id=" . CLIENT_ID; $this->appendBody($object_link); $this->appendBody("\n\n"); $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->getLanguage())); $this->appendBody(ilMail::_getInstallationSignature()); // #10044 $mail = new ilMail($ilUser->getId()); $mail->enableSOAP(false); // #10410 $mail->sendMail(ilObjUser::_lookupLogin($a_user_id), null, null, $this->getSubject(), $this->getBody(), null, array("system")); }
static function sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment = null) { global $ilUser, $ilAccess; // get blog object id (repository or workspace) if ($a_in_wsp) { include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php"; include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php"; $tree = new ilWorkspaceTree($ilUser->getId()); // owner of tree is irrelevant $blog_obj_id = $tree->lookupObjectId($a_blog_node_id); $access_handler = new ilWorkspaceAccessHandler($tree); $link = ilWorkspaceAccessHandler::getGotoLink($a_blog_node_id, $blog_obj_id, "_" . $a_posting_id); } else { $blog_obj_id = ilObject::_lookupObjId($a_blog_node_id); $access_handler = null; include_once "Services/Link/classes/class.ilLink.php"; $link = ilLink::_getStaticLink($a_blog_node_id, "blog", true, "_" . $a_posting_id); } if (!$blog_obj_id) { return; } include_once "./Modules/Blog/classes/class.ilBlogPosting.php"; $posting = new ilBlogPosting($a_posting_id); // #11138 $ignore_threshold = $a_action == "comment"; // approval handling $admin_only = false; if (!$posting->isApproved()) { $blog = new self($blog_obj_id, false); if ($blog->hasApproval()) { switch ($a_action) { case "update": // un-approved posting was updated - no notifications return; case "new": // un-approved posting was activated - admin-only notification $admin_only = true; $ignore_threshold = true; break; } } } // recipients include_once "./Services/Notification/classes/class.ilNotification.php"; $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_BLOG, $blog_obj_id, $a_posting_id, $ignore_threshold); if (!sizeof($users)) { return; } // send mails include_once "./Services/Mail/classes/class.ilMail.php"; include_once "./Services/User/classes/class.ilObjUser.php"; include_once "./Services/Language/classes/class.ilLanguageFactory.php"; include_once "./Services/User/classes/class.ilUserUtil.php"; $posting_title = $posting->getTitle(); $blog_title = ilObject::_lookupTitle($blog_obj_id); $author = $posting->getAuthor(); $notified = array(); foreach (array_unique($users) as $idx => $user_id) { // the user responsible for the action should not be notified if ($user_id == $ilUser->getId()) { continue; } // workspace if ($access_handler) { if ($admin_only && !$access_handler->checkAccessOfUser($tree, $user_id, 'write', '', $a_blog_node_id)) { continue; } if (!$access_handler->checkAccessOfUser($tree, $user_id, 'read', '', $a_blog_node_id)) { continue; } } else { if ($admin_only && !$ilAccess->checkAccessOfUser($user_id, 'write', '', $a_blog_node_id)) { continue; } if (!$ilAccess->checkAccessOfUser($user_id, 'read', '', $a_blog_node_id)) { continue; } } // use language of recipient to compose message $ulng = ilLanguageFactory::_getLanguageOfUser($user_id); $ulng->loadLanguageModule('blog'); $subject = sprintf($ulng->txt('blog_change_notification_subject'), $blog_title); $message = sprintf($ulng->txt('blog_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n"; $message .= $ulng->txt('blog_change_notification_body_' . $a_action) . ":\n\n"; $message .= $ulng->txt('obj_blog') . ": " . $blog_title . "\n"; $message .= $ulng->txt('blog_posting') . ": " . $posting_title . "\n"; $message .= $ulng->txt('blog_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n"; if ($a_comment) { $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n"; } $message .= "\n" . $ulng->txt('blog_change_notification_link') . ": " . $link; $mail_obj = new ilMail(ANONYMOUS_USER_ID); $mail_obj->appendInstallationSignature(true); $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system")); $notified[] = $user_id; } if (sizeof($notified)) { ilNotification::updateNotificationTime(ilNotification::TYPE_BLOG, $blog_obj_id, $notified); } }
public function addStatisticWorksheet(&$pewa) { include_once './Services/Excel/classes/class.ilExcelUtils.php'; include_once './Services/Payment/classes/class.ilPaymentVendors.php'; $this->__initBookingObject(); $workbook = $pewa->getWorkbook(); $worksheet = $workbook->addWorksheet(utf8_decode($this->lng->txt('bookings'))); $worksheet->mergeCells(0, 0, 0, 3); $worksheet->setColumn(0, 0, 16); $worksheet->setColumn(0, 1, 32); $worksheet->setColumn(0, 2, 32); $worksheet->setColumn(0, 3, 16); $worksheet->setColumn(0, 4, 16); $worksheet->setColumn(0, 5, 16); $worksheet->setColumn(0, 6, 24); $worksheet->setColumn(0, 7, 8); $worksheet->setColumn(0, 8, 12); $worksheet->setColumn(0, 9, 16); $title = $this->lng->txt('bookings'); $title .= ' ' . $this->lng->txt('as_of') . ' '; $title .= strftime('%Y-%m-%d %R', time()); $worksheet->writeString(0, 0, $title, $pewa->getFormatTitle()); $worksheet->writeString(1, 0, $this->lng->txt('payment_system'), $pewa->getFormatHeader()); $worksheet->writeString(1, 1, $this->lng->txt('paya_transaction'), $pewa->getFormatHeader()); $worksheet->writeString(1, 2, $this->lng->txt('title'), $pewa->getFormatHeader()); $worksheet->writeString(1, 3, $this->lng->txt('paya_vendor'), $pewa->getFormatHeader()); $worksheet->writeString(1, 4, $this->lng->txt('pays_cost_center'), $pewa->getFormatHeader()); $worksheet->writeString(1, 5, $this->lng->txt('paya_customer'), $pewa->getFormatHeader()); $worksheet->writeString(1, 6, $this->lng->txt('email'), $pewa->getFormatHeader()); $worksheet->writeString(1, 7, $this->lng->txt('paya_order_date'), $pewa->getFormatHeader()); $worksheet->writeString(1, 8, $this->lng->txt('duration'), $pewa->getFormatHeader()); $worksheet->writeString(1, 9, $this->lng->txt('price_a'), $pewa->getFormatHeader()); $worksheet->writeString(1, 10, $this->lng->txt('paya_payed_access'), $pewa->getFormatHeader()); $worksheet->writeString(1, 11, $this->lng->txt('street'), $pewa->getFormatHeader()); $worksheet->writeString(1, 12, $this->lng->txt('pay_bmf_po_box'), $pewa->getFormatHeader()); $worksheet->writeString(1, 13, $this->lng->txt('zipcode'), $pewa->getFormatHeader()); $worksheet->writeString(1, 14, $this->lng->txt('city'), $pewa->getFormatHeader()); $worksheet->writeString(1, 15, $this->lng->txt('country'), $pewa->getFormatHeader()); if (!count($bookings = $this->booking_obj->getBookings())) { return false; } include_once 'Services/User/classes/class.ilObjUser.php'; $object_title_cache = array(); $user_title_cache = array(); $counter = 2; foreach ($bookings as $booking) { if (array_key_exists($booking['ref_id'], $object_title_cache)) { $tmp_obj = $object_title_cache[$booking['ref_id']]; } else { $tmp_obj = ilObject::_lookupTitle(ilObject::_lookupObjId($booking['ref_id'])); $object_title_cache[$booking['ref_id']] = $tmp_obj; } if (array_key_exists($booking['b_vendor_id'], $user_title_cache)) { $tmp_vendor = $user_title_cache[$booking['b_vendor_id']]; } else { $tmp_vendor = ilObjUser::_lookupLogin($booking['b_vendor_id']); $user_title_cache[$booking['b_vendor_id']] = $tmp_vendor; } if (array_key_exists($booking['customer_id'], $user_title_cache)) { $tmp_purchaser = $user_title_cache[$booking['customer_id']]; } else { $tmp_purchaser_name = ilObjUser::_lookupName($booking['customer_id']); $tmp_purchaser_login = ilObjUser::_lookupLogin($booking['customer_id']); $tmp_purchaser_email = ilObjUser::_lookupEmail($booking['customer_id']); $tmp_purchaser = '' . $tmp_purchaser_name['firstname'] . ' ' . $tmp_purchaser_name['lastname'] . ' [' . $tmp_purchaser_login . ']'; $user_title_cache[$booking['customer_id']] = $tmp_purchaser; } include_once './Services/Payment/classes/class.ilPayMethods.php'; $str_paymethod = ilPayMethods::getStringByPaymethod($booking['b_pay_method']); $worksheet->writeString($counter, 0, $str_paymethod); $worksheet->writeString($counter, 1, $booking['transaction']); $worksheet->writeString($counter, 2, $tmp_obj != '' ? $tmp_obj : $this->lng->txt('object_deleted')); $worksheet->writeString($counter, 3, $tmp_vendor != '' ? $tmp_vendor : $this->lng->txt('user_deleted')); $worksheet->writeString($counter, 4, ilPaymentVendors::_getCostCenter($booking['b_vendor_id'])); $worksheet->writeString($counter, 5, $tmp_purchaser != '' ? $tmp_purchaser : $this->lng->txt('user_deleted')); $worksheet->writeString($counter, 6, $tmp_purchaser_email); $worksheet->writeString($counter, 7, strftime('%Y-%m-%d %R', $booking['order_date'])); $worksheet->writeString($counter, 8, $booking['duration']); $worksheet->writeString($counter, 9, $booking['price']); $payed_access = $booking['payed'] ? $this->lng->txt('yes') : $this->lng->txt('no'); $payed_access .= '/'; $payed_access .= $booking['access_granted'] ? $this->lng->txt('yes') : $this->lng->txt('no'); $worksheet->writeString($counter, 10, $payed_access); $worksheet->writeString($counter, 11, $booking['street']); $worksheet->writeString($counter, 12, $booking['po_box']); $worksheet->writeString($counter, 13, $booking['zipcode']); $worksheet->writeString($counter, 14, $booking['city']); $worksheet->writeString($counter, 15, $booking['country']); unset($tmp_obj); unset($tmp_vendor); unset($tmp_purchaser); ++$counter; } return true; }
/** * 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(); } } }
/** * set feedback status for member and redirect to mail screen */ function redirectFeedbackMailObject() { $this->checkPermission("write"); $members = array(); if ($_GET["member_id"] != "") { if ($this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { $members = ilExAssignment::getTeamMembersByAssignmentId($this->ass->getId(), $_GET["member_id"]); } else { $members = array($_GET["member_id"]); } } else { if (count($_POST["member"]) > 0) { if ($this->ass->getType() == ilExAssignment::TYPE_UPLOAD_TEAM) { foreach (array_keys($_POST["member"]) as $user_id) { $members = array_merge($members, ilExAssignment::getTeamMembersByAssignmentId($this->ass->getId(), $user_id)); } $members = array_unique($members); } else { $members = array_keys($_POST["member"]); } } } if ($members) { $logins = array(); foreach ($members as $user_id) { ilExAssignment::updateStatusFeedbackForUser($this->ass->getId(), $user_id, 1); $logins[] = ilObjUser::_lookupLogin($user_id); } $logins = implode($logins, ","); require_once 'Services/Mail/classes/class.ilMailFormCall.php'; ilUtil::redirect(ilMailFormCall::getRedirectTarget($this, 'members', array(), array('type' => 'new', 'rcp_to' => $logins))); } ilUtil::sendFailure($this->lng->txt("no_checkbox"), true); $this->ctrl->redirect($this, "members"); }
protected function sentReminder(array $a_recipient_ids) { include_once "./Services/Mail/classes/class.ilMail.php"; include_once "./Services/User/classes/class.ilObjUser.php"; include_once "./Services/Language/classes/class.ilLanguageFactory.php"; include_once "./Services/User/classes/class.ilUserUtil.php"; include_once "./Services/Link/classes/class.ilLink.php"; $link = ilLink::_getStaticLink($this->getRefId(), "svy"); foreach ($a_recipient_ids as $user_id) { // use language of recipient to compose message $ulng = ilLanguageFactory::_getLanguageOfUser($user_id); $ulng->loadLanguageModule('survey'); $subject = sprintf($ulng->txt('survey_reminder_subject'), $this->getTitle()); $message = sprintf($ulng->txt('survey_reminder_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n"; $message .= $ulng->txt('survey_reminder_body') . ":\n\n"; $message .= $ulng->txt('obj_svy') . ": " . $this->getTitle() . "\n"; $message .= "\n" . $ulng->txt('survey_reminder_link') . ": " . $link; $mail_obj = new ilMail(ANONYMOUS_USER_ID); $mail_obj->appendInstallationSignature(true); $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system")); } }