Glossary: Fix glossary not showing in sessions.

pull/3564/head
Julio Montoya 5 years ago
parent 3e816ccd72
commit 597411018f
  1. 7
      main/glossary/index.php
  2. 16
      main/inc/lib/glossary.lib.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[] = '<script type="text/javascript" src="'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?add_ready=1&'.api_get_cidreq().'"></script>';
$htmlHeadXtra[] = '<script
type="text/javascript"
src="'.api_get_path(WEB_CODE_PATH).'glossary/glossary.js.php?add_ready=1&'.api_get_cidreq().'"></script>';
$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;

@ -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 = '<div class="pull-right">'.self::actions_filter($glossary_item[2], '', $glossary_item).'</div>';
$actions = '<div class="pull-right">'.
self::actions_filter($glossary_item[2], '', $glossary_item).
'</div>';
}
$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 = [];

Loading…
Cancel
Save