diff --git a/main/attendance/attendance_list.php b/main/attendance/attendance_list.php index f917a15fe2..bbaf00af16 100755 --- a/main/attendance/attendance_list.php +++ b/main/attendance/attendance_list.php @@ -17,7 +17,6 @@ if (api_is_allowed_to_edit(null, true)) { } echo '
'; echo ''.Display::return_icon('adherir.png',get_lang('CreateANewAttendance')).' '.get_lang('CreateANewAttendance').''; - echo ''.Display::return_icon('defaut.gif',get_lang('ThematicControl')).' '.get_lang('ThematicControl').''; echo '
'; } $table = new SortableTable('attendance_list', array('Attendance', 'get_number_of_attendances'), array('Attendance', 'get_attendance_data'), $default_column); diff --git a/main/course_info/infocours.php b/main/course_info/infocours.php index 99684f05c3..6bf6a37279 100755 --- a/main/course_info/infocours.php +++ b/main/course_info/infocours.php @@ -235,7 +235,8 @@ if (is_settings_editable()) { // THEMATIC SETTINGS $form->addElement('html', '
'.Display::return_icon('top.gif', get_lang('Top')).''.Display::return_icon('attendance.gif', get_lang('ConfigChat')).' '.get_lang('ThematicAdvanceConfiguration').'
'); $form->addElement('radio', 'display_info_advance_inside_homecourse', get_lang('InfoAboutAdvanceInsideHomeCourse'), get_lang('DisplayAboutLastDoneAdvance'), 1); -$form->addElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDone'), 0); +$form->addElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DisplayAboutNextAdvanceNotDone'), 2); +$form->addElement('radio', 'display_info_advance_inside_homecourse', null, get_lang('DoNotDisplayAnyAdvance'), 0); $form->addElement('style_submit_button', null, get_lang('SaveSettings'), 'class="save"'); diff --git a/main/course_progress/index.php b/main/course_progress/index.php new file mode 100755 index 0000000000..604a80dd26 --- /dev/null +++ b/main/course_progress/index.php @@ -0,0 +1,217 @@ + +* @package chamilo.course_progress +*/ + +// name of the language file that needs to be included +$language_file = array ('course_description', 'pedaSuggest', 'userInfo', 'admin'); + +// including files +require_once '../inc/global.inc.php'; +require_once api_get_path(LIBRARY_PATH).'attendance.lib.php'; +require_once api_get_path(LIBRARY_PATH).'thematic.lib.php'; +require_once api_get_path(LIBRARY_PATH).'app_view.php'; +//require_once 'attendance_controller.php'; +require_once 'thematic_controller.php'; +require_once api_get_path(LIBRARY_PATH).'usermanager.lib.php'; +require_once api_get_path(LIBRARY_PATH).'course.lib.php'; +require_once api_get_path(LIBRARY_PATH).'sortabletable.class.php'; +require_once api_get_path(LIBRARY_PATH).'formvalidator/FormValidator.class.php'; +//require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php'; + +// current section +$this_section = SECTION_COURSES; + +// protect a course script +api_protect_course_script(true); + + +// defining constants +define('ADD_THEMATIC_PLAN', 6); + +// get actions +$actions = array('thematic_details', 'thematic_list', 'thematic_add', 'thematic_edit', 'thematic_delete', 'moveup', 'movedown', + 'thematic_plan_list', 'thematic_plan_add', 'thematic_plan_edit', 'thematic_plan_delete', + 'thematic_advance_list', 'thematic_advance_add', 'thematic_advance_edit', 'thematic_advance_delete'); + +$action = 'thematic_details'; +if (isset($_GET['action']) && in_array($_GET['action'],$actions)) { + $action = $_GET['action']; +} + +if (isset($_POST['action']) && $_POST['action'] == 'thematic_delete_select') { + $action = 'thematic_delete_select'; +} + +if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') { + $action = 'thematic_details'; +} + +if ($action == 'thematic_details' || $action == 'thematic_list') { + $_SESSION['thematic_control'] = $action; +} + +// get thematic id +if (isset($_GET['thematic_id'])) { + $thematic_id = intval($_GET['thematic_id']); +} + +// get thematic plan description type +if (isset($_GET['description_type'])) { + $description_type = intval($_GET['description_type']); +} + +// instance thematic object for using like library here +$thematic = new Thematic(); + +// thematic controller object +$thematic_controller = new ThematicController(); + +if (!empty($thematic_id)) { + // thematic data by id + $thematic_data = $thematic->get_thematic_list($thematic_id); +} + +// get default thematic plan title +$default_thematic_plan_title = $thematic->get_default_thematic_plan_title(); + +$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; +$htmlHeadXtra[] = ''; + + +// interbreadcrumbs +//$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_details'.$param_gradebook.$student_param, 'name' => get_lang('ToolAttendance')); +//if ($action == 'attendance_add') { + //$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('CreateANewAttendance')); +//} +if ($action == 'thematic_list') { + $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl')); +} +if ($action == 'thematic_add') { + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicSection')); +} +if ($action == 'thematic_edit') { + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('EditThematicSection')); +} +if ($action == 'thematic_details') { + $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('ThematicControl')); +} +if ($action == 'thematic_plan_list' || $action == 'thematic_plan_delete') { + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => '#', 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan')); +} +if ($action == 'thematic_plan_add' || $action == 'thematic_plan_edit') { + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_plan_list&thematic_id='.$thematic_id, 'name' => $thematic_data['title'].':'.get_lang('ThematicPlan')); + if ($description_type >= ADD_THEMATIC_PLAN) { + $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewBloc')); + } else { + $interbreadcrumb[] = array ('url' => '#', 'name' => $default_thematic_plan_title[$description_type]); + } +} +if ($action == 'thematic_advance_list') { + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => '#', 'name' => $thematic_data['title'].':'.get_lang('ThematicAdvance')); +} +if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action='.$_SESSION['thematic_control'], 'name' => get_lang('ThematicControl')); + $interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=thematic_advance_list&thematic_id='.$thematic_id, 'name' => $thematic_data['title'].':'.get_lang('ThematicAdvance')); + $interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('NewThematicAdvance')); +} + +// distpacher actions to controller +switch ($action) { + case 'thematic_add' : + case 'thematic_edit' : + case 'thematic_delete' : + case 'thematic_delete_select' : + case 'thematic_details' : + case 'moveup' : + case 'movedown' : + case 'thematic_list' : $thematic_controller->thematic($action); + break; + case 'thematic_plan_list' : + case 'thematic_plan_add' : + case 'thematic_plan_edit' : + case 'thematic_plan_delete' : $thematic_controller->thematic_plan($action); + break; + case 'thematic_advance_list' : + case 'thematic_advance_add' : + case 'thematic_advance_edit' : + case 'thematic_advance_delete' : $thematic_controller->thematic_advance($action); + break; +} + +?> \ No newline at end of file diff --git a/main/course_progress/layout.php b/main/course_progress/layout.php new file mode 100755 index 0000000000..5939ccaa25 --- /dev/null +++ b/main/course_progress/layout.php @@ -0,0 +1,29 @@ + +* @package chamilo.course_progress +*/ + +// 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_access_tool($tool); + +// Display +echo $content; + +// Footer +Display :: display_footer(); + +?> diff --git a/main/course_progress/thematic.php b/main/course_progress/thematic.php new file mode 100755 index 0000000000..9df170606d --- /dev/null +++ b/main/course_progress/thematic.php @@ -0,0 +1,173 @@ + +* @package chamilo.course_progress +*/ + +// protect a course script +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 '
'; +} + +if ($action == 'thematic_list') { + + $table = new SortableTable('thematic_list', array('Thematic', 'get_number_of_thematics'), array('Thematic', 'get_thematic_data')); + $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') { + + // display title + if (!empty($thematic_id)) { + echo '
'.$thematic_data[$thematic_id]['title'].': '.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').'
'.$thematic['title'].'
'.$thematic['content'].'
'; + if (api_is_allowed_to_edit(null, true)) { + echo '
'.Display::return_icon('lp_quiz.png',get_lang('EditThematicPlan'),array('style'=>'vertical-align:middle')).'

