Minor: Format code - refs BT#21588

pull/5464/head
Angel Fernando Quiroz Campos 7 months ago
parent 326565fb1f
commit e743d30496
  1. 1
      src/CoreBundle/Resources/views/LearnPath/menubar.html.twig
  2. 60
      src/CoreBundle/Resources/views/LearnPath/scorm_list.html.twig
  3. 248
      src/CoreBundle/Resources/views/LearnPath/view.html.twig

@ -37,7 +37,6 @@
{{ navigation_bar }}
</div>
<a title="{{ 'Options'|trans }}" class="menu-button icons" href="#">
<i class="mdi-menu mdi" aria-hidden="true"></i>
</a>
</nav>

@ -16,29 +16,17 @@
{% if item.itemType == 'dir' %}
{% set accordionClass = 'accordion' %}
{% endif %}
<div
id="toc_{{ item.iid }}"
class=" scorm_item_normal {{ itemStatusClass }} {{ itemClass }} item-{{ item.itemType }} {{ accordionClass }}"
>
<div id="toc_{{ item.iid }}"
class=" scorm_item_normal {{ itemStatusClass }} {{ itemClass }} item-{{ item.itemType }} {{ accordionClass }}">
{% if item.itemType == 'dir' %}
<div
class="section {{ itemLevel }}"
title="{{ item.description | striptags | e('html') }}"
>
<div class="section {{ itemLevel }}" title="{{ item.description | striptags | e('html') }}">
{{ item.title | raw }}
</div>
{% else %}
<div
class="item {{ itemLevel }}"
title="{{ item.description | striptags | e('html') }}"
>
<div class="item {{ itemLevel }}" title="{{ item.description | striptags | e('html') }}">
<a name="atoc_{{ item.iid }}"></a>
<a
data-type="type-{{ item.itemType }}"
class="items-list"
href="#"
onclick="switch_item('{{ lp_current_item_id }}','{{ item.iid }}'); return false;"
>
<a data-type="type-{{ item.itemType }}" class="items-list" href="#"
onclick="switch_item('{{ lp_current_item_id }}','{{ item.iid }}'); return false;">
{{ item.title | raw }}
</a>
</div>
@ -72,9 +60,7 @@
{% if data_panel is not empty %}
<div id="learning_path_toc">
<div class="scorm-title">
<h4>
{{ lp_title_scorm }}
</h4>
<h4>{{ lp_title_scorm }}</h4>
</div>
{% macro tree(item) %}
@ -89,8 +75,7 @@
{{ item.is_parent_of_current ? 'parent_of_current_item' : '' }}
{{ item.is_chapter ? 'chapter' : '' }}
"
data-lp-id="{{ item.id }}"
>
data-lp-id="{{ item.id }}">
<div class="status-heading">
<div id="heading_item_{{ item.id }}" class="panel-heading" role="tab">
{% if item.children|length %}
@ -135,28 +120,33 @@
{% endif %}
{% endautoescape %}
<script>
document.addEventListener('DOMContentLoaded', function() {
document.addEventListener("DOMContentLoaded", function() {
setTimeout(function() {
var lpCurrentItemId = '{{ lp_current_item_id }}';
var currentElement = document.getElementById('toc_' + lpCurrentItemId);
var lpCurrentItemId = '{{ lp_current_item_id }}'
var currentElement = document.getElementById("toc_" + lpCurrentItemId)
if (currentElement) {
var parentContainer = currentElement.closest('.item-children');
var previousSibling;
var parentContainer = currentElement.closest(".item-children")
var previousSibling
if (parentContainer) {
previousSibling = parentContainer.previousElementSibling;
previousSibling = parentContainer.previousElementSibling
}
if (previousSibling) {
previousSibling.click();
var parentContainer2 = previousSibling.closest('.item-children');
var previousSibling2;
previousSibling.click()
var parentContainer2 = previousSibling.closest(".item-children")
var previousSibling2
if (parentContainer2) {
previousSibling2 = parentContainer2.previousElementSibling;
previousSibling2 = parentContainer2.previousElementSibling
}
if (previousSibling2) {
previousSibling2.click()
}
}
}
}, 1000);
});
}, 1000)
})
</script>

