Browse Source

Merge branch '1.11.x' of github.com:chamilo/chamilo-lms into 1.11.x

jmontoyaa 7 years ago
parent
commit
7254ff27bc
46 changed files with 89 additions and 70 deletions
  1. 1 0
      documentation/changelog.html
  2. 1 1
      main/inc/lib/course.lib.php
  3. 29 11
      main/inc/lib/template.lib.php
  4. 1 1
      main/inc/lib/userportal.lib.php
  5. 1 1
      main/template/default/admin/career_dashboard.tpl
  6. 1 1
      main/template/default/admin/gradebook_dependency.tpl
  7. 1 1
      main/template/default/admin/gradebook_list.tpl
  8. 1 1
      main/template/default/admin/resource_sequence.tpl
  9. 2 2
      main/template/default/auth/inscription.tpl
  10. 1 1
      main/template/default/auth/session_catalog.tpl
  11. 1 1
      main/template/default/career/diagram.tpl
  12. 1 1
      main/template/default/forum/list.tpl
  13. 2 2
      main/template/default/javascript/editor/ckeditor/elfinder.tpl
  14. 1 1
      main/template/default/layout/blank.tpl
  15. 1 1
      main/template/default/layout/head.tpl
  16. 1 1
      main/template/default/layout/hot_courses.tpl
  17. 2 2
      main/template/default/layout/layout_1_col.tpl
  18. 5 5
      main/template/default/layout/layout_2_col.tpl
  19. 1 1
      main/template/default/layout/layout_3_col.tpl
  20. 1 1
      main/template/default/layout/no_layout.tpl
  21. 4 4
      main/template/default/layout/page.tpl
  22. 3 3
      main/template/default/layout/page_header.tpl
  23. 2 2
      main/template/default/layout/show_footer.tpl
  24. 2 2
      main/template/default/layout/show_header.tpl
  25. 1 1
      main/template/default/learnpath/view.tpl
  26. 2 2
      main/template/default/mail/mail.tpl
  27. 1 1
      main/template/default/portfolio/list.html.twig
  28. 1 1
      main/template/default/session/resume_session.tpl
  29. 1 1
      main/template/default/skill/skill_wheel.js.tpl
  30. 1 1
      main/template/default/skill/skill_wheel.tpl
  31. 1 1
      main/template/default/skill/skill_wheel_student.tpl
  32. 1 1
      main/template/default/social/add_groups.tpl
  33. 1 1
      main/template/default/social/edit_profile.tpl
  34. 1 1
      main/template/default/social/friends.tpl
  35. 1 1
      main/template/default/social/group_view.tpl
  36. 1 1
      main/template/default/social/group_waiting_list.tpl
  37. 1 1
      main/template/default/social/groups.tpl
  38. 1 1
      main/template/default/social/groups_topics.tpl
  39. 1 1
      main/template/default/social/home.tpl
  40. 1 1
      main/template/default/social/inbox.tpl
  41. 1 1
      main/template/default/social/invitations.tpl
  42. 1 1
      main/template/default/social/myfiles.tpl
  43. 1 1
      main/template/default/social/profile.tpl
  44. 1 1
      main/template/default/social/search.tpl
  45. 1 1
      main/template/default/social/whoisonline.tpl
  46. 1 1
      main/template/default/work/view.tpl

+ 1 - 0
documentation/changelog.html

@@ -126,6 +126,7 @@
         <h4>For developers and sysadmins</h4>
         <ul>
             <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/604950ff544088ee30632b9a85857cfee2adbc1d">604950ff</a>)  Don't clear class for audio/video when removing xss - refs BT#14026 </li>
+            <li>(<a href="https://github.com/chamilo/chamilo-lms/commit/da569547cd679b267faac7a8a55247fce150d35c">da569547</a>) Add new twig filter to get template file inside template</li>
         </ul>
         <h3>Improvements (minor features) and debug</h3>
         <h3>Stylesheets and theming</h3>

