* @package chamilo.course_progress
*/
// actions menu
$categories = array ();
foreach ($default_thematic_plan_title as $id => $title) {
$categories[$id] = $title;
}
$categories[ADD_THEMATIC_PLAN] = get_lang('NewBloc');
$i=1;
echo '
';
if ($action == 'thematic_plan_list') {
if (isset($thematic_plan_data) && count($thematic_plan_data) > 0) {
foreach ($thematic_plan_data as $thematic_plan) {
echo '';
echo '';
}
} else {
echo ''.get_lang('ThisCourseDescriptionIsEmpty').'';
}
} else if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') {
if ($description_type >= ADD_THEMATIC_PLAN) {
$header_form = get_lang('NewBloc');
} else {
$header_form = $default_thematic_plan_title[$description_type];
}
if (!$error) {
$token = md5(uniqid(rand(),TRUE));
$_SESSION['thematic_plan_token'] = $token;
}
// display form
$form = new FormValidator('thematic_plan_add','POST','index.php?action=thematic_plan_list&thematic_id='.$thematic_id.'&'.api_get_cidreq().$param_gradebook,'','style="width: 100%;"');
$form->addElement('header', '', $header_form);
$form->addElement('hidden', 'action', $action);
$form->addElement('hidden', 'thematic_plan_token', $token);
if (!empty($thematic_id)) {
$form->addElement('hidden', 'thematic_id', $thematic_id);
}
if (!empty($description_type)) {
$form->addElement('hidden', 'description_type', $description_type);
}
$form->add_textfield('title', get_lang('Title'), true, array('size'=>'50'));
$form->add_html_editor('description', get_lang('Description'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '200'));
$form->addElement('html','');
$form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"');
if ($description_type < ADD_THEMATIC_PLAN) {
$default['title'] = $default_thematic_plan_title[$description_type];
}
if (!empty($thematic_plan_data)) {
// set default values
$default['title'] = $thematic_plan_data[0]['title'];
$default['description'] = $thematic_plan_data[0]['description'];
}
$form->setDefaults($default);
if (isset($default_thematic_plan_question[$description_type])) {
$message = ''.get_lang('QuestionPlan').'
';
$message .= $default_thematic_plan_question[$description_type];
Display::display_normal_message($message, false);
}
// error messages
if ($error) {
Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false);
}
$form->display();
}
?>