本文整理汇总了PHP中forum_change_discussionid函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_change_discussionid函数的具体用法?PHP forum_change_discussionid怎么用?PHP forum_change_discussionid使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_change_discussionid函数的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: stdClass
$newdiscussion->forum = $discussion->forum;
$newdiscussion->name = $name;
$newdiscussion->firstpost = $post->id;
$newdiscussion->userid = $discussion->userid;
$newdiscussion->groupid = $discussion->groupid;
$newdiscussion->assessed = $discussion->assessed;
$newdiscussion->usermodified = $post->userid;
$newdiscussion->timestart = $discussion->timestart;
$newdiscussion->timeend = $discussion->timeend;
$newid = $DB->insert_record('forum_discussions', $newdiscussion);
$newpost = new stdClass();
$newpost->id = $post->id;
$newpost->parent = 0;
$newpost->subject = $name;
$DB->update_record("forum_posts", $newpost);
forum_change_discussionid($post->id, $newid);
// update last post in each discussion
forum_discussion_update_last_post($discussion->id);
forum_discussion_update_last_post($newid);
add_to_log($discussion->course, "forum", "prune post", "discuss.php?d={$newid}", "{$post->id}", $cm->id);
redirect(forum_go_back_to("discuss.php?d={$newid}"));
} else {
// User just asked to prune something
$course = $DB->get_record('course', array('id' => $forum->course));
$PAGE->set_cm($cm);
$PAGE->set_context($modcontext);
$PAGE->navbar->add(format_string($post->subject, true), new moodle_url('/mod/forum/discuss.php', array('d' => $discussion->id)));
$PAGE->navbar->add(get_string("prune", "forum"));
$PAGE->set_title(format_string($discussion->name) . ": " . format_string($post->subject));
$PAGE->set_heading($course->fullname);
echo $OUTPUT->header();
示例2: forum_change_discussionid
/**
* recursively sets the discussion field to $discussionid on $postid and all its children
* used when pruning a post
*
* @global object
* @param int $postid
* @param int $discussionid
* @return bool
*/
function forum_change_discussionid($postid, $discussionid) {
global $DB;
$DB->set_field('forum_posts', 'discussion', $discussionid, array('id' => $postid));
if ($posts = $DB->get_records('forum_posts', array('parent' => $postid))) {
foreach ($posts as $post) {
forum_change_discussionid($post->id, $discussionid);
}
}
return true;
}
示例3: forum_change_discussionid
/**
* recursively sets the discussion field to $discussionid on $postid and all its children
* used when pruning a post
*/
function forum_change_discussionid($postid, $discussionid)
{
set_field('forum_posts', 'discussion', $discussionid, 'id', $postid);
if ($posts = get_records('forum_posts', 'parent', $postid)) {
foreach ($posts as $post) {
forum_change_discussionid($post->id, $discussionid);
}
}
return true;
}