コード例 #1
0
 public function send()
 {
     global $lng;
     $customer_array = $this->_getObjectsToRemind();
     foreach ($customer_array as $user_id => $objects_array) {
         $this->initLanguage($user_id);
         $user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
         $this->initMail();
         $this->setRecipients($user_id);
         $this->setSubject($this->getLanguageText('payment_reminder_notification_subject'));
         $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
         $this->appendBody("\n\n");
         $this->appendBody($user_lang->txt('bought_objects_expire_soon'));
         $this->appendBody("\n\n");
         foreach ($objects_array as $key => $pobject) {
             $this->appendBody("----------------------------------------------------------------------------------------------");
             $this->appendBody("\n\n");
             $this->appendBody($user_lang->txt('title') . ": " . $objects_array[$key]['object_title'] . "\n");
             $this->appendBody($user_lang->txt('access_enddate') . ": " . $objects_array[$key]['access_enddate']);
             $this->appendBody("\n");
             $this->appendBody("\n\n");
         }
         $this->appendBody("----------------------------------------------------------------------------------------------");
         //@todo fix this: $mailbox_link
         $this->appendBody($mailbox_link);
         $this->appendBody("\n\n");
         $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->getLanguage()));
         $this->appendBody(ilMail::_getInstallationSignature());
         $mmail = new ilMimeMail();
         $mmail->autoCheck(false);
         $mmail->From('noreply');
         $mmail->To(ilObjUser::_lookupEmail($user_id));
         $mmail->Subject($this->getSubject());
         $mmail->Body($this->getBody());
         $mmail->Send();
     }
 }
