Пример #1
0
 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);
 }
Пример #2
0
 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 = "";
     }
 }
Пример #3
0
 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);
     }
 }
Пример #4
0
 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;
 }
Пример #5
0
 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);
 }
 /**
  * Delete own account dialog - action incl. notification email
  */
 protected function deleteOwnAccount4()
 {
     global $ilUser, $ilAuth, $ilSetting, $ilLog;
     if (!(bool) $ilSetting->get('user_delete_own_account') || $ilUser->getId() == SYSTEM_USER_ID || !$ilUser->hasDeletionFlag()) {
         $this->ctrl->redirect($this, "showGeneralSettings");
     }
     // build notification
     include_once "./Services/Notification/classes/class.ilSystemNotification.php";
     $ntf = new ilSystemNotification();
     $ntf->setLangModules(array("user"));
     $ntf->addAdditionalInfo("profile", $ilUser->getProfileAsString($this->lng), true);
     // mail message
     ilDatePresentation::setUseRelativeDates(false);
     $ntf->setIntroductionDirect(sprintf($this->lng->txt("user_delete_own_account_email_body"), $ilUser->getLogin(), ILIAS_HTTP_PATH, ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX))));
     $message = $ntf->composeAndGetMessage($ilUser->getId(), null, null, true);
     $subject = $this->lng->txt("user_delete_own_account_email_subject");
     // send notification
     include_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail(ANONYMOUS_USER_ID);
     $user_email = $ilUser->getEmail();
     $admin_mail = $ilSetting->get("user_delete_own_account_email");
     // to user, admin as bcc
     if ($user_email) {
         $mail->sendMimeMail($user_email, null, $admin_mail, $subject, $message, null, true);
     } else {
         if ($admin_mail) {
             $mail->sendMimeMail($admin_mail, null, null, $subject, $message, null, true);
         }
     }
     $ilLog->write("Account deleted: " . $ilUser->getLogin() . " (" . $ilUser->getId() . ")");
     $ilUser->delete();
     // terminate session
     $ilAuth->logout();
     session_destroy();
     ilUtil::redirect("login.php?accdel=1");
 }
 /**
  * Send news mail for 1 object and 1 user
  *
  * @param int $a_user_id
  * @param int $a_ref_id
  * @param array $news
  */
 protected 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);
     include_once "./Services/Notification/classes/class.ilSystemNotification.php";
     $ntf = new ilSystemNotification();
     $ntf->setLangModules(array("crs", "news"));
     $ntf->setRefId($a_ref_id);
     $ntf->setGotoLangId('url');
     $ntf->setSubjectLangId('crs_subject_course_group_notification');
     // user specific language
     $lng = $ntf->getUserLanguage($a_user_id);
     $obj_title = $lng->txt($obj_type) . " \"" . ilObject::_lookupTitle($obj_id) . "\"";
     $ntf->setIntroductionDirect(sprintf($lng->txt("crs_intro_course_group_notification_for"), $obj_title));
     $subject = sprintf($lng->txt("crs_subject_course_group_notification"), $obj_title);
     // news summary
     $counter = 1;
     $txt = "";
     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"]);
         $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() . "]";
         if ($counter > 1) {
             $txt .= $ntf->getBlockBorder();
         }
         $txt .= '#' . $counter . " - " . $loc . " " . $obj_title . "\n\n";
         $txt .= $title;
         if ($content) {
             $txt .= "\n" . $content;
         }
         $txt .= "\n\n";
         ++$counter;
     }
     $ntf->addAdditionalInfo("news", $txt, true);
     // #10044
     $mail = new ilMail($ilUser->getId());
     $mail->enableSOAP(false);
     // #10410
     $mail->sendMail(ilObjUser::_lookupLogin($a_user_id), null, null, $subject, $ntf->composeAndGetMessage($a_user_id, null, "read", true), null, array("system"));
 }