[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 // This file is part of Moodle - http://moodle.org/ 3 // 4 // Moodle is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // Moodle is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License 15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 16 17 /** 18 * prints the form to confirm the deleting of a completed 19 * 20 * @author Andreas Grabs 21 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License 22 * @package mod_feedback 23 */ 24 25 require_once("../../config.php"); 26 require_once ("lib.php"); 27 require_once ('delete_completed_form.php'); 28 29 $id = required_param('id', PARAM_INT); 30 $completedid = optional_param('completedid', 0, PARAM_INT); 31 $return = optional_param('return', 'entries', PARAM_ALPHA); 32 33 if ($completedid == 0) { 34 print_error('no_complete_to_delete', 35 'feedback', 36 'show_entries.php?id='.$id.'&do_show=showentries'); 37 } 38 39 $PAGE->set_url('/mod/feedback/delete_completed.php', array('id'=>$id, 'completed'=>$completedid)); 40 41 if (! $cm = get_coursemodule_from_id('feedback', $id)) { 42 print_error('invalidcoursemodule'); 43 } 44 45 if (! $course = $DB->get_record("course", array("id"=>$cm->course))) { 46 print_error('coursemisconf'); 47 } 48 49 if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) { 50 print_error('invalidcoursemodule'); 51 } 52 53 $context = context_module::instance($cm->id); 54 55 require_login($course, true, $cm); 56 57 require_capability('mod/feedback:deletesubmissions', $context); 58 59 $mform = new mod_feedback_delete_completed_form(); 60 $newformdata = array('id'=>$id, 61 'completedid'=>$completedid, 62 'confirmdelete'=>'1', 63 'do_show'=>'edit', 64 'return'=>$return); 65 $mform->set_data($newformdata); 66 $formdata = $mform->get_data(); 67 68 if ($mform->is_cancelled()) { 69 if ($return == 'entriesanonym') { 70 redirect('show_entries_anonym.php?id='.$id); 71 } else { 72 redirect('show_entries.php?id='.$id.'&do_show=showentries'); 73 } 74 } 75 76 if (isset($formdata->confirmdelete) AND $formdata->confirmdelete == 1) { 77 if ($completed = $DB->get_record('feedback_completed', array('id'=>$completedid))) { 78 feedback_delete_completed($completedid); 79 if ($return == 'entriesanonym') { 80 redirect('show_entries_anonym.php?id='.$id); 81 } else { 82 redirect('show_entries.php?id='.$id.'&do_show=showentries'); 83 } 84 } 85 } 86 87 /// Print the page header 88 $strfeedbacks = get_string("modulenameplural", "feedback"); 89 $strfeedback = get_string("modulename", "feedback"); 90 91 $PAGE->navbar->add(get_string('delete_entry', 'feedback')); 92 $PAGE->set_heading($course->fullname); 93 $PAGE->set_title($feedback->name); 94 echo $OUTPUT->header(); 95 96 /// Print the main part of the page 97 /////////////////////////////////////////////////////////////////////////// 98 /////////////////////////////////////////////////////////////////////////// 99 /////////////////////////////////////////////////////////////////////////// 100 echo $OUTPUT->heading(format_string($feedback->name)); 101 echo $OUTPUT->box_start('generalbox errorboxcontent boxaligncenter boxwidthnormal'); 102 echo html_writer::tag('p', get_string('confirmdeleteentry', 'feedback'), array('class' => 'bold')); 103 $mform->display(); 104 echo $OUTPUT->box_end(); 105 106 107 echo $OUTPUT->footer();
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |