From fe94aa9beb58988c953b1f03c2fdf48b547f5cf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alex=20Arag=C3=B3n?= Date: Mon, 8 Apr 2019 15:20:24 -0500 Subject: [PATCH] fix tool-view - refs #2681 --- main/course_progress/thematic.php | 10 +- main/inc/lib/glossary.lib.php | 2 + .../course_description/index.html.twig | 83 +++-- .../course_progress/progress.html.twig | 13 +- main/template/default/glossary/list.html.twig | 53 ++- main/template/default/link/index.html.twig | 2 +- .../Resources/views/LearnPath/list.html.twig | 325 +++++++++--------- 7 files changed, 272 insertions(+), 216 deletions(-) diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index 0a8113ec15..851119245d 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -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); diff --git a/main/inc/lib/glossary.lib.php b/main/inc/lib/glossary.lib.php index d58050a819..5ee30c6c3e 100755 --- a/main/inc/lib/glossary.lib.php +++ b/main/inc/lib/glossary.lib.php @@ -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); diff --git a/main/template/default/course_description/index.html.twig b/main/template/default/course_description/index.html.twig index f8bbd5813c..95a4a7a5e8 100644 --- a/main/template/default/course_description/index.html.twig +++ b/main/template/default/course_description/index.html.twig @@ -4,41 +4,58 @@ {% for message in messages %} {{ message }} {% endfor %} - {% for description in listing.descriptions %} - {% if not description is empty %} -
- {% set title %} -

- {% if is_allowed_to_edit %} -
-
- {% if session_id == description.session_id %} - - - - - - - {% else %} - - - - {% endif %} + {% if listing.descriptions|length != 0 %} + + +
+

{{ "Course description"|trans }}

+ + +
+ + {% else %} + {% for description in listing.descriptions %} + {% if not description is empty %} +
+ {% set title %} +

+ {% if is_allowed_to_edit %} +
+
+ {% if session_id == description.session_id %} + + + + + + + {% else %} + + + + {% endif %} +
-

- {% endif %} - {{ description.title }} -

- {% endset %} + {% endif %} + {{ description.title }} + + {% endset %} - {{ macro.panel_box('description' ,title , description.content ) }} + {{ macro.panel_box('description' ,title , description.content ) }} -
- {% endif %} - {% endfor %} + + {% endif %} + {% endfor %} + {% endif %} {% endautoescape %} {% endblock %} \ No newline at end of file diff --git a/main/template/default/course_progress/progress.html.twig b/main/template/default/course_progress/progress.html.twig index 91c6a1e832..e8652c4c22 100644 --- a/main/template/default/course_progress/progress.html.twig +++ b/main/template/default/course_progress/progress.html.twig @@ -124,6 +124,17 @@ {% else %} - + + {% if is_allowed_to_edit %} +
+

{{ "Educational programming"|trans }}

+ + +
+ {% endif %} {% endif %} {% endautoescape %} \ No newline at end of file diff --git a/main/template/default/glossary/list.html.twig b/main/template/default/glossary/list.html.twig index a7d6ad3941..29d649cea6 100644 --- a/main/template/default/glossary/list.html.twig +++ b/main/template/default/glossary/list.html.twig @@ -1,22 +1,39 @@ {% autoescape false %} -
- {% for item in data %} -
- {% if item.edit %} -
- +{% if data is empty %} + + + {% if is_allowed_to_edit %} +
+

{{ "Glossary"|trans }}

+ + - {% endif %} -
{{ item.title }}
- {{ item.description }} +
+ {% endif %} + +{% else %} +
+ {% for item in data %} +
+ {% if item.edit %} +
+ +
+ {% endif %} +
{{ item.title }}
+ {{ item.description }} +
+ {% endfor %}
- {% endfor %} -
+{% endif %} {% endautoescape %} \ No newline at end of file diff --git a/main/template/default/link/index.html.twig b/main/template/default/link/index.html.twig index 8ca3917f11..7aa2d0a34d 100644 --- a/main/template/default/link/index.html.twig +++ b/main/template/default/link/index.html.twig @@ -77,7 +77,7 @@
{% endif %} - + {% endif %} {% endautoescape %} {% endblock %} \ No newline at end of file diff --git a/src/ThemeBundle/Resources/views/LearnPath/list.html.twig b/src/ThemeBundle/Resources/views/LearnPath/list.html.twig index e631e9e25f..7aac6b1b49 100644 --- a/src/ThemeBundle/Resources/views/LearnPath/list.html.twig +++ b/src/ThemeBundle/Resources/views/LearnPath/list.html.twig @@ -14,193 +14,198 @@ } -

