mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
42 lines
1.4 KiB
PHP
42 lines
1.4 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)) {
|
|
print_error('invalidcoursemodule');
|
|
}
|
|
|
|
if (! $course = $DB->get_record("course", array("id"=>$cm->course))) {
|
|
print_error('coursemisconf');
|
|
}
|
|
|
|
if (! $glossary = $DB->get_record("glossary", array("id"=>$cm->instance))) {
|
|
print_error('invalidid', 'glossary');
|
|
}
|
|
|
|
require_login($course->id, false, $cm);
|
|
|
|
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
|
|
require_capability('mod/glossary:approve', $context);
|
|
|
|
$newentry = new object();
|
|
$newentry->id = $eid;
|
|
$newentry->approved = 1;
|
|
$newentry->timemodified = time(); // wee need this date here to speed up recent activity, TODO: use timestamp in approved field instead in 2.0
|
|
|
|
if (! $DB->update_record("glossary_entries", $newentry)) {
|
|
print_error('cantupdateglossary', '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;
|
|
?>
|