private function buildBody()
 {
     //	Salutation
     $this->setBody(ilMail::getSalutation($this->getRecipient(), $this->getLanguage()));
     $this->appendBody("\n\n");
     //	Message (What has happened?)
     $this->appendBody($this->getLanguageText('tst_notify_manscoring_done_body_msg_topic'));
     $this->appendBody("\n\n");
     $info = $this->getAdditionalInformation();
     $this->appendBody($this->getLanguageText('obj_tst') . ': ' . $info['test_title']);
     $this->appendBody("\n");
     $this->appendBody($this->getLanguageText('pass') . ': ' . $info['test_pass']);
     $this->appendBody("\n\n");
     foreach ($info['questions_gui_list'] as $questionId => $questionGui) {
         $points = $info['questions_scoring_data'][$questionId]['points'];
         $feedback = $info['questions_scoring_data'][$questionId]['feedback'];
         $feedback = $this->convertFeedbackForMail($feedback);
         $this->appendBody($this->getLanguageText('tst_question') . ': ' . $questionGui->object->getTitle());
         $this->appendBody("\n");
         $this->appendBody($this->getLanguageText('tst_reached_points') . ': ' . $points);
         $this->appendBody("\n");
         $this->appendBody($this->getLanguageText('set_manual_feedback') . ":\n" . $feedback);
         $this->appendBody("\n\n");
     }
     //	Task (What do I have to do?
     /* NOTHING TODO FOR PARTICIPANT */
     //	Explanation (Why do I receive the following message?)
     $this->appendBody("\n");
     $this->appendBody($this->getLanguageText('tst_notify_manscoring_done_body_msg_reason'));
     //	Signature
     $this->getMail()->appendInstallationSignature(true);
 }
 /**
  * send an advanced notification to the owner of the test
  * @param int $owner_id
  * @param string $title
  * @param sting $usr_data
  * @param array $file_names
  */
 public function sendAdvancedNotification($owner_id, $title, $usr_data, $file_names)
 {
     $this->initLanguage($owner_id);
     $this->language->loadLanguageModule('assessment');
     $this->initMail();
     $this->setSubject(sprintf($this->language->txt('tst_user_finished_test'), $title));
     $this->setBody(ilMail::getSalutation($owner_id, $this->getLanguage()));
     $this->appendBody("\n\n");
     $this->appendBody($this->language->txt('user_has_finished_a_test'));
     $this->appendBody("\n\n");
     $this->appendBody($this->language->txt('title') . ': ' . $title);
     $this->appendBody("\n");
     $this->appendBody($this->language->txt('username') . ': ' . $usr_data);
     $this->appendBody("\n");
     ilDatePresentation::setUseRelativeDates(false);
     $this->appendBody($this->language->txt('tst_finished') . ': ' . ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
     $this->appendBody("\n\n");
     $this->appendBody($this->language->txt('tst_attached_xls_file'));
     $this->appendBody("\n\n");
     $this->appendBody($this->language->txt('tst_notification_explanation_admin'));
     $this->appendBody("\n");
     $this->setAttachments($file_names);
     $this->getMail()->appendInstallationSignature(true);
     $this->sendMail(array($owner_id), array('system'));
 }
 /**
  * Send notifications
  * @return 
  */
 public function send()
 {
     global $ilUser;
     switch ($this->getType()) {
         case self::TYPE_USER_BLOCKED:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('cont_user_blocked'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('cont_user_blocked2'));
                 $this->appendBody("\n");
                 $this->appendBody($this->getLanguageText('cont_user_blocked3') . " '" . $this->getLanguageText('objs_qst') . "' > '" . $this->getLanguageText('cont_blocked_users') . "'");
                 $this->appendBody("\n");
                 $this->appendBody($this->getLanguageText('obj_lm') . ": " . $this->getObjectTitle(true));
                 $this->appendBody("\n");
                 include_once "./Services/User/classes/class.ilUserUtil.php";
                 $this->appendBody($this->getLanguageText('user') . ": " . ilUserUtil::getNamePresentation($ilUser->getId(), false, false, ""));
                 $this->appendBody("\n");
                 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
                 $this->appendBody($this->getLanguageText('question') . ": " . assQuestion::_getTitle($this->getQuestionId()));
                 $this->appendBody("\n");
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('cont_lm_mail_permanent_link'));
                 $this->appendBody("\n");
                 $this->appendBody($this->createPermanentLink(array(), ""));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
     }
     return true;
 }
    /**
     * 
     * Send notifications	 
     *  
     * @access	public
     *  
     */
    public function send()
    {
        global $ilDB;
        // parent::send();
        if (count($this->getRecipients())) {
            $res = $ilDB->queryf("SELECT u.usr_id,u.gender,u.firstname,u.lastname,u.login,u.email,u.last_login,u.active," . "u.time_limit_unlimited, " . $ilDB->fromUnixtime("u.time_limit_from") . ", " . $ilDB->fromUnixtime("u.time_limit_until") . "," . "CASE WHEN u.active = 0 THEN '0001-01-01' ELSE CASE WHEN u.time_limit_unlimited=1 THEN '9999-12-31' ELSE " . $ilDB->fromUnixtime("u.time_limit_until") . " END END access_until," . " CASE WHEN " . $ilDB->unixTimestamp() . " BETWEEN u.time_limit_from AND u.time_limit_until THEN 0 ELSE 1 END expired," . "rq.role_disk_quota, system_role.rol_id role_id, " . "p1.value+0 user_disk_quota," . "p2.value+0 disk_usage, " . "p3.value last_update, " . "p5.value language, " . "CASE WHEN rq.role_disk_quota>p1.value+0 OR p1.value IS NULL THEN rq.role_disk_quota ELSE p1.value+0 END disk_quota\t" . "FROM usr_data u  " . "JOIN (SELECT u.usr_id usr_id,MAX(rd.disk_quota) role_disk_quota " . "FROM usr_data u " . "JOIN rbac_ua ua ON ua.usr_id=u.usr_id " . "JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent=%s  " . "JOIN role_data rd ON rd.role_id=ua.rol_id WHERE u.usr_id=ua.usr_id GROUP BY u.usr_id) rq ON rq.usr_id=u.usr_id " . "LEFT JOIN rbac_ua system_role ON system_role.usr_id=u.usr_id AND system_role.rol_id = %s " . "LEFT JOIN usr_pref p1 ON p1.usr_id=u.usr_id AND p1.keyword = 'disk_quota'  " . "LEFT JOIN usr_pref p2 ON p2.usr_id=u.usr_id AND p2.keyword = 'disk_usage'  " . "LEFT JOIN usr_pref p3 ON p3.usr_id=u.usr_id AND p3.keyword = 'disk_usage.last_update'  " . "LEFT JOIN usr_pref p5 ON p5.usr_id=u.usr_id AND p5.keyword = 'language'  " . 'WHERE (((p1.value+0 > rq.role_disk_quota OR rq.role_disk_quota IS NULL) AND p2.value+0 > p1.value+0) OR 
					((rq.role_disk_quota > p1.value+0 OR p1.value IS NULL) AND p2.value+0 > rq.role_disk_quota)) ' . 'AND (u.active=1 AND (u.time_limit_unlimited = 1 OR ' . $ilDB->unixTimestamp() . ' BETWEEN u.time_limit_from AND u.time_limit_until)) ', array('integer', 'integer'), array(ROLE_FOLDER_ID, SYSTEM_ROLE_ID));
            $users = array();
            $counter = 0;
            while ($row = $ilDB->fetchAssoc($res)) {
                $details = ilDiskQuotaChecker::_lookupDiskUsage($row['usr_id']);
                $users[$counter]['disk_quota'] = $row['disk_quota'];
                $users[$counter]['disk_usage'] = $details['disk_usage'];
                $users[$counter]['email'] = $row['email'];
                $users[$counter]['firstname'] = $row['firstname'];
                $users[$counter]['lastname'] = $row['lastname'];
                ++$counter;
            }
            if (count($users)) {
                foreach ($this->getRecipients() as $rcp) {
                    $usrId = ilObjUser::_lookupId($rcp);
                    $this->initLanguage($usrId);
                    $this->initMail();
                    $this->setSubject($this->getLanguage()->txt('disk_quota_summary_subject'));
                    $this->setBody(ilMail::getSalutation($usrId, $this->getLanguage()));
                    $this->appendBody("\n\n");
                    $this->appendBody($this->getLanguage()->txt('disk_quota_exceeded_headline'));
                    $this->appendBody("\n\n");
                    $first = true;
                    $counter = 0;
                    $numUsers = count($users);
                    foreach ($users as $user) {
                        if (!$first) {
                            $this->appendBody("\n---------------------------------------------------\n\n");
                        }
                        $this->appendBody($this->getLanguage()->txt('fullname') . ': ' . $user['lastname'] . ', ' . $user['firstname'] . "\n");
                        $this->appendBody($this->getLanguage()->txt('email') . ': ' . $user['email'] . "\n");
                        $this->appendBody($this->getLanguage()->txt('disk_quota') . ': ' . ilFormat::formatSize($user['disk_quota'], 'short', $this->getLanguage()) . "\n");
                        $this->appendBody($this->getLanguage()->txt('currently_used_disk_space') . ': ' . ilFormat::formatSize($user['disk_usage'], 'short', $this->getLanguage()) . "\n");
                        $this->appendBody($this->getLanguage()->txt('usrf_profile_link') . ': ' . ilUtil::_getHttpPath() . '/goto.php?target=usrf&client_id=' . CLIENT_ID);
                        if ($counter < $numUsers - 1) {
                            $this->appendBody("\n");
                        }
                        ++$counter;
                        $first = false;
                    }
                    $this->getMail()->appendInstallationSignature(true);
                    $this->sendMail(array($rcp), array('system'), false);
                }
            }
        }
    }
 /**
  * Parse and send mail
  * @return 
  */
 public function send()
 {
     switch ($this->getType()) {
         case self::TYPE_NOTIFICATION_APPROVERS:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject($this->getLanguageText('reg_mail_new_user'));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_new_user_body'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_profile'));
                 $info = $this->getAdditionalInformation();
                 $this->appendBody("\n\n");
                 $this->appendBody($info['usr']->getProfileAsString($this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_reason'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->getMail()->enableSoap(false);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_NOTIFICATION_CONFIRMATION:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject($this->getLanguageText('reg_mail_new_user_confirmation'));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_new_user_body'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_profile'));
                 $info = $this->getAdditionalInformation();
                 $this->appendBody("\n\n");
                 $this->appendBody($info['usr']->getProfileAsString($this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_confirmation'));
                 $this->appendBody("\n");
                 // #4527
                 include_once "Services/Link/classes/class.ilLink.php";
                 $this->appendBody(ilLink::_getStaticLink($info['usr']->getId(), "usrf"));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('reg_mail_body_reason'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->getMail()->enableSoap(false);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
     }
 }
 /**
  * Send notifications
  * @return 
  */
 public function send()
 {
     global $ilUser;
     // parent::send();
     include_once "./Modules/Exercise/classes/class.ilExAssignment.php";
     switch ($this->getType()) {
         case self::TYPE_FEEDBACK_FILE_ADDED:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('exc_msg_new_feedback_file_uploaded'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('exc_msg_new_feedback_file_uploaded2'));
                 $this->appendBody("\n");
                 $this->appendBody($this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true));
                 $this->appendBody("\n");
                 $this->appendBody($this->getLanguageText('exc_assignment') . ": " . ilExAssignment::lookupTitle($this->getAssignmentId()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('exc_mail_permanent_link'));
                 $this->appendBody("\n");
                 $this->appendBody($this->createPermanentLink(array(), '_' . $this->getAssignmentId()) . '#fb' . $this->getAssignmentId());
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_SUBMISSION_UPLOAD:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('exc_submission_notification_subject'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('exc_submission_notification_body'), $this->getObjectTitle(true)));
                 $this->appendBody("\n");
                 $this->appendBody($this->getLanguageText('exc_assignment') . ": " . ilExAssignment::lookupTitle($this->getAssignmentId()));
                 $this->appendBody("\n");
                 $this->appendBody($this->getLanguageText('user') . ": " . $ilUser->getFullName());
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('exc_submission_notification_link'), $this->createPermanentLink()));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
     }
     return true;
 }
 public function send()
 {
     include_once './Services/Link/classes/class.ilLink.php';
     $obj = new ilObjectFactory();
     $instance = $obj->getInstanceByRefId($_GET['ref_id']);
     $link = ilLink::_getLink($_GET['ref_id'], $instance->getType(), array(), '');
     global $lng;
     foreach ($this->getRecipients() as $rcp) {
         $this->initLanguage($rcp);
         $this->initMail();
         $this->setSubject(sprintf($lng->txt('rubric_exercise_graded') . ' ' . ilObject::_lookupTitle($this->getObjId()) . ' ' . $lng->txt('rubric_is_now_available'), $this->getObjectTitle(true)));
         $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
         $this->appendBody("\n\n");
         $this->appendBody($lng->txt('rubric_exercise_graded') . ' ' . ilObject::_lookupTitle($this->getObjId()) . ' ' . $lng->txt('rubric_is_now_available'));
         $this->appendBody("\n");
         $this->appendBody($this->getLanguageText('obj_exc') . ": " . $this->getObjectTitle(true));
         $this->appendBody("\n");
         $this->appendBody("\n\n");
         $this->appendBody($link);
         $this->getMail()->appendInstallationSignature(true);
         $this->sendMail(array($rcp), array('system'));
     }
 }
 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();
     }
 }
