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


PHP feedback_delete_item函数代码示例

本文整理汇总了PHP中feedback_delete_item函数的典型用法代码示例。如果您正苦于以下问题:PHP feedback_delete_item函数的具体用法?PHP feedback_delete_item怎么用?PHP feedback_delete_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了feedback_delete_item函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: feedback_delete_all_items

/**
 * deletes all items of the given feedbackid
 *
 * @global object
 * @param int $feedbackid
 * @return void
 */
function feedback_delete_all_items($feedbackid) {
    global $DB, $CFG;
    require_once($CFG->libdir.'/completionlib.php');

    if (!$feedback = $DB->get_record('feedback', array('id'=>$feedbackid))) {
        return false;
    }

    if (!$cm = get_coursemodule_from_instance('feedback', $feedback->id)) {
        return false;
    }

    if (!$course = $DB->get_record('course', array('id'=>$feedback->course))) {
        return false;
    }

    if (!$items = $DB->get_records('feedback_item', array('feedback'=>$feedbackid))) {
        return;
    }
    foreach ($items as $item) {
        feedback_delete_item($item->id, false);
    }
    if ($completeds = $DB->get_records('feedback_completed', array('feedback'=>$feedback->id))) {
        $completion = new completion_info($course);
        foreach ($completeds as $completed) {
            // Update completion state
            if ($completion->is_enabled($cm) && $feedback->completionsubmit) {
                $completion->update_state($cm, COMPLETION_INCOMPLETE, $completed->userid);
            }
            $DB->delete_records('feedback_completed', array('id'=>$completed->id));
        }
    }

    $DB->delete_records('feedback_completedtmp', array('feedback'=>$feedbackid));

}
开发者ID:numbas,项目名称:moodle,代码行数:43,代码来源:lib.php

示例2: print_error

}
if (!($feedback = $DB->get_record("feedback", array("id" => $cm->instance)))) {
    print_error('invalidcoursemodule');
}
$context = context_module::instance($cm->id);
require_login($course, true, $cm);
require_capability('mod/feedback:edititems', $context);
$mform = new mod_feedback_delete_item_form();
$newformdata = array('id' => $id, 'deleteitem' => $deleteitem, 'confirmdelete' => '1');
$mform->set_data($newformdata);
$formdata = $mform->get_data();
if ($mform->is_cancelled()) {
    redirect('edit.php?id=' . $id);
}
if (isset($formdata->confirmdelete) and $formdata->confirmdelete == 1) {
    feedback_delete_item($formdata->deleteitem);
    redirect('edit.php?id=' . $id);
}
/// Print the page header
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$PAGE->navbar->add(get_string('delete_item', 'feedback'));
$PAGE->set_heading($course->fullname);
$PAGE->set_title($feedback->name);
echo $OUTPUT->header();
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////
echo $OUTPUT->heading(format_string($feedback->name));
echo $OUTPUT->box_start('generalbox errorboxcontent boxaligncenter boxwidthnormal');
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:31,代码来源:delete_item.php

示例3: feedback_delete_all_items

/**
 * deletes all items of the given feedbackid
 *
 * @global object
 * @param int $feedbackid
 * @return void
 */
function feedback_delete_all_items($feedbackid)
{
    global $DB;
    if (!($items = $DB->get_records('feedback_item', array('feedback' => $feedbackid)))) {
        return;
    }
    foreach ($items as $item) {
        feedback_delete_item($item->id, false);
    }
    $DB->delete_records('feedback_completedtmp', array('feedback' => $feedbackid));
    $DB->delete_records('feedback_completed', array('feedback' => $feedbackid));
}
开发者ID:ajv,项目名称:Offline-Caching,代码行数:19,代码来源:lib.php

示例4: feedback_delete_all_items

/** 
 *  deletes all items of the given feedbackid
 *  @param int $feedbackid
 *  @return void
 */
function feedback_delete_all_items($feedbackid)
{
    if (!($items = get_records('feedback_item', 'feedback', $feedbackid))) {
        return;
    }
    foreach ($items as $item) {
        feedback_delete_item($item->id, false);
    }
    @delete_records('feedback_completedtmp', 'feedback', $feedbackid);
    @delete_records('feedback_completed', 'feedback', $feedbackid);
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:16,代码来源:lib.php

示例5: require_capability

require_capability('mod/feedback:edititems', $context);
$feedback = $PAGE->activityrecord;
$feedbackstructure = new mod_feedback_structure($feedback, $cm);
if ($switchitemrequired) {
    require_sesskey();
    $items = $feedbackstructure->get_items();
    if (isset($items[$switchitemrequired])) {
        feedback_switch_item_required($items[$switchitemrequired]);
    }
    redirect($url);
}
if ($deleteitem) {
    require_sesskey();
    $items = $feedbackstructure->get_items();
    if (isset($items[$deleteitem])) {
        feedback_delete_item($deleteitem);
    }
    redirect($url);
}
// Process the create template form.
$cancreatetemplates = has_capability('mod/feedback:createprivatetemplate', $context) || has_capability('mod/feedback:createpublictemplate', $context);
$create_template_form = new feedback_edit_create_template_form(null, array('id' => $id));
if ($data = $create_template_form->get_data()) {
    // Check the capabilities to create templates.
    if (!$cancreatetemplates) {
        print_error('cannotsavetempl', 'feedback', $url);
    }
    $ispublic = !empty($data->ispublic) ? 1 : 0;
    if (!feedback_save_as_template($feedback, $data->templatename, $ispublic)) {
        redirect($url, get_string('saving_failed', 'feedback'), null, \core\output\notification::NOTIFY_ERROR);
    } else {
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:edit.php


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