/** * Book an appointment. All checks (assignment possible, max booking) must be done before * @param type $a_usr_id * @param type $a_app_id * @return bool */ public static function bookAppointment($a_usr_id, $a_app_id) { global $lng; // Create new default consultation hour calendar include_once './Services/Language/classes/class.ilLanguageFactory.php'; $cal_lang = ilLanguageFactory::_getLanguage($lng->getDefaultLanguage()); $cal_lang->loadLanguageModule('dateplaner'); include_once './Services/Calendar/classes/class.ilCalendarUtil.php'; include_once './Services/Calendar/classes/class.ilCalendarCategory.php'; $ch = ilCalendarUtil::initDefaultCalendarByType(ilCalendarCategory::TYPE_CH, $a_usr_id, $cal_lang->txt('cal_ch_personal_ch'), true); // duplicate appointment include_once './Services/Calendar/classes/class.ilCalendarEntry.php'; $app = new ilCalendarEntry($a_app_id); $personal_app = clone $app; $personal_app->save(); // assign appointment to category include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; $assignment = new ilCalendarCategoryAssignments($personal_app->getEntryId()); $assignment->addAssignment($ch->getCategoryID()); // book appointment include_once './Services/Booking/classes/class.ilBookingEntry.php'; $booking = new ilBookingEntry($app->getContextId()); $booking->book($app->getEntryId(), $a_usr_id); return true; }
/** * get auto generated info string * * @access public * @static * * @param string language */ public static function _getAutoGeneratedMessageString($lang = null) { global $ilSetting; if (!$lang) { include_once './Services/Language/classes/class.ilLanguageFactory.php'; $lang = ilLanguageFactory::_getLanguage(); } $http_path = ilUtil::_getHttpPath(); $lang->loadLanguageModule('mail'); return sprintf($lang->txt('mail_auto_generated_info'), $ilSetting->get('inst_name', 'ILIAS 4'), $http_path . "\n\n"); }
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]); } } }
/** * @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]); } } }
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")); } }
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); } }
/** * 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 notifications about new EContent */ protected function sendNewContentNotification($a_server_id) { include_once 'Services/WebServices/ECS/classes/class.ilECSSetting.php'; $settings = ilECSSetting::getInstanceByServerId($a_server_id); if (!count($rcps = $settings->getEContentRecipients())) { return; } include_once './Services/Mail/classes/class.ilMail.php'; include_once './Services/Language/classes/class.ilLanguageFactory.php'; $lang = ilLanguageFactory::_getLanguage(); $lang->loadLanguageModule('ecs'); $mail = new ilMail(self::MAIL_SENDER); $message = $lang->txt('ecs_' . $this->getType() . '_created_body_a') . "\n\n"; $message .= $lang->txt('title') . ': ' . $this->getTitle() . "\n"; if (strlen($desc = $this->getDescription())) { $message .= $lang->txt('desc') . ': ' . $desc . "\n"; } include_once './Services/Link/classes/class.ilLink.php'; $href = ilLink::_getStaticLink($this->getRefId(), $this->getType(), true); $message .= $lang->txt("perma_link") . ': ' . $href . "\n\n"; $message .= ilMail::_getAutoGeneratedMessageString(); $mail->sendMail($settings->getEContentRecipientsAsString(), '', '', $lang->txt('ecs_new_econtent_subject'), $message, array(), array('normal')); }
/** * send notifications about new EContent * * @return bool */ protected function sendNewContentNotification(ilECSSetting $a_server, $a_econtent_id) { global $ilLog; if (!count($rcps = $a_server->getApprovalRecipients())) { return true; } include_once './Services/Mail/classes/class.ilMail.php'; include_once './Services/Language/classes/class.ilLanguageFactory.php'; $lang = ilLanguageFactory::_getLanguage(); $lang->loadLanguageModule('ecs'); // @TODO: read mail $mail = new ilMail(self::MAIL_SENDER); $message = $lang->txt('ecs_export_created_body_a') . "\n\n"; $message .= $lang->txt('title') . ': ' . $this->content_obj->getTitle() . "\n"; if (strlen($desc = $this->content_obj->getDescription())) { $message .= $lang->txt('desc') . ': ' . $desc . "\n"; } // Participant info $message .= "\n" . $lang->txt('ecs_published_for'); try { $found = false; $receivers = null; include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php'; $details = ilECSEContentDetails::getInstance($a_server->getServerId(), $a_econtent_id, $this->getECSObjectType()); if ($details instanceof ilECSEContentDetails) { $receivers = $details->getReceivers(); } if ($receivers) { foreach ($receivers as $member) { $found = true; include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php'; $part = ilECSCommunityReader::getInstanceByServerId($a_server->getServerId())->getParticipantByMID($member); $message .= "\n\n" . $part->getParticipantName() . "\n"; $message .= $part->getDescription(); } } if ($found) { $message .= "\n\n"; } else { $message .= ' ' . $lang->txt('ecs_not_published') . "\n\n"; } } catch (ilECSConnectorException $e) { $ilLog->write(__METHOD__ . ': Cannot read approvements.'); return false; } include_once './Services/Link/classes/class.ilLink.php'; $href = ilLink::_getStaticLink($this->content_obj->getRefId(), 'crs', true); $message .= $lang->txt("perma_link") . ': ' . $href . "\n\n"; $message .= ilMail::_getAutoGeneratedMessageString(); $mail->sendMail($a_server->getApprovalRecipientsAsString(), '', '', $lang->txt('ecs_new_approval_subject'), $message, array(), array('normal')); return true; }
/** * * @return */ public function send() { global $rbacreview, $lng; switch ($this->getType()) { case self::TYPE_USER: $rcp = array_pop($this->getRecipients()); $this->initLanguage($rcp); $this->getLanguage()->loadLanguageModule('dateplaner'); $this->initMail(); $this->setSubject(sprintf($this->getLanguageText('cal_mail_notification_subject'), $this->getAppointment()->getTitle())); $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage())); $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('cal_mail_notification_body')); $this->appendBody("\n\n"); $this->appendAppointmentDetails(); $this->appendBody("\n\n"); $this->getMail()->appendInstallationSignature(true); $this->addAttachment(); $this->sendMail($this->getRecipients(), array('system'), true); break; case self::TYPE_USER_ANONYMOUS: $rcp = array_pop($this->getRecipients()); $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage())); $this->getLanguage()->loadLanguageModule('dateplaner'); $this->getLanguage()->loadLanguageModule('mail'); $this->initMail(); $this->setSubject(sprintf($this->getLanguageText('cal_mail_notification_subject'), $this->getAppointment()->getTitle())); $this->setBody(ilMail::getSalutation(0, $this->getLanguage())); $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('cal_mail_notification_body')); $this->appendBody("\n\n"); $this->appendAppointmentDetails(); $this->appendBody("\n\n"); $this->getMail()->appendInstallationSignature(true); $this->addAttachment(); $this->sendMail($this->getRecipients(), array('email'), false); break; case self::TYPE_GRP_NEW_NOTIFICATION: $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage())); $this->getLanguage()->loadLanguageModule('grp'); $this->getLanguage()->loadLanguageModule('dateplaner'); $this->initMail(); $this->setSubject(sprintf($this->getLanguageText('cal_grp_new_notification_sub'), $this->getObjectTitle(true))); $this->setBody($this->getLanguageText('grp_notification_salutation')); $this->appendBody("\n\n"); $this->appendBody(sprintf($this->getLanguageText('cal_grp_new_notification_body'), $this->getObjectTitle(true))); $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('grp_mail_permanent_link')); $this->appendBody("\n\n"); $this->appendAppointmentDetails(); $this->appendBody("\n\n"); $this->appendBody($this->createPermanentLink()); $this->getMail()->appendInstallationSignature(true); $this->addAttachment(); $this->sendMail(array('#il_grp_admin_' . $this->getRefId(), '#il_grp_member_' . $this->getRefId()), array('system'), false); break; case self::TYPE_GRP_NOTIFICATION: $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage())); $this->getLanguage()->loadLanguageModule('grp'); $this->getLanguage()->loadLanguageModule('dateplaner'); $this->initMail(); $this->setSubject(sprintf($this->getLanguageText('cal_grp_notification_sub'), $this->getObjectTitle(true))); $this->setBody($this->getLanguageText('grp_notification_salutation')); $this->appendBody("\n\n"); $this->appendBody(sprintf($this->getLanguageText('cal_grp_notification_body'), $this->getObjectTitle(true))); $this->appendBody("\n\n"); $this->appendAppointmentDetails(); $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('grp_mail_permanent_link')); $this->appendBody("\n\n"); $this->appendBody($this->createPermanentLink()); $this->getMail()->appendInstallationSignature(true); $this->addAttachment(); $this->sendMail(array('#il_grp_admin_' . $this->getRefId(), '#il_grp_member_' . $this->getRefId()), array('system'), false); break; case self::TYPE_CRS_NEW_NOTIFICATION: $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage())); $this->getLanguage()->loadLanguageModule('crs'); $this->getLanguage()->loadLanguageModule('dateplaner'); $this->initMail(); $this->setSubject(sprintf($this->getLanguageText('cal_crs_new_notification_sub'), $this->getObjectTitle(true))); $this->setBody($this->getLanguageText('crs_notification_salutation')); $this->appendBody("\n\n"); $this->appendBody(sprintf($this->getLanguageText('cal_crs_new_notification_body'), $this->getObjectTitle(true))); $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('crs_mail_permanent_link')); $this->appendBody("\n\n"); $this->appendAppointmentDetails(); $this->appendBody("\n\n"); $this->appendBody($this->createPermanentLink()); $this->getMail()->appendInstallationSignature(true); $this->addAttachment(); $this->sendMail(array('#il_crs_admin_' . $this->getRefId(), '#il_crs_tutor_' . $this->getRefId(), '#il_crs_member_' . $this->getRefId()), array('system'), false); break; case self::TYPE_CRS_NOTIFICATION: $this->setLanguage(ilLanguageFactory::_getLanguage($lng->getDefaultLanguage())); $this->getLanguage()->loadLanguageModule('crs'); $this->getLanguage()->loadLanguageModule('dateplaner'); $this->initMail(); $this->setSubject(sprintf($this->getLanguageText('cal_crs_notification_sub'), $this->getObjectTitle(true))); $this->setBody($this->getLanguageText('crs_notification_salutation')); $this->appendBody("\n\n"); $this->appendBody(sprintf($this->getLanguageText('cal_crs_notification_body'), $this->getObjectTitle(true))); $this->appendBody("\n\n"); $this->appendAppointmentDetails(); $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('crs_mail_permanent_link')); $this->appendBody("\n\n"); $this->appendBody($this->createPermanentLink()); $this->getMail()->appendInstallationSignature(true); $this->addAttachment(); $this->sendMail(array('#il_crs_admin_' . $this->getRefId(), '#il_crs_tutor_' . $this->getRefId(), '#il_crs_member_' . $this->getRefId()), array('system'), false); break; case self::TYPE_BOOKING_CONFIRMATION: $user_id = array_pop($this->getRecipients()); include_once 'Services/Calendar/classes/class.ilCalendarEntry.php'; include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $entry = new ilCalendarEntry($this->getAppointmentId()); $booking = new ilBookingEntry($entry->getContextId()); $this->initLanguage($user_id); $this->getLanguage()->loadLanguageModule('dateplaner'); $this->initMail(); $this->setSubject(sprintf($this->getLanguageText('cal_booking_confirmation_subject'), $entry->getTitle())); $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage())); $this->appendBody("\n\n"); $this->appendBody(sprintf($this->getLanguageText('cal_booking_confirmation_body'), ilObjUser::_lookupFullname($booking->getObjId()))); $this->appendBody("\n\n"); $this->appendAppointmentDetails($booking); /* $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('cal_booking_confirmation_link')); $this->appendBody("\n\n"); $this->appendBody($this->createPermanentLink()); */ $this->getMail()->appendInstallationSignature(true); $this->sendMail(array($user_id), array('system'), true); $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('cal_booking_confirmation_user') . "\n"); $this->appendBody(ilObjUser::_lookupFullname($user_id)); $this->sendMail(array($booking->getObjId()), array('system'), true); break; case self::TYPE_BOOKING_CANCELLATION: $user_id = array_pop($this->getRecipients()); include_once 'Services/Calendar/classes/class.ilCalendarEntry.php'; include_once 'Services/Booking/classes/class.ilBookingEntry.php'; $entry = new ilCalendarEntry($this->getAppointmentId()); $booking = new ilBookingEntry($entry->getContextId()); $user_id = array_pop($this->getRecipients()); $this->initLanguage($user_id); $this->getLanguage()->loadLanguageModule('dateplaner'); $this->initMail(); $this->setSubject(sprintf($this->getLanguageText('cal_booking_cancellation_subject'), $entry->getTitle())); $this->setBody(ilMail::getSalutation($user_id, $this->getLanguage())); $this->appendBody("\n\n"); $this->appendBody(sprintf($this->getLanguageText('cal_booking_cancellation_body'), ilObjUser::_lookupFullname($booking->getObjId()))); $this->appendBody("\n\n"); $this->appendAppointmentDetails($booking); $this->getMail()->appendInstallationSignature(true); $this->sendMail(array($user_id), array('system'), true); $this->appendBody("\n\n"); $this->appendBody($this->getLanguageText('cal_booking_cancellation_user') . "\n"); $this->appendBody(ilObjUser::_lookupFullname($user_id)); $this->sendMail(array($booking->getObjId()), array('system'), true); break; } $this->deleteAttachments(); }
/** * send notification about new user accounts * * @access protected */ protected static function _sendNotification(ilECSSetting $server, ilObjUser $user_obj) { if (!count($server->getUserRecipients())) { return true; } // If sub id is set => mail was send include_once './Services/WebServices/ECS/classes/class.ilECSImport.php'; $import = new ilECSImport($server->getServerId(), $user_obj->getId()); if ($import->getSubId()) { return false; } include_once './Services/Language/classes/class.ilLanguageFactory.php'; $lang = ilLanguageFactory::_getLanguage(); $lang->loadLanguageModule('ecs'); include_once './Services/Mail/classes/class.ilMail.php'; $mail = new ilMail(6); $mail->enableSoap(false); $subject = $lang->txt('ecs_new_user_subject'); // build body $body = $lang->txt('ecs_new_user_body') . "\n\n"; $body .= $lang->txt('ecs_new_user_profile') . "\n\n"; $body .= $user_obj->getProfileAsString($lang) . "\n\n"; $body .= ilMail::_getAutoGeneratedMessageString($lang); $mail->sendMail($server->getUserRecipientsAsString(), "", "", $subject, $body, array(), array("normal")); // Store sub_id = 1 in ecs import which means mail is send $import->setSubId(1); $import->save(); return true; }
/** * Send notification * * @access private * @param * */ private function sendNotification($user_obj) { if (!count($this->getCurrentServer()->getUserRecipients())) { return true; } include_once './Services/Language/classes/class.ilLanguageFactory.php'; include_once './Services/Language/classes/class.ilLanguage.php'; $lang = ilLanguageFactory::_getLanguage(); $GLOBALS['lng'] = $lang; $GLOBALS['ilUser'] = $user_obj; $lang->loadLanguageModule('ecs'); include_once './Services/Mail/classes/class.ilMail.php'; $mail = new ilMail(6); $mail->enableSoap(false); $subject = $lang->txt('ecs_new_user_subject'); // build body $body = $lang->txt('ecs_new_user_body') . "\n\n"; $body .= $lang->txt('ecs_new_user_profile') . "\n\n"; $body .= $user_obj->getProfileAsString($lang) . "\n\n"; $body .= ilMail::_getAutoGeneratedMessageString($lang); $mail->sendMail($this->getCurrentServer()->getUserRecipientsAsString(), "", "", $subject, $body, array(), array("normal")); }
/** * Init language by ISO2 code * @param string $a_code */ protected function initLanguageByIso2Code($a_code = '') { $this->language = ilLanguageFactory::_getLanguage($a_code); $this->language->loadLanguageModule('mail'); if (sizeof($this->lang_modules)) { foreach ($this->lang_modules as $lmod) { $this->language->loadLanguageModule($lmod); } } }
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"; 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; } include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php"; $link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle()); 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; } include_once "./Services/Link/classes/class.ilLink.php"; $link = ilLink::_getLink($a_wiki_ref_id); } ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_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"; 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()); $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"; // 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"; $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]); } } }
/** * Init language by ISO2 code * @param string $a_code */ protected function initLanguageByIso2Code($a_code = '') { $this->language = ilLanguageFactory::_getLanguage($a_code); $this->language->loadLanguageModule('mail'); }