當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mod_forum_post_form::is_cancelled方法代碼示例

本文整理匯總了PHP中mod_forum_post_form::is_cancelled方法的典型用法代碼示例。如果您正苦於以下問題:PHP mod_forum_post_form::is_cancelled方法的具體用法?PHP mod_forum_post_form::is_cancelled怎麽用?PHP mod_forum_post_form::is_cancelled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在mod_forum_post_form的用法示例。


在下文中一共展示了mod_forum_post_form::is_cancelled方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

        if (isset($discussion) && \mod_forum\subscriptions::is_subscribed($USER->id, $forum, $discussion->id, $cm)) {
            // User is subscribed to the discussion - continue the subscription.
            $discussionsubscribe = true;
        } else {
            if (!isset($discussion) && \mod_forum\subscriptions::is_subscribed($USER->id, $forum, null, $cm)) {
                // Starting a new discussion, and the user is subscribed to the forum - subscribe to the discussion.
                $discussionsubscribe = true;
            } else {
                // User is not subscribed to either forum or discussion. Follow user preference.
                $discussionsubscribe = $USER->autosubscribe;
            }
        }
    }
}
$mform_post->set_data(array('attachments' => $draftitemid, 'general' => $heading, 'subject' => $post->subject, 'message' => array('text' => $currenttext, 'format' => empty($post->messageformat) ? editors_get_preferred_format() : $post->messageformat, 'itemid' => $draftid_editor), 'discussionsubscribe' => $discussionsubscribe, 'mailnow' => !empty($post->mailnow), 'userid' => $post->userid, 'parent' => $post->parent, 'discussion' => $post->discussion, 'course' => $course->id) + $page_params + (isset($post->format) ? array('format' => $post->format) : array()) + (isset($discussion->timestart) ? array('timestart' => $discussion->timestart) : array()) + (isset($discussion->timeend) ? array('timeend' => $discussion->timeend) : array()) + (isset($post->groupid) ? array('groupid' => $post->groupid) : array()) + (isset($discussion->id) ? array('discussion' => $discussion->id) : array()));
if ($mform_post->is_cancelled()) {
    if (!isset($discussion->id) || $forum->type === 'qanda') {
        // Q and A forums don't have a discussion page, so treat them like a new thread..
        redirect(new moodle_url('/mod/forum/view.php', array('f' => $forum->id)));
    } else {
        redirect(new moodle_url('/mod/forum/discuss.php', array('d' => $discussion->id)));
    }
} else {
    if ($fromform = $mform_post->get_data()) {
        if (empty($SESSION->fromurl)) {
            $errordestination = "{$CFG->wwwroot}/mod/forum/view.php?f={$forum->id}";
        } else {
            $errordestination = $SESSION->fromurl;
        }
        $fromform->itemid = $fromform->message['itemid'];
        $fromform->messageformat = $fromform->message['format'];
開發者ID:sriysk,項目名稱:moodle-integration,代碼行數:31,代碼來源:post.php


注:本文中的mod_forum_post_form::is_cancelled方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。