当前位置: 首页>>代码示例>>PHP>>正文


PHP forum_grade_item_delete函数代码示例

本文整理汇总了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;
}
开发者ID:Jtgadbois,项目名称:Pedadida,代码行数:52,代码来源:lib.php

示例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;
}
开发者ID:r007,项目名称:PMoodle,代码行数:30,代码来源:lib.php


注:本文中的forum_grade_item_delete函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。