diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php
index 0c6185c186..557eaea574 100755
--- a/main/course_progress/thematic.php
+++ b/main/course_progress/thematic.php
@@ -11,12 +11,29 @@
api_protect_course_script(true);
if (api_is_allowed_to_edit(null, true)) {
- echo '
';
- echo '
'.Display::return_icon('view_table.gif',get_lang('ThematicDetails')).' '.get_lang('ThematicDetails').'';
- echo '
'.Display::return_icon('view_list.gif',get_lang('ThematicList')).' '.get_lang('ThematicList').'';
- if ($action == 'thematic_list') {
- echo '
'.Display::return_icon('introduction_add.gif',get_lang('NewThematicSection')).' '.get_lang('NewThematicSection').'';
- }
+
+ echo '
';
+ switch ($action) {
+ case 'thematic_add' :
+ echo '
'.Display::return_icon('introduction_add.gif',get_lang('NewThematicSection')).' '.get_lang('NewThematicSection').' ';
+ echo '
'.Display::return_icon('view_table.gif',get_lang('ThematicDetails')).' '.get_lang('ThematicDetails').'';
+ echo '
'.Display::return_icon('view_list.gif',get_lang('ThematicList')).' '.get_lang('ThematicList').'';
+ break;
+ case 'thematic_list' :
+ echo '
'.Display::return_icon('introduction_add.gif',get_lang('NewThematicSection')).' '.get_lang('NewThematicSection').'';
+ echo '
'.Display::return_icon('view_table.gif',get_lang('ThematicDetails')).' '.get_lang('ThematicDetails').'';
+ echo '
'.Display::return_icon('view_list.gif',get_lang('ThematicList')).' '.get_lang('ThematicList').' ';
+ break;
+ case 'thematic_details' :
+ echo '
'.Display::return_icon('introduction_add.gif',get_lang('NewThematicSection')).' '.get_lang('NewThematicSection').'';
+ echo '
'.Display::return_icon('view_table.gif',get_lang('ThematicDetails')).' '.get_lang('ThematicDetails').' ';
+ echo '
'.Display::return_icon('view_list.gif',get_lang('ThematicList')).' '.get_lang('ThematicList').'';
+ break;
+ default :
+ echo '
'.Display::return_icon('introduction_add.gif',get_lang('NewThematicSection')).' '.get_lang('NewThematicSection').'';
+ echo '
'.Display::return_icon('view_table.gif',get_lang('ThematicDetails')).' '.get_lang('ThematicDetails').'';
+ echo '
'.Display::return_icon('view_list.gif',get_lang('ThematicList')).' '.get_lang('ThematicList').'';
+ }
echo '
';
}
@@ -31,16 +48,22 @@ if ($action == 'thematic_list') {
$table->set_form_actions(array ('thematic_delete_select' => get_lang('DeleteAllThematics')));
}
- echo '
'.get_lang('ThematicList').'
';
+ //echo '
'.get_lang('ThematicList').'
';
$table->display();
} else if ($action == 'thematic_details') {
+
+ if ($last_id) {
+ $link_to_thematic_plan = '
'.Display::return_icon('info.gif',get_lang('ThematicPlan')).'';
+ $link_to_thematic_advance = '
'.Display::return_icon('porcent.png',get_lang('ThematicAdvance')).'';
+ Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull').'
'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'),$link_to_thematic_plan, $link_to_thematic_advance));
+ }
// display title
if (!empty($thematic_id)) {
echo '
'.Security::remove_XSS($thematic_data[$thematic_id]['title'], STUDENT).': '.get_lang('Details').'
';
} else {
- echo '
'.get_lang('ThematicDetails').'
';
+ //echo '
'.get_lang('ThematicDetails').'
';
// display information
$message = '
'.get_lang('Information').'';
$message .= get_lang('ThematicDetailsDescription');
@@ -127,11 +150,7 @@ if ($action == 'thematic_list') {
}
echo '';
} else {
- echo '
';
+ echo '
'.get_lang('ThereIsNoAThematicSection').'
';
}
} else if ($action == 'thematic_add' || $action == 'thematic_edit') {
@@ -140,16 +159,14 @@ if ($action == 'thematic_list') {
$token = md5(uniqid(rand(),TRUE));
$_SESSION['thematic_token'] = $token;
}
+
+ // display form
+ $form = new FormValidator('thematic_add','POST','index.php?action=thematic_details&'.api_get_cidreq(),'','style="width: 100%;"');
- $header_form = get_lang('NewThematicSection');
if ($action == 'thematic_edit') {
- $header_form = get_lang('EditThematicSection');
+ $form->addElement('header', '', get_lang('EditThematicSection'));
}
- // display form
- $form = new FormValidator('thematic_add','POST','index.php?action=thematic_list&'.api_get_cidreq(),'','style="width: 100%;"');
-
- $form->addElement('header', '', $header_form);
$form->addElement('hidden', 'thematic_token',$token);
$form->addElement('hidden', 'action', $action);
diff --git a/main/course_progress/thematic_controller.php b/main/course_progress/thematic_controller.php
index 996bdf847d..d1218ef819 100755
--- a/main/course_progress/thematic_controller.php
+++ b/main/course_progress/thematic_controller.php
@@ -37,6 +37,7 @@ class ThematicController
$thematic= new Thematic();
$data = array();
$error = false;
+ $msg_add = false;
// insert or update a thematic
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
@@ -48,8 +49,15 @@ class ThematicController
$content = $_POST['content'];
$session_id = api_get_session_id();
$thematic->set_thematic_attributes($id, $title, $content, $session_id);
- $affected_rows = $thematic->thematic_save();
- $action = 'thematic_list';
+ $last_id = $thematic->thematic_save();
+ if ($_POST['action'] == 'thematic_add') {
+ $action = 'thematic_details';
+ if ($last_id) {
+ $data['last_id'] = $last_id;
+ }
+ } else {
+ $action = 'thematic_list';
+ }
unset($_SESSION['thematic_token']);
}
} else {