From ff8352de94e83a6ef3d40af79421cf07a5afb73e Mon Sep 17 00:00:00 2001 From: moodler Date: Wed, 31 Mar 2004 08:34:41 +0000 Subject: [PATCH] Some fixes to highlighting ... it is now performed AFTER the format_text. This means that searches can no longer mess up the TeX formatting. Also, the concept names are now formatted, allowing multilang, TeX etc --- mod/glossary/formats/1.php | 3 +-- mod/glossary/formats/4.php | 4 ++-- mod/glossary/lib.php | 13 +++++++++++-- mod/glossary/view.php | 5 ++--- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/mod/glossary/formats/1.php b/mod/glossary/formats/1.php index 2a87b3852d..ad47fcd665 100644 --- a/mod/glossary/formats/1.php +++ b/mod/glossary/formats/1.php @@ -23,8 +23,7 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry,$current echo "\ncellcontent\">"; if ($entry) { - echo format_text($entry->definition, $entry->format); - + glossary_print_entry_definition($entry); glossary_print_entry_icons($course, $cm, $glossary, $entry, $currentview, $cat); } else { diff --git a/mod/glossary/formats/4.php b/mod/glossary/formats/4.php index 4898b2b7fc..0b00e13d0b 100644 --- a/mod/glossary/formats/4.php +++ b/mod/glossary/formats/4.php @@ -15,11 +15,11 @@ function glossary_print_entry_by_format($course, $cm, $glossary, $entry, $mode=" glossary_print_entry_attachment($entry,"html","right"); echo '' . get_string("question","glossary") . ': '; - echo glossary_print_entry_concept($entry) . '
'; + glossary_print_entry_concept($entry) . '
'; echo '  ' . get_string("lastedited").': '.userdate($entry->timemodified) . ''; echo "cellcontent\">"; echo '' . get_string("answer","glossary") . ': '; - echo glossary_print_entry_definition($entry); + glossary_print_entry_definition($entry); glossary_print_entry_lower_section($course, $cm, $glossary, $entry, $mode, $hook,$printicons); diff --git a/mod/glossary/lib.php b/mod/glossary/lib.php index 520f865cb5..c181042a41 100644 --- a/mod/glossary/lib.php +++ b/mod/glossary/lib.php @@ -459,7 +459,11 @@ function glossary_print_entry($course, $cm, $glossary, $entry, $mode="",$hook="" return $return; } function glossary_print_entry_concept($entry) { - echo $entry->concept; + $text = format_text($entry->concept, $entry->format); + if (!empty($entry->highlight)) { + $text = highlight($entry->highlight, $text); + } + echo $text; } function glossary_print_entry_definition($entry) { @@ -508,7 +512,12 @@ function glossary_print_entry_definition($entry) { } } */ - echo format_text($definition, $entry->format); + + $text = format_text($definition, $entry->format); + if (!empty($entry->highlight)) { + $text = highlight($entry->highlight, $text); + } + echo $text; } function glossary_print_entry_aliases($course, $cm, $glossary, $entry,$mode="",$hook="", $type = 'print') { diff --git a/mod/glossary/view.php b/mod/glossary/view.php index 8a8baff77e..acca534210 100644 --- a/mod/glossary/view.php +++ b/mod/glossary/view.php @@ -403,10 +403,9 @@ $concept = $entry->concept; $definition = $entry->definition; - /// highligh the term if necessary + /// highlight the term if necessary if ($mode == 'search') { - $entry->concept = highlight($hook, $concept); - $entry->definition = highlight($hook, $definition); + $entry->highlight = $hook; } /// and finally print the entry. -- 2.39.5