/**
  * 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"));
 }