'; + } + if (!empty($thematic_plan_data[$thematic['id']])) { + foreach ($thematic_plan_data[$thematic['id']] as $thematic_plan) { + echo '
'.$thematic_plan['title'].'
'.$thematic_plan['description'].'
'; + } + } else { + echo '
'.get_lang('StillDoNotHaveAThematicPlan').'
'; + } + echo '
'; + if (api_is_allowed_to_edit(null, true)) { + echo '
'.Display::return_icon('lp_quiz.png',get_lang('EditThematicAdvance'),array('style'=>'vertical-align:middle')).'

'; + } + echo ''; + if (!empty($thematic_advance_data[$thematic['id']])) { + foreach ($thematic_advance_data[$thematic['id']] as $thematic_advance) { + 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 '
'.api_convert_and_format_date($thematic_advance['start_date'], DATE_TIME_FORMAT_LONG, date_default_timezone_get()).'
'; + echo '
'.$thematic_advance['content'].'
'; + echo '
'.get_lang('DurationInHours').' : '.$thematic_advance['duration'].'
'; + echo '
'.get_lang('Done').'
-
'.get_lang('StillDoNotHaveAThematicAdvance').'
 
'; + echo '
'; + } else { + echo '
'.get_lang('ThereIsStillAthematicSection').'
'; + } + +} else if ($action == 'thematic_add' || $action == 'thematic_edit') { + + if (!$error) { + $token = md5(uniqid(rand(),TRUE)); + $_SESSION['thematic_token'] = $token; + } + + $header_form = get_lang('NewThematicSection'); + if ($action == 'thematic_edit') { + $header_form = 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); + + 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(); + +} +?> \ No newline at end of file diff --git a/main/course_progress/thematic_advance.php b/main/course_progress/thematic_advance.php new file mode 100755 index 0000000000..75cf5fb402 --- /dev/null +++ b/main/course_progress/thematic_advance.php @@ -0,0 +1,136 @@ + +* @package chamilo.course_progress +*/ + +// protect a course script +api_protect_course_script(true); + +if ($action == 'thematic_advance_add' || $action == 'thematic_advance_edit') { + + $header_form = get_lang('NewThematicAdvance'); + if ($action == 'thematic_advance_edit') { + $header_form = get_lang('EditThematicAdvance'); + } + + if (!$error) { + $token = md5(uniqid(rand(),TRUE)); + $_SESSION['thematic_advance_token'] = $token; + } + + // display form + $form = new FormValidator('thematic_advance','POST','index.php?action=thematic_advance_list&thematic_id='.$thematic_id.'&'.api_get_cidreq(),'','style="width: 100%;"'); + $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 = array(); + $radios[] = FormValidator::createElement('radio', 'start_date_type', null, get_lang('StartDateFromAnAttendance'),'1',array('onclick' => 'check_per_attendance(this)', 'id'=>'from_attendance')); + $radios[] = FormValidator::createElement('radio', 'start_date_type', null, get_lang('StartDateCustom'),'2',array('onclick' => 'check_per_custom_date(this)', 'id'=>'custom_date')); + $form->addGroup($radios, null, get_lang('StartDateOptions')); + + if (isset($thematic_advance_data['attendance_id']) && $thematic_advance_data['attendance_id'] == 0) { + $form->addElement('html', '
'); + } else { + $form->addElement('html', ''); + + if (isset($thematic_advance_data['attendance_id']) && $thematic_advance_data['attendance_id'] == 0) { + $form->addElement('html', '