Browse Source

Merge pull request #1807 from aragonc/1.11.x

fix error notice in course progrress
Alex Aragon Calixto 8 năm trước cách đây
mục cha
commit
60da282ddb

+ 12 - 6
main/course_progress/thematic.php

@@ -175,6 +175,7 @@ if ($action == 'thematic_list') {
             $tpl->assign('data', $listThematic);
         } //End for
     }
+    $thematicLayout = $tpl->get_template('course_progress/progress.tpl');
 } elseif ($action == 'thematic_add' || $action == 'thematic_edit') {
     // Display form
     $form = new FormValidator('thematic_add', 'POST', 'index.php?action=thematic_add&'.api_get_cidreq());
@@ -213,7 +214,8 @@ if ($action == 'thematic_list') {
         Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false);
     }
     if ($show_form) {
-        $form->display();
+        $html = $form->return_form();
+        
     }
 } elseif ($action == 'thematic_import_select') {
     // Create form to upload csv file.
@@ -222,11 +224,15 @@ if ($action == 'thematic_list') {
     $form->addElement('file', 'file');
     $form->addElement('checkbox', 'replace', null, get_lang('DeleteAllThematic'));
     $form->addButtonImport(get_lang('Import'), 'SubmitImport');
-    $form->display();
+    $html = $form->return_form();
 }
-
 $tpl->assign('actions', $toolbar);
-$tpl->assign('message', $message);
-$tpl->assign('score_progress', $total_average_of_advances);
-$thematicLayout = $tpl->get_template('course_progress/progress.tpl');
+if (!empty($html)) {
+    $tpl->assign('content', $html);
+    $thematicLayout = $tpl->get_template('course_progress/layout.tpl');
+}
+if (!empty($message) && !empty($total_average_of_advances)) {
+    $tpl->assign('message', $message);
+    $tpl->assign('score_progress', $total_average_of_advances);
+}
 $tpl->display($thematicLayout);

+ 8 - 0
main/template/default/course_progress/layout.tpl

@@ -0,0 +1,8 @@
+<div class="row">
+    <div class="col-md-12">
+        {{ actions }}
+        <div class="blog">
+            {{ content }}
+        </div>
+    </div>
+</div>