{{ 'Learning lessons'|trans }}

- -
- {% 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 %} + +{% else %} +

{{ 'Learning lessons'|trans }}

+
+ {% 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 %} - - {% if is_allowed_to_edit %} - {% set toolbar_actions %} - {% if lp_data.category.getId() > 0 %} - {% if not _c.session_id %} - - {{ - - {% if subscription_settings.allow_add_users_to_lp_category %} - - {{ + + {% if is_allowed_to_edit %} + {% set toolbar_actions %} + {% if lp_data.category.getId() > 0 %} + {% if not _c.session_id %} + + {{ + {% if subscription_settings.allow_add_users_to_lp_category %} + + {{ + + {% endif %} + {% if loop.index0 == 1 %} + + {{ + + {% else %} + + {{ + + {% endif %} + {% if (data|length - 1) == loop.index0 %} + + {{ + + {% else %} + + {{ + + {% endif %} {% endif %} - {% if loop.index0 == 1 %} - - {{ + {% if lp_data.category_visibility == 0 %} + + {{ 'Show'|trans }} {% else %} - - {{ + + {{ 'Hide'|trans }} {% endif %} - {% if (data|length - 1) == loop.index0 %} - - {{ + + {% if lp_data.category_is_published == 0 %} + + {{ 'LearnpathPublish'|trans }} {% else %} - - {{ + + {{ 'Hide'|trans }} + + {% endif %} + {% if not _c.session_id %} + + {{ {% endif %} {% endif %} - {% if lp_data.category_visibility == 0 %} - - {{ 'Show'|trans }} - - {% else %} - - {{ 'Hide'|trans }} - - {% endif %} - - {% if lp_data.category_is_published == 0 %} - - {{ 'LearnpathPublish'|trans }} - - {% else %} - - {{ 'Hide'|trans }} - - {% endif %} - {% if not _c.session_id %} - - {{ - - {% endif %} - {% endif %} - {% endset %} - {% endif %} - - {% set list_learnpath %} - - {% if lp_data.lp_list %} -
    - {% for row in lp_data.lp_list %} -
  • -
    -
    -

    - - {{ row.learnpath_icon }} - {{ row.title }} - {{ row.session_image }} - -

    - {% if row.extra %} -
    - {{ row.extra }} -
    - {% endif %} - {% if row.action_build %} -
    - {{ 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 }} -
    - {% endif %} -
    -
    - {% if is_allowed_to_edit %} -
      - {% if row.start_time %} -
    • - {{ "PublicationDate"|trans }} : - {{ row.start_time }} -
    • + {% endset %} + {% endif %} + + {% set list_learnpath %} + + {% if lp_data.lp_list %} + - {{ row.dsp_progress }} - {% else %} - {% if not is_invitee %} + {% if row.action_build %} +
      + {{ 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 }} +
      + {% endif %} +
    +
    + {% if is_allowed_to_edit %} +
      + {% if row.start_time %} +
    • + {{ "PublicationDate"|trans }} : + {{ row.start_time }} +
    • + {% endif %} +
    • + {{ "ExpirationDate"|trans }} : + {{ row.end_time }} +
    • +
    {{ row.dsp_progress }} + {% else %} + {% if not is_invitee %} + {{ row.dsp_progress }} + {% endif %} {% endif %} - {% endif %} -
    +
    -
+
- - {% endfor %} - - {% endif %} - {% endset %} - + + {% endfor %} + + {% endif %} + {% endset %} + - {% if categories|length > 1 and lp_data.category.id%} - - {% set counter = counter + 1 %} -
-
- - {{ lp_data.category.getName() }} - ({{ lp_data.lp_list|length }}) - -
- {{ toolbar_actions }} -
-
-
-
- {{ list_learnpath }} + {% if categories|length > 1 and lp_data.category.id%} + + {% set counter = counter + 1 %} +
+
+ + {{ lp_data.category.getName() }} - ({{ lp_data.lp_list|length }}) + +
+ {{ toolbar_actions }} +
+
+
+
+ {{ list_learnpath }} +
-
- - {% else %} - {{ list_learnpath }} + + {% else %} + {{ list_learnpath }} + {% endif %} {% endif %} - {% endif %} - {% endfor %} -
+ {% endfor %} +
+{% endif %} {% if is_allowed_to_edit and not lp_is_shown %}
-

{{ "LearningPaths"|trans }}

+

{{ "Learning paths"|trans }}