MDL-11517 reserved word MOD used in table alias in questions backup code
[moodle-pu.git] / mod / glossary / approve.php
blobd95e0868d7e4e4a99551569d87fd73892a765215
1 <?php // $Id$
3 require_once("../../config.php");
4 require_once("lib.php");
6 $id = required_param('id', PARAM_INT); // Course Module ID
7 $eid = optional_param('eid', 0, PARAM_INT); // Entry ID
9 $mode = optional_param('mode','approval', PARAM_ALPHA);
10 $hook = optional_param('hook','ALL', PARAM_CLEAN);
12 if (! $cm = get_coursemodule_from_id('glossary', $id)) {
13 error("Course Module ID was incorrect");
16 if (! $course = get_record("course", "id", $cm->course)) {
17 error("Course is misconfigured");
20 if (! $glossary = get_record("glossary", "id", $cm->instance)) {
21 error("Course module is incorrect");
24 require_login($course->id, false, $cm);
26 $context = get_context_instance(CONTEXT_MODULE, $cm->id);
27 require_capability('mod/glossary:approve', $context);
29 $newentry->id = $eid;
30 $newentry->approved = 1;
32 if (! update_record("glossary_entries", $newentry)) {
33 error("Could not update your glossary");
34 } else {
35 add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&amp;eid=$eid", "$eid",$cm->id);
37 redirect("view.php?id=$cm->id&amp;mode=$mode&amp;hook=$hook",get_string("entryapproved","glossary"),1);
38 die;