} $date_note = $date != date('Y-m-d') ? ' <span class=red>The selected date is not today</span>' : ''; # commented as requested if ($_REQUEST['table'] == '0') { $completed_RET = DBGet(DBQuery('SELECT \'Y\' as COMPLETED,STAFF_ID,SUBSTITUTE_STAFF_ID,IS_TAKEN_BY_SUBSTITUTE_STAFF FROM attendance_completed WHERE (STAFF_ID=\'' . User('STAFF_ID') . '\' OR SUBSTITUTE_STAFF_ID=\'' . User('STAFF_ID') . '\') AND SCHOOL_DATE=\'' . $date . '\' AND PERIOD_ID=\'' . UserPeriod() . '\' AND CPV_ID=\'' . CpvId() . '\'')); if ($completed_RET) { if ($completed_RET[1]['IS_TAKEN_BY_SUBSTITUTE_STAFF'] != 'Y' && User('STAFF_ID') == $completed_RET[1]['SUBSTITUTE_STAFF_ID']) { $note = ErrorMessage(array('<IMG SRC=assets/check.gif>Primary teacher has taken attendance today for this period.'), 'note'); } elseif ($completed_RET[1]['IS_TAKEN_BY_SUBSTITUTE_STAFF'] == 'Y' && User('STAFF_ID') == $completed_RET[1]['STAFF_ID']) { $note = ErrorMessage(array('<IMG SRC=assets/check.gif>Secondary teacher has taken attendance today for this period.'), 'note'); } else { $note = ErrorMessage(array('<IMG SRC=assets/check.gif>You have taken attendance today for this period.'), 'note'); } } if ($_SESSION['miss_attn'] == 1) { $get_profile_type = DBGet(DBQuery('SELECT PROFILE FROM user_profiles WHERE ID=' . UserProfileID())); if ($_REQUEST['username'] == 'admin' || $get_profile_type[1]['PROFILE'] == 'admin') { $note1 = '<a href=Modules.php?modname=users/TeacherPrograms.php?include=attendance/MissingAttendance.php&From=' . $From . '&to=' . $to . '><< Back to Missing Attendance List </a>'; } } } if (optional_param('attn', PARAM_NOTGAS) == 'miss') { DrawHeaderHome('<A HREF="Modules.php?modname=miscellaneous/Portal.php?back_mssn_attn_list=Y">Back to Missing Attendance List</A>'); } echo "<FORM ACTION=Modules.php?modname=" . strip_tags(trim($_REQUEST[modname])) . "&table=" . strip_tags(trim($_REQUEST[table])) . "&username="******"&From={$From}&to={$to}&attn=" . strip_tags(trim($_REQUEST[attn])) . " method=POST>"; $profile = DBGet(DBQuery('SELECT PROFILE FROM staff WHERE STAFF_ID=' . UserID())); if ($profile[1]['PROFILE'] != "admin" && UserCoursePeriod() != '') { $QI = DBQuery('SELECT DISTINCT cpv.ID,cpv.PERIOD_ID,cp.COURSE_PERIOD_ID,sp.TITLE,sp.SHORT_NAME,cp.MARKING_PERIOD_ID,cpv.DAYS,sp.SORT_ORDER,c.TITLE AS COURSE_TITLE FROM course_periods cp,course_period_var cpv, school_periods sp,courses c WHERE c.COURSE_ID=cp.COURSE_ID AND cpv.PERIOD_ID=sp.PERIOD_ID AND cp.COURSE_PERIOD_ID=cpv.COURSE_PERIOD_ID AND cpv.COURSE_PERIOD_ID=' . UserCoursePeriod() . ' AND cp.SYEAR=\'' . UserSyear() . '\' AND cp.SCHOOL_ID=\'' . UserSchool() . '\' AND (cp.TEACHER_ID=\'' . User('STAFF_ID') . '\' OR cp.SECONDARY_TEACHER_ID=\'' . User('STAFF_ID') . '\') ORDER BY sp.SORT_ORDER '); $RET = DBGet($QI); $period_select = "Choose Period: <SELECT name=period onChange='this.form.submit();'>"; $period_select .= "<OPTION value='na' selected>N/A</OPTION>";
if ($disable == '' && ($profile == 3 || $profile == 4)) { $user = $user . " AND TRIM( IFNULL( is_disable, 'NULL' ) ) = 'NULL' "; } if ($disable == '' && $profile != 3 && $profile != 4) { $user = $user . " AND TRIM( IFNULL( is_disable, '' ) ) <> 'Y' "; } if ($disable == 'Y') { $user = $user . " "; } } else { if (User('PROFILE') == 'admin' && UserProfileID() == 0) { $user1 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,staff WHERE login_authentication.user_id=staff.staff_id AND TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") and login_authentication.profile_id not in(3,4)"; $user2 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,students WHERE login_authentication.user_id=students.student_id AND login_authentication.profile_id=3 AND TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") and login_authentication.profile_id=3"; $user3 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,people WHERE login_authentication.user_id=people.staff_id AND TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") and login_authentication.profile_id=4"; } if (UserProfileID() == 1 || UserProfileID() == 5) { $user1 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,staff,staff_school_relationship WHERE login_authentication.user_id=staff.staff_id and staff_school_relationship.staff_id=staff.staff_id and staff_school_relationship.school_id in (select school_id from staff_school_relationship where staff_id=" . UserID() . ") AND TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") and login_authentication.profile_id not in(3,4)"; $user2 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,students,student_enrollment WHERE login_authentication.user_id=students.student_id and students.student_id=student_enrollment.student_id and student_enrollment.school_id in(select school_id from staff_school_relationship where staff_id=" . UserID() . ")AND login_authentication.profile_id=3 AND TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") and login_authentication.profile_id=3"; $user3 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,students_join_people,people WHERE login_authentication.user_id=people.staff_id AND students_join_people.person_id in(select school_id from students,student_enrollment,students_join_people where students.student_id=student_enrollment.student_id and students_join_people.student_id=students.student_id and student_enrollment.school_id in(select school_id from staff_school_relationship where staff_id=" . UserID() . ")) and TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") and login_authentication.profile_id=4"; // $user3="SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,people WHERE login_authentication.user_id=people.staff_id AND people.staff_id in (select staff_id from staff_school_relationship where staff_id=". UserID().") and TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=".$groupselect[1]['GROUP_ID'].") and login_authentication.profile_id=4"; } if (User('PROFILE') == 'teacher') { $user1 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,staff,staff_school_relationship WHERE login_authentication.user_id=staff.staff_id and staff_school_relationship.staff_id=staff.staff_id AND TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") and login_authentication.profile_id in(0,1,5) and school_id in(select school_id from staff_school_relationship where staff_id=" . UserID() . ")"; //all types of admin $user2 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM students,login_authentication WHERE profile_id=3 and login_authentication.user_id=students.student_id and TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") AND student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING ( course_period_id ) WHERE course_periods.teacher_id = " . UserID() . ")"; //scheduled students $user3 = 'SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,people WHERE login_authentication.user_id=people.staff_id and login_authentication.profile_id=4 AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=' . $groupselect[1]['GROUP_ID'] . ' ) and TRIM( IFNULL( USERNAME, \'\' ) ) <> \'\' AND user_id IN (SELECT DISTINCT person_id FROM students_join_people WHERE student_id IN (SELECT student_id FROM students WHERE student_id IN (SELECT DISTINCT student_id FROM course_periods INNER JOIN schedule USING (course_period_id ) WHERE course_periods.teacher_id = \'' . UserID() . '\')))'; //parents } if (User('PROFILE') == 'parent') { $user1 = "SELECT username,LAST_NAME,first_name,login_authentication.profile_id,is_disable,login_authentication.user_id FROM login_authentication,staff WHERE login_authentication.user_id=staff.staff_id AND TRIM( IFNULL( USERNAME, '' ) ) <> '' AND TRIM( IFNULL( PASSWORD, '' ) ) <> '' AND USERNAME NOT IN(SELECT USER_NAME from mail_groupmembers where group_id=" . $groupselect[1]['GROUP_ID'] . ") and login_authentication.profile_id in(0,1,5)";
$RET[$id] = $data; } } } unset($delete_button); $checked = 'CHECKED'; $new = true; } echo "<FORM name=F2 id=F2 action=Modules.php?modname={$_REQUEST['modname']}&subject_id={$_REQUEST['subject_id']}&course_id={$_REQUEST['course_id']}&course_period_id={$_REQUEST['course_period_id']} method=POST>"; echo '<input type="hidden" name="get_status" id="get_status" value="" />'; echo '<INPUT TYPE="hidden" NAME="course_period_day_checked" id="course_period_day_checked" VALUE="" />'; echo '<input type="hidden" name="cp_id" id="cp_id" value="' . $_REQUEST['course_period_id'] . '"/>'; if ($_REQUEST['course_period_id'] != 'new') { echo '<input type="hidden" id="schedule_type_id" value="' . $RET['SCHEDULE_TYPE'] . '"/>'; } if (UserProfileID() != 2) { DrawHeaderHome($title, $delete_button . SubmitButton('Save', '', 'id=save_cp class=btn_medium onclick="return validate_course_period();"')); } $header .= '<TABLE cellpadding=4 width=100%>'; $header .= '<TR>'; $header .= '<TD>' . TextInput($RET['SHORT_NAME'], 'tables[course_periods][' . $_REQUEST['course_period_id'] . '][SHORT_NAME]', 'Short Name', 'class=cell_floating', $div) . '</TD>'; echo '<input type="hidden" id="hidden_cp_id" value="' . $_REQUEST['course_period_id'] . '">'; $cal_RET = DBGet(DBQuery("SELECT TITLE,CALENDAR_ID FROM school_calendars WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' ORDER BY DEFAULT_CALENDAR DESC")); $options = array(); foreach ($cal_RET as $option) { $options[$option['CALENDAR_ID']] = $option['TITLE']; } if ($_REQUEST[course_period_id] == 'new') { $header .= '<TD>' . SelectInput($RET['CALENDAR_ID'], 'tables[course_periods][' . $_REQUEST['course_period_id'] . '][CALENDAR_ID]', 'Calendar', $options, 'N/A', ' id=calendar_id onchange=reset_schedule();', $div) . '</TD>'; } else { $cal_sql = "SELECT TITLE,CALENDAR_ID FROM school_calendars WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' AND CALENDAR_ID='" . $RET['CALENDAR_ID'] . "'";