@ -33,9 +33,27 @@
{% if lp_accumulate_work_time != '' %}
{% set lp_progress %}
<style>
#timer .container{display:table;background:#777;color:#eee;font-weight:bold;width:100%;text-align:center;text-shadow:1px 1px 4px #999;}
#timer .container div{display:table-cell;font-size:24px;padding:0px;width:20px;}
#timer .container .divider{width:10px;color:#ddd;}
#timer .container {
display: table;
background: #777;
color: #eee;
font-weight: bold;
width: 100%;
text-align: center;
text-shadow: 1px 1px 4px #999;
}
#timer .container div {
display: table-cell;
font-size: 24px;
padding: 0px;
width: 20px;
}
#timer .container .divider {
width: 10px;
color: #ddd;
}
</style>
<script>
$(function() {
@ -43,26 +61,26 @@
hour: parseInt($("#hour").text()),
minute: parseInt($("#minute").text()),
second: parseInt($("#second").text())
};
clearInterval(window.timerInterval);
}
clearInterval(window.timerInterval)
window.timerInterval = setInterval(function() {
// Seconds
timerData.second++;
timerData.second++
if (timerData.second >= 60) {
timerData.second = 0;
timerData.minute++;
timerData.second = 0
timerData.minute++
}
// Minutes
if (timerData.minute >= 60) {
timerData.minute = 0;
timerData.hour++;
timerData.minute = 0
timerData.hour++
}
$("#hour").text(timerData.hour < 10 ? '0' + timerData.hour : timerData.hour);
$("#minute").text(timerData.minute < 10 ? '0' + timerData.minute : timerData.minute);
$("#second").text(timerData.second < 10 ? '0' + timerData.second : timerData.second);
}, 1000);
$("#hour").text(timerData.hour < 10 ? "0" + timerData.hour : timerData.hour)
$("#minute").text(timerData.minute < 10 ? "0" + timerData.minute : timerData.minute)
$("#second").text(timerData.second < 10 ? "0" + timerData.second : timerData.second)
}, 1000)
})
</script>
<div class="row">
@ -188,27 +206,15 @@
<div role="tabpanel" class="tab-pane active" id="lp-view-content">
<div id="wrapper-iframe">
{% if lp_mode == 'fullscreen' %}
<iframe
id="content_id_blank"
name="content_name_blank"
src="blank.php"
style="width:100%; height:100%"
border="0"
frameborder="0"
allowfullscreen="true"
webkitallowfullscreen="true"
<iframe id="content_id_blank" name="content_name_blank" src="blank.php"
style="width:100%; height:100%" border="0" frameborder="0"
allowfullscreen="true" webkitallowfullscreen="true"
mozallowfullscreen="true">
</iframe>
{% else %}
<iframe
id="content_id"
name="content_name"
src="{{ iframe_src }}"
style="width:100%; height:100%"
border="0"
frameborder="0"
allowfullscreen="true"
webkitallowfullscreen="true"
<iframe id="content_id" name="content_name" src="{{ iframe_src }}"
style="width:100%; height:100%" border="0" frameborder="0"
allowfullscreen="true" webkitallowfullscreen="true"
mozallowfullscreen="true">
</iframe>
{% endif %}
@ -226,97 +232,97 @@
<script>
var LPViewUtils = {
setHeightLPToc: function() {
var scormInfoHeight = $('#scorm-info').outerHeight(true);
$('#learning_path_toc').css({
var scormInfoHeight = $("#scorm-info").outerHeight(true)
$("#learning_path_toc").css({
top: scormInfoHeight
});
})
}
}
};
$(function() {
$('.menu-button').on('click', function() {
$('.circle').toggleClass('open');
$('.menu-button').toggleClass('menu-button-selected');
});
$(".menu-button").on("click", function() {
$(".circle").toggleClass("open")
$(".menu-button").toggleClass("menu-button-selected")
})
if (/iPhone|iPod|iPad|Safari/.test(navigator.userAgent)) {
if (!/Chrome/.test(navigator.userAgent)) {
// Fix an issue where you cannot scroll below first screen in
// learning paths on Apple devices
document.getElementById('wrapper-iframe').setAttribute(
'style',
'width:100%; overflow:auto; position:auto; -webkit-overflow-scrolling:touch !important;'
);
$('#wrapper-iframe').before('<a style="position:fixed;right:5px;top:5px;z-index:1001;" target="_blank" href="{{ iframe_src }}" >Open PDF on Safari</a>');
document.getElementById("wrapper-iframe").setAttribute(
"style",
"width:100%; overflow:auto; position:auto; -webkit-overflow-scrolling:touch !important;"
)
$("#wrapper-iframe").before('<a style="position:fixed;right:5px;top:5px;z-index:1001;" target="_blank" href="{{ iframe_src }}" >Open PDF on Safari</a>')
// Fix another issue whereby buttons do not react to click below
// second screen in learning paths on Apple devices
document.getElementById('content_id').setAttribute('style', 'overflow: auto;');
document.getElementById("content_id").setAttribute("style", "overflow: auto;")
}
}
{% if lp_mode == 'embedframe' %}
$('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
e.preventDefault();
$('#learning_path_main').toggleClass('lp-view-collapsed');
$('#lp-view-expand-toggle i.mdi').toggleClass('mdi-arrow-expand-horizontal');
$('#lp-view-expand-toggle i.mdi').toggleClass('mdi-arrow-collapse-horizontal');
var className = $('#lp-view-expand-toggle i.mdi').attr('class');
if (className == 'mdi-arrow-collapse-horizontal') {
$(this).attr('title', '{{ "Expand" | trans }}');
$("#lp-view-expand-button, #lp-view-expand-toggle").on("click", function(e) {
e.preventDefault()
$("#learning_path_main").toggleClass("lp-view-collapsed")
$("#lp-view-expand-toggle i.mdi").toggleClass("mdi-arrow-expand-horizontal")
$("#lp-view-expand-toggle i.mdi").toggleClass("mdi-arrow-collapse-horizontal")
var className = $("#lp-view-expand-toggle i.mdi").attr("class")
if (className == "mdi-arrow-collapse-horizontal") {
$(this).attr("title", '{{ "Expand" | trans }}')
} else {
$(this).attr('title', '{{ "Collapse" | trans }}');
$(this).attr("title", '{{ "Collapse" | trans }}')
}
if($('#navTabBar').is(':hidden')) {
$('#navTabBar').show();
if ($("#navTabBar").is(":hidden")) {
$("#navTabBar").show()
} else {
$('#navTabBar').hide();
$("#navTabBar").hide()
}
});
})
{% else %}
$('#lp-view-expand-button, #lp-view-expand-toggle').on('click', function (e) {
e.preventDefault();
$('#learning_path_main').toggleClass('lp-view-collapsed');
$('#lp-view-expand-toggle i.mdi').toggleClass('mdi-arrow-collapse-horizontal');
$('#lp-view-expand-toggle i.mdi').toggleClass('mdi-arrow-expand-horizontal');
$("#lp-view-expand-button, #lp-view-expand-toggle").on("click", function(e) {
e.preventDefault()
$("#learning_path_main").toggleClass("lp-view-collapsed")
$("#lp-view-expand-toggle i.mdi").toggleClass("mdi-arrow-collapse-horizontal")
$("#lp-view-expand-toggle i.mdi").toggleClass("mdi-arrow-expand-horizontal")
var className = $('#lp-view-expand-toggle i.mdi').attr('class');
if (className == 'mdi-arrow-expand-horizontal') {
$(this).attr('title', '{{ "Expand" | trans }}');
var className = $("#lp-view-expand-toggle i.mdi").attr("class")
if (className == "mdi-arrow-expand-horizontal") {
$(this).attr("title", '{{ "Expand" | trans }}')
} else {
$(this).attr('title', '{{ "Collapse" | trans }}');
$(this).attr("title", '{{ "Collapse" | trans }}')
}
});
})
{% endif %}
$('.lp-view-tabs').on('click', '.disabled', function (e) {
e.preventDefault();
});
$(".lp-view-tabs").on("click", ".disabled", function(e) {
e.preventDefault()
})
$('a#ui-option').on('click', function (e) {
e.preventDefault();
var icon = $(this).children('.mdi');
if (icon.is('.mdi-chevron-up')) {
icon.removeClass('mdi-chevron-up').addClass('mdi-chevron-down');
$("a#ui-option").on("click", function(e) {
e.preventDefault()
var icon = $(this).children(".mdi")
if (icon.is(".mdi-chevron-up")) {
icon.removeClass("mdi-chevron-up").addClass("mdi-chevron-down")
return;
return
}
icon.removeClass('mdi-chevron-down').addClass('mdi-chevron-up');
});
icon.removeClass("mdi-chevron-down").addClass("mdi-chevron-up")
})
LPViewUtils.setHeightLPToc();
LPViewUtils.setHeightLPToc()
$('.image-avatar img').on('load', function () {
LPViewUtils.setHeightLPToc();
});
$(".image-avatar img").on("load", function() {
LPViewUtils.setHeightLPToc()
})
$('.scorm_item_normal a, #scorm-previous, #scorm-next').on('click', function () {
$(".scorm_item_normal a, #scorm-previous, #scorm-next").on("click", function() {
//$('.lp-view-tabs').animate({opacity: 0}, 500);
});
})
$('#learning_path_right_zone #lp-view-content iframe').on('load', function () {
$("#learning_path_right_zone #lp-view-content iframe").on("load", function() {
//$('.lp-view-tabs a[href="#lp-view-content"]').tab('show');
//$('.lp-view-tabs').animate({opacity: 1}, 500);
});
})
{% if lp_mode == 'embedded' %}
/*$('.scorm_item_normal a, #scorm-previous, #scorm-next').on('click', function () {
@ -328,7 +334,7 @@
{% endif %}
//loadForumThread({{ lp_id }}, {{ lp_current_item_id }});
checkCurrentItemPosition({{ lp_current_item_id }});
checkCurrentItemPosition({{ lp_current_item_id }})
{% if glossary_extra_tools in glossary_tool_available_list %}
// Loads the glossary library.
@ -340,14 +346,16 @@
},
"#content_id",
[
{ type:"script", id:"_fr1", src:"{{ jquery_web_path }}", deps: [
{
type: "script", id: "_fr1", src: "{{ jquery_web_path }}", deps: [
{ type: "script", id: "_fr4", src: "{{ jquery_ui_js_web_path }}" },
{ type: "script", id: "_fr2", src: "{{ _p.web_lib }}javascript/jquery.highlight.js" },
{{ fix_link }}
]},
{ type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
]
);
},
{ type: "stylesheet", id: "_fr5", src: "{{ jquery_ui_css_web_path }}" }
]
)
{% elseif show_glossary_in_documents == 'isautomatic' %}
$.frameReady(
function() {
@ -355,14 +363,16 @@
},
"#content_id",
[
{ type:"script", id:"_fr1", src:"{{ jquery_web_path }}", deps: [
{
type: "script", id: "_fr1", src: "{{ jquery_web_path }}", deps: [
{ type: "script", id: "_fr4", src: "{{ jquery_ui_js_web_path }}" },
{ type: "script", id: "_fr2", src: "{{ _p.web_lib }}javascript/jquery.highlight.js" },
{{ fix_link }}
]},
{ type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
]
);
},
{ type: "stylesheet", id: "_fr5", src: "{{ jquery_ui_css_web_path }}" }
]
)
{% elseif fix_link != '' %}
$.frameReady(
function() {
@ -370,46 +380,48 @@
},
"#content_id",
[
{ type:"script", id:"_fr1", src:"{{ jquery_web_path }}", deps: [
{
type: "script", id: "_fr1", src: "{{ jquery_web_path }}", deps: [
{ type: "script", id: "_fr4", src: "{{ jquery_ui_js_web_path }}" },
{{ fix_link }}
]},
{ type:"stylesheet", id:"_fr5", src:"{{ jquery_ui_css_web_path }}"},
]
);
},
{ type: "stylesheet", id: "_fr5", src: "{{ jquery_ui_css_web_path }}" }
]
)
{% endif %}
})();
})()
{% endif %}
{% if disable_js_in_lp_view == 0 %}
$(function() {
var arr = ['link', 'sco'];
var arr = ["link", "sco"]
if ($.inArray(olms.lms_item_type, arr) == -1) {
{{ frame_ready }}
}
});
})
{% endif %}
$(window).on('resize', function () {
LPViewUtils.setHeightLPToc();
});
});
$(window).on("resize", function() {
LPViewUtils.setHeightLPToc()
})
})
</script>
<script>
document.addEventListener('DOMContentLoaded', function () {
var acc = document.getElementsByClassName("accordion");
var i;
document.addEventListener("DOMContentLoaded", function() {
var acc = document.getElementsByClassName("accordion")
var i
for (i = 0; i < acc.length; i++) {
acc[i].addEventListener("click", function() {
this.classList.toggle("active");
var panel = this.nextElementSibling;
if (panel.style.display == 'block') {
panel.style.display = "none";
this.classList.toggle("active")
var panel = this.nextElementSibling
if (panel.style.display == "block") {
panel.style.display = "none"
} else {
panel.style.display = "block";
panel.style.display = "block"
}
});
})
}
});
})
</script>
<style>
.item-children {

Loading…
Cancel
Save