[ 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 * deletes an item of the feedback 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_item_form.php'); 28 29 $id = required_param('id', PARAM_INT); 30 $deleteitem = required_param('deleteitem', PARAM_INT); 31 32 $PAGE->set_url('/mod/feedback/delete_item.php', array('id'=>$id, 'deleteitem'=>$deleteitem)); 33 34 if (! $cm = get_coursemodule_from_id('feedback', $id)) { 35 print_error('invalidcoursemodule'); 36 } 37 38 if (! $course = $DB->get_record("course", array("id"=>$cm->course))) { 39 print_error('coursemisconf'); 40 } 41 42 if (! $feedback = $DB->get_record("feedback", array("id"=>$cm->instance))) { 43 print_error('invalidcoursemodule'); 44 } 45 46 $context = context_module::instance($cm->id); 47 48 require_login($course, true, $cm); 49 50 require_capability('mod/feedback:edititems', $context); 51 52 $mform = new mod_feedback_delete_item_form(); 53 $newformdata = array('id'=>$id, 54 'deleteitem'=>$deleteitem, 55 'confirmdelete'=>'1'); 56 $mform->set_data($newformdata); 57 $formdata = $mform->get_data(); 58 59 if ($mform->is_cancelled()) { 60 redirect('edit.php?id='.$id); 61 } 62 63 if (isset($formdata->confirmdelete) AND $formdata->confirmdelete == 1) { 64 feedback_delete_item($formdata->deleteitem); 65 redirect('edit.php?id=' . $id); 66 } 67 68 69 /// Print the page header 70 $strfeedbacks = get_string("modulenameplural", "feedback"); 71 $strfeedback = get_string("modulename", "feedback"); 72 73 $PAGE->navbar->add(get_string('delete_item', 'feedback')); 74 $PAGE->set_heading($course->fullname); 75 $PAGE->set_title($feedback->name); 76 echo $OUTPUT->header(); 77 78 /// Print the main part of the page 79 /////////////////////////////////////////////////////////////////////////// 80 /////////////////////////////////////////////////////////////////////////// 81 /////////////////////////////////////////////////////////////////////////// 82 echo $OUTPUT->heading(format_string($feedback->name)); 83 echo $OUTPUT->box_start('generalbox errorboxcontent boxaligncenter boxwidthnormal'); 84 echo html_writer::tag('p', get_string('confirmdeleteitem', 'feedback'), array('class' => 'bold')); 85 print_string('relateditemsdeleted', 'feedback'); 86 $mform->display(); 87 echo $OUTPUT->box_end(); 88 89 echo $OUTPUT->footer(); 90 91
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 |