Move no-data-view block code in a function

pull/3890/head
Julio Montoya 5 years ago
parent 1cd3cc5553
commit 62c3d838a5
  1. 14
      public/main/lp/lp_list.php
  2. 10
      src/CoreBundle/Resources/views/LearnPath/list.html.twig

@ -75,8 +75,7 @@ if (!empty($sessionId)) {
}
if ($is_allowed_to_edit) {
$actionLeft = '';
$actionLeft .= Display::url(
$actionLeft = Display::url(
Display::return_icon(
'new_learnpath.png',
get_lang('Create new learning path'),
@ -1009,4 +1008,15 @@ $template->assign('lp_is_shown', $lpIsShown);
$template->assign('filtered_category', $filteredCategoryId);
$template->assign('allow_min_time', $allowMinTime);
$template->assign('no_data', '');
if (false === $lpIsShown && api_is_allowed_to_edit()) {
$noData = Display::noDataView(
get_lang('Learning paths'),
Display::return_icon('scorms.png', '', [], 64),
get_lang('Create new learning path'),
api_get_self().'?'.api_get_cidreq().'&action=add_lp'
);
$template->assign('no_data', $noData);
}
$template->displayTemplate('@ChamiloCore/LearnPath/list.html.twig');

@ -578,15 +578,7 @@
</div>
{% endif %}
{% if is_allowed_to_edit and not lp_is_shown %}
<div id="no-data-view" class="tool-view">
<h2>{{ "Learning paths"|trans }}</h2>
<img src="{{ "scorms.png"|icon(64) }}" width="64" height="64">
<div class="controls">
<a href="{{ url('legacy_main', {name: 'lp/lp_controller.php'}) ~ "?" ~ course_url_params ~ "&action=add_lp" }}" class="btn btn-default">
{{ "Create new learning path"|trans }}
</a>
</div>
</div>
{{ no_data }}
{% endif %}
{% endautoescape %}
{% endblock %}
Loading…
Cancel
Save