本文整理汇总了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);
}
示例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);
}
}
示例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
///////////////////////////////////////////////////////////////////////////
示例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);
}
}
示例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();
}
示例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);
}
}