+ 1 - 1
main/inc/lib/course.lib.php

@@ -2075,7 +2075,7 @@ class CourseManager
                         'li',
                         Display::return_icon(
                             'teacher.png',
-                            $coachs,
+                            get_lang('Coach'),
                             null,
                             ICON_SIZE_TINY
                         ).' '.$coachs

+ 29 - 11
main/inc/lib/template.lib.php

@@ -171,6 +171,7 @@ class Template
                 'name' => 'format_date',
                 'callable' => 'Template::format_date',
             ],
+            ['name' => 'get_template', 'callable' => 'Template::findTemplateFilePath'],
         ];
 
         foreach ($filters as $filter) {
@@ -479,33 +480,50 @@ class Template
 
     /**
      * Returns the sub-folder and filename for the given tpl file.
-     * If template not found in overrides/ or custom template folder, the
-     * default template will be used.
+     *
+     * If template not found in overrides/ or custom template folder, the default template will be used.
      *
      * @param string $name
      *
      * @return string
      */
-    public function get_template($name)
+    public static function findTemplateFilePath($name)
     {
+        $sysTemplatePath = api_get_path(SYS_TEMPLATE_PATH);
+
         // Check if the tpl file is present in the main/template/overrides/ dir
         // Overrides is a special directory meant for temporary template
         // customization. It must be taken into account before anything else
-        $file = api_get_path(SYS_CODE_PATH).'template/overrides/'.$name;
-        if (is_readable($file)) {
-            return 'overrides/'.$name;
+        if (is_readable($sysTemplatePath."overrides/$name")) {
+            return "overrides/$name";
         }
+
+        $defaultFolder = api_get_configuration_value('default_template');
+
         // If a template folder has been manually defined, search for the right
         // file, and if not found, go for the same file in the default template
-        if ($this->templateFolder != 'default') {
+        if ($defaultFolder && $defaultFolder != 'default') {
             // Avoid missing template error, use the default file.
-            $file = api_get_path(SYS_CODE_PATH).'template/'.$this->templateFolder.'/'.$name;
-            if (!file_exists($file)) {
-                return 'default/'.$name;
+            if (file_exists($sysTemplatePath."$defaultFolder/$name")) {
+                return "$defaultFolder/$name";
             }
         }
 
-        return $this->templateFolder.'/'.$name;
+        return "default/$name";
+    }
+
+    /**
+     * Call non-static for Template::findTemplateFilePath.
+     *
+     * @see Template::findTemplateFilePath()
+     *
+     * @param string $name
+     *
+     * @return string
+     */
+    public function get_template($name)
+    {
+        return self::findTemplateFilePath($name);
     }
 
     /**

+ 1 - 1
main/inc/lib/userportal.lib.php

@@ -1847,7 +1847,7 @@ class IndexManager
 
                             $this->tpl->assign('session_category', $categoryParams);
                             $sessions_with_category .= $this->tpl->fetch(
-                                "{$this->tpl->templateFolder}/user_portal/session_category.tpl"
+                                $this->tpl->get_template('user_portal/session_category.tpl')
                             );
                         }
                     }

+ 1 - 1
main/template/default/admin/career_dashboard.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
     {{ form_filter }}

+ 1 - 1
main/template/default/admin/gradebook_dependency.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
     <h3>

+ 1 - 1
main/template/default/admin/gradebook_list.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
     {{ form }}

+ 1 - 1
main/template/default/admin/resource_sequence.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
     <script>

+ 2 - 2
main/template/default/auth/inscription.tpl

@@ -1,7 +1,7 @@
 {%
     extends hide_header == true
-    ? template ~ "/layout/blank.tpl"
-    : template ~ "/layout/layout_1_col.tpl"
+    ? 'layout/blank.tpl'|get_template
+    : 'layout/layout_1_col.tpl'|get_template
 %}
 
 {% block content %}

+ 1 - 1
main/template/default/auth/session_catalog.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/page.tpl" %}
+{% extends 'layout/page.tpl'|get_template %}
 
 {% block body %}
     <script>

+ 1 - 1
main/template/default/career/diagram.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 

+ 1 - 1
main/template/default/forum/list.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 {% block content %}
 
 {{ introduction_section }}

+ 2 - 2
main/template/default/javascript/editor/ckeditor/elfinder.tpl

@@ -1,5 +1,5 @@
-{% extends template ~ "/layout/no_layout.tpl" %}
+{% extends 'layout/no_layout.tpl'|get_template %}
 
 {% block body %}
-    {% include template ~ '/javascript/editor/elfinder_standalone.tpl' %}
+    {% include 'javascript/editor/elfinder_standalone.tpl'|get_template %}
 {% endblock %}

+ 1 - 1
main/template/default/layout/blank.tpl

@@ -4,7 +4,7 @@
 <!--[if IE 8]>    <html lang="{{document_language}}" class="no-js lt-ie9"> <![endif]-->
 <!--[if gt IE 8]><!--><html lang="{{document_language}}" class="no-js"> <!--<![endif]-->
 <head>
-{% include template ~ "/layout/head.tpl" %}
+{% include 'layout/head.tpl'|get_template %}
 </head>
 <body dir="{{text_direction}}" class="{{section_name}}">
     <div class="page-blank">

+ 1 - 1
main/template/default/layout/head.tpl

@@ -54,7 +54,7 @@ $(function() {
 
 </script>
 
-{% include template ~ '/layout/header.js.tpl' %}
+{% include 'layout/header.js.tpl'|get_template %}
 
 {{ css_custom_file_to_string }}
 {{ css_style_print }}

+ 1 - 1
main/template/default/layout/hot_courses.tpl

@@ -35,7 +35,7 @@ $(document).ready( function() {
     </div>
     <div id="list-hot-courses" class="grid-courses">
         <div class="row">
-            {% include template ~ '/layout/hot_course_item.tpl' %}
+            {% include 'layout/hot_course_item.tpl'|get_template %}
         </div>
     </div>
 </section>

+ 2 - 2
main/template/default/layout/layout_1_col.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/page.tpl" %}
+{% extends 'layout/page.tpl'|get_template %}
 
 {% block body %}
     {% if plugin_main_top %}
@@ -18,7 +18,7 @@
 
     <div class="row">
         <div class="col-xs-12 col-md-12">
-            {% include template ~ "/layout/page_body.tpl" %}
+            {% include 'layout/page_body.tpl'|get_template %}
             {% block content %}
                 {% if content is not null %}
                     <section id="main_content">

+ 5 - 5
main/template/default/layout/layout_2_col.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/page.tpl" %}
+{% extends 'layout/page.tpl'|get_template %}
 
 {% block body %}
     {% if plugin_main_top %}
@@ -26,7 +26,7 @@
                 {% endif %}
 
                 {% block page_body %}
-                    {% include template ~ "/layout/page_body.tpl" %}
+                    {% include 'layout/page_body.tpl'|get_template %}
                 {% endblock %}
 
                 {% if welcome_to_course_block %}
@@ -55,9 +55,9 @@
                     </article>
                 {% endif %}
 
-                {% include template ~ "/layout/hot_courses.tpl" %}
+                {% include 'layout/hot_courses.tpl'|get_template %}
 
-                {% include template ~ "/session/sessions_current.tpl" %}
+                {% include 'session/sessions_current.tpl'|get_template %}
 
                 {% if plugin_content_bottom %}
                     <div id="plugin_content_bottom">
@@ -74,7 +74,7 @@
                     </div>
                 {% endif %}
 
-                {% include template ~ "/layout/login_form.tpl" %}
+                {% include 'layout/login_form.tpl'|get_template %}
 
                 {% if _u.logged  == 1 %}
                     {{ user_image_block }}

+ 1 - 1
main/template/default/layout/layout_3_col.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/page.tpl" %}
+{% extends 'layout/page.tpl'|get_template %}
 {% block body %}
 <div id="maincontent" class="maincontent">
     {{ plugin_courses_block }}

+ 1 - 1
main/template/default/layout/no_layout.tpl

@@ -4,7 +4,7 @@
 <!--[if IE 8]>    <html lang="{{document_language}}" class="no-js lt-ie9"> <![endif]-->
 <!--[if gt IE 8]><!--><html lang="{{document_language}}" class="no-js"> <!--<![endif]-->
 <head>
-{% include template ~ "/layout/head.tpl" %}
+{% include 'layout/head.tpl'|get_template %}
 </head>
 <body dir="{{text_direction}}" class="{{section_name}}">
 <section id="content-scorm">

+ 4 - 4
main/template/default/layout/page.tpl

@@ -6,7 +6,7 @@
 <html lang="{{ document_language }}" class="no-js"> <!--<![endif]-->
 <head>
 {% block head %}
-{% include template ~ "/layout/head.tpl" %}
+{% include 'layout/head.tpl'|get_template %}
 {% endblock %}
 </head>
 <body dir="{{ text_direction }}" class="{{ section_name }} {{ login_class }}">
@@ -34,7 +34,7 @@
     {% endif %}
 
     {% if show_header == true %}
-    {% include template ~ "/layout/page_header.tpl" %}
+    {% include 'layout/page_header.tpl'|get_template %}
     {% endif %}
     {% if show_course_shortcut is not null %}
         <div class="nav-tools">
@@ -56,10 +56,10 @@
 	</section>
 
     {% if show_footer == true %}
-	    {% include template ~ "/layout/page_footer.tpl" %}
+	    {% include 'layout/page_footer.tpl'|get_template %}
     {% endif %}
 
-    {% include template ~ '/layout/footer.js.tpl' %}
+    {% include 'layout/footer.js.tpl'|get_template %}
     </div>
   </body>
 </html>

+ 3 - 3
main/template/default/layout/page_header.tpl

@@ -3,7 +3,7 @@
     {{ bug_notification }}
 </div>
 {% block topbar %}
-    {% include template ~ "/layout/topbar.tpl" %}
+    {% include 'layout/topbar.tpl'|get_template %}
 {% endblock %}
 <div class="extra-header">{{ header_extra_content }}</div>
 <header id="header-section" class="header-movil">
@@ -53,6 +53,6 @@
     </div>
 </header>
 {% block menu %}
-    {% include template ~ "/layout/menu.tpl" %}
+    {% include 'layout/menu.tpl'|get_template %}
 {% endblock %}
-{% include template ~ "/layout/course_navigation.tpl" %}
+{% include 'layout/course_navigation.tpl'|get_template %}

+ 2 - 2
main/template/default/layout/show_footer.tpl

@@ -1,9 +1,9 @@
     {% if show_footer == true %}
             </div>
         </section>
-        {% include template ~ "/layout/page_footer.tpl" %}
+        {% include 'layout/page_footer.tpl'|get_template %}
     {% endif %}
     </div>
-    {% include template ~ '/layout/footer.js.tpl' %}
+    {% include 'layout/footer.js.tpl'|get_template %}
 </body>
 </html>

+ 2 - 2
main/template/default/layout/show_header.tpl

@@ -9,7 +9,7 @@
 <html lang="{{ document_language }}" class="no-js"> <!--<![endif]-->
 <head>
     {% block head %}
-        {% include template ~ "/layout/head.tpl" %}
+        {% include 'layout/head.tpl'|get_template %}
     {% endblock %}
 </head>
 <body dir="{{ text_direction }}" class="{{ section_name }} {{ login_class }}">
@@ -36,7 +36,7 @@
                 </form>
             </div>
         {% endif %}
-        {% include template ~ "/layout/page_header.tpl" %}
+        {% include 'layout/page_header.tpl'|get_template %}
         {% if show_course_shortcut is not null %}
             <div class="nav-tools">
                 {{ show_course_shortcut }}

+ 1 - 1
main/template/default/learnpath/view.tpl

@@ -66,7 +66,7 @@
             </div>
         {# TOC layout #}
         <div id="toc_id" class="scorm-body" name="toc_name">
-                {% include template ~ '/learnpath/scorm_list.tpl' %}
+                {% include 'learnpath/scorm_list.tpl'|get_template %}
             </div>
         {# end TOC layout #}
         </div>

+ 2 - 2
main/template/default/mail/mail.tpl

@@ -23,7 +23,7 @@
                 <table align="center" border="0" cellpadding="0" cellspacing="0" width="600" style="border-collapse: collapse;">
                     <tr>
                         <td>
-                            {% include template ~ '/mail/header.tpl' %}
+                            {% include 'mail/header.tpl'|get_template %}
                         </td>
                     </tr>
                     <tr>
@@ -35,7 +35,7 @@
                     </tr>
                     <tr>
                         <td>
-                            {% include template ~ '/mail/footer.tpl' %}
+                            {% include 'mail/footer.tpl'|get_template %}
                         </td>
                     </tr>
                 </table>

+ 1 - 1
main/template/default/portfolio/list.html.twig

@@ -4,7 +4,7 @@
 {% set delete_img = 'delete.png'|img(22, 'Delete'|get_lang) %}
 {% set baseurl = _p.web_self ~ '?' ~ (_p.web_cid_query ? _p.web_cid_query ~ '&' : '') %}
 
-{% import template ~ '/portfolio/items.html.twig' as items %}
+{% import 'portfolio/items.html.twig'|get_template as items %}
 
 {% if not allow_edit %}
     <h3>{{ user.completeName }} <small>{{ user.username }}</small></h3>

+ 1 - 1
main/template/default/session/resume_session.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 

+ 1 - 1
main/template/default/skill/skill_wheel.js.tpl

@@ -1,5 +1,5 @@
 {# topbar #}
-{% include template ~ "/layout/topbar.tpl" %}
+{% include 'layout/topbar.tpl'|get_template %}
 <script>
 
 var SkillWheel = {

+ 1 - 1
main/template/default/skill/skill_wheel.tpl

@@ -1,4 +1,4 @@
-{% include template ~ '/skill/skill_wheel.js.tpl' %}
+{% include 'skill/skill_wheel.js.tpl'|get_template %}
 <script>
     /* Skill search input in the left menu */
     function check_skills_sidebar() {

+ 1 - 1
main/template/default/skill/skill_wheel_student.tpl

@@ -1,4 +1,4 @@
-{% include template ~ '/skill/skill_wheel.js.tpl' %}
+{% include 'skill/skill_wheel.js.tpl'|get_template %}
 <script>
     /* Skill search input in the left menu */
     function check_skills_sidebar() {

+ 1 - 1
main/template/default/social/add_groups.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/edit_profile.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/friends.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/group_view.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row" xmlns="http://www.w3.org/1999/html">

+ 1 - 1
main/template/default/social/group_waiting_list.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/groups.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/groups_topics.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
     <div class="row">

+ 1 - 1
main/template/default/social/home.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
     <div class="row">

+ 1 - 1
main/template/default/social/inbox.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/invitations.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/myfiles.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/profile.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/search.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
 <div class="row">

+ 1 - 1
main/template/default/social/whoisonline.tpl

@@ -1,4 +1,4 @@
-{% extends template ~ "/layout/layout_1_col.tpl" %}
+{% extends 'layout/layout_1_col.tpl'|get_template %}
 
 {% block content %}
     <div class="row">

+ 1 - 1
main/template/default/work/view.tpl

@@ -24,4 +24,4 @@
 </p>
 {% endif %}
 
-{% include template ~ '/work/comments.tpl' %}
+{% include 'work/comments.tpl'|get_template %}