|
|
|
|
@ -247,7 +247,8 @@ 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>'; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
@ -266,6 +267,15 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api |
|
|
|
|
|
|
|
|
|
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) { |
|
|
|
|
@ -277,20 +287,14 @@ if (api_is_allowed_to_edit(null, true) || api_is_coach(api_get_session_id(), api |
|
|
|
|
|
|
|
|
|
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'; |
|
|
|
|
@ -309,7 +313,16 @@ 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 ' <input type="checkbox" name="check_presence['.$calendar['id'].'][]" value = "state_'.$key.'_'.$user['user_id'].'" '.$disabled.' '.$input_checked.' /> '.$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')); |
|
|
|
|
|