本文整理汇总了PHP中ilMail::enableSOAP方法的典型用法代码示例。如果您正苦于以下问题:PHP ilMail::enableSOAP方法的具体用法?PHP ilMail::enableSOAP怎么用?PHP ilMail::enableSOAP使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ilMail
的用法示例。
在下文中一共展示了ilMail::enableSOAP方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sendMails
protected function sendMails($res)
{
global $ilAccess, $ilDB, $lng;
static $cache = array();
static $attachments_cache = array();
include_once 'Modules/Forum/classes/class.ilObjForum.php';
include_once 'Services/Mail/classes/class.ilMail.php';
include_once 'Services/User/classes/class.ilObjUser.php';
include_once 'Services/Language/classes/class.ilLanguage.php';
$forumObj = new ilObjForum();
$frm = $forumObj->Forum;
$numRows = 0;
$mail_obj = new ilMail(ANONYMOUS_USER_ID);
$mail_obj->enableSOAP(false);
while ($row = $ilDB->fetchAssoc($res)) {
// don not send a notification to the post author
if ($row['pos_display_user_id'] != $row['user_id']) {
// GET AUTHOR OF NEW POST
if ($row['pos_display_user_id']) {
$row['pos_usr_name'] = ilObjUser::_lookupLogin($row['pos_display_user_id']);
} else {
if (strlen($row['pos_usr_alias'])) {
$row['pos_usr_name'] = $row['pos_usr_alias'] . ' (' . $lng->txt('frm_pseudonym') . ')';
}
}
if ($row['pos_usr_name'] == '') {
$row['pos_usr_name'] = $lng->txt('forums_anonymous');
}
// get all references of obj_id
if (!isset($cache[$row['obj_id']])) {
$cache[$row['obj_id']] = ilObject::_getAllReferences($row['obj_id']);
}
// check for attachments
$has_attachments = false;
if (!isset($attachments_cache[$row['obj_id']][$row['pos_pk']])) {
$fileDataForum = new ilFileDataForum($row['obj_id'], $row['pos_pk']);
$filesOfPost = $fileDataForum->getFilesOfPost();
foreach ($filesOfPost as $attachment) {
$attachments_cache[$row['obj_id']][$row['pos_pk']][] = $attachment['name'];
$has_attachments = true;
}
} else {
$has_attachments = true;
}
// do rbac check before sending notification
$send_mail = false;
foreach ((array) $cache[$row['obj_id']] as $ref_id) {
if ($ilAccess->checkAccessOfUser($row['user_id'], 'read', '', $ref_id)) {
$row['ref_id'] = $ref_id;
$send_mail = true;
break;
}
}
$attached_files = array();
if ($has_attachments == true) {
$attached_files = $attachments_cache[$row['obj_id']][$row['pos_pk']];
}
if ($send_mail) {
$frm->setLanguage(ilForum::_getLanguageInstanceByUsrId($row['user_id']));
$mail_obj->sendMail(ilObjUser::_lookupLogin($row['user_id']), '', '', $frm->formatNotificationSubject($row), $frm->formatNotification($row, 1, $attached_files, $row['user_id']), array(), array('normal'));
$numRows++;
}
}
}
return $numRows;
}
示例2: sendMail
//.........这里部分代码省略.........
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"));
}
示例3: 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"));
}