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


PHP feedback_delete_completed函数代码示例

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


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

示例1: test_response_deleted_event

    /**
     * Tests for event response_deleted.
     */
    public function test_response_deleted_event() {
        global $USER, $DB;
        $this->resetAfterTest();

        // Create and delete a module.
        $sink = $this->redirectEvents();
        feedback_delete_completed($this->eventfeedbackcompleted->id);
        $events = $sink->get_events();
        $event = array_pop($events); // Delete feedback event.
        $sink->close();

        // Validate event data.
        $this->assertInstanceOf('\mod_feedback\event\response_deleted', $event);
        $this->assertEquals($this->eventfeedbackcompleted->id, $event->objectid);
        $this->assertEquals($USER->id, $event->userid);
        $this->assertEquals($this->eventuser->id, $event->relateduserid);
        $this->assertEquals('feedback_completed', $event->objecttable);
        $this->assertEquals(null, $event->get_url());
        $this->assertEquals($this->eventfeedbackcompleted, $event->get_record_snapshot('feedback_completed', $event->objectid));
        $this->assertEquals($this->eventcourse, $event->get_record_snapshot('course', $event->courseid));
        $this->assertEquals($this->eventfeedback, $event->get_record_snapshot('feedback', $event->other['instanceid']));

        // Test legacy data.
        $arr = array($this->eventcourse->id, 'feedback', 'delete', 'view.php?id=' . $this->eventcm->id, $this->eventfeedback->id,
                $this->eventfeedback->id);
        $this->assertEventLegacyLogData($arr, $event);
        $this->assertEventContextNotUsed($event);

        // Test can_view() .
        $this->setUser($this->eventuser);
        $this->assertFalse($event->can_view());
        $this->setAdminUser();
        $this->assertTrue($event->can_view());

        // Create a response, with anonymous set to no and test can_view().
        $response = new stdClass();
        $response->feedback = $this->eventcm->instance;
        $response->userid = $this->eventuser->id;
        $response->anonymous_response = FEEDBACK_ANONYMOUS_NO;
        $completedid = $DB->insert_record('feedback_completed', $response);
        $DB->get_record('feedback_completed', array('id' => $completedid), '*', MUST_EXIST);
        $value = new stdClass();
        $value->course_id = $this->eventcourse->id;
        $value->item = $this->eventfeedbackitem->id;
        $value->completed = $completedid;
        $value->value = 25; // User response value.
        $DB->insert_record('feedback_valuetmp', $value);

        // Save the feedback.
        $sink = $this->redirectEvents();
        feedback_delete_completed($completedid);
        $events = $sink->get_events();
        $event = array_pop($events); // Response submitted feedback event.
        $sink->close();

        // Test can_view() .
        $this->setUser($this->eventuser);
        $this->assertTrue($event->can_view());
        $this->setAdminUser();
        $this->assertTrue($event->can_view());
        $this->assertEventContextNotUsed($event);
    }
开发者ID:rwijaya,项目名称:moodle,代码行数:65,代码来源:events_test.php

示例2: feedback_delete_all_completeds

/**
 * deletes all completed-recordsets from a feedback.
 * all related data such as values also will be deleted
 *
 * @global object
 * @param int $feedbackid
 * @return void
 */
function feedback_delete_all_completeds($feedbackid) {
    global $DB;

    if (!$completeds = $DB->get_records('feedback_completed', array('feedback'=>$feedbackid))) {
        return;
    }
    foreach ($completeds as $completed) {
        feedback_delete_completed($completed->id);
    }
}
开发者ID:numbas,项目名称:moodle,代码行数:18,代码来源:lib.php

