moodle/mod/feedback/unmapcourse.php
moodler c70ad9f736 MDL-14493 First checkin of Feedback module into HEAD.
I made a number of small tidy-ups to the contrib version before adding this here:

  - fixed some language string names
  - renamed a capability from deletecompleteds to deletesubmissions (can we use "submissions" everywhere?)
  - got rid of language packs (moved english to correct location)
  - deleted 'pics' type (it needs to be rewritten to use user files in moodledata)
  - moved changelog into README.txt
  - moved captcha font out of subdir
  - bumped version to today

Thanks very much to Andreas Grabs for all your work on this module so far, and congratulations!   :-)
2008-04-23 09:33:54 +00:00

46 lines
No EOL
1.2 KiB
PHP

<?php // $Id$
/**
* drops records from feedback_sitecourse_map
*
* @version $Id$
* @author Andreas Grabs
* @license http://www.gnu.org/copyleft/gpl.html GNU Public License
* @package feedback
*/
require_once("../../config.php");
require_once($CFG->dirroot.'/mod/feedback/lib.php');
$id = required_param('id', PARAM_INT);
$cmapid = required_param('cmapid', PARAM_INT);
if ($id) {
if (! $cm = get_coursemodule_from_id('feedback', $id)) {
error("Course Module ID was incorrect");
}
if (! $course = get_record("course", "id", $cm->course)) {
error("Course is misconfigured");
}
if (! $feedback = get_record("feedback", "id", $cm->instance)) {
error("Course module is incorrect");
}
}
$capabilities = feedback_load_capabilities($cm->id);
if (!$capabilities->mapcourse) {
error ('access not allowed');
}
// cleanup all lost entries after deleting courses or feedbacks
feedback_clean_up_sitecourse_map();
if (delete_records('feedback_sitecourse_map', 'id', $cmapid)) {
redirect (htmlspecialchars('mapcourse.php?id='.$id));
} else {
error('Database problem, unable to unmap');
}
?>