本文整理汇总了PHP中notification::enqueue_post_locked方法的典型用法代码示例。如果您正苦于以下问题:PHP notification::enqueue_post_locked方法的具体用法?PHP notification::enqueue_post_locked怎么用?PHP notification::enqueue_post_locked使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类notification
的用法示例。
在下文中一共展示了notification::enqueue_post_locked方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_posts_locked_from_submit
/**
* Save the locked state for a post
*
* @return result array.
*/
public function save_posts_locked_from_submit()
{
global $DB;
// Ensure that post exists and get the right courseid.
$postid = required_param('postid', PARAM_INT);
if (!($post = $DB->get_record('format_socialwall_posts', array('id' => $postid)))) {
print_error('invalidpostid', 'format_socialwall');
}
// ... check capability.
$coursecontext = \context_course::instance($post->courseid);
if (!has_capability('format/socialwall:lockcomment', $coursecontext)) {
print_error('missingcaplockcomment', 'format_socialwall');
}
$locked = optional_param('locked', '0', PARAM_INT);
if ($post->locked != $locked) {
$post->locked = $locked;
$post->timemodified = time();
$DB->update_record('format_socialwall_posts', $post);
// We use a instant enqueueing, if needed you might use events here.
notification::enqueue_post_locked($post);
}
return array('error' => '0', 'message' => 'postsaved', 'postid' => $post->id, 'locked' => "{$post->locked}");
}