|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 // This file is part of Moodle - http://moodle.org/ 00003 // 00004 // Moodle is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // Moodle is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with Moodle. If not, see <http://www.gnu.org/licenses/>. 00016 00025 require_once("../../config.php"); 00026 require_once("lib.php"); 00027 require_once('delete_item_form.php'); 00028 00029 $id = required_param('id', PARAM_INT); 00030 $deleteitem = required_param('deleteitem', PARAM_INT); 00031 00032 $PAGE->set_url('/mod/feedback/delete_item.php', array('id'=>$id, 'deleteitem'=>$deleteitem)); 00033 00034 if (! $cm = get_coursemodule_from_id('feedback', $id)) { 00035 print_error('invalidcoursemodule'); 00036 } 00037 00038 if (! $course = $DB->get_record("course", array("id"=>$cm->course))) { 00039 print_error('coursemisconf'); 00040 } 00041 00042 if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) { 00043 print_error('invalidcoursemodule'); 00044 } 00045 00046 if (!$context = get_context_instance(CONTEXT_MODULE, $cm->id)) { 00047 print_error('badcontext'); 00048 } 00049 00050 require_login($course->id, true, $cm); 00051 00052 require_capability('mod/feedback:edititems', $context); 00053 00054 $mform = new mod_feedback_delete_item_form(); 00055 $newformdata = array('id'=>$id, 00056 'deleteitem'=>$deleteitem, 00057 'confirmdelete'=>'1'); 00058 $mform->set_data($newformdata); 00059 $formdata = $mform->get_data(); 00060 00061 if ($mform->is_cancelled()) { 00062 redirect('edit.php?id='.$id); 00063 } 00064 00065 if (isset($formdata->confirmdelete) AND $formdata->confirmdelete == 1) { 00066 feedback_delete_item($formdata->deleteitem); 00067 redirect('edit.php?id=' . $id); 00068 } 00069 00070 00072 $strfeedbacks = get_string("modulenameplural", "feedback"); 00073 $strfeedback = get_string("modulename", "feedback"); 00074 00075 $PAGE->navbar->add(get_string('delete_item', 'feedback')); 00076 $PAGE->set_heading(format_string($course->fullname)); 00077 $PAGE->set_title(format_string($feedback->name)); 00078 echo $OUTPUT->header(); 00079 00084 echo $OUTPUT->heading(format_text($feedback->name)); 00085 echo $OUTPUT->box_start('generalbox errorboxcontent boxaligncenter boxwidthnormal'); 00086 echo $OUTPUT->heading(get_string('confirmdeleteitem', 'feedback')); 00087 print_string('relateditemsdeleted', 'feedback'); 00088 $mform->display(); 00089 echo $OUTPUT->box_end(); 00090 00091 echo $OUTPUT->footer(); 00092 00093