".format_string($category->name, true, $fmtoptions)."
";
$num_entries = $DB->count_records("glossary_entries_categories", array("categoryid"=>$category->id));
if ( $num_entries ) {
print_string("deletingnoneemptycategory","glossary");
}
echo "
";
print_string("areyousuredelete","glossary");
echo "
";
?>
";
echo "
";
echo $OUTPUT->box_end();
}
}
} elseif ( $action == "add" ) {
if ( $confirm ) {
require_sesskey();
$dupcategory = $DB->get_records_sql("SELECT * FROM {glossary_categories} WHERE ".$DB->sql_like('name','?', false)." AND glossaryid=?", array($name, $glossary->id));
if ( $dupcategory ) {
redirect("editcategories.php?id=$cm->id&action=add&name=$name", get_string("duplicatecategory", "glossary"), 2);
} else {
$action = "";
$cat = new stdClass();
$cat->name = $name;
$cat->usedynalink = $usedynalink;
$cat->glossaryid = $glossary->id;
$cat->id = $DB->insert_record("glossary_categories", $cat);
$event = \mod_glossary\event\category_created::create(array(
'context' => $context,
'objectid' => $cat->id
));
$event->add_record_snapshot('glossary_categories', $cat);
$event->add_record_snapshot('glossary', $glossary);
$event->trigger();
// Reset caches.
\mod_glossary\local\concept_cache::reset_glossary($glossary);
}
} else {
echo $OUTPUT->header();
echo $OUTPUT->heading(format_string($glossary->name), 2);
echo "