本文整理汇总了PHP中forum_tp_mark_post_read函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_tp_mark_post_read函数的具体用法?PHP forum_tp_mark_post_read怎么用?PHP forum_tp_mark_post_read使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_tp_mark_post_read函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:78,代码来源:lib.php
示例2: print_progress
$dcount++;
print_progress($dcount, $dtotal);
if ($discussion->course != $currcourse) {
/// Discussions are ordered by course, so we only need to get any course's users once.
$currcourse = $discussion->course;
$users = get_course_users($currcourse, '', '', 'u.id,u.confirmed');
}
/// If this course has users, and posts more than a day old, mark them for each user.
if ($users && ($posts = get_records_select('forum_posts', 'discussion = ' . $discussion->id . ' AND ' . $dateafter . ' < modified AND modified < ' . $onedayago, '', 'id,discussion,modified'))) {
foreach ($users as $user) {
/// If its a group discussion, make sure the user is in the group.
if ($discussion->groupid) {
if (!isset($groups[$discussion->groupid][$user->id])) {
$groups[$discussion->groupid][$user->id] = ismember($discussion->groupid, $user->id);
}
}
if (!$discussion->groupid || !empty($groups[$discussion->groupid][$user->id])) {
foreach ($posts as $post) {
print_progress($dcount, $dtotal);
forum_tp_mark_post_read($user->id, $post, $discussion->forum);
}
}
}
}
}
print_progress($dcount, $dtotal, 0);
}
delete_records('config', 'name', 'upgrade', 'value', 'forumread');
notify('Log upgrading was successful!', 'notifysuccess');
print_continue('index.php');
admin_externalpage_print_footer($adminroot);
开发者ID:veritech,项目名称:pare-project,代码行数:31,代码来源:upgradeforumread.php
示例3: forum_add_discussion
/**
* Given an object containing all the necessary data,
* create a new discussion and return the id
*/
function forum_add_discussion($discussion, &$message)
{
global $USER, $CFG;
$timenow = time();
// The first post is stored as a real post, and linked
// to from the discuss entry.
$forum = get_record('forum', 'id', $discussion->forum);
$post = new object();
$post->discussion = 0;
$post->parent = 0;
$post->userid = $USER->id;
$post->created = $timenow;
$post->modified = $timenow;
$post->mailed = 0;
$post->subject = $discussion->name;
$post->message = $discussion->intro;
$post->attachment = "";
$post->forum = $forum->id;
// speedup
$post->course = $forum->course;
// speedup
$post->format = $discussion->format;
$post->mailnow = $discussion->mailnow;
if (!($post->id = insert_record("forum_posts", $post))) {
return 0;
}
if ($post->attachment = forum_add_attachment($post, 'attachment', $message)) {
set_field("forum_posts", "attachment", $post->attachment, "id", $post->id);
//ignore errors
}
// 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 = $USER->id;
if (!($post->discussion = insert_record("forum_discussions", $discussion))) {
delete_records("forum_posts", "id", $post->id);
return 0;
}
// Finally, set the pointer on the post.
if (!set_field("forum_posts", "discussion", $post->discussion, "id", $post->id)) {
delete_records("forum_posts", "id", $post->id);
delete_records("forum_discussions", "id", $post->discussion);
return 0;
}
if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
forum_tp_mark_post_read($post->userid, $post, $post->forum);
}
return $post->discussion;
}
开发者ID:r007,项目名称:PMoodle,代码行数:55,代码来源:lib.php
示例4: forum_add_discussion
/**
* Given an object containing all the necessary data,
* create a new discussion and return the id
*/
function forum_add_discussion($discussion, $mform = null, &$message = null)
{
global $USER, $CFG, $DB;
$timenow = time();
// 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);
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$post = new object();
$post->discussion = 0;
$post->parent = 0;
$post->userid = $USER->id;
$post->created = $timenow;
$post->modified = $timenow;
$post->mailed = 0;
$post->subject = $discussion->name;
$post->message = $discussion->intro;
$post->messageformat = $discussion->messageformat;
$post->messagetrust = $discussion->messagetrust;
$post->attachments = $discussion->attachments;
$post->forum = $forum->id;
// speedup
$post->course = $forum->course;
// speedup
$post->mailnow = $discussion->mailnow;
if (!($post->id = $DB->insert_record("forum_posts", $post))) {
return 0;
}
$text = file_save_draft_area_files($discussion->itemid, $context->id, 'forum_post', $post->id, array('subdirs' => true), $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 = $USER->id;
if (!($post->discussion = $DB->insert_record("forum_discussions", $discussion))) {
$DB->delete_records("forum_posts", array("id" => $post->id));
return 0;
}
// Finally, set the pointer on the post.
if (!$DB->set_field("forum_posts", "discussion", $post->discussion, array("id" => $post->id))) {
$DB->delete_records("forum_posts", array("id" => $post->id));
$DB->delete_records("forum_discussions", array("id" => $post->discussion));
return 0;
}
if (!empty($cm->id)) {
forum_add_attachment($post, $forum, $cm, $mform, $message);
}
if (forum_tp_can_track_forums($forum) && forum_tp_is_tracked($forum)) {
forum_tp_mark_post_read($post->userid, $post, $post->forum);
}
return $post->discussion;
}
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:58,代码来源:lib.php
注:本文中的forum_tp_mark_post_read函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论