function __sendMail() { global $ilUser; if (!count($notify = $this->__getNotifyLinks())) { // Nothing to do return true; } if (!$this->getMailStatus()) { return true; } include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php'; $body = ""; $obj_name = ""; foreach (ilLinkCheckNotify::_getAllNotifiers($this->db) as $usr_id => $obj_ids) { if (!is_object($tmp_user =& ilObjectFactory::getInstanceByObjId($usr_id, false))) { $this->__appendLogMessage('LinkChecker: Cannot find user with id: ' . $usr_id); continue; } $counter = 0; foreach ($obj_ids as $obj_id) { if (!isset($notify[$obj_id])) { continue; } ++$counter; switch ($this->__getType()) { case 'webr': $obj_name = $this->__txt($tmp_user->getLanguage(), 'obj_webr'); break; case 'lm': default: $obj_name = $this->__txt($tmp_user->getLanguage(), 'lo'); break; } $body .= $obj_name . ': ' . $this->__getTitle($obj_id) . "\r\n"; $body .= $this->__txt($tmp_user->getLanguage(), 'link_check_perma_link', "mail") . ": " . $this->createPermanentLink($obj_id, $usr_id, $this->__getType()) . " \r\n"; $body .= $this->__txt($tmp_user->getLanguage(), "link_check_affected_links", "mail") . ":\r\n"; // Print all invalid foreach ($notify[$obj_id] as $data) { $body .= $data['url'] . "\r\n"; } $body .= "\r\n"; } if ($counter) { include_once "./Services/Notification/classes/class.ilSystemNotification.php"; $ntf = new ilSystemNotification(); $ntf->setLangModules(array("mail", "common")); $ntf->setSubjectLangId("link_check_subject"); $ntf->setIntroductionLangId("link_check_introduction"); $ntf->setReasonLangId("link_check_reason"); $ntf->addAdditionalInfo("additional_info", $body, true); $ntf->sendMail(array($tmp_user->getId())); $this->__appendLogMessage('LinkChecker: Sent mail to ' . $tmp_user->getEmail()); } $body = ""; } }
protected function sendNotifications() { global $ilUser; // recipients include_once "./Services/Notification/classes/class.ilNotification.php"; $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_POLL, $this->object->getId(), null, true); if (!sizeof($users)) { return; } include_once "./Services/Notification/classes/class.ilSystemNotification.php"; $ntf = new ilSystemNotification(); $ntf->setLangModules(array("poll")); $ntf->setRefId($this->ref_id); if ($this->object->getNonAnonymous()) { $ntf->setChangedByUserId($ilUser->getId()); } $ntf->setSubjectLangId('poll_vote_notification_subject'); $ntf->setIntroductionLangId('poll_vote_notification_body'); $ntf->setGotoLangId('poll_vote_notification_link'); $ntf->setReasonLangId('poll_vote_notification_reason'); $notified = $ntf->sendMail($users, null, "read"); ilNotification::updateNotificationTime(ilNotification::TYPE_POLL, $this->object->getId(), $notified); }
public function sendFeedbackNotifications($a_ass_id) { global $ilDB; $ass = new self($a_ass_id); // valid assignment? if (!$ass->hasFeedbackCron() || !$ass->getFeedbackFile()) { return false; } // already done? $set = $ilDB->query("SELECT fb_cron_done" . " FROM exc_assignment" . " WHERE id = " . $ilDB->quote($a_ass_id, "integer")); $row = $ilDB->fetchAssoc($set); if ($row["fb_cron_done"]) { return false; } include_once "./Services/Notification/classes/class.ilSystemNotification.php"; $ntf = new ilSystemNotification(); $ntf->setLangModules(array("exc")); $ntf->setObjId($ass->getExerciseId()); $ntf->setSubjectLangId("exc_feedback_notification_subject"); $ntf->setIntroductionLangId("exc_feedback_notification_body"); $ntf->addAdditionalInfo("exc_assignment", $ass->getTitle()); $ntf->setGotoLangId("exc_feedback_notification_link"); $ntf->setReasonLangId("exc_feedback_notification_reason"); include_once "./Modules/Exercise/classes/class.ilExerciseMembers.php"; $ntf->sendMail(ilExerciseMembers::_getMembers($ass->getExerciseId())); $ilDB->manipulate("UPDATE exc_assignment" . " SET fb_cron_done = " . $ilDB->quote(1, "integer") . " WHERE id = " . $ilDB->quote($a_ass_id, "integer")); return true; }
function sendNotificationMail($user_id, $anonymize_id, $appr_id) { include_once "./Services/User/classes/class.ilObjUser.php"; include_once "./Services/User/classes/class.ilUserUtil.php"; $recipients = preg_split('/,/', $this->mailaddresses); foreach ($recipients as $recipient) { // #11298 include_once "./Services/Notification/classes/class.ilSystemNotification.php"; $ntf = new ilSystemNotification(); $ntf->setLangModules(array("survey")); $ntf->setRefId($this->getRefId()); $ntf->setSubjectLangId('finished_mail_subject'); $messagetext = $this->mailparticipantdata; if (trim($messagetext)) { $data = ilObjUser::_getUserData(array($user_id)); foreach ($data[0] as $key => $value) { if ($this->getAnonymize()) { $messagetext = str_replace('[' . $key . ']', '', $messagetext); } else { $messagetext = str_replace('[' . $key . ']', $value, $messagetext); } } $ntf->setIntroductionDirect($messagetext); } else { $ntf->setIntroductionLangId('survey_notification_finished_introduction'); } // 360°? add appraisee data if ($appr_id) { $ntf->addAdditionalInfo('survey_360_appraisee', ilUserUtil::getNamePresentation($appr_id)); } $active_id = $this->getActiveID($user_id, $anonymize_id, $appr_id); $ntf->addAdditionalInfo('results', $this->getParticipantTextResults($active_id), true); $ntf->setGotoLangId('survey_notification_tutor_link'); $ntf->setReasonLangId('survey_notification_finished_reason'); $ntf->sendMail(array($recipient), null, null); } }
static function sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment = null) { global $ilUser; // 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); } else { $blog_obj_id = ilObject::_lookupObjId($a_blog_node_id); $access_handler = null; } 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; } include_once "./Services/Notification/classes/class.ilSystemNotification.php"; $ntf = new ilSystemNotification($a_in_wsp); $ntf->setLangModules(array("blog")); $ntf->setRefId($a_blog_node_id); $ntf->setChangedByUserId($ilUser->getId()); $ntf->setSubjectLangId('blog_change_notification_subject'); $ntf->setIntroductionLangId('blog_change_notification_body_' . $a_action); $ntf->addAdditionalInfo('blog_posting', $posting->getTitle()); if ($a_comment) { $ntf->addAdditionalInfo('comment', $a_comment, true); } $ntf->setGotoLangId('blog_change_notification_link'); $ntf->setReasonLangId('blog_change_notification_reason'); $notified = $ntf->sendMail($users, "_" . $a_posting_id, $admin_only ? "write" : "read"); ilNotification::updateNotificationTime(ilNotification::TYPE_BLOG, $blog_obj_id, $notified); }