本文整理汇总了PHP中forum::get_read_tracking_deadline方法的典型用法代码示例。如果您正苦于以下问题:PHP forum::get_read_tracking_deadline方法的具体用法?PHP forum::get_read_tracking_deadline怎么用?PHP forum::get_read_tracking_deadline使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类forum
的用法示例。
在下文中一共展示了forum::get_read_tracking_deadline方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: is_read_tracked
/**
* @return bool True if read tracking is enabled for this discussion
* (it is not too old, and read tracking is turned on globally)
*/
public function is_read_tracked()
{
$this->check_full();
return forum::enabled_read_tracking() && $this->discussionfields->timemodified >= forum::get_read_tracking_deadline();
}
示例2: split
/**
* Splits this post to become a new discussion
* @param $newsubject
* @param bool $log True to log action
* @return int ID of new discussion
*/
function split($newsubject, $log = true)
{
global $CFG;
$this->require_children();
// Begin a transaction
forum_utils::start_transaction();
$olddiscussion = $this->get_discussion();
// Create new discussion
$newest = null;
$this->find_newest_child($newest);
$newdiscussionid = $olddiscussion->clone_for_split($this->get_id(), $newest->get_id());
// Update all child posts
$list = array();
$this->list_child_ids($list);
unset($list[0]);
// Don't include this post itself
if (count($list) > 0) {
$inorequals = forum_utils::in_or_equals($list);
forum_utils::execute_sql("\nUPDATE\n {$CFG->prefix}forumng_posts\nSET\n discussionid = {$newdiscussionid}\nWHERE\n id {$inorequals}");
}
// Update this post
$changes = new stdClass();
$changes->id = $this->get_id();
$changes->subject = addslashes($newsubject);
$changes->parentpostid = null;
//When split the post, reset the important to 0 so that it is not highlighted.
$changes->important = 0;
// Note don't update modified time, or it makes this post unread,
// which isn't very helpful
$changes->discussionid = $newdiscussionid;
forum_utils::update_record('forumng_posts', $changes);
// Update read data if relevant
if (forum::enabled_read_tracking() && $newest->get_modified() >= forum::get_read_tracking_deadline()) {
$rs = forum_utils::get_recordset_sql("\nSELECT\n userid, time\nFROM\n {$CFG->prefix}forumng_read\nWHERE\n discussionid = " . $olddiscussion->get_id() . "\n AND time >= " . $this->get_created());
while ($rec = rs_fetch_next_record($rs)) {
$rec->discussionid = $newdiscussionid;
forum_utils::insert_record('forumng_read', $rec);
}
rs_close($rs);
}
$olddiscussion->possible_lastpost_change();
// Move attachments
$olddiscussionfolder = $olddiscussion->get_attachment_folder();
$newdiscussionfolder = $olddiscussion->get_attachment_folder(0, 0, $newdiscussionid);
if (is_dir($olddiscussionfolder)) {
// Put this post back on the list
$list[0] = $this->get_id();
// Loop through all posts; move attachments if present
$madenewfolder = false;
foreach ($list as $id) {
$oldfolder = $olddiscussionfolder . '/' . $id;
$newfolder = $newdiscussionfolder . '/' . $id;
if (is_dir($oldfolder)) {
if (!$madenewfolder) {
check_dir_exists($newfolder, true, true);
$madenewfolder = true;
}
forum_utils::rename($oldfolder, $newfolder);
}
}
}
if ($log) {
$this->log('split post');
}
forum_utils::finish_transaction();
$this->get_discussion()->uncache();
// If discussion-based completion is turned on, this may enable someone
// to complete
if ($this->get_forum()->get_completion_discussions()) {
$this->update_completion(true);
}
return $newdiscussionid;
}