* @author Julio Montoya Bug fixing * @package chamilo.course_progress */ // protect a course script api_protect_course_script(true); if (api_is_allowed_to_edit(null, true)) { 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 '
'; } if ($action == 'thematic_list') { $table = new SortableTable('thematic_list', array('Thematic', 'get_number_of_thematics'), array('Thematic', 'get_thematic_data')); $parameters['action'] = $action; $table->set_additional_parameters($parameters); $table->set_header(0, '', false, array('style'=>'width:20px;')); $table->set_header(1, get_lang('Title'), false ); if (api_is_allowed_to_edit(null, true)) { $table->set_header(2, get_lang('Actions'), false,array('style'=>'text-align:center;width:40%;')); $table->set_form_actions(array ('thematic_delete_select' => get_lang('DeleteAllThematics'))); } //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'), array('style'=>'vertical-align:middle')).''; $link_to_thematic_advance = ''.Display::return_icon('porcent.png', get_lang('ThematicAdvance'), array('style'=>'vertical-align:middle')).''; Display::display_confirmation_message(get_lang('ThematicSectionHasBeenCreatedSuccessfull').'
'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'),$link_to_thematic_plan, $link_to_thematic_advance), false); } // display title if (!empty($thematic_id)) { echo '
'.Security::remove_XSS($thematic_data[$thematic_id]['title'], STUDENT).': '.get_lang('Details').'

'; } else { //echo '
'.get_lang('ThematicDetails').'

'; // display information $message = ''.get_lang('Information').'
'; $message .= get_lang('ThematicDetailsDescription'); Display::display_normal_message($message, false); echo '
'; } // display thematic data if (!empty($thematic_data)) { // display progress if (!empty($thematic_id)) { echo '
'.get_lang('Progress').': '.$total_average_of_advances.'%

'; } else { echo '
'.get_lang('Progress').': '.$total_average_of_advances.'%

'; } echo ''; echo ''; foreach ($thematic_data as $thematic) { echo ''; // display thematic data echo ''; // display thematic plan data echo ''; // display thematic advance data echo ''; echo ''; } echo '
'.get_lang('Thematic').''.get_lang('ThematicPlan').''.get_lang('ThematicAdvance').'
'.Security::remove_XSS($thematic['title'], STUDENT).'
'.Security::remove_XSS($thematic['content'], STUDENT).'
'; if (api_is_allowed_to_edit(null, true)) { echo '
'; } if (!empty($thematic_plan_data[$thematic['id']])) { foreach ($thematic_plan_data[$thematic['id']] as $thematic_plan) { echo '
'.Security::remove_XSS($thematic_plan['title'], STUDENT).'
'.Security::remove_XSS($thematic_plan['description'], STUDENT).'
'; } } else { echo '
'.get_lang('StillDoNotHaveAThematicPlan').'
'; } echo '
'; if (api_is_allowed_to_edit(null, true)) { echo '
'; } echo ''; if (!empty($thematic_advance_data[$thematic['id']])) { foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) { $thematic_advance['start_date'] = api_get_local_time($thematic_advance['start_date']); $thematic_advance['start_date'] = api_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG); echo ''; echo ''; if (empty($thematic_id) && api_is_allowed_to_edit(null, true)) { $checked = ''; if ($last_done_thematic_advance == $thematic_advance['id']) { $checked = 'checked'; } $style = ''; if ($thematic_advance['done_advance'] == 1) { $style = ' style="background-color:#E5EDF9" '; } else { $style = ' style="background-color:#fff" '; } echo ''; } else { if ($thematic_advance['done_advance'] == 1) { echo ''; } else { echo ''; } } echo ''; } } else { echo ''; } echo '
'; echo '
'.$thematic_advance['start_date'].'
'; echo '
'.Security::remove_XSS($thematic_advance['content'], STUDENT).'
'; echo '
'.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'
'; echo '
'.get_lang('Done').'
-
'.get_lang('ThereIsNoAThematicAdvance').'
 
'; echo '
'; } else { echo '
'.get_lang('ThereIsNoAThematicSection').'
'; } } else if ($action == 'thematic_add' || $action == 'thematic_edit') { if (!$error) { $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%;"'); if ($action == 'thematic_edit') { $form->addElement('header', '', get_lang('EditThematicSection')); } $form->addElement('hidden', 'thematic_token',$token); $form->addElement('hidden', 'action', $action); if (!empty($thematic_id)) { $form->addElement('hidden', 'thematic_id',$thematic_id); } $form->add_textfield('title', get_lang('Title'), true, array('size'=>'50')); $form->add_html_editor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Width' => '100%', 'Height' => '250')); $form->addElement('html','
'); $form->addElement('style_submit_button', null, get_lang('Save'), 'class="save"'); if (!empty($thematic_data)) { // set default values $default['title'] = $thematic_data['title']; $default['content'] = $thematic_data['content']; $form->setDefaults($default); } // error messages if ($error) { Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false); } $form->display(); } ?>