$id)); if ($usedynalink !== 0) { $url->param('usedynalink', $usedynalink); } if ($confirm !== 0) { $url->param('confirm', $confirm); } if ($name !== 'name') { $url->param('name', $name); } if ($action !== 'action') { $url->param('action', $action); } if ($hook !== 'hook') { $url->param('hook', $hook); } if ($mode !== 'mode') { $url->param('mode', $mode); } $PAGE->set_url($url); 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('invalidcoursemodule'); } if ($hook > 0) { if ($category = $DB->get_record("glossary_categories", array("id"=>$hook))) { //Check it belongs to the same glossary if ($category->glossaryid != $glossary->id) { print_error('invalidid', 'glossary'); } } else { print_error('invalidcategoryid'); } } require_login($course->id, false, $cm); $context = get_context_instance(CONTEXT_MODULE, $cm->id); require_capability('mod/glossary:managecategories', $context); $strglossaries = get_string("modulenameplural", "glossary"); $strglossary = get_string("modulename", "glossary"); $PAGE->navbar->add($strglossaries, new moodle_url('/mod/glossary/index.php', array('id'=>$course->id))); $PAGE->navbar->add(get_string("categories","glossary")); if (!empty($action)) { $navaction = get_string($action). " " . moodle_strtolower(get_string("category","glossary")); $PAGE->navbar->add($navaction); } $PAGE->set_title(format_string($glossary->name)); $PAGE->set_heading($course->fullname); echo $OUTPUT->header(); // Prepare format_string/text options $fmtoptions = array( 'context' => $context); if (right_to_left()) { // RTL table alignment support $rightalignment = 'left'; $leftalignment = 'right'; } else { $rightalignment = 'right'; $leftalignment = 'left'; } if ( $hook >0 ) { if ( $action == "edit" ) { if ( $confirm ) { $action = ""; $cat = new stdClass(); $cat->id = $hook; $cat->name = $name; $cat->usedynalink = $usedynalink; $DB->update_record("glossary_categories", $cat); add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id); } else { echo "
" . get_string("delete"). " " . get_string("category","glossary"). "
"; echo $OUTPUT->box_start('generalbox boxaligncenter errorboxcontent boxwidthnarrow'); echo ""; print_string("areyousuredelete","glossary"); echo "
"; ?>$id); echo $OUTPUT->single_button(new moodle_url("editcategories.php", $options), get_string("no")); echo " |