* * @package chamilo.attendance */ // protect a course script api_protect_course_script(true); if (!$is_locked_attendance || api_is_platform_admin()) { echo '
'; if ($action == 'calendar_add') { echo ''. Display::return_icon('back.png', get_lang('AttendanceCalendar'), '', ICON_SIZE_MEDIUM).''; } else { echo ''. Display::return_icon('back.png', get_lang('AttendanceSheet'), '', ICON_SIZE_MEDIUM).''; if (api_is_allowed_to_edit()) { echo ''. Display::return_icon('add.png', get_lang('AddDateAndTime'), '', ICON_SIZE_MEDIUM).''; echo ''. Display::return_icon('clean.png', get_lang('CleanCalendar'), '', ICON_SIZE_MEDIUM).''; } } echo '
'; } $message_information = get_lang('AttendanceCalendarDescription'); if (!empty($message_information)) { $message = ''.get_lang('Information').'
'; $message .= $message_information; echo Display::return_message($message, 'normal', false); } if (isset($error_repeat_date) && $error_repeat_date) { $message = get_lang('EndDateMustBeMoreThanStartDate'); echo Display::return_message($message, 'error', false); } if (isset($error_checkdate) && $error_checkdate) { $message = get_lang('InvalidDate'); echo Display::return_message($message, 'error', false); } if (isset($action) && $action == 'calendar_add') { $groupList = GroupManager::get_group_list(null, null, 1); $groupIdList = ['--']; foreach ($groupList as $group) { $groupIdList[$group['id']] = $group['name']; } // calendar add form $form = new FormValidator( 'attendance_calendar_add', 'POST', 'index.php?action=calendar_add&attendance_id='.$attendance_id.'&'.api_get_cidreq(), '' ); $form->addElement('header', get_lang('AddADateTime')); $form->addDateTimePicker( 'date_time', [get_lang('StartDate')], ['id' => 'date_time'] ); $defaults['date_time'] = date('Y-m-d H:i', api_strtotime(api_get_local_time())); $form->addElement( 'checkbox', 'repeat', null, get_lang('RepeatDate'), [ 'onclick' => "javascript: if(this.checked){document.getElementById('repeat-date-attendance').style.display='block';}else{document.getElementById('repeat-date-attendance').style.display='none';}", ] ); $defaults['repeat'] = isset($repeat) ? $repeat : null; if ($defaults['repeat']) { $form->addElement('html', '
'); } else { $form->addElement('html', ''); $defaults['repeat_type'] = 'weekly'; $form->addSelect('groups', get_lang('Group'), $groupIdList); $form->addButtonCreate(get_lang('Save')); $form->setDefaults($defaults); $form->display(); } else { // Calendar list $groupList = GroupManager::get_group_list(); $groupIdList = ['--']; foreach ($groupList as $group) { $groupIdList[$group['id']] = $group['name']; } echo Display::page_subheader(get_lang('CalendarList')); echo ''; }