Fix lp item titles when is changed to HTML see BT#15259

pull/2990/head
Julio Montoya 6 years ago
parent 35b95f560d
commit db5984db10
  1. 32
      main/course_home/course_home.php
  2. 15
      main/inc/lib/course_home.lib.php
  3. 34
      main/lp/learnpath.class.php
  4. 4
      main/lp/lp_view.php
  5. 4
      main/template/default/learnpath/scorm_list.tpl

@ -227,7 +227,7 @@ if (!empty($lpAutoLaunch)) {
} else {
$session_key = 'lp_autolaunch_'.$session_id.'_'.api_get_course_int_id().'_'.api_get_user_id();
if (!isset($_SESSION[$session_key])) {
//redirecting to the LP
// Redirecting to the LP
$url = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq().'&action=view&lp_id='.$lp_data['id'];
$_SESSION[$session_key] = true;
@ -325,9 +325,8 @@ if ($documentAutoLaunch == 1) {
}
}
// Used in different pages
$tool_table = Database::get_course_table(TABLE_TOOL_LIST);
$temps = time();
$reqdate = "&reqdate=$temps";
/* Introduction section (editable by course admins) */
$content = Display::return_introduction_section(
@ -349,16 +348,22 @@ if (!empty($autoLaunchWarning)) {
);
}
if (api_get_setting('homepage_view') === 'activity' ||
api_get_setting('homepage_view') === 'activity_big'
) {
require 'activity.php';
} elseif (api_get_setting('homepage_view') === '2column') {
require '2column.php';
} elseif (api_get_setting('homepage_view') === '3column') {
require '3column.php';
} elseif (api_get_setting('homepage_view') === 'vertical_activity') {
require 'vertical_activity.php';
$homePageView = api_get_setting('homepage_view');
switch ($homePageView) {
case 'activity':
case 'activity_big':
require 'activity.php';
break;
case '2column':
require '2column.php';
break;
case '3column':
require '3column.php';
break;
case 'vertical_activity':
require 'vertical_activity.php';
break;
}
// Get session-career diagram
@ -417,6 +422,7 @@ Session::erase('_gid');
Session::erase('oLP');
Session::erase('lpobject');
api_remove_in_gradebook();
Exercise::cleanSessionVariables();
DocumentManager::removeGeneratedAudioTempFile();
$tpl = new Template(null);

@ -858,7 +858,7 @@ class CourseHome
$item = [];
$studentview = false;
$tool['original_link'] = $tool['link'];
if ($tool['image'] == 'scormbuilder.gif') {
if ($tool['image'] === 'scormbuilder.gif') {
// Check if the published learnpath is visible for student
$lpId = self::getPublishedLpIdFromLink($tool['link']);
if (api_is_allowed_to_edit(null, true)) {
@ -926,9 +926,8 @@ class CourseHome
switch ($visibility) {
case '0':
$info = pathinfo($tool['image']);
$basename = basename($tool['image'], '.'.$info['extension']); // $file is set to "index"
$basename = basename($tool['image'], '.'.$info['extension']);
$tool['image'] = $basename.'_na.'.$info['extension'];
$link['name'] = Display::return_icon(
'invisible.png',
get_lang('Activate'),
@ -977,7 +976,7 @@ class CourseHome
}
}
$item['visibility'] = null;
$item['visibility'] = '';
if (isset($lnk) && is_array($lnk)) {
foreach ($lnk as $this_link) {
if (empty($tool['adminlink'])) {
@ -986,8 +985,6 @@ class CourseHome
$this_link['name'].'</a>';
}
}
} else {
$item['visibility'] .= '';
}
// NOTE : Table contains only the image file name, not full path
@ -1002,14 +999,14 @@ class CourseHome
if ($tool['visibility'] == '0' && $toolAdmin != '1') {
$class = 'text-muted';
$info = pathinfo($tool['image']);
$basename = basename($tool['image'], '.'.$info['extension']); // $file is set to "index"
$basename = basename($tool['image'], '.'.$info['extension']);
$tool['image'] = $basename.'_na.'.$info['extension'];
}
$qm_or_amp = strpos($tool['link'], '?') === false ? '?' : '&';
// If it's a link, we don't add the cidReq
if ($tool['image'] == 'file_html.png' || $tool['image'] == 'file_html_na.png') {
if ($tool['image'] === 'file_html.png' || $tool['image'] === 'file_html_na.png') {
$tool['link'] = $tool['link'];
} else {
$tool['link'] = $tool['link'].$qm_or_amp.api_get_cidreq();
@ -1216,7 +1213,7 @@ class CourseHome
'external_na.gif',
];
$toolName = Security::remove_XSS(stripslashes($tool['name']));
$toolName = Security::remove_XSS(stripslashes(strip_tags($tool['name'])));
if (isset($tool['image']) && in_array($tool['image'], $already_translated_icons)) {
return $toolName;

@ -1834,7 +1834,7 @@ class learnpath
error_log('In learnpath::first() - First item is '.$this->get_current_item_id());
}
}
/**
* Gets the js library from the database.
*
@ -5992,8 +5992,37 @@ class learnpath
$return_audio = null;
$iconPath = api_get_path(SYS_CODE_PATH).'img/';
$mainUrl = api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?'.api_get_cidreq();
$countItems = count($arrLP);
for ($i = 0; $i < count($arrLP); $i++) {
$upIcon = Display::return_icon(
'up.png',
get_lang('Up'),
[],
ICON_SIZE_TINY
);
$disableUpIcon = Display::return_icon(
'up_na.png',
get_lang('Up'),
[],
ICON_SIZE_TINY
);
$downIcon = Display::return_icon(
'down.png',
get_lang('Down'),
[],
ICON_SIZE_TINY
);
$disableDownIcon = Display::return_icon(
'down_na.png',
get_lang('Down'),
[],
ICON_SIZE_TINY
);
for ($i = 0; $i < $countItems; $i++) {
$parent_id = $arrLP[$i]['parent_item_id'];
$title = $arrLP[$i]['title'];
$title_cut = cut($arrLP[$i]['title'], self::MAX_LP_ITEM_TITLE_LENGTH);
// Link for the documents
@ -6329,7 +6358,6 @@ class learnpath
Display::span($audio, ['class' => 'button_actions']);
}
$parent_id = $arrLP[$i]['parent_item_id'];
$default_data[$arrLP[$i]['id']] = $row;
$default_content[$arrLP[$i]['id']] = $arrLP[$i];

@ -606,7 +606,7 @@ if (Tracking::minimumTimeAvailable(api_get_session_id(), api_get_course_int_id()
$template->assign('lp_accumulate_work_time', $lpMinTime);
$template->assign('lp_mode', $lp->mode);
$template->assign('lp_title_scorm', $lp->name);
$template->assign('lp_title_scorm', $lp->get_name());
if (api_get_configuration_value('lp_view_accordion') === true && $lpType == 1) {
$template->assign('data_panel', $lp->getParentToc($get_toc_list));
} else {
@ -619,7 +619,7 @@ $template->assign(
'lp_preview_image',
Display::img(
$lpPreviewImagePath,
$lp->name,
$lp->getNameNoTags(),
[],
ICON_SIZE_BIG
)

@ -8,11 +8,11 @@
{% for item in data_list %}
<div id="toc_{{ item.id }}" class="{{ item.class }} item-{{ item.type }}">
{% if item.type == 'dir' %}
<div class="section {{ item.css_level }}" title="{{ item.description | e('html') }}">
<div class="section {{ item.css_level }}" title="{{ item.description | striptags | e('html') }}">
{{ item.title }}
</div>
{% else %}
<div class="item {{ item.css_level }}" title="{{ item.description | e('html')}}">
<div class="item {{ item.css_level }}" title="{{ item.description | striptags | e('html') }}">
<a name="atoc_{{ item.id }}"></a>
<a data-type="type-{{ item.type }}" class="items-list" href="#"
onclick="switch_item('{{ item.current_id }}','{{ item.id }}'); return false;">

Loading…
Cancel
Save