示例#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);
 }
 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);
     }
 }
示例#3
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);
 }
 /**
  * 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/Notification/classes/class.ilSystemNotification.php";
     $ntf = new ilSystemNotification();
     $ntf->setLangModules(array("exc"));
     $ntf->setRefId($a_exc_ref_id);
     $ntf->setChangedByUserId($ilUser->getId());
     $ntf->setSubjectLangId('exc_team_notification_subject_' . $a_action);
     $ntf->setIntroductionLangId('exc_team_notification_body_' . $a_action);
     $ntf->addAdditionalInfo("exc_assignment", $this->getTitle());
     $ntf->setGotoLangId('exc_team_notification_link');
     $ntf->setReasonLangId('exc_team_notification_reason');
     $ntf->sendMail(array($a_user_id));
 }
 /**
  * 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"));
 }