本文整理汇总了PHP中forum_grade_item_delete函数的典型用法代码示例。如果您正苦于以下问题:PHP forum_grade_item_delete函数的具体用法?PHP forum_grade_item_delete怎么用?PHP forum_grade_item_delete使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了forum_grade_item_delete函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: forum_delete_instance
/**
* Given an ID of an instance of this module,
* this function will permanently delete the instance
* and any data that depends on it.
*
* @global object
* @param int $id forum instance id
* @return bool success
*/
function forum_delete_instance($id) {
global $DB;
if (!$forum = $DB->get_record('forum', array('id'=>$id))) {
return false;
}
if (!$cm = get_coursemodule_from_instance('forum', $forum->id)) {
return false;
}
if (!$course = $DB->get_record('course', array('id'=>$cm->course))) {
return false;
}
$context = context_module::instance($cm->id);
// now get rid of all files
$fs = get_file_storage();
$fs->delete_area_files($context->id);
$result = true;
if ($discussions = $DB->get_records('forum_discussions', array('forum'=>$forum->id))) {
foreach ($discussions as $discussion) {
if (!forum_delete_discussion($discussion, true, $course, $cm, $forum)) {
$result = false;
}
}
}
if (!$DB->delete_records('forum_subscriptions', array('forum'=>$forum->id))) {
$result = false;
}
forum_tp_delete_read_records(-1, -1, -1, $forum->id);
if (!$DB->delete_records('forum', array('id'=>$forum->id))) {
$result = false;
}
forum_grade_item_delete($forum);
return $result;
}
示例2: forum_delete_instance
/**
* Given an ID of an instance of this module,
* this function will permanently delete the instance
* and any data that depends on it.
* @param int forum instance id
* @return bool success
*/
function forum_delete_instance($id)
{
if (!($forum = get_record('forum', 'id', $id))) {
return false;
}
$result = true;
if ($discussions = get_records('forum_discussions', 'forum', $forum->id)) {
foreach ($discussions as $discussion) {
if (!forum_delete_discussion($discussion, true)) {
$result = false;
}
}
}
if (!delete_records('forum_subscriptions', 'forum', $forum->id)) {
$result = false;
}
forum_tp_delete_read_records(-1, -1, -1, $forum->id);
if (!delete_records('forum', 'id', $forum->id)) {
$result = false;
}
forum_grade_item_delete($forum);
return $result;
}