コード例 #2
0
 /**
  * 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();
 }
コード例 #3
0
 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;
 }
コード例 #4
0
 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'] = '&nbsp;';
                 }
             }
             $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'] = '&nbsp;';
                 }
             }
             $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();
     }
 }
コード例 #5
0
ファイル: ilObjUserTest.php プロジェクト: arlendotcn/ilias
 /**
  * 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);
 }
コード例 #6
0
 /**
  * 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();
 }
コード例 #7
0
 public function getRatersData($a_appraisee_id)
 {
     global $ilDB;
     $res = $anonymous_ids = array();
     $set = $ilDB->query("SELECT * FROM svy_360_rater" . " WHERE obj_id = " . $ilDB->quote($this->getSurveyId(), "integer") . " AND appr_id = " . $ilDB->quote($a_appraisee_id, "integer"));
     while ($row = $ilDB->fetchAssoc($set)) {
         if ($row["anonymous_id"]) {
             $res["a" . $row["anonymous_id"]] = array("lastname" => "unknown code " . $row["anonymous_id"], "sent" => $row["mail_sent"], "finished" => null);
             $anonymous_ids[] = $row["anonymous_id"];
         } else {
             $name = ilObjUser::_lookupName($row["user_id"]);
             $name["user_id"] = "u" . $name["user_id"];
             $name["email"] = ilObjUser::_lookupEmail($row["user_id"]);
             $name["sent"] = $row["mail_sent"];
             $name["finished"] = (bool) $this->is360SurveyStarted($a_appraisee_id, $row["user_id"]);
             $res["u" . $row["user_id"]] = $name;
         }
     }
     if (sizeof($anonymous_ids)) {
         $data = $this->getSurveyCodesTableData("en", $anonymous_ids);
         foreach ($data as $item) {
             if (isset($res["a" . $item["id"]])) {
                 $res["a" . $item["id"]] = array("user_id" => "a" . $item["id"], "lastname" => $item["last_name"], "firstname" => $item["first_name"], "login" => "", "email" => $item["email"], "code" => $item["code"], "href" => $item["href"], "sent" => $res["a" . $item["id"]]["sent"], "finished" => (bool) $this->is360SurveyStarted($a_appraisee_id, null, $item["code"]));
             }
         }
     }
     return $res;
 }
コード例 #8
0
    /**
     * get options of user and set variables $signature and $linebreak
     * this method shouldn't bew called from outside
     * use getSignature() and getLinebreak()
     * @access	private
     * @return	boolean
     */
    function getOptions()
    {
        global $ilDB;
        $res = $ilDB->queryf('
			SELECT * FROM ' . $this->table_mail_options . '
			WHERE user_id = %s', array('integer'), array($this->user_id));
        $row = $res->fetchRow(DB_FETCHMODE_OBJECT);
        $this->cronjob_notification = stripslashes($row->cronjob_notification);
        $this->signature = stripslashes($row->signature);
        $this->linebreak = stripslashes($row->linebreak);
        $this->incoming_type = $row->incoming_type;
        if (!strlen(ilObjUser::_lookupEmail($this->user_id))) {
            $this->incoming_type = $this->LOCAL;
        }
        return true;
    }
コード例 #9
0
 /** 
  * Initialises the mail options form
  */
 private function initMailOptionsForm()
 {
     global $ilCtrl, $ilSetting, $lng, $ilUser;
     include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
     $this->form = new ilPropertyFormGUI();
     $this->form->setFormAction($ilCtrl->getFormAction($this, 'saveMailOptions'));
     $this->form->setTitle($lng->txt('mail_settings'));
     // BEGIN INCOMING
     include_once 'Services/Mail/classes/class.ilMailOptions.php';
     if ($ilSetting->get('usr_settings_hide_mail_incoming_mail') != '1') {
         $options = array(IL_MAIL_LOCAL => $this->lng->txt('mail_incoming_local'), IL_MAIL_EMAIL => $this->lng->txt('mail_incoming_smtp'), IL_MAIL_BOTH => $this->lng->txt('mail_incoming_both'));
         $si = new ilSelectInputGUI($lng->txt('mail_incoming'), 'incoming_type');
         $si->setOptions($options);
         if (!strlen(ilObjUser::_lookupEmail($ilUser->getId())) || $ilSetting->get('usr_settings_disable_mail_incoming_mail') == '1') {
             $si->setDisabled(true);
         }
         $this->form->addItem($si);
     }
     // BEGIN LINEBREAK_OPTIONS
     $options = array();
     for ($i = 50; $i <= 80; $i++) {
         $options[$i] = $i;
     }
     $si = new ilSelectInputGUI($lng->txt('linebreak'), 'linebreak');
     $si->setOptions($options);
     $this->form->addItem($si);
     // BEGIN SIGNATURE
     $ta = new ilTextAreaInputGUI($lng->txt('signature'), 'signature');
     $ta->setRows(10);
     $ta->setCols(60);
     $this->form->addItem($ta);
     // BEGIN CRONJOB NOTIFICATION
     if ($ilSetting->get('mail_notification')) {
         $cb = new ilCheckboxInputGUI($lng->txt('cron_mail_notification'), 'cronjob_notification');
         $cb->setInfo($lng->txt('mail_cronjob_notification_info'));
         $cb->setValue(1);
         $this->form->addItem($cb);
     }
     $this->form->addCommandButton('saveMailOptions', $lng->txt('save'));
 }
コード例 #10
0
    public function send()
    {
        global $ilDB, $lng, $ilSetting;
        $is_message_enabled = $ilSetting->get("mail_notification_message");
        $res = $ilDB->queryF('SELECT mail.* FROM mail_options
						INNER JOIN mail ON mail.user_id = mail_options.user_id
						INNER JOIN mail_obj_data ON mail_obj_data.obj_id = mail.folder_id
						WHERE cronjob_notification = %s
						AND send_time >= %s
						AND m_status = %s', array('integer', 'timestamp', 'text'), array(1, date('Y-m-d H:i:s', time() - 60 * 60 * 24), 'unread'));
        $users = array();
        $user_id = 0;
        while ($row = $ilDB->fetchAssoc($res)) {
            if ($user_id == 0 || $row['user_id'] != $user_id) {
                $user_id = $row['user_id'];
            }
            $users[$user_id][] = $row;
        }
        foreach ($users as $user_id => $mail_data) {
            $this->initLanguage($user_id);
            $user_lang = $this->getLanguage() ? $this->getLanguage() : $lng;
            $this->initMail();
            $this->setRecipients($user_id);
            $this->setSubject($this->getLanguageText('mail_notification_subject'));
            $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage()));
            $this->appendBody("\n\n");
            if (count($mail_data) == 1) {
                $this->appendBody(sprintf($user_lang->txt('mail_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
            } else {
                $this->appendBody(sprintf($user_lang->txt('mails_at_the_ilias_installation'), count($mail_data), ilUtil::_getHttpPath()));
            }
            $this->appendBody("\n\n");
            $counter = 1;
            foreach ($mail_data as $mail) {
                $this->appendBody("----------------------------------------------------------------------------------------------");
                $this->appendBody("\n\n");
                $this->appendBody('#' . $counter . "\n\n");
                $this->appendBody($user_lang->txt('date') . ": " . $mail['send_time']);
                $this->appendBody("\n");
                if ($mail['sender_id'] == ANONYMOUS_USER_ID) {
                    $sender = ilMail::_getIliasMailerName();
                } else {
                    $sender = ilObjUser::_lookupLogin($mail['sender_id']);
                }
                $this->appendBody($user_lang->txt('sender') . ": " . $sender);
                $this->appendBody("\n");
                $this->appendBody($user_lang->txt('subject') . ": " . $mail['m_subject']);
                $this->appendBody("\n\n");
                if ($is_message_enabled == true) {
                    $this->appendBody($user_lang->txt('message') . ": " . $mail['m_message']);
                    $this->appendBody("\n\n");
                }
                ++$counter;
            }
            $this->appendBody("----------------------------------------------------------------------------------------------");
            $this->appendBody("\n\n");
            $this->appendBody($user_lang->txt('follow_link_to_read_mails') . " ");
            $this->appendBody("\n");
            $mailbox_link = ilUtil::_getHttpPath();
            $mailbox_link .= "/goto.php?target=mail&client_id=" . CLIENT_ID;
            $this->appendBody($mailbox_link);
            $this->appendBody("\n\n");
            $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->getLanguage()));
            $this->appendBody(ilMail::_getInstallationSignature());
            $mmail = new ilMimeMail();
            $mmail->autoCheck(false);
            $mmail->From(ilMail::getIliasMailerAddress());
            $mmail->To(ilObjUser::_lookupEmail($user_id));
            $mmail->Subject($this->getSubject());
            $mmail->Body($this->getBody());
            $mmail->Send();
        }
    }
コード例 #11
0
 /**
  * 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
     $valid_user_ids = $filters = array();
     if ($this->roles) {
         if ($this->has_local_role) {
             $members = array();
             foreach ($this->participants->getMembers() as $member_id) {
                 foreach ($this->participants->getAssignedRoles($member_id) as $role_id) {
                     $members[$role_id][] = $member_id;
                 }
             }
         } else {
             $members = $this->participants->getMembers();
         }
         foreach ($this->roles as $role_id) {
             switch ($this->role_data[$role_id][1]) {
                 case "admin":
                     $valid_user_ids = array_merge($valid_user_ids, $this->participants->getAdmins());
                     break;
                 case "tutor":
                     $valid_user_ids = array_merge($valid_user_ids, $this->participants->getTutors());
                     break;
                     // member/local
                 // member/local
                 default:
                     if (!$this->has_local_role) {
                         $valid_user_ids = array_merge($valid_user_ids, (array) $members);
                     } else {
                         $valid_user_ids = array_merge($valid_user_ids, (array) $members[$role_id]);
                     }
                     break;
             }
         }
     }
     if ($this->include_subscribers) {
         $valid_user_ids = array_merge($valid_user_ids, $this->participants->getSubscribers());
     }
     if ($this->include_waiting_list) {
         $valid_user_ids = array_merge($valid_user_ids, $this->waiting_list->getUserIds());
     }
     if ($this->user_filters) {
         foreach ($this->user_filters as $sub_id => $sub_item) {
             $filters[$sub_id] = (bool) $sub_item[2];
         }
     }
     $valid_user_ids = ilUtil::_sortIds(array_unique($valid_user_ids), 'usr_data', 'lastname', 'usr_id');
     // rows
     foreach ($valid_user_ids as $user_id) {
         if ($this->callback) {
             $user_data = call_user_func_array($this->callback, array($user_id, $filters));
             if (!$user_data) {
                 continue;
             }
             $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();
 }
 /** Generates the login name for a user depending on assignment_mode setting
  * 
  * @param integer $user_id user_id 
  */
 public static function generateXavcLoginName($user_id)
 {
     // set default when there is no setting set: assign_user_email
     $assignment_mode = ilAdobeConnectServer::getSetting('user_assignment_mode') ? ilAdobeConnectServer::getSetting('user_assignment_mode') : 'assign_user_email';
     switch ($assignment_mode) {
         case 'assign_user_email':
             $xavc_login = IL_INST_ID . '_' . $user_id . '_' . ilObjUser::_lookupEmail($user_id);
             break;
         case 'assign_ilias_login':
             $xavc_login = IL_INST_ID . '_' . $user_id . '_' . ilObjUser::_lookupLogin($user_id);
             break;
             //The SWITCH aai/DFN case, only return e-mail address
         //The SWITCH aai/DFN case, only return e-mail address
         case 'assign_dfn_email':
         case 'assign_breezeSession':
             $xavc_login = ilObjUser::_lookupEmail($user_id);
             break;
     }
     return $xavc_login;
 }
コード例 #13
0
 /**
  * Function for getting the parameters needed for handing in a document to Ephorus.
  *
  * @param object $document - The document there the parameters are needed from
  * @return array - Hand-in parameters bool - false
  */
 public static function getHandinParameters($document)
 {
     $user = ilObjUser::_lookupName($document->user_id);
     return array("code" => self::getSetting('handin_code'), "firstName" => $user["firstname"], "middleName" => "", "lastName" => $user["lastname"], "studentEmail" => ilObjUser::_lookupEmail($document->user_id), "studentNumber" => $document->user_id, "comment" => "", "fileName" => $document->filetitle, "file" => file_get_contents($document->filename), "processType" => $document->processtype);
 }