本文整理汇总了PHP中ilMail::sendMail方法的典型用法代码示例。如果您正苦于以下问题:PHP ilMail::sendMail方法的具体用法?PHP ilMail::sendMail怎么用?PHP ilMail::sendMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilMail
的用法示例。
在下文中一共展示了ilMail::sendMail方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: notify
public function notify(ilNotificationObject $notification)
{
// use a specific sender or ANONYMOUS
$sender_id = isset($notification->handlerParams['mail']['sender']) ? $notification->handlerParams['mail']['sender'] : ANONYMOUS_USER_ID;
include_once 'Services/Mail/classes/class.ilMail.php';
$mail = new ilMail($sender_id);
$mail->appendInstallationSignature(true);
$mail->sendMail($notification->user->getLogin(), '', '', $notification->title, $notification->longDescription, false, array('normal'));
//mail($notification->user->getEmail(), $notification->title, $notification->longDescription);
}
示例2: _sendNotificationToVATAdministration
/**
* Sends a notification message to all users responsible for vat assignment.
*
* @access public
* @static
* @param ilPaymentObject $oPaymentObject
*/
public static function _sendNotificationToVATAdministration($oPaymentObject)
{
global $ilSetting, $lng, $ilClientIniFile;
$payment_vat_admins = $ilSetting->get('payment_vat_admins');
$users = explode(',', $payment_vat_admins);
$subject = $lng->txt('payment_vat_assignment_notification_subject');
$tmp_obj = ilObjectFactory::getInstanceByRefId($oPaymentObject->getRefId());
$message = sprintf($lng->txt('payment_vat_assignment_notification_body'), $tmp_obj->getTitle()) . "\n\n";
$message .= "------------------------------------------------------------\n";
$message .= sprintf($lng->txt('payment_vat_assignment_notification_intro'), $ilClientIniFile->readVariable('client', 'name'), ILIAS_HTTP_PATH . '/?client_id=' . CLIENT_ID);
include_once 'Services/Mail/classes/class.ilMail.php';
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
foreach ((array) $users as $login) {
if (strlen(trim($login)) && (int) ilObjUser::_lookupId(trim($login))) {
$success = $mail_obj->sendMail(trim($login), '', '', $subject, $message, array(), array("system"));
}
}
}
示例3: sendNewContentNotification
/**
* send notifications about new EContent
*
* @return bool
*/
protected function sendNewContentNotification(ilECSSetting $a_server, $a_econtent_id)
{
global $ilLog;
if (!count($rcps = $a_server->getApprovalRecipients())) {
return true;
}
include_once './Services/Mail/classes/class.ilMail.php';
include_once './Services/Language/classes/class.ilLanguageFactory.php';
$lang = ilLanguageFactory::_getLanguage();
$lang->loadLanguageModule('ecs');
// @TODO: read mail
$mail = new ilMail(self::MAIL_SENDER);
$message = $lang->txt('ecs_export_created_body_a') . "\n\n";
$message .= $lang->txt('title') . ': ' . $this->content_obj->getTitle() . "\n";
if (strlen($desc = $this->content_obj->getDescription())) {
$message .= $lang->txt('desc') . ': ' . $desc . "\n";
}
// Participant info
$message .= "\n" . $lang->txt('ecs_published_for');
try {
$found = false;
$receivers = null;
include_once './Services/WebServices/ECS/classes/class.ilECSEContentDetails.php';
$details = ilECSEContentDetails::getInstance($a_server->getServerId(), $a_econtent_id, $this->getECSObjectType());
if ($details instanceof ilECSEContentDetails) {
$receivers = $details->getReceivers();
}
if ($receivers) {
foreach ($receivers as $member) {
$found = true;
include_once './Services/WebServices/ECS/classes/class.ilECSCommunityReader.php';
$part = ilECSCommunityReader::getInstanceByServerId($a_server->getServerId())->getParticipantByMID($member);
$message .= "\n\n" . $part->getParticipantName() . "\n";
$message .= $part->getDescription();
}
}
if ($found) {
$message .= "\n\n";
} else {
$message .= ' ' . $lang->txt('ecs_not_published') . "\n\n";
}
} catch (ilECSConnectorException $e) {
$ilLog->write(__METHOD__ . ': Cannot read approvements.');
return false;
}
include_once './Services/Link/classes/class.ilLink.php';
$href = ilLink::_getStaticLink($this->content_obj->getRefId(), 'crs', true);
$message .= $lang->txt("perma_link") . ': ' . $href . "\n\n";
$message .= ilMail::_getAutoGeneratedMessageString();
$mail->sendMail($a_server->getApprovalRecipientsAsString(), '', '', $lang->txt('ecs_new_approval_subject'), $message, array(), array('normal'));
return true;
}
示例4: confirmRegistration
public function confirmRegistration()
{
global $lng, $ilias, $ilLog;
ilUtil::setCookie('iltest', 'cookie', false);
if (!isset($_GET['rh']) || !strlen(trim($_GET['rh']))) {
ilUtil::redirect('./login.php?cmd=force_login®_confirmation_msg=reg_confirmation_hash_not_passed');
}
try {
require_once 'Services/Registration/classes/class.ilRegistrationSettings.php';
$oRegSettings = new ilRegistrationSettings();
$usr_id = ilObjUser::_verifyRegistrationHash(trim($_GET['rh']));
$oUser = ilObjectFactory::getInstanceByObjId($usr_id);
$oUser->setActive(true);
if ($oRegSettings->passwordGenerationEnabled()) {
$passwd = ilUtil::generatePasswords(1);
$password = $passwd[0];
$oUser->setPasswd($password, IL_PASSWD_PLAIN);
$oUser->setLastPasswordChangeTS(time());
}
$oUser->update();
$usr_lang = $oUser->getPref('language');
if ($lng->getLangKey() != $usr_lang) {
$lng = new ilLanguage($usr_lang);
}
// send email
// try individual account mail in user administration
include_once "Services/Mail/classes/class.ilAccountMail.php";
include_once './Services/User/classes/class.ilObjUserFolder.php';
$amail = ilObjUserFolder::_lookupNewAccountMail($usr_lang);
if (trim($amail["body"]) != "" && trim($amail["subject"]) != "") {
$acc_mail = new ilAccountMail();
$acc_mail->setUser($oUser);
if ($oRegSettings->passwordGenerationEnabled()) {
$acc_mail->setUserPassword($password);
}
$acc_mail->send();
} else {
include_once 'Services/Mail/classes/class.ilMail.php';
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
// mail subject
$subject = $lng->txt("reg_mail_subject");
// mail body
$body = $lng->txt("reg_mail_body_salutation") . " " . $oUser->getFullname() . ",\n\n" . $lng->txt("reg_mail_body_text1") . "\n\n" . $lng->txt("reg_mail_body_text2") . "\n" . ILIAS_HTTP_PATH . "/login.php?client_id=" . CLIENT_ID . "\n";
$body .= $lng->txt("login") . ": " . $oUser->getLogin() . "\n";
if ($oRegSettings->passwordGenerationEnabled()) {
$body .= $lng->txt("passwd") . ": " . $password . "\n";
}
$body .= "\n";
$body .= $lng->txt('reg_mail_body_forgot_password_info') . "\n";
$body .= "\n";
$body .= $lng->txt("reg_mail_body_text3") . "\n\r";
$body .= $oUser->getProfileAsString($lng);
$mail_obj->enableSoap(false);
$mail_obj->appendInstallationSignature(true);
$mail_obj->sendMail($oUser->getEmail(), '', '', $subject, $body, array(), array('normal'));
}
ilUtil::redirect('./login.php?cmd=force_login®_confirmation_msg=reg_account_confirmation_successful&lang=' . $usr_lang);
} catch (ilRegConfirmationLinkExpiredException $exception) {
include_once 'Services/WebServices/SOAP/classes/class.ilSoapClient.php';
$soap_client = new ilSoapClient();
$soap_client->setResponseTimeout(1);
$soap_client->enableWSDL(true);
$soap_client->init();
$ilLog->write(__METHOD__ . ': Triggered soap call (background process) for deletion of inactive user objects with expired confirmation hash values (dual opt in) ...');
$soap_client->call('deleteExpiredDualOptInUserObjects', array($_COOKIE['PHPSESSID'] . '::' . $_COOKIE['ilClientId'], $exception->getCode()));
ilUtil::redirect('./login.php?cmd=force_login®_confirmation_msg=' . $exception->getMessage() . "&lang=" . $usr_lang);
} catch (ilRegistrationHashNotFoundException $exception) {
ilUtil::redirect('./login.php?cmd=force_login®_confirmation_msg=' . $exception->getMessage() . "&lang=" . $usr_lang);
}
}
示例5: sendPostActivationNotification
function sendPostActivationNotification($post_data)
{
global $ilDB, $ilUser, $lng;
if (is_array($moderators = $this->getModerators())) {
// GET THREAD DATA
$result = $ilDB->queryf('
SELECT thr_subject FROM frm_threads
WHERE thr_pk = %s', array('integer'), array($post_data['pos_thr_fk']));
while ($record = $ilDB->fetchAssoc($result)) {
$post_data['thr_subject'] = $record['thr_subject'];
break;
}
// GET AUTHOR OF NEW POST
if ($post_data['pos_usr_id']) {
$post_data['pos_usr_name'] = ilObjUser::_lookupLogin($post_data['pos_usr_id']);
} else {
if (strlen($post_data['pos_usr_alias'])) {
$post_data['pos_usr_name'] = $post_data['pos_usr_alias'] . ' (' . $lng->txt('frm_pseudonym') . ')';
}
}
if ($post_data['pos_usr_name'] == '') {
$post_data['pos_usr_name'] = $this->lng->txt('forums_anonymous');
}
// save language of the current user
global $lng;
$userLanguage = $lng;
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
foreach ($moderators as $moderator) {
// set forum language instance for earch user
$this->setLanguage(self::_getLanguageInstanceByUsrId($moderator));
$subject = $this->formatNotificationSubject($post_data);
$message = $this->formatPostActivationNotification($post_data, $moderator);
$mail_obj->sendMail(ilObjUser::_lookupLogin($moderator), '', '', $subject, $message, array(), array("system"));
}
// reset language
$this->setLanguage($userLanguage);
}
}
示例6: sendMail
/**
* 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()));
//.........这里部分代码省略.........
示例7: sendNotification
//.........这里部分代码省略.........
$wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id);
$wiki = new ilObjWiki($a_wiki_ref_id, true);
$page = new ilWikiPage($a_page_id);
// #11138
$ignore_threshold = $a_action == "comment";
// 1st update will be converted to new - see below
if ($a_action == "new") {
return;
}
if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
$users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold);
$wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
$users = array_merge($users, $wiki_users);
if (!sizeof($users)) {
return;
}
ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI_PAGE, $a_page_id, $users);
} else {
$users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
if (!sizeof($users)) {
return;
}
}
ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_id);
// #15192 - should always be present
if ($a_page_id) {
include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
$link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle());
} else {
include_once "./Services/Link/classes/class.ilLink.php";
$link = ilLink::_getLink($a_wiki_ref_id);
}
include_once "./Services/Mail/classes/class.ilMail.php";
include_once "./Services/User/classes/class.ilObjUser.php";
include_once "./Services/Language/classes/class.ilLanguageFactory.php";
include_once "./Services/User/classes/class.ilUserUtil.php";
// see ilBlogPostingGUI::getSnippet()
// see ilBlogPosting::getNotificationAbstract()
include_once "Modules/Wiki/classes/class.ilWikiPageGUI.php";
$pgui = new ilWikiPageGUI($page->getId());
$pgui->setRawPageContent(true);
$pgui->setAbstractOnly(true);
$pgui->setFileDownloadLink(".");
$pgui->setFullscreenLink(".");
$pgui->setSourcecodeDownloadScript(".");
$snippet = $pgui->showPage();
$snippet = ilPageObject::truncateHTML($snippet, 500, "...");
// making things more readable
$snippet = str_replace('<br/>', "\n", $snippet);
$snippet = str_replace('<br />', "\n", $snippet);
$snippet = str_replace('</p>', "\n", $snippet);
$snippet = str_replace('</div>', "\n", $snippet);
$snippet = trim(strip_tags($snippet));
// "fake" new (to enable snippet - if any)
$current_version = array_shift($page->getHistoryEntries());
$current_version = $current_version["nr"];
if (!$current_version) {
$a_type = ilNotification::TYPE_WIKI;
$a_action = "new";
}
foreach (array_unique($users) as $idx => $user_id) {
if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id)) {
// use language of recipient to compose message
$ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
$ulng->loadLanguageModule('wiki');
$subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle(), $page->getTitle());
$message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
// update/delete
$message .= $ulng->txt('wiki_change_notification_page_body_' . $a_action) . ":\n\n";
$message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
$message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
$message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n";
if ($snippet) {
$message .= "\n" . $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n";
}
// include comment/note text
if ($a_comment) {
$message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n";
}
$message .= "\n" . $ulng->txt('wiki_change_notification_page_link') . ": " . $link;
} else {
// new
$message .= $ulng->txt('wiki_change_notification_body_' . $a_action) . ":\n\n";
$message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
$message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
$message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
if ($snippet) {
$message .= $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n\n";
}
$message .= $ulng->txt('wiki_change_notification_link') . ": " . $link;
}
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
$mail_obj->appendInstallationSignature(true);
$mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
} else {
unset($users[$idx]);
}
}
}
示例8: sentReminder
protected function sentReminder(array $a_recipient_ids)
{
include_once "./Services/Mail/classes/class.ilMail.php";
include_once "./Services/User/classes/class.ilObjUser.php";
include_once "./Services/Language/classes/class.ilLanguageFactory.php";
include_once "./Services/User/classes/class.ilUserUtil.php";
include_once "./Services/Link/classes/class.ilLink.php";
$link = ilLink::_getStaticLink($this->getRefId(), "svy");
foreach ($a_recipient_ids as $user_id) {
// use language of recipient to compose message
$ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
$ulng->loadLanguageModule('survey');
$subject = sprintf($ulng->txt('survey_reminder_subject'), $this->getTitle());
$message = sprintf($ulng->txt('survey_reminder_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
$message .= $ulng->txt('survey_reminder_body') . ":\n\n";
$message .= $ulng->txt('obj_svy') . ": " . $this->getTitle() . "\n";
$message .= "\n" . $ulng->txt('survey_reminder_link') . ": " . $link;
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
$mail_obj->appendInstallationSignature(true);
$mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
}
}
示例9: sendNotification
/**
* 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/Mail/classes/class.ilMail.php";
include_once "./Services/User/classes/class.ilObjUser.php";
include_once "./Services/Language/classes/class.ilLanguageFactory.php";
include_once "./Services/User/classes/class.ilUserUtil.php";
include_once "./Services/Link/classes/class.ilLink.php";
$link = ilLink::_getStaticLink($a_exc_ref_id);
// use language of recipient to compose message
$ulng = ilLanguageFactory::_getLanguageOfUser($a_user_id);
$ulng->loadLanguageModule('exc');
$subject = sprintf($ulng->txt('exc_team_notification_subject_' . $a_action), $this->getTitle());
$message = sprintf($ulng->txt('exc_team_notification_salutation'), ilObjUser::_lookupFullname($a_user_id)) . "\n\n";
$message .= $ulng->txt('exc_team_notification_body_' . $a_action) . "\n\n";
$message .= $ulng->txt('obj_exc') . ": " . ilObject::_lookupTitle($this->getExerciseId()) . "\n";
$message .= $ulng->txt('exc_assignment') . ": " . $this->getTitle() . "\n";
$message .= $ulng->txt('exc_team_notification_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
$message .= $ulng->txt('exc_team_notification_link') . ": " . $link;
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
$mail_obj->appendInstallationSignature(true);
$ret = $mail_obj->sendMail(ilObjUser::_lookupLogin($a_user_id), "", "", $subject, $message, array(), array("system"));
// var_dump($ret);
}
示例10: sendMail
/**
* 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"));
}
示例11: sendCodes
function sendCodes($not_sent, $subject, $message, $lang = "en")
{
/*
* 0 = all
* 1 = not sent
* 2 = finished
* 3 = not finished
*/
$check_finished = $not_sent > 1;
include_once "./Services/Mail/classes/class.ilMail.php";
$user_id = $this->getOwner();
$mail = new ilMail($user_id);
$recipients = $this->getExternalCodeRecipients($check_finished);
foreach ($recipients as $data) {
if ($data['email'] && $data['code']) {
$do_send = false;
switch ((int) $not_sent) {
case 1:
$do_send = !(bool) $data['sent'];
break;
case 2:
$do_send = $data['finished'];
break;
case 3:
$do_send = !$data['finished'];
break;
default:
$do_send = true;
break;
}
if ($do_send) {
// build text
$messagetext = $message;
$url = ILIAS_HTTP_PATH . "/goto.php?cmd=infoScreen&target=svy_" . $this->getRefId() . "&client_id=" . CLIENT_ID . "&accesscode=" . $data["code"] . "&lang=" . $lang;
$messagetext = str_replace('[url]', "<" . $url . ">", $messagetext);
foreach ($data as $key => $value) {
$messagetext = str_replace('[' . $key . ']', $value, $messagetext);
}
// send mail
$mail->sendMail($data['email'], "", "", $subject, $messagetext, array(), array('normal'));
}
}
}
global $ilDB;
$ilDB->manipulateF("UPDATE svy_anonymous SET sent = %s WHERE survey_fi = %s AND externaldata IS NOT NULL", array('integer', 'integer'), array(1, $this->getSurveyId()));
}
示例12: send
/**
* Sends the mail with its object properties as MimeMail
* It first tries to read the mail body, subject and sender address from posted named formular fields.
* If no field values found the defaults are used.
* Placehoders will be replaced by the appropriate data.
* @access public
* @param object ilUser
*/
function send()
{
global $ilSetting;
// determine language and get account mail data
// fall back to default language if acccount mail data is not given for user language.
$amail = $this->readMailTemplate($this->data['language']);
if ($amail['body'] == '' || $amail['subject'] == '') {
$amail = $this->readMailTemplate($ilSetting->get('language'));
$lang = $ilSetting->get('language');
} else {
$lang = $this->data['language'];
}
// fallback if mail data is still not given
if ($this->areLangVariablesUsedAsFallback() && ($amail['body'] == '' || $amail['subject'] == '')) {
$lang = $this->data['language'];
$tmp_lang = $this->getLng($lang);
// mail subject
$mail_subject = $tmp_lang->txt('disk_quota_mail_subject');
// mail body
$mail_body = $tmp_lang->txt('disk_quota_mail_body_salutation') . ' ' . $data['firstname'] . ' ' . $data['lastname'] . ",\n\n" . $tmp_lang->txt('disk_quota_body_text1') . "\n\n" . $tmp_lang->txt('disk_quota_body_text2') . "\n" . ILIAS_HTTP_PATH . '/login.php?client_id=' . CLIENT_ID . "\n";
$mail_body .= $tmp_lang->txt('login') . ': ' . $data['firstname'] . "\n";
$mail_body .= "\n";
$mail_body .= $tmp_lang->txt('disk_quota_mail_body_text3') . "\n\r";
//$mail_body .= $user->getProfileAsString($tmp_lang);
} else {
// replace placeholders
$mail_subject = $this->replacePlaceholders($amail['subject'], $amail, $lang);
$mail_body = $this->replacePlaceholders($amail['body'], $amail, $lang);
}
// send the mail
include_once 'Services/Mail/classes/class.ilMimeMail.php';
$mmail = new ilMimeMail();
$mmail->autoCheck(false);
$mmail->From($ilSetting->get('admin_email'));
$mmail->Subject($mail_subject);
$mmail->To($this->data['email']);
$mmail->Body($mail_body);
$mmail->Send();
include_once 'Services/Mail/classes/class.ilMail.php';
$mail = new ilMail($_SESSION["AccountId"]);
$mail->sendMail($this->data['login'], "", "", $mail_subject, $mail_body, array(), array("normal"));
return true;
}
示例13: refuseApplicantsObject
/**
* adds applicant to group as member
* @access public
*/
function refuseApplicantsObject()
{
$user_ids = $_POST["user_id"];
if (empty($user_ids[0])) {
$this->ilErr->raiseError($this->lng->txt("no_checkbox"), $this->ilErr->MESSAGE);
}
include_once 'Services/Mail/classes/class.ilMail.php';
$mail = new ilMail($_SESSION["AccountId"]);
foreach ($user_ids as $new_member) {
$user =& $this->ilias->obj_factory->getInstanceByObjId($new_member);
$this->object->deleteApplicationListEntry($new_member);
$mail->sendMail($user->getLogin(), "", "", "Membership application refused: Group " . $this->object->getTitle(), "Your application has been refused.", array(), array('system'));
}
ilUtil::sendSuccess($this->lng->txt("grp_msg_applicants_removed"), true);
$this->ctrl->redirect($this, 'members');
}
示例14: sendNotification
static function sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment = null)
{
global $ilUser, $ilObjDataCache, $ilAccess;
include_once "./Services/Notification/classes/class.ilNotification.php";
include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
$wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id);
$wiki = new ilObjWiki($a_wiki_ref_id, true);
$page = new ilWikiPage($a_page_id);
// #11138
$ignore_threshold = $a_action == "comment";
if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
$users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold);
$wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
$users = array_merge($users, $wiki_users);
if (!sizeof($users)) {
return;
}
include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
$link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle());
ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI_PAGE, $a_page_id, $users);
} else {
$users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
if (!sizeof($users)) {
return;
}
include_once "./Services/Link/classes/class.ilLink.php";
$link = ilLink::_getLink($a_wiki_ref_id);
}
ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_id);
include_once "./Services/Mail/classes/class.ilMail.php";
include_once "./Services/User/classes/class.ilObjUser.php";
include_once "./Services/Language/classes/class.ilLanguageFactory.php";
include_once "./Services/User/classes/class.ilUserUtil.php";
foreach (array_unique($users) as $idx => $user_id) {
if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id)) {
// use language of recipient to compose message
$ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
$ulng->loadLanguageModule('wiki');
$subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle());
$message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
// update/delete
$message .= $ulng->txt('wiki_change_notification_page_body_' . $a_action) . ":\n\n";
$message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
$message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
$message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n";
// include comment/note text
if ($a_comment) {
$message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n";
}
$message .= "\n" . $ulng->txt('wiki_change_notification_page_link') . ": " . $link;
} else {
// new
$message .= $ulng->txt('wiki_change_notification_body_' . $a_action) . ":\n\n";
$message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
$message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
$message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
$message .= $ulng->txt('wiki_change_notification_link') . ": " . $link;
}
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
$mail_obj->appendInstallationSignature(true);
$mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
} else {
unset($users[$idx]);
}
}
}
示例15: sendNewContentNotification
/**
* send notifications about new EContent
*/
protected function sendNewContentNotification($a_server_id)
{
include_once 'Services/WebServices/ECS/classes/class.ilECSSetting.php';
$settings = ilECSSetting::getInstanceByServerId($a_server_id);
if (!count($rcps = $settings->getEContentRecipients())) {
return;
}
include_once './Services/Mail/classes/class.ilMail.php';
include_once './Services/Language/classes/class.ilLanguageFactory.php';
$lang = ilLanguageFactory::_getLanguage();
$lang->loadLanguageModule('ecs');
$mail = new ilMail(self::MAIL_SENDER);
$message = $lang->txt('ecs_' . $this->getType() . '_created_body_a') . "\n\n";
$message .= $lang->txt('title') . ': ' . $this->getTitle() . "\n";
if (strlen($desc = $this->getDescription())) {
$message .= $lang->txt('desc') . ': ' . $desc . "\n";
}
include_once './Services/Link/classes/class.ilLink.php';
$href = ilLink::_getStaticLink($this->getRefId(), $this->getType(), true);
$message .= $lang->txt("perma_link") . ': ' . $href . "\n\n";
$message .= ilMail::_getAutoGeneratedMessageString();
$mail->sendMail($settings->getEContentRecipientsAsString(), '', '', $lang->txt('ecs_new_econtent_subject'), $message, array(), array('normal'));
}