本文整理汇总了PHP中mod_forum_post_form::editor_options方法的典型用法代码示例。如果您正苦于以下问题:PHP mod_forum_post_form::editor_options方法的具体用法?PHP mod_forum_post_form::editor_options怎么用?PHP mod_forum_post_form::editor_options使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mod_forum_post_form
的用法示例。
在下文中一共展示了mod_forum_post_form::editor_options方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forum_add_discussion
/**
* Given an object containing all the necessary data,
* create a new discussion and return the id
*
* @param object $post
* @param mixed $mform
* @param string $unused
* @param int $userid
* @return object
*/
function forum_add_discussion($discussion, $mform=null, $unused=null, $userid=null) {
global $USER, $CFG, $DB;
$timenow = time();
if (is_null($userid)) {
$userid = $USER->id;
}
// The first post is stored as a real post, and linked
// to from the discuss entry.
$forum = $DB->get_record('forum', array('id'=>$discussion->forum));
$cm = get_coursemodule_from_instance('forum', $forum->id);
$post = new stdClass();
$post->discussion = 0;
$post->parent = 0;
$post->userid = $userid;
$post->created = $timenow;
$post->modified = $timenow;
$post->mailed = FORUM_MAILED_PENDING;
$post->subject = $discussion->name;
$post->message = $discussion->message;
$post->messageformat = $discussion->messageformat;
$post->messagetrust = $discussion->messagetrust;
$post->attachments = isset($discussion->attachments) ? $discussion->attachments : null;
$post->forum = $forum->id; // speedup
$post->course = $forum->course; // speedup
$post->mailnow = $discussion->mailnow;
$post->id = $DB->insert_record("forum_posts", $post);
// TODO: Fix the calling code so that there always is a $cm when this function is called
if (!empty($cm->id) && !empty($discussion->itemid)) { // In "single simple discussions" this may not exist yet
$context = context_module::instance($cm->id);
$text = file_save_draft_area_files($discussion->itemid, $context->id, 'mod_forum', 'post', $post->id,
mod_forum_post_form::editor_options(), $post->message);
$DB->set_field('forum_posts', 'message', $text, array('id'=>$post->id));
}
// Now do the main entry for the discussion, linking to this first post
$discussion->firstpost = $post->id;
$discussion->timemodified = $timenow;
$discussion->usermodified = $post->userid;
$discussion->userid = $userid;
$post->discussion = $DB->insert_record("forum_discussions", $discussion);
// Finally, set the pointer on the post.
$DB->set_field("forum_posts", "discussion", $post->discussion, array("id"=>$post->id));
if (!empty($cm->id)) {
forum_add_attachment($post, $forum, $cm, $mform, $unused);
}
if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
forum_tp_mark_post_read($post->userid, $post, $post->forum);
}
// Let Moodle know that assessable content is uploaded (eg for plagiarism detection)
if (!empty($cm->id)) {
forum_trigger_content_uploaded_event($post, $cm, 'forum_add_discussion');
}
return $post->discussion;
}
示例2: unset
unset($data);
}
$formheading = '';
if (!empty($parent)) {
$heading = get_string("yourreply", "forum");
$formheading = get_string('reply', 'forum');
} else {
if ($forum->type == 'qanda') {
$heading = get_string('yournewquestion', 'forum');
} else {
$heading = get_string('yournewtopic', 'forum');
}
}
$postid = empty($post->id) ? null : $post->id;
$draftid_editor = file_get_submitted_draft_itemid('message');
$currenttext = file_prepare_draft_area($draftid_editor, $modcontext->id, 'mod_forum', 'post', $postid, mod_forum_post_form::editor_options($modcontext, $postid), $post->message);
$manageactivities = has_capability('moodle/course:manageactivities', $coursecontext);
if (\mod_forum\subscriptions::subscription_disabled($forum) && !$manageactivities) {
// User does not have permission to subscribe to this discussion at all.
$discussionsubscribe = false;
} else {
if (\mod_forum\subscriptions::is_forcesubscribed($forum)) {
// User does not have permission to unsubscribe from this discussion at all.
$discussionsubscribe = true;
} else {
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.