Merge pull request #4507 from AngelFQC/BT20399

LP: Improvements to additional button to course home - refs BT20399
pull/4524/head
Yannick Warnier 3 years ago committed by GitHub
commit 10156e3d15
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      main/install/configuration.dist.php
  2. 12
      main/lp/lp_edit.php
  3. 6
      main/lp/lp_view.php
  4. 20
      main/template/default/learnpath/view.tpl

@ -1031,6 +1031,10 @@ ALTER TABLE skill_rel_course ADD CONSTRAINT FK_E7CEC7FA613FECDF FOREIGN KEY (ses
'add_extra_quit_to_home_icon' => false,
],
];*/
// To enable the add_extra_quit_to_home_icon feature for single LP, add the following extrafield:
/*
INSERT INTO extra_field (extra_field_type, field_type, variable, display_text, default_value, field_order, visible_to_self, visible_to_others, changeable, filter, created_at) VALUES (6, 13, 'add_extra_quit_button', 'Add extra quit button', '', 0, 1, 0, 1, 0, NOW());
*/
// Force to hide the invisible course documents in sessions
//$_configuration['hide_invisible_course_documents_in_sessions'] = false;

@ -326,6 +326,18 @@ $defaults['expired_on'] = (!empty($expired_on))
? api_get_local_time($expired_on)
: date('Y-m-d 12:00:00', time() + 84600);
$defaults['subscribe_users'] = $learnPath->getSubscribeUsers();
$display = api_get_configuration_value('lp_view_settings')['display'] ?? [];
if (!empty($display)) {
$addExtraQuitToHomeIcon = $display['add_extra_quit_to_home_icon'] ?? false;
$value = (new ExtraFieldValue('lp'))->get_values_by_handler_and_field_variable($lpId, 'add_extra_quit_button');
if (!is_array($value) && $addExtraQuitToHomeIcon) {
$defaults['extra_add_extra_quit_button[extra_add_extra_quit_button]'] = true;
}
}
$form->setDefaults($defaults);
Display::display_header(get_lang('CourseSettings'), 'Path');

@ -566,6 +566,12 @@ if (!empty($display)) {
$showMenu = isset($display['show_toolbar_by_default']) && $display['show_toolbar_by_default'] ? 1 : 0;
$navigationInTheMiddle = isset($display['navigation_in_the_middle']) && $display['navigation_in_the_middle'] ? 1 : 0;
$addExtraQuitToHomeIcon = $display['add_extra_quit_to_home_icon'] ?? false;
$value = (new ExtraFieldValue('lp'))->get_values_by_handler_and_field_variable($lp_id, 'add_extra_quit_button');
if (is_array($value)) {
$addExtraQuitToHomeIcon = $value['value'] !== '0';
}
}
$template->assign('show_toolbar_by_default', $showMenu);

@ -156,15 +156,17 @@
<div class="lp-view-tabs">
<div id="navTabsbar" class="nav-tabs-bar">
{% if add_extra_quit_to_home_icon %}
<a style="margin: 3px 10px 0 0; position: relative; z-index: 10"
role="button"
title="{{ 'Close'|get_lang }}"
href="{{ button_home_url }}"
class="icon-toolbar pull-right" target="_self"
onclick="window.parent.API.save_asset();"
>
<em class="fa fa-times" aria-hidden="true"></em>
</a>
<div id="extra-quit-lp">
<a style="margin: 3px 10px 0 0; position: relative; z-index: 10"
role="button"
title="{{ 'Close'|get_lang }}"
href="{{ button_home_url }}"
class="icon-toolbar pull-right" target="_self"
onclick="window.parent.API.save_asset();"
>
<em class="fa fa-times" aria-hidden="true"></em>
</a>
</div>
{% endif %}
<ul id="navTabs" class="nav nav-tabs tabs-right" role="tablist">

Loading…
Cancel
Save