Пример #9
0
 public function sendUserResultsMail($a_active_id, $a_recipient)
 {
     global $ilUser;
     $finished = $this->object->getSurveyParticipants(array($a_active_id));
     $finished = array_pop($finished);
     $finished = ilDatePresentation::formatDate(new ilDateTime($finished["finished_tstamp"], IL_CAL_UNIX));
     require_once "Services/Mail/classes/class.ilMail.php";
     require_once "Services/Link/classes/class.ilLink.php";
     $body = ilMail::getSalutation($ilUser->getId()) . "\n\n";
     $body .= $this->lng->txt("svy_mail_own_results_body") . "\n";
     $body .= "\n" . $this->lng->txt("obj_svy") . ": " . $this->object->getTitle() . "\n";
     $body .= ilLink::_getLink($this->object->getRefId(), "svy") . "\n";
     $body .= "\n" . $this->lng->txt("survey_results_finished") . ": " . $finished . "\n\n";
     $body .= $this->getUserResultsPlain($a_active_id);
     // $body .= ilMail::_getAutoGeneratedMessageString($this->lng);
     $body .= ilMail::_getInstallationSignature();
     require_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail(ANONYMOUS_USER_ID);
     $mail->sendMimeMail($a_recipient, null, null, sprintf($this->lng->txt("svy_mail_own_results_subject"), $this->object->getTitle()), $body, null, true);
 }
 /**
  * Send notifications
  * @return 
  */
 public function send()
 {
     global $ilSetting;
     // parent::send();
     switch ($this->getType()) {
         case self::TYPE_ADMISSION_MEMBER:
             // automatic mails about status change disabled
             if (!$ilSetting->get('mail_grp_member_notification', false)) {
                 return;
             }
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('grp_mail_admission_new_sub'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('grp_mail_admission_new_bod'), $this->getObjectTitle()));
                 $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->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_DISMISS_MEMBER:
             // automatic mails about status change disabled
             if (!$ilSetting->get('mail_grp_member_notification', false)) {
                 return;
             }
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('grp_mail_dismiss_sub'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('grp_mail_dismiss_bod'), $this->getObjectTitle()));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_SUBSCRIBE_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('grp_mail_subscribe_member_sub'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('grp_mail_subscribe_member_bod'), $this->getObjectTitle()));
                 $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->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_NOTIFICATION_REGISTRATION_REQUEST:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('grp_mail_notification_reg_req_sub'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $info = $this->getAdditionalInformation();
                 $this->appendBody(sprintf($this->getLanguageText('grp_mail_notification_reg_req_bod'), $this->userToString($info['usr_id']), $this->getObjectTitle()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('grp_mail_notification_reg_req_bod2'));
                 $this->appendBody("\n");
                 $this->appendBody($this->createPermanentLink(array(), '_mem'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('grp_notification_explanation_admin'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_REFUSED_SUBSCRIPTION_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('sess_mail_sub_dec_sub'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('sess_mail_sub_dec_bod'), $this->getObjectTitle()));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('sess_mail_sub_acc_sub'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('sess_mail_sub_acc_bod'), $this->getObjectTitle()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('sess_mail_permanent_link'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->createPermanentLink());
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
     }
     return true;
 }
 /**
  * Compose notification of sequence booking for the creator of that booking.
  *
  * @param array $a_user_id The user who will get the mail.
  *                         Returns nothing.
  */
 private function composeSequenceBookingMailForCreator($a_user_id)
 {
     $lng = $this->lng;
     $this->initLanguage($a_user_id);
     $this->initMail();
     $this->setSubject($this->lng->txt('rep_robj_xrs_mail_sequencebook_creator_subject'));
     $this->setBody(ilMail::getSalutation($a_user_id, $this->getLanguage()));
     $this->appendBody("\n\n");
     $this->appendBody($lng->txt('rep_robj_xrs_mail_sequencebook_cre ator_message') . "\n");
     $this->appendBody($lng->txt('rep_robj_xrs_room') . " ");
     $this->appendBody($this->s_roomname . " ");
     $this->appendBody($lng->txt('rep_robj_xrs_from') . " ");
     $this->appendBody($this->datestart->get(IL_CAL_FKT_DATE, 'd.m.Y H:s') . " ");
     $this->appendBody($lng->txt('rep_robj_xrs_to') . " ");
     $this->appendBody($this->dateend->get(IL_CAL_FKT_DATE, 'd.m.Y H:s'));
     $this->appendBody("\n\n");
     $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->language));
 }
 /**
  * 
  * @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();
 }
    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();
        }
    }
 /**
  * Compose notification to single recipient
  * 
  * @param mixed $a_rcp
  * @param string $a_goto_additional
  * @param string $a_permission
  * @param bool $a_append_signature_direct
  * @return bool
  */
 public function compose($a_user_id, $a_goto_additional = null, $a_permission = "read", $a_append_signature_direct = false)
 {
     $this->initLanguage($a_user_id);
     $this->initMail();
     $this->setSubject(sprintf($this->getLanguageText($this->subject_lang_id), $this->getObjectTitle(true)));
     $this->setBody(ilMail::getSalutation($a_user_id, $this->getLanguage()));
     $this->appendBody("\n\n");
     if ($this->introduction) {
         $this->appendBody($this->getLanguageText($this->introduction));
         $this->appendBody("\n\n");
     }
     if ($this->introduction_direct) {
         $this->appendBody($this->introduction_direct);
         $this->appendBody("\n\n");
     }
     if ($this->task) {
         $this->appendBody($this->getLanguageText($this->task));
         $this->appendBody("\n\n");
     }
     // details table
     if ($this->getObjId()) {
         $this->appendBody($this->getLanguageText("obj_" . $this->getObjType()) . ": " . $this->getObjectTitle() . "\n");
     }
     if (sizeof($this->additional)) {
         foreach ($this->additional as $lang_id => $item) {
             if (!$item[1]) {
                 $this->appendBody($this->getLanguageText($lang_id) . ": " . $item[0] . "\n");
             } else {
                 $this->appendBody("\n" . $this->getLanguageText($lang_id) . "\n" . $this->getBlockBorder() . $item[0] . "\n" . $this->getBlockBorder() . "\n");
             }
         }
     }
     $this->body = trim($this->body);
     $this->appendBody("\n\n");
     if ($this->changed_by) {
         $this->appendBody($this->getLanguageText("system_notification_installation_changed_by") . ": " . ilUserUtil::getNamePresentation($this->changed_by));
         $this->appendBody("\n\n");
     }
     if ($this->getObjId()) {
         // try to find accessible ref_id
         if (!$this->getRefId() && $this->all_ref_ids) {
             $find_ref_id = true;
             foreach ($this->all_ref_ids as $ref_id) {
                 if ($this->isRefIdAccessible($a_user_id, $ref_id, $a_permission)) {
                     $this->ref_id = $ref_id;
                     break;
                 }
             }
         }
         // check if initially given ref_id is accessible for current recipient
         if ($this->getRefId() && !$find_ref_id && !$this->isRefIdAccessible($a_user_id, $this->getRefId(), $a_permission)) {
             return false;
         }
         $goto = $this->createPermanentLink(array(), $a_goto_additional);
         if ($goto) {
             $this->appendBody($this->getLanguageText($this->goto_caption) . ": " . $goto);
             $this->appendBody("\n\n");
         }
         if ($find_ref_id) {
             $this->ref_id = null;
         }
     }
     if ($this->reason) {
         $this->appendBody($this->getLanguageText($this->reason));
         $this->appendBody("\n\n");
     }
     $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->language));
     // signature will append new lines
     $this->body = trim($this->body);
     if (!$a_append_signature_direct) {
         $this->getMail()->appendInstallationSignature(true);
     } else {
         $this->appendBody(ilMail::_getInstallationSignature());
     }
     return true;
 }
 /**
  * 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");
     }
     include_once "Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail(ANONYMOUS_USER_ID);
     // send mail(s)
     $subject = $this->lng->txt("user_delete_own_account_email_subject");
     $message = $this->lng->txt("user_delete_own_account_email_body");
     // salutation/info
     ilDatePresentation::setUseRelativeDates(false);
     $message = ilMail::getSalutation($ilUser->getId()) . "\n\n" . sprintf($message, $ilUser->getLogin(), ILIAS_HTTP_PATH, ilDatePresentation::formatDate(new ilDateTime(time(), IL_CAL_UNIX)));
     // add profile data (see ilAccountRegistrationGUI)
     $message .= "\n\n" . $ilUser->getProfileAsString($this->lng);
     // signatur
     $message .= ilMail::_getInstallationSignature();
     $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
  */
 public 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);
     $this->initLanguage($a_user_id);
     $this->getLanguage()->loadLanguageModule("crs");
     $this->getLanguage()->loadLanguageModule("news");
     // needed for ilNewsItem
     $lng = $this->getLanguage();
     $this->initMail();
     $obj_title = $this->getLanguageText($obj_type) . " \"" . ilObject::_lookupTitle($obj_id) . "\"";
     $this->setRecipients($a_user_id);
     $this->setSubject(sprintf($this->getLanguageText("crs_subject_course_group_notification"), $obj_title));
     $this->setBody(ilMail::getSalutation($a_user_id, $this->getLanguage()));
     $this->appendBody("\n\n");
     $this->appendBody(sprintf($this->getLanguageText("crs_intro_course_group_notification_for"), $obj_title));
     $this->appendBody("\n\n");
     // ilDatePresentation::setUseRelativeDates(false);
     // news summary
     $counter = 1;
     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"]);
         /* process sub-item info
         			if($item["aggregation"])
         			{
         				$sub = array();
         				foreach($item["aggregation"] as $subitem)
         				{
         					$sub_id = ilObject::_lookupObjId($subitem["ref_id"]);
         					$sub_title = ilObject::_lookupTitle($sub_id);
         					
         					// to include posting title
         					if($subitem["context_obj_type"] == "frm")
         					{
         						$sub_title = ilNewsItem::determineNewsTitle($subitem["context_obj_type"],
         							$subitem["title"], $subitem["content_is_lang_var"]);
         					}					
         								
         					$sub[] = $sub_title;
         					
         					$sub_content = ilNewsItem::determineNewsContent($subitem["context_obj_type"], 
         						$subitem["content"], $subitem["content_text_is_lang_var"]);								
         					if($sub_content)
         					{
         						$sub[] = strip_tags($sub_content);
         					}
         				}
         				$content .= "\n".implode("\n\n", $sub);
         			} 
         			*/
         $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() . "]";
         $this->appendBody("----------------------------------------------------------------------------------------------");
         $this->appendBody("\n\n");
         $this->appendBody('#' . $counter . " - " . $loc . " " . $obj_title . "\n\n");
         $this->appendBody($title);
         if ($content) {
             $this->appendBody("\n");
             $this->appendBody($content);
         }
         $this->appendBody("\n\n");
         ++$counter;
     }
     $this->appendBody("----------------------------------------------------------------------------------------------");
     $this->appendBody("\n\n");
     // link to object
     $this->appendBody($this->getLanguageText("crs_course_group_notification_link"));
     $this->appendBody("\n");
     $object_link = ilUtil::_getHttpPath();
     $object_link .= "/goto.php?target=" . $obj_type . "_" . $a_ref_id . "&client_id=" . CLIENT_ID;
     $this->appendBody($object_link);
     $this->appendBody("\n\n");
     $this->appendBody(ilMail::_getAutoGeneratedMessageString($this->getLanguage()));
     $this->appendBody(ilMail::_getInstallationSignature());
     // #10044
     $mail = new ilMail($ilUser->getId());
     $mail->enableSOAP(false);
     // #10410
     $mail->sendMail(ilObjUser::_lookupLogin($a_user_id), null, null, $this->getSubject(), $this->getBody(), null, array("system"));
 }
 /**
  * Send notifications
  * @return 
  */
 public function send()
 {
     global $ilSetting;
     if ((int) $this->getRefId() && in_array($this->getType(), array(self::TYPE_ADMISSION_MEMBER))) {
         $obj = ilObjectFactory::getInstanceByRefId((int) $this->getRefId());
         if ($obj->getAutoNotification() == false) {
             return false;
         }
     }
     // #11359
     // parent::send();
     switch ($this->getType()) {
         case self::TYPE_ADMISSION_MEMBER:
             // automatic mails about status change disabled
             if (!$ilSetting->get('mail_crs_member_notification', true)) {
                 return;
             }
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_added_member'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_added_member_body'), $this->getObjectTitle()));
                 $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->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_ACCEPTED_SUBSCRIPTION_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_accept_subscriber'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_accept_subscriber_body'), $this->getObjectTitle()));
                 $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->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_REFUSED_SUBSCRIPTION_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_reject_subscriber'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_reject_subscriber_body'), $this->getObjectTitle()));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_STATUS_CHANGED:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_status_changed'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_status_changed_body'), $this->getObjectTitle()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->createCourseStatus($rcp));
                 $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->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_DISMISS_MEMBER:
             // automatic mails about status change disabled
             if (!$ilSetting->get('mail_crs_member_notification', true)) {
                 return;
             }
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_dismiss_member'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_dismiss_member_body'), $this->getObjectTitle()));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_BLOCKED_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_blocked_member'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_blocked_member_body'), $this->getObjectTitle()));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_UNBLOCKED_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_unblocked_member'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_unblocked_member_body'), $this->getObjectTitle()));
                 $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->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_NOTIFICATION_REGISTRATION:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_new_subscription'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $info = $this->getAdditionalInformation();
                 $this->appendBody(sprintf($this->getLanguageText('crs_new_subscription_body'), $this->userToString($info['usr_id']), $this->getObjectTitle()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('crs_mail_permanent_link'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->createPermanentLink(array(), '_mem'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_NOTIFICATION_REGISTRATION_REQUEST:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_new_subscription_request'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $info = $this->getAdditionalInformation();
                 $this->appendBody(sprintf($this->getLanguageText('crs_new_subscription_request_body'), $this->userToString($info['usr_id']), $this->getObjectTitle()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('crs_new_subscription_request_body2'));
                 $this->appendBody("\n");
                 $this->appendBody($this->createPermanentLink(array(), '_mem'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_NOTIFICATION_UNSUBSCRIBE:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_cancel_subscription'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $info = $this->getAdditionalInformation();
                 $this->appendBody(sprintf($this->getLanguageText('crs_cancel_subscription_body'), $this->userToString($info['usr_id']), $this->getObjectTitle()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('crs_cancel_subscription_body2'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->createPermanentLink(array(), '_mem'));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('crs_notification_explanation_admin'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_UNSUBSCRIBE_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_unsubscribe_member'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_unsubscribe_member_body'), $this->getObjectTitle()));
                 $this->appendBody("\n\n");
                 $this->appendBody($this->getLanguageText('crs_unsubscribe_member_explanation'));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_SUBSCRIBE_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_subscribe_member'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_subscribe_member_body'), $this->getObjectTitle()));
                 $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->sendMail(array($rcp), array('system'));
             }
             break;
         case self::TYPE_WAITING_LIST_MEMBER:
             foreach ($this->getRecipients() as $rcp) {
                 $this->initLanguage($rcp);
                 $this->initMail();
                 $this->setSubject(sprintf($this->getLanguageText('crs_subscribe_wl'), $this->getObjectTitle(true)));
                 $this->setBody(ilMail::getSalutation($rcp, $this->getLanguage()));
                 $info = $this->getAdditionalInformation();
                 $this->appendBody("\n\n");
                 $this->appendBody(sprintf($this->getLanguageText('crs_subscribe_wl_body'), $this->getObjectTitle(), $info['position']));
                 $this->getMail()->appendInstallationSignature(true);
                 $this->sendMail(array($rcp), array('system'));
             }
             break;
     }
     return true;
 }
Пример #18
0
 /**
  * @param      $post_data
  * @param int  $cron
  * @param array $attachments 
  * @param int 	$user_id 	user_id of mail-recipient
  * @return string
  */
 public function formatNotification($post_data, $cron = 0, $attachments = array(), $user_id)
 {
     global $ilIliasIniFile;
     $user_lang = self::_getLanguageInstanceByUsrId($user_id);
     $message = "";
     $message .= ilMail::getSalutation($user_id, $user_lang);
     $message .= "\n\n";
     $message .= $this->lng->txt("forums_notification_subject") . " " . $post_data['top_name'] . "\n\n";
     $message .= $this->lng->txt("forum") . ": " . $post_data["top_name"] . "\n\n";
     $message .= $this->lng->txt("thread") . ": " . $post_data["thr_subject"] . "\n\n";
     $message .= $this->lng->txt("new_post") . ":\n------------------------------------------------------------\n";
     $message .= $this->lng->txt("author") . ": " . $post_data["pos_usr_name"] . "\n";
     $message .= $this->lng->txt("date") . ": " . $post_data["pos_date"] . "\n";
     $message .= $this->lng->txt("subject") . ": " . $post_data["pos_subject"] . "\n\n";
     if ($post_data["pos_cens"] == 1) {
         $message .= $post_data["pos_cens_com"] . "\n";
     } else {
         $pos_message = $post_data['pos_message'];
         if (strip_tags($pos_message) != $pos_message) {
             $pos_message = preg_replace("/\n/i", "", $pos_message);
             $pos_message = preg_replace("/<br(\\s*)(\\/?)>/i", "\n", $pos_message);
             $pos_message = preg_replace("/<p([^>]*)>/i", "\n\n", $pos_message);
             $pos_message = preg_replace("/<\\/p([^>]*)>/i", '', $pos_message);
         }
         $message .= strip_tags($pos_message) . "\n";
     }
     $message .= "------------------------------------------------------------\n";
     if (count($attachments) > 0) {
         foreach ($attachments as $attachment) {
             $message .= $this->lng->txt('attachment') . ": " . $attachment . "\n";
         }
         $message .= "\n------------------------------------------------------------\n";
     }
     if ($cron == 1) {
         $message .= sprintf($this->lng->txt("forums_notification_show_post"), $ilIliasIniFile->readVariable("server", "http_path") . "/goto.php?target=frm_" . $post_data["ref_id"] . "_" . $post_data["pos_thr_fk"] . "_" . $post_data["pos_pk"] . '&client_id=' . CLIENT_ID) . "\n\n";
     } else {
         $message .= sprintf($this->lng->txt("forums_notification_show_post"), ILIAS_HTTP_PATH . "/goto.php?target=frm_" . $post_data["ref_id"] . "_" . $post_data["pos_thr_fk"] . "_" . $post_data["pos_pk"] . '&client_id=' . CLIENT_ID) . "\n\n";
     }
     if ($cron == 1) {
         $message .= sprintf($this->lng->txt("forums_notification_intro"), $this->ilias->ini->readVariable("client", "name"), $ilIliasIniFile->readVariable("server", "http_path") . '/?client_id=' . CLIENT_ID) . "\n\n";
     } else {
         $message .= sprintf($this->lng->txt("forums_notification_intro"), $this->ilias->ini->readVariable("client", "name"), ILIAS_HTTP_PATH . '/?client_id=' . CLIENT_ID) . "\n\n";
     }
     return $message;
 }