657 lines
33 KiB
Smarty
657 lines
33 KiB
Smarty
<style>
|
|
.js-hide-order-icons {display: none !important;}
|
|
.js-hide-cat-order-icons {display: none !important;}
|
|
.lp-empty-placeholder {opacity: .6; font-style: italic;}
|
|
</style>
|
|
<script>
|
|
function confirmation(name) {
|
|
if (confirm("{{ "AreYouSureToDeleteJS"|get_lang }} \"" + name + "\" ?")) {
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
document.addEventListener("DOMContentLoaded", function () {
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
if (urlParams.has("reduced")) {
|
|
document.body.addEventListener("click", function (event) {
|
|
let target = event.target;
|
|
while (target && target.tagName !== "A" && target.tagName !== "BUTTON") {
|
|
target = target.parentElement;
|
|
}
|
|
if (target && target.tagName === "A" && target.href) {
|
|
event.preventDefault();
|
|
let newUrl = new URL(target.href, window.location.origin);
|
|
newUrl.searchParams.delete("reduced");
|
|
window.top.location.href = newUrl.href;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
</script>
|
|
{% set configuration = 'lp_category_accordion'|api_get_configuration_value %}
|
|
<div class="lp-accordion panel-group" id="lp-accordion" role="tablist" aria-multiselectable="true">
|
|
{% set number = 0 %}
|
|
{% for lp_data in data %}
|
|
{% set show_category = true %}
|
|
{% if filtered_category and filtered_category != lp_data.category.id %}
|
|
{% set show_category = false %}
|
|
{% endif %}
|
|
|
|
{% if show_category %}
|
|
{% if configuration == 0 %}
|
|
<!-- old view -->
|
|
<div class="lp-category-item" data-cat-id="{{ lp_data.category.getId() }}">
|
|
{% if categories|length > 1 and lp_data.category.id %}
|
|
{% if is_allowed_to_edit %}
|
|
<h3 class="page-header">
|
|
{% if is_allowed_to_edit %}
|
|
<!-- drag handle for category -->
|
|
<span class="drag-handle" title="Drag category to reorder" style="cursor:move;margin-right:6px;">
|
|
<img src="{{ 'move_everywhere.png'|icon }}" alt="drag">
|
|
</span>
|
|
{% endif %}
|
|
|
|
{{ lp_data.category.getName()|trim }}
|
|
{% if lp_data.category.sessionId %}{{ session_star_icon }}{% endif %}
|
|
|
|
{% if lp_data.category.getId() > 0 and lp_data.category.sessionId == _c.session_id %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=add_lp_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'Edit'|get_lang }}"><img src="{{ 'edit.png'|icon }}" alt="{{ 'Edit'|get_lang }}"></a>
|
|
|
|
{% if subscription_settings.allow_add_users_to_lp_category %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=add_users_to_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'AddUsers'|get_lang }}"><img src="{{ 'user.png'|icon }}" alt="{{ 'AddUsers'|get_lang }}"></a>
|
|
{% endif %}
|
|
|
|
<!-- keep yellow arrows but hide them with CSS -->
|
|
<span class="js-hide-cat-order-icons">
|
|
{% if loop.index0 == 1 or first_session_category == lp_data.category.id %}
|
|
<a href="#"><img src="{{ 'up_na.png'|icon }}" alt="{{ 'Move'|get_lang }}"></a>
|
|
{% else %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=move_up_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'Move'|get_lang }}"><img src="{{ 'up.png'|icon }}" alt="{{ 'Move'|get_lang }}"></a>
|
|
{% endif %}
|
|
{% if (data|length - 1) == loop.index0 %}
|
|
<a href="#"><img src="{{ 'down_na.png'|icon }}" alt="{{ 'Move'|get_lang }}"></a>
|
|
{% else %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=move_down_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'Move'|get_lang }}"><img src="{{ 'down.png'|icon }}" alt="{{ 'Move'|get_lang }}"></a>
|
|
{% endif %}
|
|
</span>
|
|
{% endif %}
|
|
|
|
{% if lp_data.category_visibility == 0 %}
|
|
<a href="lp_controller.php?{{ _p.web_cid_query ~ '&' ~ {'action':'toggle_category_visibility','id':lp_data.category.id,'new_status':1}|url_encode }}"
|
|
title="{{ 'Show'|get_lang }}"><img src="{{ 'invisible.png'|icon }}" alt="{{ 'Show'|get_lang }}"></a>
|
|
{% else %}
|
|
<a href="lp_controller.php?{{ _p.web_cid_query ~ '&' ~ {'action':'toggle_category_visibility','id':lp_data.category.id,'new_status':0}|url_encode }}"
|
|
title="{{ 'Hide'|get_lang }}"><img src="{{ 'visible.png'|icon }}" alt="{{ 'Hide'|get_lang }}"></a>
|
|
{% endif %}
|
|
|
|
{% if lp_data.category_is_published == 0 %}
|
|
<a href="lp_controller.php?{{ _p.web_cid_query ~ '&' ~ {'action':'toggle_category_publish','id':lp_data.category.id,'new_status':1}|url_encode }}"
|
|
title="{{ 'LearnpathPublish'|get_lang }}"><img src="{{ 'lp_publish_na.png'|icon }}" alt="{{ 'LearnpathPublish'|get_lang }}"></a>
|
|
{% else %}
|
|
<a href="lp_controller.php?{{ _p.web_cid_query ~ '&' ~ {'action':'toggle_category_publish','id':lp_data.category.id,'new_status':0}|url_encode }}"
|
|
title="{{ 'LearnpathDoNotPublish'|get_lang }}"><img src="{{ 'lp_publish.png'|icon }}" alt="{{ 'Hide'|get_lang }}"></a>
|
|
{% endif %}
|
|
|
|
{% if lp_data.category.sessionId == _c.session_id %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=delete_lp_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'Delete'|get_lang }}"><img src="{{ 'delete.png'|icon }}" alt="{{ 'Delete'|get_lang }}"></a>
|
|
{% endif %}
|
|
</h3>
|
|
{% elseif lp_data.lp_list is not empty %}
|
|
<h3 class="page-header">
|
|
{% if is_allowed_to_edit %}
|
|
<span class="drag-handle" title="Drag category to reorder" style="cursor:move;margin-right:6px;">
|
|
<img src="{{ 'move_everywhere.png'|icon }}" alt="drag">
|
|
</span>
|
|
{% endif %}
|
|
{{ lp_data.category.getName() }}
|
|
</h3>
|
|
{% endif %}
|
|
{% elseif lp_data.lp_list is not empty %}
|
|
<h3 class="page-header">{{ lp_data.category.getName() }}</h3>
|
|
{% endif %}
|
|
|
|
{% if lp_data.lp_list %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ "Title"|get_lang }}</th>
|
|
{% if is_allowed_to_edit %}
|
|
<th>{{ "PublicationDate"|get_lang }}</th>
|
|
<th>{{ "ExpirationDate"|get_lang }}</th>
|
|
<th>{{ "Progress"|get_lang }}</th>
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ "AuthoringOptions"|get_lang }}</th>
|
|
{% else %}
|
|
{% if allow_dates_for_student %}
|
|
<th>{{ "PublicationDate"|get_lang }}</th>
|
|
<th>{{ "ExpirationDate"|get_lang }}</th>
|
|
{% endif %}
|
|
{% if not is_invitee %}<th>{{ "Progress"|get_lang }}</th>{% endif %}
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ "Actions"|get_lang }}</th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody class="lp-sortable" data-cat-id="{{ lp_data.category.getId() }}">
|
|
{% for row in lp_data.lp_list %}
|
|
<tr class="lp-row" data-lp-id="{{ row.lp_id|default(row.url_start|split('lp_id=')[1]|split('&')[0]) }}">
|
|
<td>
|
|
{% if is_allowed_to_edit %}
|
|
<!-- drag handle for LP row -->
|
|
<span class="drag-handle" title="Drag to reorder" style="cursor:move;margin-right:6px;">
|
|
<img src="{{ 'move_everywhere.png'|icon }}" alt="drag">
|
|
</span>
|
|
{% endif %}
|
|
{{ row.learnpath_icon }}
|
|
<a href="{{ row.url_start }}">{{ row.title }} {{ row.session_image }}</a>
|
|
{{ row.extra }}
|
|
</td>
|
|
{% if is_allowed_to_edit %}
|
|
<td>{% if row.start_time %}<span class="small">{{ row.start_time }}</span>{% endif %}</td>
|
|
<td><span class="small">{{ row.end_time }}</span></td>
|
|
<td>{{ row.dsp_progress }}</td>
|
|
{% if allow_min_time %}<td>{% if row.info_time_prerequisite %}{{ row.info_time_prerequisite }}{% endif %}</td>{% endif %}
|
|
{% else %}
|
|
{% if allow_dates_for_student %}
|
|
<td>{% if row.start_time %}<span class="small">{{ row.start_time }}</span>{% endif %}</td>
|
|
<td><span class="small">{{ row.end_time }}</span></td>
|
|
{% endif %}
|
|
{% if not is_invitee %}<td>{{ row.dsp_progress }}</td>{% endif %}
|
|
{% if allow_min_time %}<td>{% if row.info_time_prerequisite %}{{ row.info_time_prerequisite }}{% endif %}</td>{% endif %}
|
|
{% endif %}
|
|
<td>
|
|
{{ row.action_build }}
|
|
{{ row.action_edit }}
|
|
{{ row.action_visible }}
|
|
{{ row.action_tracking }}
|
|
{{ row.action_publish }}
|
|
{{ row.action_subscribe_users }}
|
|
{{ row.action_serious_game }}
|
|
{{ row.action_reinit }}
|
|
{{ row.action_default_view }}
|
|
{{ row.action_debug }}
|
|
{{ row.action_export }}
|
|
{{ row.action_copy }}
|
|
{{ row.action_auto_launch }}
|
|
{{ row.action_pdf }}
|
|
{{ row.action_delete }}
|
|
<span class="js-hide-order-icons">{{ row.action_order }}</span> {# keep arrows, hide via CSS #}
|
|
{{ row.action_update_scorm }}
|
|
{{ row.action_export_to_course_build }}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% elseif is_allowed_to_edit %}
|
|
<!-- empty category: allow dropping LPs here -->
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ "Title"|get_lang }}</th>
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ is_allowed_to_edit ? "AuthoringOptions"|get_lang : "Actions"|get_lang }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="lp-sortable" data-cat-id="{{ lp_data.category.getId() }}">
|
|
<tr class="lp-empty-placeholder"><td colspan="3"><em>Drop a learning path here</em></td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<!-- end old view -->
|
|
{% else %}
|
|
<!-- new accordion view -->
|
|
{% if lp_data.category.id == 0 %}
|
|
{% if is_allowed_to_edit %}
|
|
{% if lp_data.lp_list %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ "Title"|get_lang }}</th>
|
|
{% if is_allowed_to_edit %}
|
|
<th>{{ "PublicationDate"|get_lang }}</th>
|
|
<th>{{ "ExpirationDate"|get_lang }}</th>
|
|
<th>{{ "Progress"|get_lang }}</th>
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ "AuthoringOptions"|get_lang }}</th>
|
|
{% else %}
|
|
{% if allow_dates_for_student %}
|
|
<th>{{ "PublicationDate"|get_lang }}</th>
|
|
<th>{{ "ExpirationDate"|get_lang }}</th>
|
|
{% endif %}
|
|
{% if not is_invitee %}<th>{{ "Progress"|get_lang }}</th>{% endif %}
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ "Actions"|get_lang }}</th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody class="lp-sortable" data-cat-id="{{ lp_data.category.getId() }}">
|
|
{% for row in lp_data.lp_list %}
|
|
<tr class="lp-row" data-lp-id="{{ row.lp_id|default(row.url_start|split('lp_id=')[1]|split('&')[0]) }}">
|
|
<td>
|
|
{% if is_allowed_to_edit %}
|
|
<!-- Drag handle (accordion/no-category) -->
|
|
<span class="drag-handle" title="Drag to reorder" style="cursor:move;margin-right:6px;">
|
|
<img src="{{ 'move_everywhere.png'|icon }}" alt="drag">
|
|
</span>
|
|
{% endif %}
|
|
{{ row.learnpath_icon }}
|
|
<a href="{{ row.url_start }}">{{ row.title }} {{ row.session_image }} {{ row.extra }}</a>
|
|
</td>
|
|
{% if is_allowed_to_edit %}
|
|
<td>{% if row.start_time %}<span class="small">{{ row.start_time }}</span>{% endif %}</td>
|
|
<td><span class="small">{{ row.end_time }}</span></td>
|
|
<td>{{ row.dsp_progress }}</td>
|
|
{% if allow_min_time %}<td>{% if row.info_time_prerequisite %}{{ row.info_time_prerequisite }}{% endif %}</td>{% endif %}
|
|
{% else %}
|
|
{% if allow_dates_for_student %}
|
|
<td>{% if row.start_time %}<span class="small">{{ row.start_time }}</span>{% endif %}</td>
|
|
<td><span class="small">{{ row.end_time }}</span></td>
|
|
{% endif %}
|
|
{% if not is_invitee %}<td>{{ row.dsp_progress }}</td>{% endif %}
|
|
{% if allow_min_time %}<td>{% if row.info_time_prerequisite %}{{ row.info_time_prerequisite }}{% endif %}</td>{% endif %}
|
|
{% endif %}
|
|
<td>
|
|
{{ row.action_build }}
|
|
{{ row.action_edit }}
|
|
{{ row.action_visible }}
|
|
{{ row.action_tracking }}
|
|
{{ row.action_publish }}
|
|
{{ row.action_subscribe_users }}
|
|
{{ row.action_serious_game }}
|
|
{{ row.action_reinit }}
|
|
{{ row.action_default_view }}
|
|
{{ row.action_debug }}
|
|
{{ row.action_export }}
|
|
{{ row.action_copy }}
|
|
{{ row.action_auto_launch }}
|
|
{{ row.action_pdf }}
|
|
{{ row.action_delete }}
|
|
<span class="js-hide-order-icons">{{ row.action_order }}</span>
|
|
{{ row.action_update_scorm }}
|
|
{{ row.action_export_to_course_build }}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<!-- empty no-category bucket (accordion) -->
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ "Title"|get_lang }}</th>
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ "AuthoringOptions"|get_lang }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="lp-sortable" data-cat-id="{{ lp_data.category.getId() }}">
|
|
<tr class="lp-empty-placeholder"><td colspan="3"><em>Drop a learning path here</em></td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
{% else %}
|
|
<div id="not-category" class="panel panel-default">
|
|
<div class="panel-body">
|
|
{% for row in lp_data.lp_list %}
|
|
<div class="lp-item">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
|
|
<a href="{{ row.url_start }}">{{ row.title }} {{ row.session_image }} {{ row.extra }}</a>
|
|
</div>
|
|
<div class="col-md-3">{{ row.dsp_progress }}</div>
|
|
{% if allow_dates_for_student %}
|
|
<div class="col-md-2">
|
|
{% if row.start_time %}<span class="small">{{ row.start_time }}</span>{% endif %}
|
|
<span class="small">{{ row.end_time }}</span>
|
|
</div>
|
|
{% endif %}
|
|
{% if allow_min_time %}
|
|
<div class="col-md-2">{% if row.info_time_prerequisite %}{{ row.info_time_prerequisite }}{% endif %}</div>
|
|
{% endif %}
|
|
<div class="col-md-1">{{ row.action_pdf }} {{ row.action_export }}</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if categories|length > 1 and lp_data.category.id %}
|
|
{% set number = number + 1 %}
|
|
<!-- category panel item (accordion) -->
|
|
<div class="panel panel-default lp-category-item" data-cat-id="{{ lp_data.category.getId() }}">
|
|
<div class="panel-heading" role="tab" id="heading-{{ lp_data.category.getId() }}">
|
|
{% if is_allowed_to_edit %}
|
|
<div class="tools-actions pull-right">
|
|
{% if lp_data.category.getId() > 0 and lp_data.category.sessionId == _c.session_id %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=add_lp_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'Edit'|get_lang }}"><img src="{{ 'edit.png'|icon }}" alt="{{ 'Edit'|get_lang }}"></a>
|
|
|
|
{% if subscription_settings.allow_add_users_to_lp_category %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=add_users_to_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'AddUsers'|get_lang }}"><img src="{{ 'user.png'|icon }}" alt="{{ 'AddUsers'|get_lang }}"></a>
|
|
{% endif %}
|
|
|
|
<!-- keep and hide yellow arrows also in accordion -->
|
|
<span class="js-hide-cat-order-icons">
|
|
{% if loop.index0 == 1 %}
|
|
<a href="#"><img src="{{ 'up_na.png'|icon }}" alt="{{ 'Move'|get_lang }}"></a>
|
|
{% else %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=move_up_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'Move'|get_lang }}"><img src="{{ 'up.png'|icon }}" alt="{{ 'Move'|get_lang }}"></a>
|
|
{% endif %}
|
|
{% if (data|length - 1) == loop.index0 %}
|
|
<a href="#"><img src="{{ 'down_na.png'|icon }}" alt="{{ 'Move'|get_lang }}"></a>
|
|
{% else %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=move_down_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'Move'|get_lang }}"><img src="{{ 'down.png'|icon }}" alt="{{ 'Move'|get_lang }}"></a>
|
|
{% endif %}
|
|
</span>
|
|
{% endif %}
|
|
|
|
{% if lp_data.category_visibility == 0 %}
|
|
<a href="lp_controller.php?{{ _p.web_cid_query ~ '&' ~ {'action':'toggle_category_visibility','id':lp_data.category.id,'new_status':1}|url_encode }}"
|
|
title="{{ 'Show'|get_lang }}"><img src="{{ 'invisible.png'|icon }}" alt="{{ 'Show'|get_lang }}"></a>
|
|
{% else %}
|
|
<a href="lp_controller.php?{{ _p.web_cid_query ~ '&' ~ {'action':'toggle_category_visibility','id':lp_data.category.id,'new_status':0}|url_encode }}"
|
|
title="{{ 'Hide'|get_lang }}"><img src="{{ 'visible.png'|icon }}" alt="{{ 'Hide'|get_lang }}"></a>
|
|
{% endif %}
|
|
|
|
{% if lp_data.category_visibility == 1 %}
|
|
{% if lp_data.category_is_published == 0 %}
|
|
<a href="lp_controller.php?{{ _p.web_cid_query ~ '&' ~ {'action':'toggle_category_publish','id':lp_data.category.id,'new_status':1}|url_encode }}"
|
|
title="{{ 'LearnpathPublish'|get_lang }}"><img src="{{ 'lp_publish_na.png'|icon }}" alt="{{ 'LearnpathPublish'|get_lang }}"></a>
|
|
{% else %}
|
|
<a href="lp_controller.php?{{ _p.web_cid_query ~ '&' ~ {'action':'toggle_category_publish','id':lp_data.category.id,'new_status':0}|url_encode }}"
|
|
title="{{ 'LearnpathDoNotPublish'|get_lang }}"><img src="{{ 'lp_publish.png'|icon }}" alt="{{ 'Hide'|get_lang }}"></a>
|
|
{% endif %}
|
|
{% else %}
|
|
<img src="{{ 'lp_publish_na.png'|icon }}" alt="{{ 'LearnpathPublish'|get_lang }}">
|
|
{% endif %}
|
|
|
|
{% if not _c.session_id %}
|
|
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=delete_lp_category&id=' ~ lp_data.category.getId() }}"
|
|
title="{{ 'Delete'|get_lang }}"><img src="{{ 'delete.png'|icon }}" alt="{{ 'Delete'|get_lang }}"></a>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
<h4 class="panel-title">
|
|
{% if is_allowed_to_edit %}
|
|
<!-- drag handle for category (accordion header) -->
|
|
<span class="drag-handle" title="Drag category to reorder" style="cursor:move;margin-right:6px;">
|
|
<img src="{{ 'move_everywhere.png'|icon }}" alt="drag">
|
|
</span>
|
|
{% endif %}
|
|
<a role="button" data-toggle="collapse" data-parent="#lp-accordion"
|
|
href="#collapse-{{ lp_data.category.getId() }}"
|
|
aria-expanded="{{ number == 1 ? 'true' : 'false' }}"
|
|
aria-controls="collapse-{{ lp_data.category.getId() }}">
|
|
{{ lp_data.category.getName() }}
|
|
{% if lp_data.category.sessionId %}{{ session_star_icon }}{% endif %}
|
|
</a>
|
|
</h4>
|
|
</div>
|
|
<div id="collapse-{{ lp_data.category.getId() }}"
|
|
class="panel-collapse collapse {{ (number == 1 ? 'in' : '') }}"
|
|
role="tabpanel" aria-labelledby="heading-{{ lp_data.category.getId() }}">
|
|
<div class="panel-body">
|
|
{% if lp_data.lp_list %}
|
|
{% if is_allowed_to_edit %}
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ "Title"|get_lang }}</th>
|
|
{% if is_allowed_to_edit %}
|
|
<th>{{ "PublicationDate"|get_lang }}</th>
|
|
<th>{{ "ExpirationDate"|get_lang }}</th>
|
|
<th>{{ "Progress"|get_lang }}</th>
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ "AuthoringOptions"|get_lang }}</th>
|
|
{% else %}
|
|
{% if allow_dates_for_student %}
|
|
<th>{{ "PublicationDate"|get_lang }}</th>
|
|
<th>{{ "ExpirationDate"|get_lang }}</th>
|
|
{% endif %}
|
|
{% if not is_invitee %}<th>{{ "Progress"|get_lang }}</th>{% endif %}
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ "Actions"|get_lang }}</th>
|
|
{% endif %}
|
|
</tr>
|
|
</thead>
|
|
|
|
<tbody class="lp-sortable" data-cat-id="{{ lp_data.category.getId() }}">
|
|
{% for row in lp_data.lp_list %}
|
|
<tr class="lp-row" data-lp-id="{{ row.lp_id|default(row.url_start|split('lp_id=')[1]|split('&')[0]) }}">
|
|
<td>
|
|
{% if is_allowed_to_edit %}
|
|
<span class="drag-handle" title="Drag to reorder" style="cursor:move;margin-right:6px;">
|
|
<img src="{{ 'move_everywhere.png'|icon }}" alt="drag">
|
|
</span>
|
|
{% endif %}
|
|
{{ row.learnpath_icon }}
|
|
<a href="{{ row.url_start }}">{{ row.title }} {{ row.session_image }} {{ row.extra }}</a>
|
|
</td>
|
|
{% if is_allowed_to_edit %}
|
|
<td>{% if row.start_time %}<span class="small">{{ row.start_time }}</span>{% endif %}</td>
|
|
<td><span class="small">{{ row.end_time }}</span></td>
|
|
<td>{{ row.dsp_progress }}</td>
|
|
{% if allow_min_time %}<td>{% if row.info_time_prerequisite %}{{ row.info_time_prerequisite }}{% endif %}</td>{% endif %}
|
|
{% else %}
|
|
{% if allow_dates_for_student %}
|
|
<td>{% if row.start_time %}<span class="small">{{ row.start_time }}</span>{% endif %}</td>
|
|
<td><span class="small">{{ row.end_time }}</span></td>
|
|
{% endif %}
|
|
{% if not is_invitee %}<td>{{ row.dsp_progress }}</td>{% endif %}
|
|
{% if allow_min_time %}<td>{% if row.info_time_prerequisite %}{{ row.info_time_prerequisite }}{% endif %}</td>{% endif %}
|
|
{% endif %}
|
|
<td>
|
|
{{ row.action_build }}
|
|
{{ row.action_edit }}
|
|
{{ row.action_visible }}
|
|
{{ row.action_tracking }}
|
|
{{ row.action_publish }}
|
|
{{ row.action_subscribe_users }}
|
|
{{ row.action_serious_game }}
|
|
{{ row.action_reinit }}
|
|
{{ row.action_default_view }}
|
|
{{ row.action_debug }}
|
|
{{ row.action_export }}
|
|
{{ row.action_copy }}
|
|
{{ row.action_auto_launch }}
|
|
{{ row.action_pdf }}
|
|
{{ row.action_delete }}
|
|
<span class="js-hide-order-icons">{{ row.action_order }}</span>
|
|
{{ row.action_update_scorm }}
|
|
{{ row.action_export_to_course_build }}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
{% for row in lp_data.lp_list %}
|
|
<div class="lp-item">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<i class="fa fa-chevron-circle-right" aria-hidden="true"></i>
|
|
<a href="{{ row.url_start }}">{{ row.title }} {{ row.session_image }} {{ row.extra }}</a>
|
|
</div>
|
|
<div class="col-md-3">{{ row.dsp_progress }}</div>
|
|
{% if allow_dates_for_student %}
|
|
<div class="col-md-2">
|
|
{% if row.start_time %}<span class="small">{{ row.start_time }}</span>{% endif %}
|
|
<span class="small">{{ row.end_time }}</span>
|
|
</div>
|
|
{% endif %}
|
|
{% if allow_min_time %}
|
|
<div class="col-md-2">{% if row.info_time_prerequisite %}{{ row.info_time_prerequisite }}{% endif %}</div>
|
|
{% endif %}
|
|
<div class="col-md-1">{{ row.action_pdf }} {{ row.action_export }}</div>
|
|
</div>
|
|
</div>
|
|
{% endfor %}
|
|
{% endif %}
|
|
{% elseif is_allowed_to_edit %}
|
|
<!-- empty category (accordion) -->
|
|
<div class="table-responsive">
|
|
<table class="table table-hover table-striped">
|
|
<thead>
|
|
<tr>
|
|
<th>{{ "Title"|get_lang }}</th>
|
|
{% if allow_min_time %}<th>{{ "TimeSpentTimeRequired"|get_lang }}</th>{% endif %}
|
|
<th>{{ "AuthoringOptions"|get_lang }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="lp-sortable" data-cat-id="{{ lp_data.category.getId() }}">
|
|
<tr class="lp-empty-placeholder"><td colspan="3"><em>Drop a learning path here</em></td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
<!-- end accordion view -->
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endfor %}
|
|
</div>
|
|
|
|
{% if not is_invitee and lp_is_shown and allow_min_time %}
|
|
<div id="lp_notification_control" class="controls text-center">
|
|
{% if not is_ending %}
|
|
<button class="btn btn-primary" type="button" disabled>
|
|
{{ 'IHaveFinishedTheLessonsNotifyTheTeacher'|get_lang }}
|
|
</button>
|
|
{% else %}
|
|
<a href="{{ web_self ~ "?" ~ _p.web_cid_query ~ "&action=send_notify_teacher" }}" class="btn btn-primary">
|
|
{{ 'IHaveFinishedTheLessonsNotifyTheTeacher'|get_lang }}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if not is_invitee and lp_is_shown and allow_min_time and is_ending %}
|
|
<div id="lp_download_file_after_finish" class="controls text-center">
|
|
{{ download_files_after_finish }}
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if is_allowed_to_edit and not lp_is_shown %}
|
|
<div id="no-data-view">
|
|
<h2>{{ "LearningPaths"|get_lang }}</h2>
|
|
<img src="{{ "scorms.png"|icon(64) }}" width="64" height="64">
|
|
<div class="controls">
|
|
<a href="{{ web_self ~ "?" ~ _p.web_cid_query ~ "&action=add_lp" }}" class="btn btn-default">
|
|
{{ "LearnpathAddLearnpath"|get_lang }}
|
|
</a>
|
|
</div>
|
|
</div>
|
|
{% endif %}
|
|
<script>
|
|
(function($){
|
|
if (!$ || !$.fn || !$.fn.sortable) { return; }
|
|
|
|
var cidreq = "{{ _p.web_cid_query|e('js') }}";
|
|
var hasSession = {{ _c.session_id ? 'true' : 'false' }};
|
|
var canEdit = {{ is_allowed_to_edit ? 'true' : 'false' }};
|
|
var secToken = "{{ sec_token|e('js') }}"; // CSRF token required by controller
|
|
|
|
function refreshPlaceholders(){
|
|
if (!canEdit) { return; }
|
|
$(".lp-sortable").each(function(){
|
|
var $tbody = $(this);
|
|
var hasRows = $tbody.find("tr.lp-row").length > 0;
|
|
var $ph = $tbody.find(".lp-empty-placeholder");
|
|
if (!hasRows && $ph.length === 0) {
|
|
$tbody.append('<tr class="lp-empty-placeholder"><td colspan="3"><em>Drop a learning path here</em></td></tr>');
|
|
} else if (hasRows) {
|
|
$ph.remove();
|
|
}
|
|
});
|
|
}
|
|
|
|
/* LP rows drag & drop (move within and across categories) */
|
|
$(".lp-sortable").sortable({
|
|
connectWith: ".lp-sortable",
|
|
items: "> tr.lp-row",
|
|
handle: ".drag-handle",
|
|
cancel: ".lp-empty-placeholder",
|
|
placeholder: "ui-state-highlight",
|
|
tolerance: "pointer",
|
|
update: function(){
|
|
if (hasSession) { return; } // keep current behavior in sessions
|
|
var lists = {};
|
|
$(".lp-sortable").each(function(){
|
|
var catId = String($(this).data("cat-id") || 0);
|
|
lists[catId] = [];
|
|
$(this).find("tr.lp-row").each(function(){
|
|
var id = parseInt($(this).data("lp-id"),10);
|
|
if (!isNaN(id)) { lists[catId].push(id); }
|
|
});
|
|
});
|
|
// Send CSRF token
|
|
$.post("lp_controller.php?action=reorder_lps&"+cidreq, {lists: lists, sec_token: secToken})
|
|
.fail(function(){ console.warn("Failed to save LP order"); });
|
|
refreshPlaceholders();
|
|
},
|
|
receive: function(){
|
|
$(this).find(".lp-empty-placeholder").remove();
|
|
}
|
|
});
|
|
|
|
/* Categories drag & drop (works for old view containers and accordion panels) */
|
|
$("#lp-accordion").sortable({
|
|
items: "> .lp-category-item",
|
|
handle: ".drag-handle",
|
|
placeholder: "ui-state-highlight",
|
|
tolerance: "pointer",
|
|
cancel: ".panel-collapse, a, .tools-actions",
|
|
update: function(){
|
|
var order = [];
|
|
$("#lp-accordion > .lp-category-item").each(function(){
|
|
var catId = parseInt($(this).data("cat-id"),10);
|
|
if (!isNaN(catId)) { order.push(catId); }
|
|
});
|
|
if (order.length) {
|
|
// Send CSRF token
|
|
$.post("lp_controller.php?action=reorder_categories&"+cidreq, {order: order, sec_token: secToken})
|
|
.fail(function(){ console.warn("Failed to save category order"); });
|
|
}
|
|
}
|
|
});
|
|
|
|
if (hasSession) {
|
|
/* in session mode, keep current behavior (no drag/save) */
|
|
$(".lp-sortable").sortable("disable");
|
|
$("#lp-accordion").sortable("disable");
|
|
}
|
|
|
|
refreshPlaceholders();
|
|
})(window.jQuery);
|
|
</script>
|