本文整理汇总了PHP中forum_make_mail_post函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_make_mail_post函数的具体用法?PHP forum_make_mail_post怎么用?PHP forum_make_mail_post使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_make_mail_post函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forum_make_mail_html
/**
* Builds and returns the body of the email notification in html format.
*
* @global object
* @param object $course
* @param object $cm
* @param object $forum
* @param object $discussion
* @param object $post
* @param object $userfrom
* @param object $userto
* @return string The email text in HTML format
*/
function forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfrom, $userto) {
global $CFG;
if ($userto->mailformat != 1) { // Needs to be HTML
return '';
}
if (!isset($userto->canpost[$discussion->id])) {
$canreply = forum_user_can_post($forum, $discussion, $userto, $cm, $course);
} else {
$canreply = $userto->canpost[$discussion->id];
}
$strforums = get_string('forums', 'forum');
$canunsubscribe = ! forum_is_forcesubscribed($forum);
$shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
$posthtml = '<head>';
/* foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$posthtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />'."\n";
}*/
$posthtml .= '</head>';
$posthtml .= "\n<body id=\"email\">\n\n";
$posthtml .= '<div class="navbar">'.
'<a target="_blank" href="'.$CFG->wwwroot.'/course/view.php?id='.$course->id.'">'.$shortname.'</a> » '.
'<a target="_blank" href="'.$CFG->wwwroot.'/mod/forum/index.php?id='.$course->id.'">'.$strforums.'</a> » '.
'<a target="_blank" href="'.$CFG->wwwroot.'/mod/forum/view.php?f='.$forum->id.'">'.format_string($forum->name,true).'</a>';
if ($discussion->name == $forum->name) {
$posthtml .= '</div>';
} else {
$posthtml .= ' » <a target="_blank" href="'.$CFG->wwwroot.'/mod/forum/discuss.php?d='.$discussion->id.'">'.
format_string($discussion->name,true).'</a></div>';
}
$posthtml .= forum_make_mail_post($course, $cm, $forum, $discussion, $post, $userfrom, $userto, false, $canreply, true, false);
if ($canunsubscribe) {
$posthtml .= '<hr /><div class="mdl-align unsubscribelink">
<a href="'.$CFG->wwwroot.'/mod/forum/subscribe.php?id='.$forum->id.'">'.get_string('unsubscribe', 'forum').'</a>
<a href="'.$CFG->wwwroot.'/mod/forum/unsubscribeall.php">'.get_string('unsubscribeall', 'forum').'</a></div>';
}
$posthtml .= '</body>';
return $posthtml;
}
示例2: forum_make_mail_html
/**
* Builds and returns the body of the email notification in html format.
*
* @global object
* @param object $course
* @param object $cm
* @param object $forum
* @param object $discussion
* @param object $post
* @param object $userfrom
* @param object $userto
* @param string $replyaddress The inbound address that a user can reply to the generated e-mail with. [Since 2.8].
* @return string The email text in HTML format
*/
function forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $replyaddress = null)
{
global $CFG;
if ($userto->mailformat != 1) {
// Needs to be HTML
return '';
}
if (!isset($userto->canpost[$discussion->id])) {
$canreply = forum_user_can_post($forum, $discussion, $userto, $cm, $course);
} else {
$canreply = $userto->canpost[$discussion->id];
}
$strforums = get_string('forums', 'forum');
$canunsubscribe = !\mod_forum\subscriptions::is_forcesubscribed($forum);
$shortname = format_string($course->shortname, true, array('context' => context_course::instance($course->id)));
$posthtml = '<head>';
/* foreach ($CFG->stylesheets as $stylesheet) {
//TODO: MDL-21120
$posthtml .= '<link rel="stylesheet" type="text/css" href="'.$stylesheet.'" />'."\n";
}*/
$posthtml .= '</head>';
$posthtml .= "\n<body id=\"email\">\n\n";
$posthtml .= '<div class="navbar">' . '<a target="_blank" href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . $shortname . '</a> » ' . '<a target="_blank" href="' . $CFG->wwwroot . '/mod/forum/index.php?id=' . $course->id . '">' . $strforums . '</a> » ' . '<a target="_blank" href="' . $CFG->wwwroot . '/mod/forum/view.php?f=' . $forum->id . '">' . format_string($forum->name, true) . '</a>';
if ($discussion->name == $forum->name) {
$posthtml .= '</div>';
} else {
$posthtml .= ' » <a target="_blank" href="' . $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $discussion->id . '">' . format_string($discussion->name, true) . '</a></div>';
}
$posthtml .= forum_make_mail_post($course, $cm, $forum, $discussion, $post, $userfrom, $userto, false, $canreply, true, false);
if ($replyaddress) {
$posthtml .= html_writer::tag('p', get_string('replytopostbyemail', 'mod_forum'));
}
$footerlinks = array();
if ($canunsubscribe) {
if (\mod_forum\subscriptions::is_subscribed($userto->id, $forum, null, $cm)) {
// If subscribed to this forum, offer the unsubscribe link.
$unsublink = new moodle_url('/mod/forum/subscribe.php', array('id' => $forum->id));
$footerlinks[] = html_writer::link($unsublink, get_string('unsubscribe', 'mod_forum'));
}
// Always offer the unsubscribe from discussion link.
$unsublink = new moodle_url('/mod/forum/subscribe.php', array('id' => $forum->id, 'd' => $discussion->id));
$footerlinks[] = html_writer::link($unsublink, get_string('unsubscribediscussion', 'mod_forum'));
$footerlinks[] = '<a href="' . $CFG->wwwroot . '/mod/forum/unsubscribeall.php">' . get_string('unsubscribeall', 'forum') . '</a>';
}
$footerlinks[] = "<a href='{$CFG->wwwroot}/mod/forum/index.php?id={$forum->course}'>" . get_string('digestmailpost', 'forum') . '</a>';
$posthtml .= '<hr /><div class="mdl-align unsubscribelink">' . implode(' ', $footerlinks) . '</div>';
$posthtml .= '</body>';
return $posthtml;
}
示例3: forum_make_mail_html
/**
* Builds and returns the body of the email notification in html format.
*
* @param object $course
* @param object $cm
* @param object $forum
* @param object $discussion
* @param object $post
* @param object $userfrom
* @param object $userto
* @param string $replyaddress The inbound address that a user can reply to the generated e-mail with. [Since 2.8].
* @return string The email text in HTML format
* @deprecated since Moodle 3.0 use \mod_forum\output\forum_post_email instead
*/
function forum_make_mail_html($course, $cm, $forum, $discussion, $post, $userfrom, $userto, $replyaddress = null)
{
return forum_make_mail_post($course, $cm, $forum, $discussion, $post, $userfrom, $userto, forum_user_can_post($forum, $discussion, $userto, $cm, $course));
}
示例4: forum_make_mail_html
/**
* Builds and returns the body of the email notification in html format.
*
* @param object $course
* @param object $forum
* @param object $discussion
* @param object $post
* @param object $userfrom
* @param object $userto
* @return string The email text in HTML format
*/
function forum_make_mail_html($course, $forum, $discussion, $post, $userfrom, $userto)
{
global $CFG;
if ($userto->mailformat != 1) {
// Needs to be HTML
return '';
}
$strforums = get_string('forums', 'forum');
$canreply = forum_user_can_post($forum, $userto);
$canunsubscribe = !$forum->forcesubscribe;
$posthtml = '<head>';
foreach ($CFG->stylesheets as $stylesheet) {
$posthtml .= '<link rel="stylesheet" type="text/css" href="' . $stylesheet . '" />' . "\n";
}
$posthtml .= '</head>';
$posthtml .= "\n<body id=\"email\">\n\n";
$posthtml .= '<div class="navbar">' . '<a target="_blank" href="' . $CFG->wwwroot . '/course/view.php?id=' . $course->id . '">' . $course->shortname . '</a> » ' . '<a target="_blank" href="' . $CFG->wwwroot . '/mod/forum/index.php?id=' . $course->id . '">' . $strforums . '</a> » ' . '<a target="_blank" href="' . $CFG->wwwroot . '/mod/forum/view.php?f=' . $forum->id . '">' . format_string($forum->name, true) . '</a>';
if ($discussion->name == $forum->name) {
$posthtml .= '</div>';
} else {
$posthtml .= ' » <a target="_blank" href="' . $CFG->wwwroot . '/mod/forum/discuss.php?d=' . $discussion->id . '">' . format_string($discussion->name, true) . '</a></div>';
}
$posthtml .= forum_make_mail_post($post, $userfrom, $userto, $course, false, $canreply, true, false);
if ($canunsubscribe) {
$posthtml .= '<br /><div class="unsubscribelink"><a href="' . $CFG->wwwroot . '/mod/forum/subscribe.php?id=' . $forum->id . '">' . get_string('unsubscribe', 'forum') . '</a></div>';
}
$posthtml .= '</body>';
return $posthtml;
}