mod-glossary MDL-23026 Fixed regressions in conversion to OUTPUT for glossary auto-linking filter
This commit is contained in:
+18
-14
@@ -1,7 +1,15 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
*
|
||||
* @global moodle_database $DB
|
||||
* @global core_renderer $OUTPUT
|
||||
* @param int $courseid
|
||||
* @param string $text
|
||||
* @return string
|
||||
*/
|
||||
function glossary_filter($courseid, $text) {
|
||||
global $CFG, $DB, $OUTPUT;
|
||||
global $CFG, $DB, $OUTPUT, $GLOSSARY_EXCLUDECONCEPTS;
|
||||
|
||||
// Trivial-cache - keyed on $cachedcourseid
|
||||
static $nothingtodo;
|
||||
@@ -114,7 +122,6 @@ function glossary_filter($courseid, $text) {
|
||||
foreach ($concepts as $concept) {
|
||||
|
||||
$glossaryname = $glossaries[$concept->glossaryid];
|
||||
|
||||
if ($concept->category) { // Link to a category
|
||||
$title = strip_tags($glossaryname.': '.$strcategory.' '.$concept->concept);
|
||||
$href_tag_begin = '<a class="glossary autolink glossaryid'.$concept->glossaryid.'" title="'.$title.'" '.
|
||||
@@ -128,18 +135,16 @@ function glossary_filter($courseid, $text) {
|
||||
$encodedconcept = urlencode($concept->concept);
|
||||
$title = str_replace('"', "'", strip_tags($glossaryname.': '.$concept->concept));
|
||||
}
|
||||
$randid = html_writer::random_id($title);
|
||||
$href_tag_begin = '<a id="'.$randid.'" class="glossary autolink glossaryid'.$concept->glossaryid.'" title="'.$title.'" '.
|
||||
'href="'.$CFG->wwwroot.'/mod/glossary/showentry.php?courseid='.$courseid.
|
||||
'&concept='.$encodedconcept.'" >';
|
||||
|
||||
//attach the onclick event
|
||||
$link = '/mod/glossary/showentry.php?courseid='.$courseid.'\&concept='.$encodedconcept;
|
||||
$action = new popup_action('click', $link.'&popup=1', 'entry', array('height'=>600,'width'=>450));
|
||||
$OUTPUT->add_action_handler($action, $randid);
|
||||
$randid = html_writer::random_id('glossary');
|
||||
$link = new moodle_url('/mod/glossary/showentry.php', array('courseid'=>$courseid, 'concept'=>$encodedconcept));
|
||||
$href_tag_begin = html_writer::start_tag('a', array(
|
||||
'href'=>$link,
|
||||
'id'=>$randid,
|
||||
'title'=>$title,
|
||||
'class'=>'glossary autolink glossaryid'.$concept->glossaryid));
|
||||
//attach the onclick events
|
||||
$OUTPUT->add_action_handler(new popup_action('click', new moodle_url($link, array('popup'=>'1')), 'entry', array('height'=>600,'width'=>450)), $randid);
|
||||
}
|
||||
|
||||
|
||||
$conceptlist[] = new filterobject($concept->concept, $href_tag_begin, '</a>',
|
||||
$concept->casesensitive, $concept->fullmatch);
|
||||
}
|
||||
@@ -147,7 +152,6 @@ function glossary_filter($courseid, $text) {
|
||||
$conceptlist = filter_remove_duplicates($conceptlist);
|
||||
}
|
||||
|
||||
global $GLOSSARY_EXCLUDECONCEPTS;
|
||||
if(!empty($GLOSSARY_EXCLUDECONCEPTS)) {
|
||||
$reducedconceptlist=array();
|
||||
foreach($conceptlist as $concept) {
|
||||
|
||||
Reference in New Issue
Block a user