$searchterm) { if (strlen($searchterm) < 2) { unset($searchterms[$key]); } } $search = trim(implode(" ", $searchterms)); } elseif ( $eid ) { $search = ""; } if (! $cm = get_record("course_modules", "id", $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); add_to_log($course->id, "glossary", "view", "view.php?id=$cm->id", "$glossary->id"); /// Print the page header if ($course->category) { $navigation = "id\">$course->shortname ->"; } $strglossaries = get_string("modulenameplural", "glossary"); $strglossary = get_string("modulename", "glossary"); $strselectletter = get_string("selectletter", "glossary"); $strspecial = get_string("special", "glossary"); $strallentries = get_string("allentries", "glossary"); $strnoentries = get_string("noentries", "glossary"); $straddentry = get_string("addentry", "glossary"); $streditentry = get_string("editentry", "glossary"); $strdeleteentry = get_string("deleteentry", "glossary"); print_header("$course->shortname: $glossary->name", "$course->fullname", "$navigation id>$strglossaries -> $glossary->name", "", "", true, update_module_button($cm->id, $course->id, $strglossary), navmenu($course, $cm)); /// Print the main part of the page /// Printing the navigation links (letters to look for) echo "
" ; if ( !$course->visible ) { notice(get_string("activityiscurrentlyhidden")); } print_simple_box_start("center", "70%"); echo "
wwwroot/mod/glossary/view.php?id=$id&l=SPECIAL\">$strspecial | ";
}
if ( $glossary->showalphabet ) {
$alphabet = explode("|", get_string("alphabet","glossary"));
$letters_by_line = 14;
for ($i = 0; $i < count($alphabet); $i++) {
echo "wwwroot/mod/glossary/view.php?id=$id&l=$alphabet[$i]\">$alphabet[$i]";
if ((int) ($i % $letters_by_line) != 0 or $i == 0) {
echo " | ";
} else {
echo "
";
}
}
}
if ( $glossary->showall ) {
echo "wwwroot/mod/glossary/view.php?id=$id&l=ALL\">$strallentries
"; if ($l) { $CurrentLetter = ""; if ($l == "ALL" or $l == "SPECIAL") { if ( $l == "ALL" ) { echo "
"; } elseif ($l == "SPECIAL") { echo "
"; } } } elseif( $search ) { echo get_string("search") . ": $search"; } /// Printing the entries if ( $search ) { // looking for a term $allentries = glossary_search_entries($searchterms, $glossary, $includedefinition); } elseif ( $eid ) { // looking for an entry $allentries = get_records("glossary_entries", "id", $eid); } else { // looking for terms that begin with a specify letter $allentries = get_records("glossary_entries", "glossaryid", $glossary->id,"concept ASC"); } if ( $allentries ) { $DumpedDefinitions= 0; foreach ($allentries as $entry) { $DumpToScreen = 0; $FirstLetter = strtoupper( ltrim( $entry->concept[0] ) ); if ( $l ) { if ( $l == "ALL" or $FirstLetter == $l) { if ( $CurrentLetter != $FirstLetter ) { $CurrentLetter = $FirstLetter; if ( $glossary->displayformat == 0 ) { if ( $DumpedDefinitions != 1) { echo "
"; } echo "\n
cellheading\">"; } echo $CurrentLetter; if ( $glossary->displayformat == 0 ) { echo "\n |