diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php index 48248a38db..bcbbf6a29c 100755 --- a/main/course_progress/thematic.php +++ b/main/course_progress/thematic.php @@ -2,11 +2,11 @@ /* For licensing terms, see /license.txt */ /** -* View (MVC patter) for thematic control -* @author Christian Fasanando -* @author Julio Montoya Bug fixing -* @package chamilo.course_progress -*/ + * View (MVC patter) for thematic control + * @author Christian Fasanando + * @author Julio Montoya Bug fixing + * @package chamilo.course_progress + */ // protect a course script api_protect_course_script(true); @@ -23,25 +23,25 @@ if (api_is_allowed_to_edit(null, true)) { case 'thematic_add': case 'thematic_import_select': echo ''. - Display::return_icon('back.png',get_lang('BackTo').' '.get_lang('ThematicDetails'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('back.png', get_lang('BackTo').' '.get_lang('ThematicDetails'), '', ICON_SIZE_MEDIUM).''; break; case 'thematic_list': echo ''. - Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).''; break; case 'thematic_details': echo ''. - Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).''; echo ''. - Display::return_icon('import_csv.png',get_lang('ImportThematic'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('import_csv.png', get_lang('ImportThematic'), '', ICON_SIZE_MEDIUM).''; echo ''. - Display::return_icon('export_csv.png',get_lang('ExportThematic'),'', ICON_SIZE_MEDIUM).''; + Display::return_icon('export_csv.png', get_lang('ExportThematic'), '', ICON_SIZE_MEDIUM).''; echo ''. - Display::return_icon('pdf.png',get_lang('ExportToPDF'),'', ICON_SIZE_MEDIUM).''; + Display::return_icon('pdf.png', get_lang('ExportToPDF'), '', ICON_SIZE_MEDIUM).''; break; default: echo ''. - Display::return_icon('new_course_progress.png',get_lang('NewThematicSection'),'',ICON_SIZE_MEDIUM).''; + Display::return_icon('new_course_progress.png', get_lang('NewThematicSection'), '', ICON_SIZE_MEDIUM).''; } echo ''; } @@ -55,7 +55,7 @@ if ($action == 'thematic_list') { $parameters['action'] = $action; $table->set_additional_parameters($parameters); - $table->set_header(0, '', false, array('style'=>'width:20px;')); + $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( @@ -64,7 +64,7 @@ if ($action == 'thematic_list') { false, array('style' => 'text-align:center;width:40%;') ); - $table->set_form_actions(array ('thematic_delete_select' => get_lang('DeleteAllThematics'))); + $table->set_form_actions(array('thematic_delete_select' => get_lang('DeleteAllThematics'))); } $table->display(); @@ -75,11 +75,11 @@ if ($action == 'thematic_list') { if (isset($last_id) && $last_id) { $link_to_thematic_plan = ''. - Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), array('style'=>'vertical-align:middle;float:none;'),ICON_SIZE_SMALL).''; + Display::return_icon('lesson_plan.png', get_lang('ThematicPlan'), array('style' => 'vertical-align:middle;float:none;'), ICON_SIZE_SMALL).''; $link_to_thematic_advance = ''. - Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), array('style'=>'vertical-align:middle;float:none;'),ICON_SIZE_SMALL).''; + Display::return_icon('lesson_plan_calendar.png', get_lang('ThematicAdvance'), array('style' => 'vertical-align:middle;float:none;'), ICON_SIZE_SMALL).''; Display::display_confirmation_message( - get_lang('ThematicSectionHasBeenCreatedSuccessfull').'
'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'),$link_to_thematic_plan, $link_to_thematic_advance), + get_lang('ThematicSectionHasBeenCreatedSuccessfull').'
'.sprintf(get_lang('NowYouShouldAddThematicPlanXAndThematicAdvanceX'), $link_to_thematic_plan, $link_to_thematic_advance), false ); } @@ -119,35 +119,41 @@ if ($action == 'thematic_list') { Display::return_icon('cd.gif', get_lang('Copy')), 'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$my_thematic_id.$params.$url_token ); - if (api_get_session_id() == 0 ) { + if (api_get_session_id() == 0) { if ($thematic['display_order'] > 1) { - $actions_first_col .= ' '.Display::return_icon('up.png', get_lang('Up'),'',ICON_SIZE_SMALL).''; + $actions_first_col .= ' '.Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_SMALL).''; } else { - $actions_first_col .= ' '.Display::return_icon('up_na.png',' ','',ICON_SIZE_SMALL); + $actions_first_col .= ' '.Display::return_icon('up_na.png', ' ', '', ICON_SIZE_SMALL); } if (isset($thematic['max_thematic_item']) && $thematic['display_order'] < $thematic['max_thematic_item']) { - $actions_first_col .= ' '.Display::return_icon('down.png',get_lang('Down'),'',ICON_SIZE_SMALL).''; + $actions_first_col .= ' '.Display::return_icon('down.png', get_lang('Down'), '', ICON_SIZE_SMALL).''; } else { - $actions_first_col .= ' '.Display::return_icon('down_na.png',' ','',ICON_SIZE_SMALL); + $actions_first_col .= ' '.Display::return_icon('down_na.png', ' ', '', ICON_SIZE_SMALL); } } if (api_get_session_id() == $thematic['session_id']) { - $actions_first_col .= ''.Display::return_icon('edit.png',get_lang('Edit'),'',ICON_SIZE_SMALL).''; - $actions_first_col .= ''.Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).''; + $actions_first_col .= '' + .Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_SMALL).''; + $actions_first_col .= '' + .Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''; } - $actions_first_col = Display::div($actions_first_col, array('id'=>'thematic_id_content_'.$thematic['id'], 'class'=>'thematic_tools')); - $actions_first_col = Display::div($actions_first_col, array('style'=>'height:20px')); + $actions_first_col = Display::div($actions_first_col, array('id' => 'thematic_id_content_'.$thematic['id'], 'class' => 'thematic_tools')); + $actions_first_col = Display::div($actions_first_col, array('style' => 'height:20px')); } - echo Display::tag('td', Display::tag('h3', Security::remove_XSS($thematic['title'], STUDENT).$session_star).Security::remove_XSS($thematic['content'], STUDENT).$actions_first_col, array('id'=>'thematic_td_content_'.$thematic['id'], 'class'=>'thematic_content')); + echo Display::tag('td', Display::tag('h3', Security::remove_XSS($thematic['title'], STUDENT).$session_star).Security::remove_XSS($thematic['content'], STUDENT).$actions_first_col, array('id' => 'thematic_td_content_'.$thematic['id'], 'class' => 'thematic_content')); // Display 2nd column - thematic plan data echo ''; //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (api_is_allowed_to_edit(null, true)) { echo '
'. - Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style'=>'vertical-align:middle'),ICON_SIZE_MEDIUM).'

