parent
1c782fa66b
commit
784f70862b
File diff suppressed because it is too large
Load Diff
@ -1,27 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/** |
||||
* Layout (principal view) used for structuring other views. |
||||
* |
||||
* @author Christian Fasanando <christian1827@gmail.com> |
||||
*/ |
||||
|
||||
// protect a course script |
||||
api_protect_course_script(true); |
||||
|
||||
// Header |
||||
$tool = TOOL_COURSE_PROGRESS; |
||||
//Display::display_header(''); |
||||
|
||||
// Introduction section |
||||
Display::display_introduction_section($tool); |
||||
|
||||
// Tracking |
||||
Event::event_access_tool($tool); |
||||
|
||||
// Display |
||||
echo $content; |
||||
|
||||
// Footer |
||||
//Display::display_footer(); |
@ -1,14 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
// protect a course script |
||||
api_protect_course_script(true); |
||||
|
||||
Display::display_reduced_header(); |
||||
|
||||
$tool = isset($tool) ? $tool : null; |
||||
// Tracking |
||||
Event::event_access_tool($tool); |
||||
|
||||
// Display |
||||
echo $content; |
@ -1,303 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/** |
||||
* View (MVC patter) for thematic control. |
||||
* |
||||
* @author Christian Fasanando <christian1827@gmail.com> |
||||
* @author Julio Montoya <gugli100@gmail.com> Bug fixing |
||||
*/ |
||||
|
||||
// protect a course script |
||||
api_protect_course_script(true); |
||||
|
||||
$token = Security::get_token(); |
||||
$url_token = "&sec_token=".$token; |
||||
$user_info = api_get_user_info(); |
||||
$params = '&'.api_get_cidreq(); |
||||
|
||||
$tpl = new Template(get_lang('Thematic control')); |
||||
$isTeacher = api_is_allowed_to_edit(null, true); |
||||
|
||||
$tpl->assign('token', $url_token); |
||||
$tpl->assign('is_allowed_to_edit', $isTeacher); |
||||
$toolbar = null; |
||||
|
||||
if ($isTeacher) { |
||||
switch ($action) { |
||||
case 'thematic_add': |
||||
case 'thematic_import_select': |
||||
$actionLeft = '<a href="index.php?'.api_get_cidreq().'">'; |
||||
$actionLeft .= Display::return_icon( |
||||
'back.png', |
||||
get_lang('Back to').' '.get_lang('Thematic view with details'), |
||||
'', |
||||
ICON_SIZE_MEDIUM |
||||
); |
||||
$actionLeft .= '</a>'; |
||||
break; |
||||
case 'thematic_list': |
||||
$actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. |
||||
Display::return_icon('new_course_progress.png', get_lang('New thematic section'), '', ICON_SIZE_MEDIUM).'</a>'; |
||||
break; |
||||
case 'thematic_details': |
||||
$actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. |
||||
Display::return_icon('new_course_progress.png', get_lang('New thematic section'), '', ICON_SIZE_MEDIUM).'</a>'; |
||||
$actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_import_select'.$url_token.'">'. |
||||
Display::return_icon('import_csv.png', get_lang('Import course progress'), '', ICON_SIZE_MEDIUM).'</a>'; |
||||
$actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_export'.$url_token.'">'. |
||||
Display::return_icon('export_csv.png', get_lang('Export course progress'), '', ICON_SIZE_MEDIUM).'</a>'; |
||||
$actionLeft .= '<a href="index.php?'.api_get_cidreq().'&action=thematic_export_pdf'.$url_token.'">'. |
||||
Display::return_icon('pdf.png', get_lang('Export to PDF'), '', ICON_SIZE_MEDIUM).'</a>'; |
||||
$actionLeft .= Display::url( |
||||
Display::return_icon('export_to_documents.png', get_lang('Export latest version of this page to Documents'), [], ICON_SIZE_MEDIUM), |
||||
api_get_self().'?'.api_get_cidreq().'&'.http_build_query(['action' => 'export_documents']).$url_token |
||||
); |
||||
break; |
||||
default: |
||||
$actionLeft = '<a href="index.php?'.api_get_cidreq().'&action=thematic_add'.$url_token.'">'. |
||||
Display::return_icon( |
||||
'new_course_progress.png', |
||||
get_lang('New thematic section'), |
||||
'', |
||||
ICON_SIZE_MEDIUM |
||||
).'</a>'; |
||||
} |
||||
|
||||
$toolbar = Display::toolbarAction('thematic-bar', [$actionLeft]); |
||||
} |
||||
|
||||
if ('thematic_list' == $action) { |
||||
$table = new SortableTable( |
||||
'thematic_list', |
||||
['Thematic', 'get_number_of_thematics'], |
||||
['Thematic', 'get_thematic_data'] |
||||
); |
||||
|
||||
$parameters['action'] = $action; |
||||
$table->set_additional_parameters($parameters); |
||||
$table->set_header(0, '', false, ['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('Detail'), |
||||
false, |
||||
['style' => 'text-align:center;width:40%;'] |
||||
); |
||||
$table->set_form_actions(['thematic_delete_select' => get_lang('Delete all thematics')]); |
||||
} |
||||
$table->display(); |
||||
} elseif ('thematic_details' == $action) { |
||||
if (isset($_GET['thematic_plan_save_message']) && |
||||
'ok' == $_GET['thematic_plan_save_message'] |
||||
) { |
||||
Display::addFlash( |
||||
Display::return_message( |
||||
get_lang('Thematic section has been created successfully'), |
||||
'confirmation', |
||||
false |
||||
) |
||||
); |
||||
} |
||||
|
||||
if (isset($last_id) && $last_id) { |
||||
$link_to_thematic_plan = '<a href="index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$last_id.'">'. |
||||
Display::return_icon('lesson_plan.png', get_lang('Thematic plan'), ['style' => 'vertical-align:middle;float:none;'], ICON_SIZE_SMALL).'</a>'; |
||||
$link_to_thematic_advance = '<a href="index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$last_id.'">'. |
||||
Display::return_icon('lesson_plan_calendar.png', get_lang('Thematic advance'), ['style' => 'vertical-align:middle;float:none;'], ICON_SIZE_SMALL).'</a>'; |
||||
Display::addFlash(Display::return_message( |
||||
get_lang('Thematic section has been created successfully').'<br />'.sprintf(get_lang('NowYouShouldAddThematic planXAndThematic advanceX'), $link_to_thematic_plan, $link_to_thematic_advance), |
||||
'confirmation', |
||||
false |
||||
)); |
||||
} |
||||
if (empty($thematic_id)) { |
||||
// display information |
||||
$text = '<strong>'.get_lang('Information').': </strong>'; |
||||
$text .= get_lang('Thematic view with detailsDescription'); |
||||
$message = Display::return_message($text, 'info', false); |
||||
} |
||||
$list = []; |
||||
|
||||
// Display thematic data |
||||
if (!empty($thematic_data)) { |
||||
// display progress |
||||
foreach ($thematic_data as $thematic) { |
||||
$list['id'] = $thematic['id']; |
||||
$list['id_course'] = $thematic['c_id']; |
||||
$list['id_session'] = $thematic['session_id']; |
||||
$list['title'] = Security::remove_XSS($thematic['title'], STUDENT); |
||||
$list['content'] = Security::remove_XSS($thematic['content'], STUDENT); |
||||
$list['display_orden'] = $thematic['display_order']; |
||||
$list['active'] = $thematic['active']; |
||||
$my_thematic_id = $thematic['id']; |
||||
|
||||
$session_star = ''; |
||||
if (api_is_allowed_to_edit(null, true)) { |
||||
if (api_get_session_id() == $thematic['session_id']) { |
||||
$session_star = api_get_session_image(api_get_session_id(), $user_info['status']); |
||||
} |
||||
} |
||||
|
||||
$tpl->assign('session_star', $session_star); |
||||
|
||||
//@todo add a validation in order to load or not course thematics in the session thematic |
||||
$toolbarThematic = ''; |
||||
if (api_is_allowed_to_edit(null, true)) { |
||||
// Thematic title |
||||
$toolbarThematic = Display::url( |
||||
Display::return_icon( |
||||
'cd.png', |
||||
get_lang('Copy'), |
||||
null, |
||||
ICON_SIZE_TINY |
||||
), |
||||
'index.php?'.api_get_cidreq().'&action=thematic_copy&thematic_id='.$my_thematic_id.$params.$url_token, |
||||
['class' => 'btn btn-default'] |
||||
); |
||||
if (0 == api_get_session_id()) { |
||||
if ($thematic['display_order'] > 1) { |
||||
$toolbarThematic .= ' <a class="btn btn-default" href="'.api_get_self().'?action=moveup&'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'. |
||||
Display::return_icon('up.png', get_lang('Up'), '', ICON_SIZE_TINY).'</a>'; |
||||
} else { |
||||
$toolbarThematic .= '<div class="btn btn-default">'. |
||||
Display::return_icon('up_na.png', ' ', '', ICON_SIZE_TINY).'</div>'; |
||||
} |
||||
if (isset($thematic['max_thematic_item']) && $thematic['display_order'] < $thematic['max_thematic_item']) { |
||||
$toolbarThematic .= ' <a class="btn btn-default" href="'.api_get_self().'?action=movedown&a'.api_get_cidreq().'&thematic_id='.$my_thematic_id.$params.$url_token.'">'. |
||||
Display::return_icon('down.png', get_lang('down'), '', ICON_SIZE_TINY).'</a>'; |
||||
} else { |
||||
$toolbarThematic .= '<div class="btn btn-default">'. |
||||
Display::return_icon('down_na.png', ' ', '', ICON_SIZE_TINY).'</div>'; |
||||
} |
||||
} |
||||
if (api_get_session_id() == $thematic['session_id']) { |
||||
$toolbarThematic .= Display::url( |
||||
Display::return_icon('pdf.png', get_lang('Export to PDF'), null, ICON_SIZE_TINY), |
||||
api_get_self().'?'.api_get_cidreq()."$url_token&".http_build_query([ |
||||
'action' => 'export_single_thematic', |
||||
'thematic_id' => $my_thematic_id, |
||||
]), |
||||
['class' => 'btn btn-default'] |
||||
); |
||||
$toolbarThematic .= Display::url( |
||||
Display::return_icon( |
||||
'export_to_documents.png', |
||||
get_lang('Export latest version of this page to Documents'), |
||||
[], |
||||
ICON_SIZE_TINY |
||||
), |
||||
api_get_self().'?'.api_get_cidreq().$url_token.'&'.http_build_query( |
||||
['action' => 'export_single_documents', 'thematic_id' => $my_thematic_id] |
||||
), |
||||
['class' => 'btn btn-default'] |
||||
); |
||||
$toolbarThematic .= '<a class="btn btn-default" href="index.php?'.api_get_cidreq().'&action=thematic_edit&thematic_id=' |
||||
.$my_thematic_id.$params.$url_token.'">' |
||||
.Display::return_icon('edit.png', get_lang('Edit'), '', ICON_SIZE_TINY).'</a>'; |
||||
$toolbarThematic .= '<a class="btn btn-default" onclick="javascript:if(!confirm(\'' |
||||
.get_lang('Are you sure you want to delete') |
||||
.'\')) return false;" href="index.php?'.api_get_cidreq().'&action=thematic_delete&thematic_id=' |
||||
.$my_thematic_id.$params.$url_token.'">' |
||||
.Display::return_icon('delete.png', get_lang('Delete'), '', ICON_SIZE_TINY).'</a>'; |
||||
} |
||||
} |
||||
if (empty($thematic_plan_div[$thematic['id']])) { |
||||
$list['thematic_plan'] = null; |
||||
} else { |
||||
$list['thematic_plan'] = $thematic_plan_div[$thematic['id']]; |
||||
} |
||||
$list['thematic_advance'] = isset($thematic_advance_data[$thematic['id']]) |
||||
? $thematic_advance_data[$thematic['id']] |
||||
: null; |
||||
$list['last_done'] = $last_done_thematic_advance; |
||||
$list['toolbar'] = $toolbarThematic; |
||||
$listThematic[] = $list; |
||||
|
||||
$tpl->assign('data', $listThematic); |
||||
} //End for |
||||
} |
||||
$thematicLayout = $tpl->get_template('course_progress/progress.html.twig'); |
||||
$content = $tpl->fetch($thematicLayout); |
||||
$tpl->assign('content', $content); |
||||
} elseif ('thematic_add' == $action || 'thematic_edit' == $action) { |
||||
// Display form |
||||
$form = new FormValidator('thematic_add', 'POST', 'index.php?action=thematic_add&'.api_get_cidreq()); |
||||
if ('thematic_edit' == $action) { |
||||
$form->addElement('header', '', get_lang('Edit thematic section')); |
||||
} |
||||
|
||||
$form->addElement('hidden', 'sec_token', $token); |
||||
$form->addElement('hidden', 'action', $action); |
||||
|
||||
if (!empty($thematic_id)) { |
||||
$form->addElement('hidden', 'thematic_id', $thematic_id); |
||||
} |
||||
|
||||
if (api_get_configuration_value('save_titles_as_html')) { |
||||
$form->addHtmlEditor( |
||||
'title', |
||||
get_lang('Title'), |
||||
true, |
||||
false, |
||||
['ToolbarSet' => 'TitleAsHtml'] |
||||
); |
||||
} else { |
||||
$form->addText('title', get_lang('Title'), true, ['size' => '50']); |
||||
} |
||||
$form->addHtmlEditor( |
||||
'content', |
||||
get_lang('Content'), |
||||
false, |
||||
false, |
||||
['ToolbarSet' => 'Basic', 'Height' => '150'] |
||||
); |
||||
$form->addButtonSave(get_lang('Save')); |
||||
|
||||
$show_form = true; |
||||
|
||||
if (!empty($thematic_data)) { |
||||
if (api_get_session_id()) { |
||||
if ($thematic_data['session_id'] != api_get_session_id()) { |
||||
$show_form = false; |
||||
echo Display::return_message(get_lang('Sorry, you are not allowed to access this page, or maybe your connection has expired. Please click your browser\'s "Back" button or follow the link below to return to the previous page.'), 'error', false); |
||||
} |
||||
} |
||||
// set default values |
||||
$default['title'] = $thematic_data['title']; |
||||
$default['content'] = $thematic_data['content']; |
||||
$form->setDefaults($default); |
||||
} |
||||
|
||||
// error messages |
||||
if (isset($error)) { |
||||
echo Display::return_message(get_lang('The form contains incorrect or incomplete data. Please check your input.'), 'error', false); |
||||
} |
||||
if ($show_form) { |
||||
$html = $form->returnForm(); |
||||
} |
||||
} elseif ('thematic_import_select' == $action) { |
||||
// Create form to upload csv file. |
||||
$form = new FormValidator( |
||||
'thematic_import', |
||||
'POST', |
||||
'index.php?action=thematic_import&'.api_get_cidreq().$url_token |
||||
); |
||||
$form->addElement('header', get_lang('Import course progress')); |
||||
$form->addElement('file', 'file'); |
||||
$form->addElement('checkbox', 'replace', null, get_lang('Delete all course progress')); |
||||
$form->addButtonImport(get_lang('Import'), 'SubmitImport'); |
||||
$html = $form->returnForm(); |
||||
} |
||||
$tpl->assign('actions', $toolbar); |
||||
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_one_col_template(); |
@ -1,267 +0,0 @@ |
||||
<?php |
||||
/* For licensing terms, see /license.txt */ |
||||
|
||||
/** |
||||
* View (MVC patter) for thematic advance. |
||||
* |
||||
* @author Christian Fasanando <christian1827@gmail.com> |
||||
* @author Julio Montoya <gugli100@gmail.com> BeezNest 2011 Bug fixing |
||||
*/ |
||||
|
||||
// protect a course script |
||||
api_protect_course_script(true); |
||||
$tpl = new Template(get_lang('Thematic control')); |
||||
$toolbar = null; |
||||
$formLayout = null; |
||||
|
||||
if ('thematic_advance_add' === $action || 'thematic_advance_edit' === $action) { |
||||
$header_form = get_lang('New thematic advance'); |
||||
if ('thematic_advance_edit' === $action) { |
||||
$header_form = get_lang('Edit thematic advance'); |
||||
} |
||||
|
||||
// display form |
||||
$form = new FormValidator( |
||||
'thematic_advance', |
||||
'POST', |
||||
api_get_self().'?'.api_get_cidreq() |
||||
); |
||||
$form->addElement('header', $header_form); |
||||
//$form->addElement('hidden', 'thematic_advance_token',$token); |
||||
$form->addElement('hidden', 'action', $action); |
||||
|
||||
if (!empty($thematic_advance_id)) { |
||||
$form->addElement('hidden', 'thematic_advance_id', $thematic_advance_id); |
||||
} |
||||
if (!empty($thematic_id)) { |
||||
$form->addElement('hidden', 'thematic_id', $thematic_id); |
||||
} |
||||
|
||||
$radios = []; |
||||
$radios[] = $form->createElement( |
||||
'radio', |
||||
'start_date_type', |
||||
null, |
||||
get_lang('Start date taken from an attendance date'), |
||||
'1', |
||||
[ |
||||
'onclick' => 'check_per_attendance(this)', |
||||
'id' => 'from_attendance', |
||||
] |
||||
); |
||||
$radios[] = $form->createElement( |
||||
'radio', |
||||
'start_date_type', |
||||
null, |
||||
get_lang('Custom start date'), |
||||
'2', |
||||
[ |
||||
'onclick' => 'check_per_custom_date(this)', |
||||
'id' => 'custom_date', |
||||
] |
||||
); |
||||
$form->addGroup($radios, null, get_lang('Start date options')); |
||||
|
||||
if (isset($thematic_advance_data['attendance_id']) && |
||||
0 == $thematic_advance_data['attendance_id']) { |
||||
$form->addElement('html', '<div id="div_custom_datetime" style="display:block">'); |
||||
} else { |
||||
$form->addElement('html', '<div id="div_custom_datetime" style="display:none">'); |
||||
} |
||||
|
||||
$form->addElement('DateTimePicker', 'custom_start_date', get_lang('Start Date')); |
||||
$form->addElement('html', '</div>'); |
||||
|
||||
if (isset($thematic_advance_data['attendance_id']) && |
||||
0 == $thematic_advance_data['attendance_id'] |
||||
) { |
||||
$form->addElement('html', '<div id="div_datetime_by_attendance" style="display:none">'); |
||||
} else { |
||||
$form->addElement('html', '<div id="div_datetime_by_attendance" style="display:block">'); |
||||
} |
||||
|
||||
if (count($attendance_select) > 1) { |
||||
$form->addElement( |
||||
'select', |
||||
'attendance_select', |
||||
get_lang('Attendances'), |
||||
$attendance_select, |
||||
['id' => 'id_attendance_select', 'onchange' => 'datetime_by_attendance(this.value)'] |
||||
); |
||||
} else { |
||||
$form->addElement( |
||||
'label', |
||||
get_lang('Attendances'), |
||||
'<strong><em>'.get_lang('There is no attendance sheet in this course').'</em></strong>' |
||||
); |
||||
} |
||||
|
||||
$form->addElement('html', '<div id="div_datetime_attendance">'); |
||||
if (!empty($calendar_select)) { |
||||
$form->addElement( |
||||
'select', |
||||
'start_date_by_attendance', |
||||
get_lang('Start Date'), |
||||
$calendar_select, |
||||
['id' => 'start_date_select_calendar'] |
||||
); |
||||
} |
||||
$form->addElement('html', '</div>'); |
||||
$form->addElement('html', '</div>'); |
||||
|
||||
$form->addText( |
||||
'duration_in_hours', |
||||
get_lang('Duration in hours'), |
||||
false, |
||||
[ |
||||
'size' => '3', |
||||
'id' => 'duration_in_hours_element', |
||||
'autofocus' => 'autofocus', |
||||
] |
||||
); |
||||
|
||||
$form->addHtmlEditor( |
||||
'content', |
||||
get_lang('Content'), |
||||
false, |
||||
false, |
||||
[ |
||||
'ToolbarStartExpanded' => 'false', |
||||
'ToolbarSet' => 'Basic', |
||||
'Height' => '150', |
||||
] |
||||
); |
||||
|
||||
if ('thematic_advance_add' == $action) { |
||||
$form->addButtonSave(get_lang('Save')); |
||||
} else { |
||||
$form->addButtonUpdate(get_lang('Save')); |
||||
} |
||||
|
||||
$attendance_select_item_id = null; |
||||
if (count($attendance_select) > 1) { |
||||
$i = 1; |
||||
foreach ($attendance_select as $key => $attendance_select_item) { |
||||
if (2 == $i) { |
||||
$attendance_select_item_id = $key; |
||||
break; |
||||
} |
||||
$i++; |
||||
} |
||||
if (!empty($attendance_select_item_id)) { |
||||
$default['attendance_select'] = $attendance_select_item_id; |
||||
if ($thematic_advance_id) { |
||||
echo '<script> datetime_by_attendance("'.$attendance_select_item_id.'", "'.$thematic_advance_id.'"); </script>'; |
||||
} else { |
||||
echo '<script> datetime_by_attendance("'.$attendance_select_item_id.'", 0); </script>'; |
||||
} |
||||
} |
||||
} |
||||
|
||||
$default['start_date_type'] = 1; |
||||
$default['custom_start_date'] = date('Y-m-d H:i:s', api_strtotime(api_get_local_time())); |
||||
$default['duration_in_hours'] = 1; |
||||
|
||||
if (!empty($thematic_advance_data)) { |
||||
// set default values |
||||
$default['content'] = isset($thematic_advance_data['content']) ? $thematic_advance_data['content'] : null; |
||||
$default['duration_in_hours'] = isset($thematic_advance_data['duration']) ? $thematic_advance_data['duration'] : 1; |
||||
if (empty($thematic_advance_data['attendance_id'])) { |
||||
$default['start_date_type'] = 1; |
||||
$default['custom_start_date'] = null; |
||||
if (isset($thematic_advance_data['start_date'])) { |
||||
$default['custom_start_date'] = date( |
||||
'Y-m-d H:i:s', |
||||
api_strtotime(api_get_local_time($thematic_advance_data['start_date'])) |
||||
); |
||||
} |
||||
} else { |
||||
$default['start_date_type'] = 1; |
||||
if (!empty($thematic_advance_data['start_date'])) { |
||||
$default['start_date_by_attendance'] = api_get_local_time($thematic_advance_data['start_date']); |
||||
} |
||||
|
||||
$default['attendance_select'] = $thematic_advance_data['attendance_id']; |
||||
} |
||||
} |
||||
$form->setDefaults($default); |
||||
|
||||
if ($form->validate()) { |
||||
$values = $form->exportValues(); |
||||
|
||||
if (isset($_POST['start_date_by_attendance'])) { |
||||
$values['start_date_by_attendance'] = $_POST['start_date_by_attendance']; |
||||
} |
||||
|
||||
$thematic = new Thematic(); |
||||
$thematic->set_thematic_advance_attributes( |
||||
isset($values['thematic_advance_id']) ? $values['thematic_advance_id'] : null, |
||||
$values['thematic_id'], |
||||
1 == $values['start_date_type'] && isset($values['attendance_select']) ? $values['attendance_select'] : 0, |
||||
$values['content'], |
||||
2 == $values['start_date_type'] ? $values['custom_start_date'] : $values['start_date_by_attendance'], |
||||
$values['duration_in_hours'] |
||||
); |
||||
|
||||
$affected_rows = $thematic->thematic_advance_save(); |
||||
|
||||
if ($affected_rows) { |
||||
// get last done thematic advance before move thematic list |
||||
$last_done_thematic_advance = $thematic->get_last_done_thematic_advance(); |
||||
// update done advances with de current thematic list |
||||
if (!empty($last_done_thematic_advance)) { |
||||
$thematic->update_done_thematic_advances($last_done_thematic_advance); |
||||
} |
||||
} |
||||
|
||||
$redirectUrlParams = 'course_progress/index.php?'.api_get_cidreq().'&'. |
||||
http_build_query([ |
||||
'action' => 'thematic_advance_list', |
||||
'thematic_id' => $values['thematic_id'], |
||||
]); |
||||
|
||||
Display::addFlash(Display::return_message(get_lang('Update successful'))); |
||||
|
||||
header('Location: '.api_get_path(WEB_CODE_PATH).$redirectUrlParams); |
||||
exit; |
||||
} |
||||
|
||||
$formLayout = $form->returnForm(); |
||||
} elseif ('thematic_advance_list' == $action) { |
||||
// thematic advance list |
||||
echo '<div class="actions">'; |
||||
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=thematic_details">'. |
||||
Display::return_icon('back.png', get_lang("Back to"), '', ICON_SIZE_MEDIUM).'</a>'; |
||||
if (api_is_allowed_to_edit(false, true)) { |
||||
echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=thematic_advance_add&thematic_id='.$thematic_id.'"> '. |
||||
Display::return_icon('add.png', get_lang('New thematic advance'), '', ICON_SIZE_MEDIUM).'</a>'; |
||||
} |
||||
echo '</div>'; |
||||
$table = new SortableTable( |
||||
'thematic_advance_list', |
||||
['Thematic', 'get_number_of_thematic_advances'], |
||||
['Thematic', 'get_thematic_advance_data'] |
||||
); |
||||
//$table->set_additional_parameters($parameters); |
||||
$table->set_header(0, '', false, ['style' => 'width:20px;']); |
||||
$table->set_header(1, get_lang('Start Date'), false); |
||||
$table->set_header(2, get_lang('Duration in hours'), false, ['style' => 'width:80px;']); |
||||
$table->set_header(3, get_lang('Content'), false); |
||||
|
||||
if (api_is_allowed_to_edit(null, true)) { |
||||
$table->set_header( |
||||
4, |
||||
get_lang('Detail'), |
||||
false, |
||||
['style' => 'text-align:center'] |
||||
); |
||||
} |
||||
$table->display(); |
||||
} |
||||
$tpl->assign('form_thematic', $formLayout); |
||||
|
||||
$thematicLayout = $tpl->get_template('course_progress/thematic_advance.html.twig'); |
||||
$content = $tpl->fetch($thematicLayout); |
||||
$tpl->assign('content', $content); |
||||
|
||||
$tpl->display_one_col_template(); |
Loading…
Reference in new issue