mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 05:58:34 +01:00
0468976c9a
The API was changed slightly so that has_capability now takes the whole $context object (we almost always have it anyway) The $kill thing was removed. If you want to assert a capability then use: require_capability('capname', $context); with optional variables to modify the error message Misc bugs here and there also removed and code tidied
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?php // $Id$
|
|
|
|
require_once("../../config.php");
|
|
require_once("lib.php");
|
|
|
|
$id = required_param('id', PARAM_INT); // Course Module ID
|
|
$eid = optional_param('eid', 0, PARAM_INT); // Entry ID
|
|
|
|
$mode = optional_param('mode','approval', PARAM_ALPHA);
|
|
$hook = optional_param('hook','ALL', PARAM_CLEAN);
|
|
|
|
if (! $cm = get_coursemodule_from_id('glossary', $id)) {
|
|
error("Course Module ID was incorrect");
|
|
}
|
|
|
|
if (! $course = get_record("course", "id", $cm->course)) {
|
|
error("Course is misconfigured");
|
|
}
|
|
|
|
if (! $glossary = get_record("glossary", "id", $cm->instance)) {
|
|
error("Course module is incorrect");
|
|
}
|
|
|
|
require_login($course->id, false, $cm);
|
|
|
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
|
require_capability('mod/glossary:approve', $context);
|
|
|
|
$newentry->id = $eid;
|
|
$newentry->approved = 1;
|
|
|
|
if (! update_record("glossary_entries", $newentry)) {
|
|
error("Could not update your glossary");
|
|
} else {
|
|
add_to_log($course->id, "glossary", "approve entry", "showentry.php?id=$cm->id&eid=$eid", "$eid",$cm->id);
|
|
}
|
|
redirect("view.php?id=$cm->id&mode=$mode&hook=$hook",get_string("entryapproved","glossary"),1);
|
|
die;
|
|
?>
|