From 597411018fcf5b66455dad5755e985767f0087ff Mon Sep 17 00:00:00 2001 From: Julio Montoya Date: Fri, 9 Oct 2020 11:10:57 +0200 Subject: [PATCH] Glossary: Fix glossary not showing in sessions. --- main/glossary/index.php | 7 ++++--- main/inc/lib/glossary.lib.php | 16 ++++++++++------ 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/main/glossary/index.php b/main/glossary/index.php index 60af9924a6..56b72a21fc 100755 --- a/main/glossary/index.php +++ b/main/glossary/index.php @@ -36,7 +36,7 @@ $(function() { modal: true }); $("#export_opener").click(function() { - var targetUrl = $(this).attr("href"); + var targetUrl = $(this).attr("href"); $( "#dialog-confirm" ).dialog({ width:400, height:300, @@ -447,14 +447,15 @@ switch ($action) { break; default: $tool_name = get_lang('List'); - $htmlHeadXtra[] = ''; + $htmlHeadXtra[] = ''; $htmlHeadXtra[] = api_get_js('jquery.highlight.js'); $content = GlossaryManager::display_glossary(); break; } Display::display_header($tool_name); - Display::display_introduction_section(TOOL_GLOSSARY); echo $content; diff --git a/main/inc/lib/glossary.lib.php b/main/inc/lib/glossary.lib.php index 1870ce28ad..18767013c5 100755 --- a/main/inc/lib/glossary.lib.php +++ b/main/inc/lib/glossary.lib.php @@ -484,7 +484,6 @@ class GlossaryManager } $content .= $table->return_table(); } - if ($view === 'list') { $content .= self::displayGlossaryList(); } @@ -504,7 +503,9 @@ class GlossaryManager foreach ($glossaryList as $key => $glossary_item) { $actions = ''; if (api_is_allowed_to_edit(null, true)) { - $actions = '
'.self::actions_filter($glossary_item[2], '', $glossary_item).'
'; + $actions = '
'. + self::actions_filter($glossary_item[2], '', $glossary_item). + '
'; } $content .= Display::panel($glossary_item[1], $glossary_item[0].' '.$actions); } @@ -525,6 +526,9 @@ class GlossaryManager $t_glossary = Database::get_course_table(TABLE_GLOSSARY); $course_id = api_get_course_int_id(); $session_id = (int) $session_id; + if (empty($session_id)) { + $session_id = api_get_session_id(); + } $sql_filter = api_get_session_condition($session_id, true, true); $keyword = isset($_GET['keyword']) ? Database::escape_string($_GET['keyword']) : ''; @@ -537,10 +541,12 @@ class GlossaryManager FROM $t_glossary WHERE c_id = $course_id $sql_filter $keywordCondition "; + $res = Database::query($sql); if ($res === false) { return 0; } + $obj = Database::fetch_object($res); return $obj->total; @@ -564,15 +570,12 @@ class GlossaryManager ) { $_user = api_get_user_info(); $view = self::getGlossaryView(); - - // Database table definition $t_glossary = Database::get_course_table(TABLE_GLOSSARY); $t_item_propery = Database::get_course_table(TABLE_ITEM_PROPERTY); + $col2 = ' '; if (api_is_allowed_to_edit(null, true)) { $col2 = ' glossary.glossary_id as col2, '; - } else { - $col2 = ' '; } // Condition for the session @@ -613,6 +616,7 @@ class GlossaryManager $keywordCondition ORDER BY col$column $direction LIMIT $from, $number_of_items"; + $res = Database::query($sql); $return = [];