Twig Template fixes

- Use underscore variables as twig filters,
- Use common api_* names instead of custom, to avoid confusion.
pull/2487/head
jmontoyaa 9 years ago
parent 966dd36160
commit 2b735d0d0a
  1. 36
      main/inc/lib/template.lib.php
  2. 2
      main/template/default/course_progress/progress.tpl
  3. 2
      main/template/default/create_course/add_course.tpl
  4. 6
      main/template/default/layout/login_form.tpl
  5. 2
      main/template/default/layout/topbar.tpl
  6. 2
      main/template/default/layout/welcome_to_course.tpl
  7. 2
      main/template/default/session/about.tpl
  8. 4
      main/template/default/social/user_block.tpl
  9. 2
      main/template/default/user_portal/grid_session.tpl

@ -128,6 +128,11 @@ class Template
'get_lang',
'api_get_path',
'api_get_local_time',
'api_convert_and_format_date',
'api_is_allowed_to_edit',
'api_get_user_info',
'api_get_configuration_value',
'api_get_setting',
[
'name' => 'return_message',
'callable' => 'Display::return_message_and_translate'
@ -155,26 +160,6 @@ class Template
[
'name' => 'icon',
'callable' => 'Template::get_icon_path'
],
[
'name' => 'isAllowedToEdit',
'callable' => 'api_is_allowed_to_edit'
],
[
'name' => 'local_format_date',
'callable' => 'api_convert_and_format_date'
],
[
'name' => 'user_info',
'callable' => 'api_get_user_info'
],
[
'name' => 'get_configuration_value',
'callable' => 'api_get_configuration_value'
],
[
'name' => 'get_setting',
'callable' => 'api_get_setting'
]
];
@ -186,21 +171,20 @@ class Template
}
}
//Setting system variables
// Setting system variables
$this->set_system_parameters();
//Setting user variables
// Setting user variables
$this->set_user_parameters();
//Setting course variables
// Setting course variables
$this->set_course_parameters();
//Setting administrator variables
// Setting administrator variables
$this->setAdministratorParams();
$this->setCSSEditor();
//header and footer are showed by default
// Header and footer are showed by default
$this->set_footer($show_footer);
$this->set_header($show_header);

@ -2,7 +2,7 @@
{{ message }}
{{ flash_messages }}
{% if data is not empty %}
{% set tutor = false | isAllowedToEdit(true) %}
{% set tutor = false | api_convert_and_format_date(true) %}
<div id="course-progress" class="thematic">
<div class="row">
<div class="col-md-12">

@ -38,7 +38,7 @@
</div>
</div>
</div>
{% if ("allow_user_course_subscription_by_course_admin" | get_setting) == 'true' or _u.is_admin == 1 %}
{% if ("allow_user_course_subscription_by_course_admin" | api_get_setting) == 'true' or _u.is_admin == 1 %}
<div class="col-md-3">
<div class="thumbnail">

@ -13,13 +13,13 @@
{{ login_failed }}
{{ login_form }}
{% if "allow_lostpassword" | get_setting == 'true' or "allow_registration" | get_setting == 'true' %}
{% if "allow_lostpassword" | api_get_setting == 'true' or "allow_registration" | api_get_setting == 'true' %}
<ul class="nav nav-pills nav-stacked">
{% if "allow_registration" | get_setting != 'false' %}
{% if "allow_registration" | api_get_setting != 'false' %}
<li><a href="{{ _p.web_main }}auth/inscription.php"> {{ 'SignUp' | get_lang }} </a></li>
{% endif %}
{% if "allow_lostpassword" | get_setting == 'true' %}
{% if "allow_lostpassword" | api_get_setting == 'true' %}
<li><a href="{{ _p.web_main }}auth/lostPassword.php"> {{ 'LostPassword' | get_lang }} </a></li>
{% endif %}
</ul>

@ -10,7 +10,7 @@
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="{{ _p.web }}">
<img src="{{ "icon-chamilo.png"|icon(22) }}" title="{{ "siteName" | get_setting }}">
<img src="{{ "icon-chamilo.png"|icon(22) }}" title="{{ "siteName" | api_get_setting }}">
</a>
</div>
{% if _u.logged %}

@ -5,7 +5,7 @@
{{ "PleaseAllowUsALittleTimeToSubscribeYouToOneOfOurCourses"|get_lang }}
{% else %}
{% if "allow_students_to_browse_courses"|get_setting == 'true' %}
{% if "allow_students_to_browse_courses"|api_get_setting == 'true' %}
{{ "GoAheadAndBrowseOurCourseCatalogXOnceRegisteredYouWillSeeTheCourseHereX"|get_lang|format(course_catalog_link, course_list_link) }}
<a class="btn btn-primary btn-large" href="{{ course_catalog_url }}">
{{ "CourseCatalog"|get_lang }}

@ -239,7 +239,7 @@
{% if _u.logged and not is_subscribed %}
{{ subscribe_button }}
{% elseif not _u.logged %}
{% if 'allow_registration'|get_setting == 'true' %}
{% if 'allow_registration'|api_get_setting == 'true' %}
<a href="{{ _p.web_main ~ 'auth/inscription.php' ~ redirect_to_session }}" class="btn btn-info btn-lg">
<i class="fa fa-pencil" aria-hidden="true"></i> {{ 'SignUp'|get_lang }}
</a>

@ -41,7 +41,7 @@
{% endif %}
{% endfor %}
{% if 'allow_show_skype_account'|get_setting == 'true' and not skype_account is empty %}
{% if 'allow_show_skype_account'|api_get_setting == 'true' and not skype_account is empty %}
<li class="item">
<a href="skype:{{ skype_account }}?chat">
<span class="fa fa-skype fa-fw" aria-hidden="true"></span> {{ 'Skype'|get_lang }}
@ -49,7 +49,7 @@
</li>
{% endif %}
{% if 'allow_show_linkedin_url'|get_setting == 'true' and not linkedin_url is empty %}
{% if 'allow_show_linkedin_url'|api_get_setting == 'true' and not linkedin_url is empty %}
<li class="item">
<a href="{{ linkedin_url }}" target="_blank">
<span class="fa fa-linkedin fa-fw" aria-hidden="true"></span> {{ 'LinkedIn'|get_lang }}

@ -1,4 +1,4 @@
{% set group_courses = 'view_grid_courses_grouped_categories_in_sessions'|get_configuration_value %}
{% set group_courses = 'view_grid_courses_grouped_categories_in_sessions'| api_get_configuration_value %}
{% macro course_block(course, show_category) %}
<div class="col-xs-12 col-sm-6 col-md-4">

Loading…
Cancel
Save