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);
30 $newentry->approved
= 1;
32 if (! update_record("glossary_entries", $newentry)) {
33 error("Could not update your glossary");
35 add_to_log($course->id
, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid",$cm->id
);
37 redirect("view.php?id=$cm->id&mode=$mode&hook=$hook",get_string("entryapproved","glossary"),1);