course)) { error("Course is misconfigured"); } if (! $glossary = get_record("glossary", "id", $cm->instance)) { error("Course module is incorrect"); } require_login($course->id); if ( !isteacher($course->id) ) { error("You must be a teacher to use this page."); } // add_to_log($course->id, "glossary", "edit categories", "view.php?id=$cm->id", "$glossary->id", $cm->id); if ($course->category) { $navigation = "id\">$course->shortname ->"; } $strglossaries = get_string("modulenameplural", "glossary"); $strglossary = get_string("modulename", "glossary"); print_header(strip_tags("$course->shortname: $glossary->name"), "$course->fullname", "$navigation id>$strglossaries -> id&tab=GLOSSARY_CATEGORY_VIEW>$glossary->name -> " . get_string("categories","glossary"), "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); if ( $hook ) { $category = get_record("glossary_categories","id",$hook); if ( $action == "edit" ) { if ( $confirm ) { $action = ""; $cat->id = $hook; $cat->name = $name; $cat->usedynalink = $usedynalink; if ( !update_record("glossary_categories", $cat) ) { error("Weird error. The category was not updated."); redirect("editcategories.php?id=$cm->id"); } else { add_to_log($course->id, "glossary", "edit category", "editcategories.php?id=$cm->id", $hook,$cm->id); } } else { echo "
" . get_string("edit"). " " . get_string("category","glossary") . ""; $name = $category->name; $usedynalink = $category->usedynalink; require "editcategories.html"; print_footer(); die; } } elseif ( $action == "delete" ) { if ( $confirm ) { delete_records("glossary_entries_categories","categoryid", $hook); delete_records("glossary_categories","id", $hook); print_simple_box_start("center","40%", "#FFBBBB"); echo "
" . get_string("delete"). " " . get_string("category","glossary") . ""; print_simple_box_start("center","40%", "#FFBBBB"); echo "
"; print_string("areyousuredelete","glossary"); ?>
" . get_string("add"). " " . get_string("category","glossary") . ""; print_simple_box_start("center","40%", "#FFBBBB"); echo "
" . get_string("add"). " " . get_string("category","glossary") . "";
$name="";
require "editcategories.html";
}
}
if ( $action ) {
print_footer();
die;
}
?>