diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php index 9c69b7afa2..51316254ec 100755 --- a/main/inc/lib/template.lib.php +++ b/main/inc/lib/template.lib.php @@ -272,6 +272,16 @@ class Template $response->send(); } + /** + * @param string $template + * + * @throws \Twig\Error\Error + */ + public function displayTemplate($template) + { + $this->returnResponse($this->params, $template); + } + /** * Shortcut to display a 1 col layout (index.php). * */ diff --git a/main/lp/lp_add_audio.php b/main/lp/lp_add_audio.php index 587058e81b..7dd02ab66c 100755 --- a/main/lp/lp_add_audio.php +++ b/main/lp/lp_add_audio.php @@ -124,8 +124,6 @@ $tpl->assign('enable_record_audio', api_get_setting('enable_record_audio') === ' $tpl->assign('cur_dir_path', '/audio'); $tpl->assign('lp_item_id', $lp_item_id); $tpl->assign('lp_dir', api_remove_trailing_slash($lpPathInfo['dir'])); -$template = $tpl->get_template('learnpath/record_voice.tpl'); -$recordVoiceForm .= $tpl->fetch($template); $form->addElement('header', get_lang('Or')); $form->addElement('header', get_lang('AudioFile')); $form->addLabel(null, sprintf(get_lang('AudioFileForItemX'), $lp_item->get_title())); @@ -163,17 +161,17 @@ $documentTree = DocumentManager::get_document_preview( api_get_path(WEB_CODE_PATH).'lp/lp_controller.php?action=add_audio&lp_id='.$lp->get_id().'&id='.$lp_item_id, false, true - //$folderId = false ); -$page .= $recordVoiceForm; -$page .= $form->returnForm(); -$page .= ''.get_lang('SelectAnAudioFileFromDocuments').''; +$tpl->assign('pre_page', $page); + +$tpl->assign('form', $form->returnForm()); + +$page = ''.get_lang('SelectAnAudioFileFromDocuments').''; $page .= $documentTree; $page .= ''; $page .= ''; -$tpl->assign('content', $page); -$template = $tpl->get_template('learnpath/lp_upload_audio.tpl'); -$content = $tpl->fetch($template); -$tpl->display_one_col_template(); +$tpl->assign('post_page', $page); + +$tpl->displayTemplate('@ChamiloTheme/LearnPath/add_audio.html.twig'); diff --git a/main/lp/lp_list.php b/main/lp/lp_list.php index 9d97e4de86..255eff5e52 100755 --- a/main/lp/lp_list.php +++ b/main/lp/lp_list.php @@ -940,7 +940,5 @@ $template->assign('introduction', $introduction); $template->assign('data', $data); $template->assign('lp_is_shown', $lpIsShown); $template->assign('filtered_category', $filteredCategoryId); -$templateName = $template->get_template('learnpath/list.tpl'); -$content = $template->fetch($templateName); -$template->assign('content', $content); -$template->display_one_col_template(); + +$template->displayTemplate('@ChamiloTheme/LearnPath/list.html.twig'); diff --git a/main/lp/lp_view.php b/main/lp/lp_view.php index b6e35f675a..4c3c4b09f1 100755 --- a/main/lp/lp_view.php +++ b/main/lp/lp_view.php @@ -566,11 +566,7 @@ $template->assign( ) ); -$view = $template->get_template('learnpath/view.tpl'); -$content = $template->fetch($view); - -$template->assign('content', $content); -$template->display_no_layout_template(); +$template->displayTemplate('@ChamiloTheme/LearnPath/view.html.twig'); // Restore a global setting. $_setting['show_navigation_menu'] = $save_setting; diff --git a/main/template/default/learnpath/lp_upload_audio.html.twig b/main/template/default/learnpath/lp_upload_audio.html.twig deleted file mode 100644 index cddd07099f..0000000000 --- a/main/template/default/learnpath/lp_upload_audio.html.twig +++ /dev/null @@ -1 +0,0 @@ -{{ content }} diff --git a/src/ThemeBundle/Resources/views/Layout/no_layout.html.twig b/src/ThemeBundle/Resources/views/Layout/no_layout.html.twig index 442d11e135..62bb4e0ea9 100644 --- a/src/ThemeBundle/Resources/views/Layout/no_layout.html.twig +++ b/src/ThemeBundle/Resources/views/Layout/no_layout.html.twig @@ -4,7 +4,9 @@ {% autoescape false %}
+ {% block content %} {{ content }} + {% endblock %}
{% endautoescape %} {% endblock %} diff --git a/src/ThemeBundle/Resources/views/LearnPath/add_audio.html.twig b/src/ThemeBundle/Resources/views/LearnPath/add_audio.html.twig new file mode 100644 index 0000000000..9ccdc2c4ad --- /dev/null +++ b/src/ThemeBundle/Resources/views/LearnPath/add_audio.html.twig @@ -0,0 +1,9 @@ +{% extends '@ChamiloTheme/Layout/layout_one_col.html.twig' %} +{% block content %} + {% autoescape false %} + {{ pre_page }} + {% include '@ChamiloTheme/LearnPath/record_voice.html.twig' %} + {{ form }} + {{ post_page }} + {% endautoescape %} +{% endblock %} \ No newline at end of file diff --git a/main/template/default/learnpath/impress.html.twig b/src/ThemeBundle/Resources/views/LearnPath/impress.html.twig similarity index 100% rename from main/template/default/learnpath/impress.html.twig rename to src/ThemeBundle/Resources/views/LearnPath/impress.html.twig diff --git a/main/template/default/learnpath/list.html.twig b/src/ThemeBundle/Resources/views/LearnPath/list.html.twig similarity index 99% rename from main/template/default/learnpath/list.html.twig rename to src/ThemeBundle/Resources/views/LearnPath/list.html.twig index 4771ca16af..07c52489d9 100644 --- a/main/template/default/learnpath/list.html.twig +++ b/src/ThemeBundle/Resources/views/LearnPath/list.html.twig @@ -1,3 +1,5 @@ +{% extends '@ChamiloTheme/Layout/layout_one_col.html.twig' %} +{% block content %} {% autoescape false %} -{% endautoescape %} \ No newline at end of file +{% endautoescape %} +{% endblock %} \ No newline at end of file