本文整理匯總了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}");
}