示例3: feedback_load_capabilities

}
$capabilities = feedback_load_capabilities($cm->id);
require_login($course->id, true, $cm);
if (!$capabilities->deletesubmissions) {
    print_error('error');
}
$mform = new mod_feedback_delete_completed_form();
$newformdata = array('id' => $id, 'completedid' => $completedid, 'confirmdelete' => '1', 'do_show' => 'edit');
$mform->set_data($newformdata);
$formdata = $mform->get_data();
if ($mform->is_cancelled()) {
    redirect('show_entries.php?id=' . $id . '&do_show=showentries');
}
if (isset($formdata->confirmdelete) and $formdata->confirmdelete == 1) {
    if ($completed = $DB->get_record('feedback_completed', array('id' => $completedid))) {
        feedback_delete_completed($completedid);
        add_to_log($course->id, 'feedback', 'delete', 'view.php?id=' . $cm->id, $feedback->id, $cm->id);
        redirect('show_entries.php?id=' . $id . '&do_show=showentries');
    }
}
/// Print the page header
$strfeedbacks = get_string("modulenameplural", "feedback");
$strfeedback = get_string("modulename", "feedback");
$buttontext = update_module_button($cm->id, $course->id, $strfeedback);
$navlinks = array();
$navlinks[] = array('name' => $strfeedbacks, 'link' => "index.php?id={$course->id}", 'type' => 'activity');
$navlinks[] = array('name' => format_string($feedback->name), 'link' => "", 'type' => 'activityinstance');
$navigation = build_navigation($navlinks);
print_header_simple(format_string($feedback->name), "", $navigation, "", "", true, $buttontext, navmenu($course, $cm));
/// Print the main part of the page
///////////////////////////////////////////////////////////////////////////
开发者ID:nicolasconnault,项目名称:moodle2.0,代码行数:31,代码来源:delete_completed.php

示例4: feedback_delete_all_completeds

/** 
 *  deletes all completed-recordsets from a feedback.
 *  all related data such as values also will be deleted
 *  @param int $feedbackid
 *  @return void
 */
function feedback_delete_all_completeds($feedbackid)
{
    if (!($completeds = get_records('feedback_completed', 'feedback', $feedbackid))) {
        return;
    }
    foreach ($completeds as $completed) {
        feedback_delete_completed($completed->id);
    }
}
开发者ID:nadavkav,项目名称:MoodleTAO,代码行数:15,代码来源:lib.php

示例5: list

////////////////////////////////////////////////////////
//get the objects
////////////////////////////////////////////////////////
list($course, $cm) = get_course_and_cm_from_cmid($id, 'feedback');
$baseurl = new moodle_url('/mod/feedback/show_entries.php', array('id' => $cm->id));
$PAGE->set_url(new moodle_url($baseurl, array('userid' => $userid, 'showcompleted' => $showcompleted, 'delete' => $deleteid)));
$context = context_module::instance($cm->id);
require_login($course, true, $cm);
$feedback = $PAGE->activityrecord;
require_capability('mod/feedback:viewreports', $context);
if ($deleteid) {
    // This is a request to delete a reponse.
    require_capability('mod/feedback:deletesubmissions', $context);
    require_sesskey();
    $feedbackstructure = new mod_feedback_completion($feedback, $cm, 0, true, $deleteid);
    feedback_delete_completed($feedbackstructure->get_completed(), $feedback, $cm);
    redirect($baseurl);
} else {
    if ($showcompleted || $userid) {
        // Viewing individual response.
        $feedbackstructure = new mod_feedback_completion($feedback, $cm, 0, true, $showcompleted, $userid);
    } else {
        // Viewing list of reponses.
        $feedbackstructure = new mod_feedback_structure($feedback, $cm, $courseid);
    }
}
$responsestable = new mod_feedback_responses_table($feedbackstructure);
$anonresponsestable = new mod_feedback_responses_anon_table($feedbackstructure);
if ($responsestable->is_downloading()) {
    $responsestable->download();
}
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:show_entries.php

示例6: feedback_delete_all_completeds

/**
 * deletes all completed-recordsets from a feedback.
 * all related data such as values also will be deleted
 *
 * @param stdClass|int $feedback
 * @param stdClass|cm_info $cm
 * @param stdClass $course
 * @return void
 */
function feedback_delete_all_completeds($feedback, $cm = null, $course = null)
{
    global $DB;
    if (is_int($feedback)) {
        $feedback = $DB->get_record('feedback', array('id' => $feedback));
    }
    if (!($completeds = $DB->get_records('feedback_completed', array('feedback' => $feedback->id)))) {
        return;
    }
    if (!$course && !($course = $DB->get_record('course', array('id' => $feedback->course)))) {
        return false;
    }
    if (!$cm && !($cm = get_coursemodule_from_instance('feedback', $feedback->id))) {
        return false;
    }
    foreach ($completeds as $completed) {
        feedback_delete_completed($completed, $feedback, $cm, $course);
    }
}
开发者ID:evltuma,项目名称:moodle,代码行数:28,代码来源:lib.php


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