'; + Display::return_icon('edit.png', get_lang('EditThematicPlan'), array('style' => 'vertical-align:middle'), ICON_SIZE_MEDIUM).'
'; } if (empty($thematic_plan_div[$thematic['id']])) { @@ -163,7 +169,7 @@ if ($action == 'thematic_list') { //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { if (api_is_allowed_to_edit(null, true)) { echo '
'. - Display::return_icon('add.png',get_lang('NewThematicAdvance'),'',ICON_SIZE_MEDIUM).'
'; + Display::return_icon('add.png', get_lang('NewThematicAdvance'), '', ICON_SIZE_MEDIUM).''; } //if (api_is_allowed_to_edit(null, true) && api_get_session_id() == $thematic['session_id']) { @@ -184,24 +190,24 @@ if ($action == 'thematic_list') { [], ICON_SIZE_SMALL ), - 'index.php?' . api_get_cidreq() . '&' . http_build_query([ + 'index.php?'.api_get_cidreq().'&'.http_build_query([ 'action' => 'thematic_advance_edit', 'thematic_id' => $thematic['id'], 'thematic_advance_id' => $thematic_advance['id'] ]) ); $edit_link .= ''. - Display::return_icon('delete.png',get_lang('Delete'),'',ICON_SIZE_SMALL).''; + Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_SMALL).''; // Links $edit_link = Display::div( - Display::div($edit_link, array('id'=>'thematic_advance_tools_'.$thematic_advance['id'], 'class'=>'thematic_advance_actions')), - array('style'=>'height:20px;') + Display::div($edit_link, array('id' => 'thematic_advance_tools_'.$thematic_advance['id'], 'class' => 'thematic_advance_actions')), + array('style' => 'height:20px;') ); } $thematic_advance_item = isset($thematic_advance_div[$thematic['id']][$thematic_advance['id']]) ? $thematic_advance_div[$thematic['id']][$thematic_advance['id']] : null; - echo Display::div($thematic_advance_item, array('id'=>'thematic_advance_'.$thematic_advance['id'])); + echo Display::div($thematic_advance_item, array('id' => 'thematic_advance_'.$thematic_advance['id'])); echo $edit_link; echo ''; @@ -244,7 +250,7 @@ if ($action == 'thematic_list') { } } elseif ($action == 'thematic_add' || $action == 'thematic_edit') { // Display form - $form = new FormValidator('thematic_add','POST','index.php?action=thematic_add&'.api_get_cidreq()); + $form = new FormValidator('thematic_add', 'POST', 'index.php?action=thematic_add&'.api_get_cidreq()); if ($action == 'thematic_edit') { $form->addElement('header', '', get_lang('EditThematicSection')); } @@ -253,10 +259,10 @@ if ($action == 'thematic_list') { $form->addElement('hidden', 'action', $action); if (!empty($thematic_id)) { - $form->addElement('hidden', 'thematic_id',$thematic_id); + $form->addElement('hidden', 'thematic_id', $thematic_id); } - $form->addText('title', get_lang('Title'), true, array('size'=>'50')); + $form->addText('title', get_lang('Title'), true, array('size' => '50')); $form->addHtmlEditor('content', get_lang('Content'), false, false, array('ToolbarSet' => 'TrainingDescription', 'Height' => '150')); $form->addButtonSave(get_lang('Save')); @@ -265,8 +271,8 @@ if ($action == 'thematic_list') { if (!empty($thematic_data)) { if (api_get_session_id()) { if ($thematic_data['session_id'] != api_get_session_id()) { - $show_form = false; - Display::display_error_message(get_lang('NotAllowedClickBack'),false); + $show_form = false; + Display::display_error_message(get_lang('NotAllowedClickBack'), false); } } // set default values @@ -277,14 +283,14 @@ if ($action == 'thematic_list') { // error messages if (isset($error)) { - Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'),false); + Display::display_error_message(get_lang('FormHasErrorsPleaseComplete'), false); } if ($show_form) { $form->display(); } } elseif ($action == 'thematic_import_select') { // Create form to upload csv file. - $form = new FormValidator('thematic_import','POST','index.php?action=thematic_import&'.api_get_cidreq().$url_token); + $form = new FormValidator('thematic_import', 'POST', 'index.php?action=thematic_import&'.api_get_cidreq().$url_token); $form->addElement('header', get_lang('ImportThematic')); $form->addElement('file', 'file'); $form->addElement('checkbox', 'replace', null, get_lang('DeleteAllThematic'));