fix tool-view - refs #2681

pull/2877/head
Alex Aragón 6 years ago
parent 0726d31425
commit fe94aa9beb
  1. 10
      main/course_progress/thematic.php
  2. 2
      main/inc/lib/glossary.lib.php
  3. 83
      main/template/default/course_description/index.html.twig
  4. 13
      main/template/default/course_progress/progress.html.twig
  5. 53
      main/template/default/glossary/list.html.twig
  6. 2
      main/template/default/link/index.html.twig
  7. 325
      src/ThemeBundle/Resources/views/LearnPath/list.html.twig

@ -19,9 +19,13 @@ $user_info = api_get_user_info();
$params = '&'.api_get_cidreq();
$tpl = new Template(get_lang('ThematicControl'));
$isTeacher = api_is_allowed_to_edit(null, true);
$tpl->assign('token', $url_token);
$tpl->assign('is_allowed_to_edit', $isTeacher);
$toolbar = null;
if (api_is_allowed_to_edit(null, true)) {
if ($isTeacher) {
switch ($action) {
case 'thematic_add':
case 'thematic_import_select':
@ -216,7 +220,7 @@ if ($action == 'thematic_list') {
$tpl->assign('data', $listThematic);
} //End for
}
$thematicLayout = $tpl->get_template('course_progress/progress.tpl');
$thematicLayout = $tpl->get_template('course_progress/progress.html.twig');
$content = $tpl->fetch($thematicLayout);
$tpl->assign('content', $content);
} elseif ($action == 'thematic_add' || $action == 'thematic_edit') {
@ -291,7 +295,7 @@ if ($action == 'thematic_list') {
$tpl->assign('actions', $toolbar);
if (!empty($html)) {
$tpl->assign('content', $html);
$thematicLayout = $tpl->get_template('course_progress/layout.tpl');
$thematicLayout = $tpl->get_template('course_progress/layout.html.twig');
}
if (!empty($message) && !empty($total_average_of_advances)) {
$tpl->assign('message', $message);

@ -461,7 +461,9 @@ class GlossaryManager
$list = self::getListGlossary(1000, 0, $orderList);
$tpl = new Template(null);
$isTeacher = api_is_allowed_to_edit(null, true);
$tpl->assign('data', $list);
$tpl->assign('is_allowed_to_edit', $isTeacher);
$layout = $tpl->get_template('glossary/list.html.twig');
$content .= $tpl->fetch($layout);

@ -4,41 +4,58 @@
{% for message in messages %}
{{ message }}
{% endfor %}
{% for description in listing.descriptions %}
{% if not description is empty %}
<div id="description_{{ description.description_type }}"
data-id="{{ description.id }}" data-c_id="{{ description.c_id }}" data-type="course_description">
{% set title %}
<h3 class="card-title">
{% if is_allowed_to_edit %}
<div class="float-right">
<div class="btn-group btn-group-sm" role="group">
{% if session_id == description.session_id %}
<a class="btn btn-light" href="{{ _p.web_self }}?action=edit&amp;id={{ description.id }}&amp;{{ _p.web_cid_query }}"
title="{{ 'Edit'|get_lang }}">
<i class="fas fa-pencil-alt"></i>
</a>
<a class="btn btn-light delete-swal" href="{{ _p.web_self }}?action=delete&amp;id={{ description.id }}&amp;{{ _p.web_cid_query }}"
title="{{ 'Delete'|get_lang }} {{ description.title_js }}">
<i class="far fa-trash-alt"></i>
</a>
{% else %}
<a class="btn btn-light disabled" href="#"
title="{{ 'EditionNotAvailableFromSession'|get_lang }}">
<i class="fas fa-pencil-alt"></i>
</a>
{% endif %}
{% if listing.descriptions|length != 0 %}
<div class="alert alert-info" role="alert">
{{ 'No description of the course is recorded'|trans }}
</div>
<div id="no-data-view" class="tool-view">
<h2>{{ "Course description"|trans }}</h2>
<img src="{{ "info.png"|icon(64) }}" width="64" height="64">
<div class="controls">
<a href="{{ web_self ~ "?" ~ _p.web_cid_query ~ "&action=edit&description_type=1" }}" class="btn btn-outline-primary">
{{ "Add description"|trans }}
</a>
</div>
</div>
{% else %}
{% for description in listing.descriptions %}
{% if not description is empty %}
<div id="description_{{ description.description_type }}"
data-id="{{ description.id }}" data-c_id="{{ description.c_id }}" data-type="course_description">
{% set title %}
<h3 class="card-title">
{% if is_allowed_to_edit %}
<div class="float-right">
<div class="btn-group btn-group-sm" role="group">
{% if session_id == description.session_id %}
<a class="btn btn-light" href="{{ _p.web_self }}?action=edit&amp;id={{ description.id }}&amp;{{ _p.web_cid_query }}"
title="{{ 'Edit'|get_lang }}">
<i class="fas fa-pencil-alt"></i>
</a>
<a class="btn btn-light delete-swal" href="{{ _p.web_self }}?action=delete&amp;id={{ description.id }}&amp;{{ _p.web_cid_query }}"
title="{{ 'Delete'|get_lang }} {{ description.title_js }}">
<i class="far fa-trash-alt"></i>
</a>
{% else %}
<a class="btn btn-light disabled" href="#"
title="{{ 'EditionNotAvailableFromSession'|get_lang }}">
<i class="fas fa-pencil-alt"></i>
</a>
{% endif %}
</div>
</div>
</div>
{% endif %}
{{ description.title }}
</h3>
{% endset %}
{% endif %}
{{ description.title }}
</h3>
{% endset %}
{{ macro.panel_box('description' ,title , description.content ) }}
{{ macro.panel_box('description' ,title , description.content ) }}
</div>
{% endif %}
{% endfor %}
</div>
{% endif %}
{% endfor %}
{% endif %}
{% endautoescape %}
{% endblock %}

@ -124,6 +124,17 @@
</div>
</div>
{% else %}
<div class="alert alert-info" role="alert">{{ 'ThereIsNoAThematicSection' | get_lang }}</div>
<div class="alert alert-info" role="alert">{{ 'There is no thematic section' | get_lang }}</div>
{% if is_allowed_to_edit %}
<div id="no-data-view" class="tool-view">
<h2>{{ "Educational programming"|trans }}</h2>
<img src="{{ "course_progress.png"|icon(64) }}" width="64" height="64">
<div class="controls">
<a href="{{ _p.web_self }}?{{ _p.web_cid_query ~ "&action=thematic_add" ~ token }}" class="btn btn-outline-primary">
{{ "Add thematic"|trans }}
</a>
</div>
</div>
{% endif %}
{% endif %}
{% endautoescape %}

@ -1,22 +1,39 @@
{% autoescape false %}
<div class="glossary mt-5">
{% for item in data %}
<div class="item-glossary mb-4 pl-2 pr-2">
{% if item.edit %}
<div class="float-right">
<div class="btn-group" role="group">
<a href="{{ item.edit }}" class="btn btn-light btn-sm">
<i class="fas fa-pencil-alt"></i>
</a>
<a title="{{ 'Confirm if you want to delete'|trans }}" href="{{ item.delete }}" class="btn btn-light btn-sm delete-swal">
<i class="far fa-trash-alt"></i>
</a>
</div>
{% if data is empty %}
<div class="alert alert-info" role="alert">{{ 'There is no thematic section' | get_lang }}</div>
{% if is_allowed_to_edit %}
<div id="no-data-view" class="tool-view">
<h2>{{ "Glossary"|trans }}</h2>
<img src="{{ "glossary.png"|icon(64) }}" width="64" height="64">
<div class="controls">
<a href="{{ _p.web_self }}?{{ _p.web_cid_query ~ "&action=addglossary" }}" class="btn btn-outline-primary">
{{ "Add glossary"|trans }}
</a>
</div>
{% endif %}
<h5 class="terms-title">{{ item.title }}</h5>
{{ item.description }}
</div>
{% endif %}
{% else %}
<div class="glossary mt-5">
{% for item in data %}
<div class="item-glossary mb-4 pl-2 pr-2">
{% if item.edit %}
<div class="float-right">
<div class="btn-group" role="group">
<a href="{{ item.edit }}" class="btn btn-light btn-sm">
<i class="fas fa-pencil-alt"></i>
</a>
<a title="{{ 'Confirm if you want to delete'|trans }}" href="{{ item.delete }}" class="btn btn-light btn-sm delete-swal">
<i class="far fa-trash-alt"></i>
</a>
</div>
</div>
{% endif %}
<h5 class="terms-title">{{ item.title }}</h5>
{{ item.description }}
</div>
{% endfor %}
</div>
{% endfor %}
</div>
{% endif %}
{% endautoescape %}

@ -77,7 +77,7 @@
</div>
</div>
{% endif %}
{% endif %}
{% endautoescape %}
{% endblock %}

@ -14,193 +14,198 @@
}
</script>
<h4 class="learning-lessons">{{ 'Learning lessons'|trans }}</h4>
<div class="accordion lp-accordion" id="lessons-learning">
{% 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 data|length != 0 %}
<div class="alert alert-info" role="alert">
{{ 'No lessons were recorded'|trans }}
</div>
{% else %}
<h4 class="learning-lessons">{{ 'Learning lessons'|trans }}</h4>
<div class="accordion lp-accordion" id="lessons-learning">
{% 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 show_category %}
<!--- TOOLBAR SET CATEGORY -->
{% if is_allowed_to_edit %}
{% set toolbar_actions %}
{% if lp_data.category.getId() > 0 %}
{% if not _c.session_id %}
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=add_lp_category&id=' ~ lp_data.category.getId() }}"
title="{{ "Edit"|trans }}">
<img src="{{ "edit.png"|icon }}" alt="{{ "Edit"|trans }}">
</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"|trans }}">
<img src="{{ "user.png"|icon }}" alt="{{ "AddUsers"|trans }}">
<!--- TOOLBAR SET CATEGORY -->
{% if is_allowed_to_edit %}
{% set toolbar_actions %}
{% if lp_data.category.getId() > 0 %}
{% if not _c.session_id %}
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=add_lp_category&id=' ~ lp_data.category.getId() }}"
title="{{ "Edit"|trans }}">
<img src="{{ "edit.png"|icon }}" alt="{{ "Edit"|trans }}">
</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"|trans }}">
<img src="{{ "user.png"|icon }}" alt="{{ "AddUsers"|trans }}">
</a>
{% endif %}
{% if loop.index0 == 1 %}
<a href="#">
<img src="{{ "up_na.png"|icon }}" alt="{{ "Move"|trans }}">
</a>
{% else %}
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=move_up_category&id=' ~ lp_data.category.getId() }}"
title="{{ "Move"|trans }}">
<img src="{{ "up.png"|icon }}" alt="{{ "Move"|trans }}">
</a>
{% endif %}
{% if (data|length - 1) == loop.index0 %}
<a href="#">
<img src="{{ "down_na.png"|icon }}" alt="{{ "Move"|trans }}">
</a>
{% else %}
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=move_down_category&id=' ~ lp_data.category.getId() }}"
title="{{ "Move"|trans }}">
<img src="{{ "down.png"|icon }}" alt="{{ "Move"|trans }}">
</a>
{% endif %}
{% endif %}
{% if loop.index0 == 1 %}
<a href="#">
<img src="{{ "up_na.png"|icon }}" alt="{{ "Move"|trans }}">
{% 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'|trans }}">
<img src="{{ 'invisible.png'|icon }}" alt="{{ 'Show'|trans }}">
</a>
{% else %}
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=move_up_category&id=' ~ lp_data.category.getId() }}"
title="{{ "Move"|trans }}">
<img src="{{ "up.png"|icon }}" alt="{{ "Move"|trans }}">
<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'|trans }}">
<img src="{{ 'visible.png'|icon }}" alt="{{ 'Hide'|trans }}">
</a>
{% endif %}
{% if (data|length - 1) == loop.index0 %}
<a href="#">
<img src="{{ "down_na.png"|icon }}" alt="{{ "Move"|trans }}">
{% 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'|trans }}">
<img src="{{ 'lp_publish_na.png'|icon }}"
alt="{{ 'LearnpathPublish'|trans }}">
</a>
{% else %}
<a href="{{ 'lp_controller.php?' ~ _p.web_cid_query ~ '&action=move_down_category&id=' ~ lp_data.category.getId() }}"
title="{{ "Move"|trans }}">
<img src="{{ "down.png"|icon }}" alt="{{ "Move"|trans }}">
<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'|trans }}">
<img src="{{ 'lp_publish.png'|icon }}" alt="{{ 'Hide'|trans }}">
</a>
{% 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"|trans }}">
<img src="{{ "delete.png"|icon }}" alt="{{ "Delete"|trans }}">
</a>
{% endif %}
{% 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'|trans }}">
<img src="{{ 'invisible.png'|icon }}" alt="{{ 'Show'|trans }}">
</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'|trans }}">
<img src="{{ 'visible.png'|icon }}" alt="{{ 'Hide'|trans }}">
</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'|trans }}">
<img src="{{ 'lp_publish_na.png'|icon }}"
alt="{{ 'LearnpathPublish'|trans }}">
</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'|trans }}">
<img src="{{ 'lp_publish.png'|icon }}" alt="{{ 'Hide'|trans }}">
</a>
{% 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"|trans }}">
<img src="{{ "delete.png"|icon }}" alt="{{ "Delete"|trans }}">
</a>
{% endif %}
{% endif %}
{% endset %}
{% endif %}
<!-- END TOOLBAR SET CATEGORY -->
{% set list_learnpath %}
<!-- LIST SCORM -->
{% if lp_data.lp_list %}
<ul class="list-group list-group-flush">
{% for row in lp_data.lp_list %}
<li class="list-group-item learnpath-item">
<div class="row">
<div class="col-md-5">
<h4 class="title">
<a href="{{ row.url_start }}">
{{ row.learnpath_icon }}
{{ row.title }}
{{ row.session_image }}
</a>
</h4>
{% if row.extra %}
<div class="extra">
{{ row.extra }}
</div>
{% endif %}
{% if row.action_build %}
<div class="lp-actions">
{{ 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 }}
{{ row.action_order }}
{{ row.action_update_scorm }}
{{ row.action_export_to_course_build }}
</div>
{% endif %}
</div>
<div class="col-md-5 col-md-offset-2">
{% if is_allowed_to_edit %}
<ul class="list-allowed">
{% if row.start_time %}
<li>
<strong>{{ "PublicationDate"|trans }} :</strong>
{{ row.start_time }}
</li>
{% endset %}
{% endif %}
<!-- END TOOLBAR SET CATEGORY -->
{% set list_learnpath %}
<!-- LIST SCORM -->
{% if lp_data.lp_list %}
<ul class="list-group list-group-flush">
{% for row in lp_data.lp_list %}
<li class="list-group-item learnpath-item">
<div class="row">
<div class="col-md-5">
<h4 class="title">
<a href="{{ row.url_start }}">
{{ row.learnpath_icon }}
{{ row.title }}
{{ row.session_image }}
</a>
</h4>
{% if row.extra %}
<div class="extra">
{{ row.extra }}
</div>
{% endif %}
<li>
<strong>{{ "ExpirationDate"|trans }} :</strong>
{{ row.end_time }}
</li>
</ul>
{{ row.dsp_progress }}
{% else %}
{% if not is_invitee %}
{% if row.action_build %}
<div class="lp-actions">
{{ 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 }}
{{ row.action_order }}
{{ row.action_update_scorm }}
{{ row.action_export_to_course_build }}
</div>
{% endif %}
</div>
<div class="col-md-5 col-md-offset-2">
{% if is_allowed_to_edit %}
<ul class="list-allowed">
{% if row.start_time %}
<li>
<strong>{{ "PublicationDate"|trans }} :</strong>
{{ row.start_time }}
</li>
{% endif %}
<li>
<strong>{{ "ExpirationDate"|trans }} :</strong>
{{ row.end_time }}
</li>
</ul>
{{ row.dsp_progress }}
{% else %}
{% if not is_invitee %}
{{ row.dsp_progress }}
{% endif %}
{% endif %}
{% endif %}
</div>
</div>
</div>
</div>
</li>
{% endfor %}
</ul>
{% endif %}
{% endset %}
<!-- END LIST SCORM -->
</li>
{% endfor %}
</ul>
{% endif %}
{% endset %}
<!-- END LIST SCORM -->
{% if categories|length > 1 and lp_data.category.id%}
<!--- START CARD LESSON --->
{% set counter = counter + 1 %}
<div class="card card-learnpath">
<h5 class="card-header" id="heading-{{ lp_data.category.id }}">
<a href="#" class="btn btn-link" data-toggle="collapse" data-target="#collapse-{{ lp_data.category.id }}" aria-expanded="true" aria-controls="collapse-{{ lp_data.category.id }}">
{{ lp_data.category.getName() }} - ({{ lp_data.lp_list|length }})
</a>
<div class="float-actions">
{{ toolbar_actions }}
</div>
</h5>
<div id="collapse-{{ lp_data.category.id }}" class="collapse {{ (counter < 2) ? 'show' : '' }}" aria-labelledby="heading-{{ lp_data.category.id }}" data-parent="#lessons-learning">
<div class="card-body">
{{ list_learnpath }}
{% if categories|length > 1 and lp_data.category.id%}
<!--- START CARD LESSON --->
{% set counter = counter + 1 %}
<div class="card card-learnpath">
<h5 class="card-header" id="heading-{{ lp_data.category.id }}">
<a href="#" class="btn btn-link" data-toggle="collapse" data-target="#collapse-{{ lp_data.category.id }}" aria-expanded="true" aria-controls="collapse-{{ lp_data.category.id }}">
{{ lp_data.category.getName() }} - ({{ lp_data.lp_list|length }})
</a>
<div class="float-actions">
{{ toolbar_actions }}
</div>
</h5>
<div id="collapse-{{ lp_data.category.id }}" class="collapse {{ (counter < 2) ? 'show' : '' }}" aria-labelledby="heading-{{ lp_data.category.id }}" data-parent="#lessons-learning">
<div class="card-body">
{{ list_learnpath }}
</div>
</div>
</div>
</div>
<!--- END CARD LESSON -->
{% else %}
{{ list_learnpath }}
<!--- END CARD LESSON -->
{% else %}
{{ list_learnpath }}
{% endif %}
{% endif %}
{% endif %}
{% endfor %}
</div>
{% endfor %}
</div>
{% endif %}
{% if is_allowed_to_edit and not lp_is_shown %}
<div id="no-data-view" class="tool-view">
<h2>{{ "LearningPaths"|trans }}</h2>
<h2>{{ "Learning paths"|trans }}</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-outline-primary">
{{ "LearnpathAddLearnpath"|trans }}
{{ "Learnpath add learnpath"|trans }}
</a>
</div>
</div>

Loading…
Cancel
Save