Adding different states for the attendance see BT#5419

skala
Julio Montoya 13 years ago
parent b621049d98
commit c2d95cca0f
  1. 334
      main/attendance/attendance_controller.php
  2. 201
      main/attendance/attendance_sheet.php
  3. 138
      main/attendance/index.php

@ -3,9 +3,9 @@
/**
* This file contains class used like controller, it should be included inside a dispatcher file (e.g: index.php)
*
*
* !!! WARNING !!! : ALL DATES IN THIS MODULE ARE STORED IN UTC ! DO NOT CONVERT DURING THE TRANSITION FROM CHAMILO 1.8.x TO 2.0
*
*
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> lot of bugfixes + improvements
* @package chamilo.attendance
@ -14,59 +14,59 @@
/**
* Controller script. Prepares the common background variables to give to the scripts corresponding to
* the requested action
* @package chamilo.attendance
* @package chamilo.attendance
*/
class AttendanceController
class AttendanceController
{
/**
* Constructor
*/
public function __construct() {
$this->toolname = 'attendance';
$this->view = new View($this->toolname);
public function __construct() {
$this->toolname = 'attendance';
$this->view = new View($this->toolname);
}
/**
* It's used for listing attendace,
* render to attendance_list view
* @param boolean true for listing history (optional)
* @param array message for showing by action['edit','add','delete'] (optional)
* @param array message for showing by action['edit','add','delete'] (optional)
*/
public function attendance_list($history = false, $messages = array()) {
public function attendance_list($history = false, $messages = array()) {
// render to the view
$this->view->set_data(array());
$this->view->set_layout('layout');
$this->view->set_template('attendance_list');
$this->view->render();
$this->view->set_layout('layout');
$this->view->set_template('attendance_list');
$this->view->render();
}
/**
* It's used for adding attendace,
* render to attendance_add or attendance_list view
*/
public function attendance_add() {
$attendance = new Attendance();
$attendance = new Attendance();
$data = array();
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (!empty($_POST['title'])) {
$check = Security::check_token();
$check = Security::check_token();
if ($check) {
$attendance->set_name($_POST['title']);
$attendance->set_description($_POST['description']);
$attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']);
$attendance->set_attendance_weight($_POST['attendance_weight']);
$link_to_gradebook = false;
$link_to_gradebook = false;
if ( isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1 ) {
$link_to_gradebook = true;
}
$link_to_gradebook = true;
}
$attendance->category_id = $_POST['category_id'];
$last_id = $attendance->attendance_add($link_to_gradebook);
Security::clear_token();
$last_id = $attendance->attendance_add($link_to_gradebook);
Security::clear_token();
}
$param_gradebook = '';
if (isset($_SESSION['gradebook'])) {
@ -74,70 +74,70 @@
}
//header('location:index.php?action=attendance_sheet_list&attendance_id='.$last_id.'&'.api_get_cidreq().$param_gradebook);
header('location:index.php?action=calendar_add&attendance_id='.$last_id.'&'.api_get_cidreq().$param_gradebook);
exit;
exit;
} else {
$data['error'] = true;
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('attendance_add');
$this->view->set_layout('layout');
$this->view->set_template('attendance_add');
$this->view->render();
}
} else {
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('attendance_add');
$this->view->set_layout('layout');
$this->view->set_template('attendance_add');
$this->view->render();
}
}
}
/**
* It's used for editing attendace,
* render to attendance_edit or attendance_list view
* @param int attendance id
*/
public function attendance_edit($attendance_id) {
$attendance = new Attendance();
public function attendance_edit($attendance_id) {
$attendance = new Attendance();
$data = array();
$attendance_id = intval($attendance_id);
$attendance_id = intval($attendance_id);
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (!empty($_POST['title'])) {
$check = Security::check_token();
$check = Security::check_token();
if ($check) {
$attendance->set_name($_POST['title']);
$attendance->set_description($_POST['description']);
$attendance->set_attendance_qualify_title($_POST['attendance_qualify_title']);
$attendance->set_attendance_weight($_POST['attendance_weight']);
$attendance->category_id = $_POST['category_id'];
$link_to_gradebook = false;
$link_to_gradebook = false;
if ( isset($_POST['attendance_qualify_gradebook']) && $_POST['attendance_qualify_gradebook'] == 1 ) {
$link_to_gradebook = true;
}
$last_id = $attendance->attendance_edit($attendance_id,$link_to_gradebook);
$link_to_gradebook = true;
}
$last_id = $attendance->attendance_edit($attendance_id,$link_to_gradebook);
Security::clear_token();
$param_gradebook = '';
if (isset($_SESSION['gradebook'])) {
$param_gradebook = '&gradebook='.Security::remove_XSS($_SESSION['gradebook']);
}
header('location:index.php?action=attendance_list&'.api_get_cidreq().$param_gradebook);
exit;
exit;
}
} else {
$data['attendance_id'] = $_POST['attendance_id'];
$data['error'] = true;
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('attendance_edit');
$this->view->render();
$this->view->set_layout('layout');
$this->view->set_template('attendance_edit');
$this->view->render();
}
} else {
// default values
$attendance_data = $attendance->get_attendance_by_id($attendance_id);
$data['attendance_id'] = $attendance_data['id'];
@ -147,42 +147,42 @@
$data['attendance_weight'] = $attendance_data['attendance_weight'];
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('attendance_edit');
$this->view->set_layout('layout');
$this->view->set_template('attendance_edit');
$this->view->render();
}
}
}
/**
* It's used for delete attendaces
* render to attendance_list view
* @param int attendance id
*/
public function attendance_delete($attendance_id) {
$attendance = new Attendance();
$attendance = new Attendance();
if (!empty($attendance_id)) {
$affected_rows = $attendance->attendance_delete($attendance_id);
}
if ($affected_rows) {
$message['message_attendance_delete'] = true;
}
$this->attendance_list();
if ($affected_rows) {
$message['message_attendance_delete'] = true;
}
$this->attendance_list();
}
/**
* Restores an attendance entry and fallback to attendances rendering
* @param int attendance id
*/
public function attendance_restore($attendance_id) {
$attendance = new Attendance();
$attendance = new Attendance();
if (!empty($attendance_id)) {
$affected_rows = $attendance->attendance_restore($attendance_id);
}
if ($affected_rows) {
$message['message_attendance_restore'] = true;
}
$this->attendance_list();
if ($affected_rows) {
$message['message_attendance_restore'] = true;
}
$this->attendance_list();
}
/**
@ -195,7 +195,7 @@
public function lock_attendance($action, $attendance_id) {
$attendance = new Attendance();
$attendance_id = intval($attendance_id);
if ($action == 'lock_attendance') {
$result = $attendance->lock_attendance($attendance_id);
} else {
@ -206,7 +206,7 @@
}
$this->attendance_list();
}
public function export($id, $type = 'pdf') {
$attendance = new Attendance();
$attendance_id = intval($attendance_id);
@ -218,75 +218,85 @@
* @param string action
* @param int attendance id
*/
public function attendance_sheet($action, $attendance_id, $user_id = 0, $edit = true) {
$attendance = new Attendance();
public function attendance_sheet($action, $attendance_id, $user_id = 0, $edit = true) {
$attendance = new Attendance();
$data = array();
$data['attendance_id'] = $attendance_id;
$data['attendance_id'] = $attendance_id;
$data['users_in_course'] = $attendance->get_users_rel_course($attendance_id);
$filter_type = 'today';
if (!empty($user_id)) {
$user_id = intval($user_id);
} else {
$user_id = api_get_user_id();
$user_id = api_get_user_id();
}
if (!empty($_REQUEST['filter'])) {
$filter_type = $_REQUEST['filter'];
}
if ($edit == true) {
if ($edit == true) {
if (api_is_allowed_to_edit(null, true)) {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);
}
} else {
if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api_get_course_id())) {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);
if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api_get_course_id())) {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);
} else {
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, $user_id);
}
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id, $user_id);
}
$data['faults'] = $attendance->get_faults_of_user($user_id, $attendance_id);
$data['user_id'] = $user_id;
}
$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
$data['next_attendance_calendar_datetime'] = $attendance->get_next_attendance_calendar_datetime($attendance_id);
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (isset($_POST['hidden_input'])) {
foreach ($_POST['hidden_input'] as $cal_id) {
$users_present = array();
$users_result = array();
if (isset($_POST['check_presence'][$cal_id])) {
$users_present = $_POST['check_presence'][$cal_id];
$users_result = $_POST['check_presence'][$cal_id];
}
$affected_rows = $attendance->attendance_sheet_add($cal_id,$users_present,$attendance_id);
$user_final_results = array();
if (!empty($users_result)) {
foreach ($users_result as $result) {
$user_status = explode('_', $result);
if (isset($user_status[2]) && isset($user_status[1])) {
$user_final_results[$user_status[2]] = $user_status[1];
}
}
}
$affected_rows = $attendance->attendance_sheet_add($cal_id, $user_final_results, $attendance_id);
}
}
$data['users_in_course'] = $attendance->get_users_rel_course($attendance_id);
$my_calendar_id = null;
if (is_numeric($filter_type)) {
$my_calendar_id = null;
if (is_numeric($filter_type)) {
$my_calendar_id = $filter_type;
$filter_type = 'calendar_id';
}
$data['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id, $filter_type, $my_calendar_id);
$data['attendant_calendar_all'] = $attendance->get_attendance_calendar($attendance_id);
$data['users_presence'] = $attendance->get_users_attendance_sheet($attendance_id);
$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
$data['next_attendance_calendar_datetime'] = $attendance->get_next_attendance_calendar_datetime($attendance_id);
} else {
$data['attendant_calendar_all'] = $attendance->get_attendance_calendar($attendance_id);
$data['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
$data['next_attendance_calendar_datetime'] = $attendance->get_next_attendance_calendar_datetime($attendance_id);
} else {
$data['attendant_calendar_all'] = $attendance->get_attendance_calendar($attendance_id);
$data['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id, $filter_type);
}
$data['edit_table'] = intval($edit);
$data['is_locked_attendance'] = $attendance->is_locked_attendance($attendance_id);
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('attendance_sheet');
$this->view->render();
$this->view->set_layout('layout');
$this->view->set_template('attendance_sheet');
$this->view->render();
}
/**
@ -299,23 +309,23 @@
public function attendance_calendar($action = 'calendar_list',$attendance_id = 0, $calendar_id = 0) {
$attendance = new Attendance();
$calendar_id = intval($calendar_id);
$calendar_id = intval($calendar_id);
$data = array();
$data['attendance_id'] = $attendance_id;
$attendance_id = intval($attendance_id);
if ($action == 'calendar_add') {
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if ($action == 'calendar_add') {
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (!isset($_POST['cancel'])) {
if (isset($_POST['repeat'])) {
//@todo check this error_logs
$start_datetime = api_strtotime(api_get_utc_datetime($attendance->build_datetime_from_array($_POST['date_time'])),'UTC');
//error_log('$start_datetime '.$start_datetime);
$_POST['end_date_time']['H'] = $_POST['date_time']['H'];
$_POST['end_date_time']['i'] = $_POST['date_time']['i'];
//error_log($attendance->build_datetime_from_array($_POST['end_date_time']));
$end_datetime = api_strtotime(api_get_utc_datetime($attendance->build_datetime_from_array($_POST['end_date_time'])),'UTC');
//error_log('$end_datetime '.$end_datetime);
$checkdate = checkdate($_POST['end_date_time']['F'], $_POST['end_date_time']['d'], $_POST['end_date_time']['Y']);
@ -323,14 +333,14 @@
$repeat_type = $_POST['repeat_type'];
if (($end_datetime > $start_datetime) && $checkdate) {
$affected_rows = $attendance->attendance_repeat_calendar_add($attendance_id, $start_datetime, $end_datetime, $repeat_type);
$action = 'calendar_list';
$action = 'calendar_list';
} else {
if (!$checkdate) {
$data['error_checkdate'] = true;
} else {
$data['error_repeat_date'] = true;
}
$data['repeat'] = true;
$data['repeat'] = true;
$action = 'calendar_add';
}
} else {
@ -348,20 +358,20 @@
} else {
$action = 'calendar_list';
}
}
}
} else if ($action == 'calendar_edit') {
$data['calendar_id'] = $calendar_id;
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (!isset($_POST['cancel'])) {
$datetime = $attendance->build_datetime_from_array($_POST['date_time']);
$datetimezone = api_get_utc_datetime($datetime);
$attendance->set_date_time($datetimezone);
if (strtoupper($_SERVER['REQUEST_METHOD']) == "POST") {
if (!isset($_POST['cancel'])) {
$datetime = $attendance->build_datetime_from_array($_POST['date_time']);
$datetimezone = api_get_utc_datetime($datetime);
$attendance->set_date_time($datetimezone);
$affected_rows = $attendance->attendance_calendar_edit($calendar_id, $attendance_id);
$data['calendar_id'] = 0;
$action = 'calendar_list';
} else {
$action = 'calendar_list';
}
}
}
} else if ($action == 'calendar_delete') {
$affected_rows = $attendance->attendance_calendar_delete($calendar_id, $attendance_id);
@ -371,23 +381,23 @@
$action = 'calendar_list';
}
$data['action'] = $action;
$data['action'] = $action;
$data['attendance_calendar'] = $attendance->get_attendance_calendar($attendance_id);
$data['is_locked_attendance'] = $attendance->is_locked_attendance($attendance_id);
// render to the view
$this->view->set_data($data);
$this->view->set_layout('layout');
$this->view->set_template('attendance_calendar');
$this->view->render();
$this->view->set_layout('layout');
$this->view->set_template('attendance_calendar');
$this->view->render();
}
/**
* It's used to print attendance sheet
* @param string action
* @param int attendance id
*/
public function attendance_sheet_export_to_pdf($action, $attendance_id, $student_id = 0, $course_id = '') {
$attendance = new Attendance();
$courseInfo = CourseManager::get_course_information($course_id);
@ -395,19 +405,19 @@
$data_array = array();
$data_array['attendance_id'] = $attendance_id;
$data_array['users_in_course'] = $attendance->get_users_rel_course($attendance_id);
$filter_type = 'today';
if (!empty($_REQUEST['filter'])) {
$filter_type = $_REQUEST['filter'];
}
$my_calendar_id = null;
if (is_numeric($filter_type)) {
if (is_numeric($filter_type)) {
$my_calendar_id = $filter_type;
$filter_type = 'calendar_id';
}
$data_array['attendant_calendar'] = $attendance->get_attendance_calendar($attendance_id, $filter_type, $my_calendar_id);
if (api_is_allowed_to_edit(null, true) || api_is_drh()) {
@ -422,13 +432,13 @@
$data_array['faults'] = $attendance->get_faults_of_user($user_id, $attendance_id);
$data_array['user_id'] = $user_id;
}
$data_array['next_attendance_calendar_id'] = $attendance->get_next_attendance_calendar_id($attendance_id);
//Set headers pdf
$courseCategory = CourseManager::get_course_category($courseInfo['category_code']);
$teacherInfo = CourseManager::get_teacher_list_from_course_code($courseInfo['code']);
$teacherName = null;
@ -441,29 +451,29 @@
// Get data table - Marco - ordenacao fixa - just fullname
$data_table = array();
$head_table = array('#', get_lang('Name'));
foreach ($data_array['attendant_calendar'] as $class_day) {
foreach ($data_array['attendant_calendar'] as $class_day) {
//$head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_SHORT).' <br />'.api_format_date($class_day['date_time'], TIME_NO_SEC_FORMAT);
$head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_NUMBER_NO_YEAR);
}
$head_table[] = api_format_date($class_day['date_time'], DATE_FORMAT_NUMBER_NO_YEAR);
}
$data_table[] = $head_table;
$dataClass = array();
$max_dates_per_page = 10;
$data_attendant_calendar = $data_array['attendant_calendar'];
$data_users_presence = $data_array['users_presence'];
$count = 1;
if (!empty($data_array['users_in_course'])) {
foreach ($data_array['users_in_course'] as $user) {
$cols = 1;
$result = array();
$result['count'] = $count;
$result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']);
foreach ($data_array['attendant_calendar'] as $class_day) {
$result['full_name'] = api_get_person_name($user['firstname'], $user['lastname']);
foreach ($data_array['attendant_calendar'] as $class_day) {
if ($class_day['done_attendance'] == 1) {
if ($data_users_presence[$user['user_id']][$class_day['id']]['presence'] == 1)
$result[$class_day['id']] = get_lang('UserAttendedSymbol');
@ -471,71 +481,71 @@
$result[$class_day['id']] = get_lang('UserNotAttendedSymbol');
} else {
$result[$class_day['id']] = " ";
}
}
$cols++;
}
$count++;
$count++;
$data_table[] = $result;
}
}
}
$max_cols_per_page = 12; //10 dates + 2 name and number
$max_dates_per_page = $max_dates_per_page_original = $max_cols_per_page - 2;//10
//var_dump($cols);exit;
$rows = count($data_table);
$rows = count($data_table);
if ($cols > $max_cols_per_page) {
$number_tables = round(($cols-2)/$max_dates_per_page);
$headers = $data_table[0];
$all = array();
$number_tables = round(($cols-2)/$max_dates_per_page);
$headers = $data_table[0];
$all = array();
$tables = array();
$changed = 1;
for ($i= 0; $i <= $rows; $i++) {
$row = $data_table[$i];
$changed = 1;
for ($i= 0; $i <= $rows; $i++) {
$row = $data_table[$i];
$key = 1;
$max_dates_per_page = 10;
$item = $data_table[$i];
$count_j = 0;
if (!empty($item)) {
foreach ($item as $value) {
foreach ($item as $value) {
if ($count_j >= $max_dates_per_page) {
$key++;
$max_dates_per_page = $max_dates_per_page_original*$key;
$max_dates_per_page = $max_dates_per_page_original*$key;
//magic hack
$tables[$key][$i][] = $tables[1][$i][0];
$tables[$key][$i][] = $tables[1][$i][1];
}
$tables[$key][$i][] = $value;
$count_j++;
$tables[$key][$i][] = $tables[1][$i][1];
}
$tables[$key][$i][] = $value;
$count_j++;
}
}
}
$content = null;
if (!empty($tables)) {
foreach ($tables as $sub_table) {
$content .= Export::convert_array_to_html($sub_table).'<br /><br />';
$content .= Export::convert_array_to_html($sub_table).'<br /><br />';
}
}
} else {
$content .= Export::convert_array_to_html($data_table, array('header_attributes' => array('align' => 'center')));
}
$params = array(
$params = array(
'filename' => get_lang('Attendance').'-'.api_get_local_time(),
'pdf_title' => $courseInfo['title'],
'course_code' => $courseInfo['code'],
'add_signatures' => true,
'orientation' => 'landscape',
'pdf_teachers' => $teacherName,
'pdf_course_category' => $courseCategory['name'],
'pdf_course_category' => $courseCategory['name'],
'format' => 'A4-L',
'orientation' => 'L'
);
Export::export_html_to_pdf($content, $params);
exit;
}
}
}

@ -2,7 +2,7 @@
/* For licensing terms, see /license.txt */
/**
* View (MVC patter) for attendance sheet (list, edit, add)
* View (MVC patter) for attendance sheet (list, edit, add)
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya reworked 2010
* @package chamilo.attendance
@ -12,64 +12,64 @@
api_protect_course_script(true);
if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api_get_course_id())) {
$param_gradebook = '';
if (isset($_SESSION['gradebook'])) {
$param_gradebook = '&gradebook='.$_SESSION['gradebook'];
}
$form = new FormValidator('filter', 'post', 'index.php?action=attendance_sheet_list&'.api_get_cidreq().$param_gradebook.'&attendance_id='.$attendance_id, null, array('class' => 'form-search pull-left'));
}
$form = new FormValidator('filter', 'post', 'index.php?action=attendance_sheet_list&'.api_get_cidreq().$param_gradebook.'&attendance_id='.$attendance_id, null, array('class' => 'form-search pull-left'));
$values = array(
'all' => get_lang('All'),
'all' => get_lang('All'),
'today' => get_lang('Today'),
'all_done' => get_lang('AllDone'),
'all_done' => get_lang('AllDone'),
'all_not_done' => get_lang('AllNotDone')
);
);
$today = api_convert_and_format_date(null, DATE_FORMAT_SHORT);
$exists_attendance_today = false;
if (!empty($attendant_calendar_all)) {
$values[''] = '---------------';
foreach($attendant_calendar_all as $attendance_date) {
if ($today == $attendance_date['date']) {
$exists_attendance_today = true;
}
$exists_attendance_today = true;
}
$values[$attendance_date['id']] = $attendance_date['date_time'];
}
}
if (!$exists_attendance_today) {
Display::display_warning_message(get_lang('ThereIsNoClassScheduledTodayTryPickingAnotherDay'));
}
$form->addElement('select', 'filter', get_lang('Filter'), $values, array('id' => 'filter_id'));
$form->addElement('select', 'filter', get_lang('Filter'), $values, array('id' => 'filter_id'));
$form->addElement('style_submit_button', null, get_lang('Filter'), 'class="filter"');
if (isset($_REQUEST['filter'])) {
if (isset($_REQUEST['filter'])) {
if (in_array($_REQUEST['filter'], array_keys($values))) {
$default_filter = $_REQUEST['filter'];
}
}
} else {
$default_filter = 'today';
}
$default_filter = 'today';
}
$renderer = $form->defaultRenderer();
$renderer->setElementTemplate('{label} {element} ');
$form->setDefaults(array('filter'=>$default_filter));
if (!$is_locked_attendance || api_is_platform_admin()) {
echo '<div class="actions">';
echo '<a style="float:left;" href="index.php?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.$param_gradebook.'">'.
Display::return_icon('attendance_calendar.png',get_lang('AttendanceCalendar'),'',ICON_SIZE_MEDIUM).'</a>';
if (count($users_in_course) > 0) {
$form->display();
$form->display();
}
echo '<a id="pdf_export" style="float:left;" href="index.php?'.api_get_cidreq().'&action=attendance_sheet_export_to_pdf&attendance_id='.$attendance_id.$param_gradebook.'&filter='.$default_filter.'">'.
Display::return_icon('pdf.png',get_lang('ExportToPDF'),'',ICON_SIZE_MEDIUM).'</a>';
echo '</div>';
}
$message_information = get_lang('AttendanceSheetDescription');
if (!empty($message_information)) {
$message = '<strong>'.get_lang('Information').'</strong><br />';
@ -80,14 +80,14 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
if ($is_locked_attendance) {
Display::display_warning_message(get_lang('TheAttendanceSheetIsLocked'), false);
}
$param_filter = '&filter='.Security::remove_XSS($default_filter);
if (count($users_in_course) > 0) {
?>
<script>
var original_url = '';
var original_url = '';
$("#filter_id").on('change', function() {
filter = $(this).val();
if (original_url == '') {
@ -97,7 +97,7 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
$("#pdf_export").attr('href', new_url);
//console.log(new_url);
});
function UpdateTableHeaders() {
$("div.divTableWithFloatingHeader").each(function() {
var originalHeaderRow = $(".tableFloatingHeaderOriginal", this);
@ -109,14 +109,14 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
var topbar = 0;
if ($("#topbar").length != 0) {
topbar = $("#topbar").height();
} else {
} else {
if ($(".subnav").length != 0) {
topbar = $(".subnav").height();
}
}
var top_value = Math.min(scrollTop - offset.top, $(this).height() - floatingHeaderRow.height()) + topbar;
floatingHeaderRow.css("top", top_value + "px");
// Copy cell widths from original header
@ -126,10 +126,10 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
});
// Copy row width from whole table
floatingHeaderRow.css("width", $(this).css("width"));
floatingHeaderRow.css("width", $(this).css("width"));
floatingHeaderRow.css("visibility", "visible");
floatingHeaderRow.css("z-index", "1000");
originalHeaderRow.css("height", "80px");
originalHeaderRow.css("height", "80px");
} else {
floatingHeaderRow.css("visibility", "hidden");
floatingHeaderRow.css("top", "0px");
@ -140,20 +140,20 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
$(document).ready(function() {
$("table.tableWithFloatingHeader").each(function() {
$(this).wrap("<div class=\"divTableWithFloatingHeader\" style=\"position:relative\"></div>");
var originalHeaderRow = $("tr:first", this)
originalHeaderRow.before(originalHeaderRow.clone());
var clonedHeaderRow = $("tr:first", this)
clonedHeaderRow.addClass("tableFloatingHeader");
clonedHeaderRow.css("position", "absolute");
clonedHeaderRow.css("top", "0px");
clonedHeaderRow.css("left", $(this).css("margin-left"));
clonedHeaderRow.css("visibility", "hidden");
originalHeaderRow.addClass("tableFloatingHeaderOriginal");
});
UpdateTableHeaders();
$(window).scroll(UpdateTableHeaders);
$(window).resize(UpdateTableHeaders);
@ -161,19 +161,19 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
</script>
<form method="post" action="index.php?action=attendance_sheet_add&<?php echo api_get_cidreq().$param_gradebook.$param_filter ?>&attendance_id=<?php echo $attendance_id?>" >
<div class="attendance-sheet-content" style="width:100%;background-color:#E1E1E1;margin-top:20px;">
<div class="divTableWithFloatingHeader attendance-users-table" style="width:45%;float:left;margin:0px;padding:0px;">
<table class="tableWithFloatingHeader data_table" width="100%">
<thead>
<tr class="tableFloatingHeader" style="position: absolute; top: 0px; left: 0px; visibility: hidden; margin:0px;padding:0px" >
<tr class="tableFloatingHeader" style="position: absolute; top: 0px; left: 0px; visibility: hidden; margin:0px;padding:0px" >
<th width="10px"><?php echo '#'; ?></th>
<th width="10px"><?php echo get_lang('Photo')?></th>
<th width="100px"><?php echo get_lang('LastName')?></th>
<th width="100px"><?php echo get_lang('FirstName')?></th>
<th width="100px"><?php echo get_lang('AttendancesFaults')?></th>
</tr>
<tr class="tableFloatingHeaderOriginal" >
<tr class="tableFloatingHeaderOriginal" >
<th height="65px" width="10px"><?php echo '#';?></th>
<th width="10px"><?php echo get_lang('Photo')?></th>
<th width="150px"><?php echo get_lang('LastName')?></th>
@ -181,15 +181,15 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
<th width="100px"><?php echo get_lang('AttendancesFaults')?></th>
</tr>
</thead>
<tbody>
<?php
<?php
$i = 1;
$class = '';
$class = '';
foreach ($users_in_course as $data) {
$faults = 0;
if ($i%2 == 0) {
$class='row_odd';
$class='row_odd';
} else {
$class='row_even';
}
@ -201,9 +201,9 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
<td><span title="<?php echo $username ?>"><?php echo $data['lastname'] ?></span></td>
<td><?php echo $data['firstname'] ?></td>
<td>
<div class="attendance-faults-bar">
<div class="attendance-faults-bar">
<?php echo Display::label($data['attendance_result'], $data['result_color_bar']); ?>
</div>
</div>
</td>
</tr>
<?php
@ -213,9 +213,9 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
</tbody>
</table>
</div>
<?php
<?php
echo '<div class="divTableWithFloatingHeader attendance-calendar-table" style="margin:0px;padding:0px;float:left;width:55%;overflow:auto;overflow-y:hidden;">';
echo '<table class="tableWithFloatingHeader data_table" width="100%">';
echo '<thead>';
@ -231,12 +231,12 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
$datetime = '<font color="blue">'.$date.'<br />'.$time.'</font>';
}
$disabled_check = 'disabled = "true"';
$input_hidden = '<input type="hidden" id="hidden_input_'.$calendar['id'].'" name="hidden_input[]" value="" disabled />';
$input_hidden = '<input type="hidden" id="hidden_input_'.$calendar['id'].'" name="hidden_input[]" value="" disabled />';
if ($next_attendance_calendar_id == $calendar['id']) {
$input_hidden = '<input type="hidden" id="hidden_input_'.$calendar['id'].'" name="hidden_input[]" value="'.$calendar['id'].'" />';
$disabled_check = '';
$img_lock = Display::return_icon('unlock.gif',get_lang('DateLock'),array('class'=>'img_unlock','id'=>'datetime_column_'.$calendar['id']));
}
}
$result .= '<th width="800px">';
$result .= '<center><div style="font-size:10px;width:125px;">'.$datetime.'&nbsp;';
@ -247,59 +247,63 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
if ($is_locked_attendance == false) {
if (api_is_allowed_to_edit(null, true)) {
$result .= '<br /><input type="checkbox" class="checkbox_head_'.$calendar['id'].'" id="checkbox_head_'.$calendar['id'].'" '.$disabled_check.' checked="checked" />'.$input_hidden.'</div></center></th>';
//$result .= '<br /><input type="checkbox" class="checkbox_head_'.$calendar['id'].'" id="checkbox_head_'.$calendar['id'].'" '.$disabled_check.' checked="checked" />';
$result .= $input_hidden.'</div></center></th>';
}
}
}
}
} else {
$result = '<th width="2000px"><span><a href="index.php?'.api_get_cidreq().'&action=calendar_list&attendance_id='.$attendance_id.$param_gradebook.'">';
$result .= Display::return_icon('attendance_calendar.png',get_lang('AttendanceCalendar'),'',ICON_SIZE_MEDIUM).' '.get_lang('GoToAttendanceCalendar').'</a></span></th>';
}
echo '<tr class="tableFloatingHeader row_odd" style="position: absolute; top: 0px; left: 0px; visibility: hidden; margin:0px;padding:0px">';
echo $result;
echo '</tr>';
echo $result;
echo '</tr>';
echo '<tr class="tableWithFloatingHeader row_odd">';
echo $result;
echo '</tr>';
echo '</thead>';
echo '<tbody>';
$i = 0;
$attendance_states = array(
'1' => get_lang('Present'),
'0' => get_lang('Absent'),
'2' => get_lang('VeryLate'),
'3' => get_lang('Late'),
);
$default_presence_value = 1;
foreach ($users_in_course as $user) {
$class = '';
if ($i%2 == 0) {
$class = 'row_even';
if ($i % 2 == 0) {
$class = 'row_even';
} else {
$class = 'row_odd';
}
echo '<tr class="'.$class.'">';
if (count($attendant_calendar) > 0 ) {
if (count($attendant_calendar) > 0 ) {
foreach ($attendant_calendar as $calendar) {
$checked = 'checked';
$presence = -1;
$presence = $default_presence_value;
if (isset($users_presence[$user['user_id']][$calendar['id']]['presence'])) {
$presence = $users_presence[$user['user_id']][$calendar['id']]['presence'];
if (intval($presence) == 1) {
$checked = 'checked';
} else {
$checked = '';
}
$presence = isset($users_presence[$user['user_id']][$calendar['id']]['presence']) ? $users_presence[$user['user_id']][$calendar['id']]['presence'] : $default_presence_value;
} else {
//if the user wasn't registered at that time, consider unchecked
if ($next_attendance_calendar_datetime == 0 || $calendar['date_time'] < $next_attendance_calendar_datetime) {
$checked = '';
$presence = $default_presence_value;
}
}
$disabled = 'disabled';
$style_td = '';
if ($next_attendance_calendar_id == $calendar['id']) {
if ($i%2==0)
if ($i % 2 == 0)
$style_td = 'background-color:#eee;';
else
else
$style_td = 'background-color:#dcdcdc;';
$disabled = '';
}
@ -309,10 +313,19 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
echo '<center>';
if (api_is_allowed_to_edit(null, true)) {
if (!$is_locked_attendance || api_is_platform_admin()) {
echo '<input type="checkbox" name="check_presence['.$calendar['id'].'][]" value="'.$user['user_id'].'" '.$disabled.' '.$checked.' />';
//echo '<input type="checkbox" name="check_presence['.$calendar['id'].'][]" value="'.$user['user_id'].'" '.$disabled.' '.$checked.' />';
foreach ($attendance_states as $key => $state) {
$input_checked = null;
if ($key == $presence) {
$input_checked = " checked=checked";
}
echo '&nbsp;&nbsp;<input type="checkbox" name="check_presence['.$calendar['id'].'][]" value = "state_'.$key.'_'.$user['user_id'].'" '.$disabled.' '.$input_checked.' />&nbsp;'.$state;
}
echo '<span class="anchor_'.$calendar['id'].'"></span>';
} else {
echo $presence ? Display::return_icon('checkbox_on.gif',get_lang('Presence')) : Display::return_icon('checkbox_off.gif',get_lang('Presence'));
} else {
echo $presence ? Display::return_icon('checkbox_on.gif',get_lang('Presence')) : Display::return_icon('checkbox_off.gif',get_lang('Presence'));
}
} else {
switch($presence) {
@ -322,16 +335,16 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
case 0:
echo Display::return_icon('exclamation.png',get_lang('NotAttended'));
break;
case -1:
case -1:
//echo Display::return_icon('warning.png',get_lang('NotAttended'));
break;
}
}
}
echo '</center>';
echo '</div>';
echo '</td>';
}
} else {
} else {
echo '<td class="checkboxes_col_'.$calendar['id'].'">';
echo '<div style="height:20px">';
echo '<center>&nbsp;</center>
@ -339,14 +352,14 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
</td>';
}
echo '</tr>';
$i++ ;
$i++ ;
}
echo '</tbody></table>';
echo '</div></div>';
?>
<div class="clear"></div>
<div style="margin-top:20px;">
<?php if (!$is_locked_attendance || api_is_platform_admin()) {
<?php if (!$is_locked_attendance || api_is_platform_admin()) {
if (api_is_allowed_to_edit(null, true)) {
?>
<button type="submit" class="save"><?php echo get_lang('Save') ?></button>
@ -354,15 +367,15 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
}
?>
</div>
</form>
<?php
} else {
echo Display::display_warning_message('<a href="'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'">'.get_lang('ThereAreNoRegisteredLearnersInsidetheCourse').'</a>', false);
</form>
<?php
} else {
echo Display::display_warning_message('<a href="'.api_get_path(WEB_CODE_PATH).'user/user.php?'.api_get_cidreq().'">'.get_lang('ThereAreNoRegisteredLearnersInsidetheCourse').'</a>', false);
}
} else {
echo Display::page_header(get_lang('AttendanceSheetReport'));
// View for students
?>
?>
<?php if(!empty($users_presence)) { ?>
<div>
<table width="250px;">
@ -380,29 +393,29 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api
<th><?php echo get_lang('Attendance')?></th>
</tr>
<?php
if (!empty($users_presence)) {
$i = 0;
foreach ($users_presence[$user_id] as $presence) {
foreach ($users_presence[$user_id] as $presence) {
$class = '';
if ($i%2==0) {
$class = 'row_even';
} else {
$class = 'row_odd';
}
}
?>
<tr class="<?php echo $class ?>">
<td>
<tr class="<?php echo $class ?>">
<td>
<?php echo $presence['presence']?Display::return_icon('checkbox_on.gif',get_lang('Presence')):Display::return_icon('checkbox_off.gif',get_lang('Presence')) ?>
<?php echo "&nbsp; ".$presence['date_time'] ?>
<?php echo "&nbsp; ".$presence['date_time'] ?>
</td>
</tr>
<?php }
</tr>
<?php }
} else { ?>
<tr><td>
<center><?php echo get_lang('YouDoNotHaveDoneAttendances')?></center></td>
</tr>
<?php }
</tr>
<?php }
?>
</table>
<?php } ?>

@ -2,17 +2,17 @@
/* For licensing terms, see /license.txt */
/**
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* Template (front controller in MVC pattern) used for distpaching to the controllers depend on the current action
* @author Christian Fasanando <christian1827@gmail.com>
* @author Julio Montoya <gugli100@gmail.com> Bug fixing, sql improvements
*
*
* @package chamilo.attendance
*/
// name of the language file that needs to be included
$language_file = array ('course_description', 'course_info', 'userInfo', 'admin', 'agenda','tracking', 'gradebook');
// including files
// including files
require_once '../inc/global.inc.php';
require_once api_get_path(SYS_CODE_PATH).'gradebook/lib/gradebook_functions.inc.php';
require_once api_get_path(LIBRARY_PATH).'attendance.lib.php';
@ -32,13 +32,13 @@ api_protect_course_script(true);
// get actions
$actions = array(
'attendance_list',
'attendance_sheet_list',
'attendance_sheet_add',
'attendance_add',
'attendance_edit',
'attendance_delete',
'attendance_delete_select',
'attendance_list',
'attendance_sheet_list',
'attendance_sheet_add',
'attendance_add',
'attendance_edit',
'attendance_delete',
'attendance_delete_select',
'attendance_restore',
'attendance_sheet_export_to_pdf',
'attendance_sheet_list_no_edit',
@ -62,7 +62,7 @@ if (isset($_GET['isStudentView']) && $_GET['isStudentView'] == 'true') {
}
// get attendance id
$attendance_id = 0;
$attendance_id = 0;
if (isset($_GET['attendance_id'])) {
$attendance_id = intval($_GET['attendance_id']);
}
@ -88,90 +88,90 @@ if (!empty($attendance_id)) {
$htmlHeadXtra[] = api_get_jqgrid_js();
$htmlHeadXtra[] = '<script>
$(function() {
$("table th img").click(function() {
$(function() {
$("table th img").click(function() {
var col_id = this.id;
var col_split = col_id.split("_");
var calendar_id = col_split[2];
var col_split = col_id.split("_");
var calendar_id = col_split[2];
var class_img = $(this).attr("class");
if (class_img == "img_unlock") {
//lock
$(".checkbox_head_"+calendar_id).attr("disabled", true);
//lock
$(".checkbox_head_"+calendar_id).attr("disabled", true);
$(".row_odd td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#F9F9F9", "border-left":"none","border-right":"none"});
$(".row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#FFF", "border-left":"none","border-right":"none"});
$(".checkboxes_col_"+calendar_id+" input:checkbox").attr("disabled",true);
$(this).attr("src","'.api_get_path(WEB_CODE_PATH).'img/lock.gif");
$(".checkboxes_col_"+calendar_id+" input:checkbox").attr("disabled",true);
$(this).attr("src","'.api_get_path(WEB_CODE_PATH).'img/lock.gif");
$(this).attr("title","'.get_lang('DateUnLock').'");
$(this).attr("alt","'.get_lang('DateUnLock').'");
$(this).attr("class","img_lock");
$("#hidden_input_"+calendar_id).attr("value","");
$("#hidden_input_"+calendar_id).attr("disabled",true);
return false;
} else {
//Unlock
$(".checkbox_head_"+calendar_id).attr("disabled", false);
$(".checkbox_head_"+calendar_id).removeAttr("disabled");
$(".row_odd td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#dcdcdc", "border-left":"1px #bbb solid", "border-right":"1px #bbb solid", "z-index":"1" });
$(".row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#eee", "border-left":"1px #bbb solid", "border-right":"1px #bbb solid", "z-index":"1" });
$(".checkboxes_col_"+calendar_id).mouseover(function() {
//$(".checkbox_head_"+calendar_id).removeAttr("opacity");
$(".checkboxes_col_"+calendar_id).mouseover(function() {
//$(".checkbox_head_"+calendar_id).removeAttr("opacity");
//$("row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"red", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
//$("row_odd td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#FFF", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
});
$(".checkboxes_col_"+calendar_id).mouseout(function() {
// $("row_even td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#F9F9F9", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
// $("row_odd td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#FFF", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
// $("row_odd td.checkboxes_col_"+calendar_id).css({"opacity":"1","background-color":"#FFF", "border-left":"1px #EEEE00 solid", "border-right":"1px #EEEE00 solid" , "border-bottom":"1px #ccc solid" });
});
$(".checkboxes_col_"+calendar_id+" input:checkbox").attr("disabled",false);
$(".checkboxes_col_"+calendar_id+" input:checkbox").attr("disabled",false);
$(this).attr("src","'.api_get_path(WEB_CODE_PATH).'img/unlock.gif");
$(this).attr("title","'.get_lang('DateLock').'");
$(this).attr("alt","'.get_lang('DateLock').'");
$(this).attr("class","img_unlock");
$(this).attr("class","img_unlock");
$("#hidden_input_"+calendar_id).attr("disabled",false);
$("#hidden_input_"+calendar_id).attr("value",calendar_id);
$("#hidden_input_"+calendar_id).attr("value",calendar_id);
return false;
}
});
}
});
$("table th input:checkbox").click(function() {
var col_id = this.id;
var col_split = col_id.split("_");
var col_split = col_id.split("_");
var calendar_id = col_split[2];
if (this.checked) {
$(".checkboxes_col_"+calendar_id+" input:checkbox").attr("checked",true);
$(".checkboxes_col_"+calendar_id+" input:checkbox").attr("checked",true);
} else {
$(".checkboxes_col_"+calendar_id+" input:checkbox").attr("checked",false);
}
});
$(".attendance-sheet-content .row_odd, .attendance-sheet-content .row_even").mouseover(function() {
$(".row_odd").css({"background-color":"#F9F9F9"});
$(".row_even").css({"background-color":"#FFF"});
});
});
$(".attendance-sheet-content .row_odd, .attendance-sheet-content .row_even").mouseout(function() {
$(".row_odd").css({"background-color":"#F9F9F9"});
$(".row_even").css({"background-color":"#FFF"});
});
$(".advanced_parameters").click(function() {
});
$(".advanced_parameters").click(function() {
if ($("#id_qualify").css("display") == "none") {
$("#id_qualify").css("display","block");
$("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_hide.gif',get_lang('Hide'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\');
} else {
$("#id_qualify").css("display","none");
$("#img_plus_and_minus").html(\'&nbsp;'.Display::return_icon('div_show.gif',get_lang('Show'),array('style'=>'vertical-align:middle')).'&nbsp;'.get_lang('AdvancedParameters').'\');
}
});
});
}
});
});
</script>';
@ -188,15 +188,15 @@ if (isset($_SESSION['gradebook'])) {
$param_gradebook = '&gradebook='.$gradebook;
}
$student_param = '';
if (api_is_drh() && isset($_GET['student_id'])) {
if (api_is_drh() && isset($_GET['student_id'])) {
$student_id = intval($_GET['student_id']);
$student_param = '&student_id='.$student_id;
$student_info = api_get_user_info($student_id);
$student_name = api_get_person_name($student_info['firstname'],$student_info['lastname']);
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$student_id, 'name' => $student_name);
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'mySpace/myStudents.php?student='.$student_id, 'name' => $student_name);
}
if (!empty($gradebook)) {
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php', 'name' => get_lang('ToolGradebook'));
$interbreadcrumb[] = array ('url' => api_get_path(WEB_CODE_PATH).'gradebook/index.php', 'name' => get_lang('ToolGradebook'));
}
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=attendance_list'.$param_gradebook.$student_param, 'name' => get_lang('ToolAttendance'));
if ($action == 'attendance_add') {
@ -210,11 +210,11 @@ if ($action == 'attendance_sheet_list' || $action == 'attendance_sheet_add') {
}
if ($action == 'calendar_list' || $action == 'calendar_edit' || $action == 'calendar_delete' || $action == 'calendar_all_delete') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$attendance_id.$param_gradebook, 'name' => $attendance_data['name']);
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('AttendanceCalendar'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('AttendanceCalendar'));
}
if ($action == 'calendar_add') {
$interbreadcrumb[] = array ('url' => 'index.php?'.api_get_cidreq().'&action=attendance_sheet_list&attendance_id='.$attendance_id.$param_gradebook, 'name' => $attendance_data['name']);
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('AddDateAndTime'));
$interbreadcrumb[] = array ('url' => '#', 'name' => get_lang('AddDateAndTime'));
}
// delete selected attendance
@ -222,8 +222,8 @@ if (isset($_POST['action']) && $_POST['action'] == 'attendance_delete_select') {
$attendance_controller->attendance_delete($_POST['id']);
}
// distpacher actions to controller
switch ($action) {
case 'attendance_list':
switch ($action) {
case 'attendance_list':
$attendance_controller->attendance_list();
break;
case 'attendance_add':
@ -233,7 +233,7 @@ switch ($action) {
api_not_allowed();
}
break;
case 'attendance_edit' :
case 'attendance_edit' :
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_edit($attendance_id);
} else {
@ -243,15 +243,15 @@ switch ($action) {
case 'attendance_delete' :
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_delete($attendance_id);
} else {
api_not_allowed();
} else {
api_not_allowed();
}
break;
break;
case 'attendance_restore':
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_restore($attendance_id);
} else {
api_not_allowed();
} else {
api_not_allowed();
}
break;
case 'attendance_sheet_list':
@ -260,22 +260,22 @@ switch ($action) {
break;
case 'attendance_sheet_list_no_edit':
$attendance_controller->attendance_sheet($action, $attendance_id, $student_id, false);
break;
break;
case 'attendance_sheet_export_to_pdf':
$attendance_controller->attendance_sheet_export_to_pdf($action, $attendance_id, $student_id, $course_id);
break;
case 'attendance_sheet_add' :
case 'attendance_sheet_add' :
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->attendance_sheet($action, $attendance_id);
} else {
api_not_allowed();
} else {
api_not_allowed();
}
break;
case 'lock_attendance' :
case 'unlock_attendance' :
if (api_is_allowed_to_edit(null, true)) {
if (api_is_allowed_to_edit(null, true)) {
$attendance_controller->lock_attendance($action, $attendance_id);
} else {
} else {
api_not_allowed();
}
break;
@ -285,10 +285,10 @@ switch ($action) {
case 'calendar_delete' :
if (!api_is_allowed_to_edit(null, true)) {
api_not_allowed();
}
case 'calendar_list' :
$attendance_controller->attendance_calendar($action, $attendance_id, $calendar_id);
}
case 'calendar_list' :
$attendance_controller->attendance_calendar($action, $attendance_id, $calendar_id);
break;
default :
default :
$attendance_controller->attendance_list();
}

Loading…
Cancel
Save