function dayToNumber($day_time) { $date = date('Y-m-d', $day_time); //check if the day is attendance day $check_day_RET = DBGet(DBQuery("SELECT school_date AS check_day FROM attendance_calendar WHERE school_date='" . $date . "' AND school_id='" . ($school_id = UserSchool()) . "'")); if (empty($check_day_RET)) { return FALSE; } //quarter start date $begin_quarter_RET = DBGet(DBQuery("SELECT start_date FROM school_marking_periods WHERE start_date<='" . $date . "' AND end_date>='" . $date . "' AND mp='QTR' AND school_id='" . $school_id . "'")); if (empty($begin_quarter_RET)) { return FALSE; } $begin_quarter = $begin_quarter_RET[1]['START_DATE']; //number of school days since the beginning of the quarter $school_days_RET = DBGet(DBQuery("SELECT COUNT(school_date) AS school_days FROM attendance_calendar WHERE school_date>='" . $begin_quarter . "' AND school_date<='" . $date . "' AND school_id='" . $school_id . "'")); $school_days = $school_days_RET[1]['SCHOOL_DAYS']; if ($school_days % SchoolInfo('NUMBER_DAYS_ROTATION') == 0) { return SchoolInfo('NUMBER_DAYS_ROTATION'); } return $school_days % SchoolInfo('NUMBER_DAYS_ROTATION'); }
function UpdateAttendanceDaily($student_id, $date = '', $comment = false) { if (!$date) { $date = DBDate(); } //modif Francois: days numbered //modif Francois: multiple school periods for a course period if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) { $sql = "SELECT\n\t\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\tWHERE \n\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\t\t\tAND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<='{$date}' AND end_date>='{$date}' AND mp='QTR') AND school_date<='{$date}') AS INT) FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\t"; } else { $sql = "SELECT\n\t\t\t\t\tsum(sp.LENGTH) AS TOTAL\n\t\t\t\tFROM SCHEDULE s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\tWHERE \n\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\ts.COURSE_PERIOD_ID = cp.COURSE_PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\tAND ac.SCHOOL_DATE='{$date}' AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL)\n\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_ID=s.SCHOOL_ID AND ac.SYEAR=s.SYEAR\n\t\t\t\t\tAND s.SYEAR = cp.SYEAR AND sp.PERIOD_ID = cpsp.PERIOD_ID\n\t\t\t\t\tAND position(substring('UMTWHFS' FROM cast(extract(DOW FROM cast('{$date}' AS DATE)) AS INT)+1 FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tAND s.STUDENT_ID='{$student_id}'\n\t\t\t\t\tAND s.SYEAR='" . UserSyear() . "'\n\t\t\t\t\tAND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\tAND s.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\t"; } $RET = DBGet(DBQuery($sql)); $total = $RET[1]['TOTAL']; if ($total == 0) { return; } $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='A'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'"; $RET = DBGet(DBQuery($sql)); $total -= $RET[1]['TOTAL']; $sql = "SELECT sum(sp.LENGTH) AS TOTAL\n\t\t\tFROM ATTENDANCE_PERIOD ap,SCHOOL_PERIODS sp,ATTENDANCE_CODES ac\n\t\t\tWHERE ap.STUDENT_ID='{$student_id}' AND ap.SCHOOL_DATE='{$date}' AND ap.PERIOD_ID=sp.PERIOD_ID AND ac.ID = ap.ATTENDANCE_CODE AND ac.STATE_CODE='H'\n\t\t\tAND sp.SYEAR='" . UserSyear() . "'"; $RET = DBGet(DBQuery($sql)); $total -= $RET[1]['TOTAL'] * 0.5; if ($total >= Config('ATTENDANCE_FULL_DAY_MINUTES')) { $length = '1.0'; } elseif ($total >= Config('ATTENDANCE_FULL_DAY_MINUTES') / 2) { $length = '.5'; } else { $length = '0.0'; } $current_RET = DBGet(DBQuery("SELECT MINUTES_PRESENT,STATE_VALUE,COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'")); if (count($current_RET) && $current_RET[1]['MINUTES_PRESENT'] != $total) { DBQuery("UPDATE ATTENDANCE_DAY SET MINUTES_PRESENT='{$total}',STATE_VALUE='{$length}'" . ($comment !== false ? ",COMMENT='" . $comment . "'" : '') . " WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"); } elseif (count($current_RET) && $comment !== false && $current_RET[1]['COMMENT'] != $comment) { DBQuery("UPDATE ATTENDANCE_DAY SET COMMENT='" . $comment . "' WHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}'"); } elseif (count($current_RET) == 0) { DBQuery("INSERT INTO ATTENDANCE_DAY (SYEAR,STUDENT_ID,SCHOOL_DATE,MINUTES_PRESENT,STATE_VALUE,MARKING_PERIOD_ID,COMMENT) values('" . UserSyear() . "','{$student_id}','{$date}','{$total}','{$length}','" . GetCurrentMP('QTR', $date) . "','" . $comment . "')"); } }
DrawHeader(PrepareDate($date, '_date', false, array('submit' => true))); echo '</FORM>'; ErrorMessage(array(_('You cannot take attendance for this course period.')), 'fatal'); } if ($_REQUEST['table'] == '') { $_REQUEST['table'] = $categories_RET[1]['ID']; } if ($_REQUEST['table'] == '0') { $table = 'ATTENDANCE_PERIOD'; } else { $table = 'LUNCH_PERIOD'; } //modif Francois: days numbered //modif Francois: multiple school periods for a course period if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) { $course_RET = DBGET(DBQuery("SELECT cp.HALF_DAY FROM ATTENDANCE_CALENDAR acc,COURSE_PERIODS cp,SCHOOL_PERIODS sp, COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND acc.SYEAR='" . UserSyear() . "' AND cp.SCHOOL_ID=acc.SCHOOL_ID AND cp.SYEAR=acc.SYEAR AND acc.SCHOOL_DATE='{$date}' AND cp.CALENDAR_ID=acc.CALENDAR_ID AND cpsp.COURSE_PERIOD_SCHOOL_PERIODS_ID='" . UserCoursePeriodSchoolPeriod() . "'\n\tAND cp.MARKING_PERIOD_ID IN (SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE (MP='FY' OR MP='SEM' OR MP='QTR') AND SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE)\n\tAND sp.PERIOD_ID=cpsp.PERIOD_ID AND (sp.BLOCK IS NULL AND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<=acc.SCHOOL_DATE AND end_date>=acc.SCHOOL_DATE AND mp='QTR') AND school_date<=acc.SCHOOL_DATE) AS INT) FOR 1) IN cpsp.DAYS)>0\n\t\tOR sp.BLOCK IS NOT NULL AND acc.BLOCK IS NOT NULL AND sp.BLOCK=acc.BLOCK)\n\tAND position(',{$_REQUEST['table']},' IN cp.DOES_ATTENDANCE)>0")); } else { $course_RET = DBGET(DBQuery("SELECT cp.HALF_DAY FROM ATTENDANCE_CALENDAR acc,COURSE_PERIODS cp,SCHOOL_PERIODS sp, COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND acc.SYEAR='" . UserSyear() . "' AND cp.SCHOOL_ID=acc.SCHOOL_ID AND cp.SYEAR=acc.SYEAR AND acc.SCHOOL_DATE='{$date}' AND cp.CALENDAR_ID=acc.CALENDAR_ID AND cpsp.COURSE_PERIOD_SCHOOL_PERIODS_ID='" . UserCoursePeriodSchoolPeriod() . "'\n\tAND cp.MARKING_PERIOD_ID IN (SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE (MP='FY' OR MP='SEM' OR MP='QTR') AND SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE)\n\tAND sp.PERIOD_ID=cpsp.PERIOD_ID AND (sp.BLOCK IS NULL AND position(substring('UMTWHFS' FROM cast(extract(DOW FROM acc.SCHOOL_DATE) AS INT)+1 FOR 1) IN cpsp.DAYS)>0\n\t\tOR sp.BLOCK IS NOT NULL AND acc.BLOCK IS NOT NULL AND sp.BLOCK=acc.BLOCK)\n\tAND position(',{$_REQUEST['table']},' IN cp.DOES_ATTENDANCE)>0")); } if (count($course_RET) == 0) { echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '&table=' . $_REQUEST['table'] . '" method="POST">'; DrawHeader(PrepareDate($date, '_date', false, array('submit' => true))); echo '</FORM>'; ErrorMessage(array(_('You cannot take attendance for this period on this day.')), 'fatal'); } $qtr_id = GetCurrentMP('QTR', $date, false); if (!$qtr_id) { echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '&table=' . $_REQUEST['table'] . '" method="POST">'; DrawHeader(PrepareDate($date, '_date', false, array('submit' => true))); echo '</FORM>'; ErrorMessage(array(_('The selected date is not in a school quarter.')), 'fatal');
echo $extra['search']; } if ($extra['extra_search']) { echo $extra['extra_search']; } Search('staff_fields', is_array($extra['staff_fields']) ? $extra['staff_fields'] : array()); echo '</TABLE>'; echo '</TD><TD>'; echo '<TABLE class="width-100p"><TR><TD class="center"><BR />'; if ($extra['search_second_col']) { echo $extra['search_second_col']; } if (User('PROFILE') == 'admin') { //modif Francois: add <label> on checkbox //modif Francois: if only one school, no Search All Schools option if (SchoolInfo('SCHOOLS_NB') > 1) { echo '<label><INPUT type="checkbox" name="_search_all_schools" value="Y"' . (Preferences('DEFAULT_ALL_SCHOOLS') == 'Y' ? ' checked' : '') . '> ' . _('Search All Schools') . '</label><BR />'; } } else { echo '<label><INPUT type="checkbox" name="include_inactive" value="Y"> ' . _('Include Parents of Inactive Students') . '</label><BR />'; } echo '<BR />'; echo Buttons(_('Submit'), _('Reset')); echo '</TD></TR>'; echo '</TABLE>'; if ($extra['second_col']) { echo '<BR /><TABLE>' . $extra['second_col'] . '</TABLE>'; } echo '</TD></TR>'; echo '<TR class="valign-top"><TD><TABLE class="width-100p cellspacing-0 cellpadding-0"><TR><TD>'; if ($_REQUEST['advanced'] == 'Y') {
}*/ //modif Francois: remove DrawTab params $headerl .= '<TD style="width:10px;"></TD><TD>' . DrawTab($category['TITLE'], $tmp_PHP_SELF . '&table=' . $category['ID']) . '</TD>'; } $headerl .= '</TR></TABLE>'; } if (isset($_REQUEST['student_id']) && $_REQUEST['student_id'] != 'new') { if (UserStudentID() != $_REQUEST['student_id']) { $_SESSION['student_id'] = $_REQUEST['student_id']; echo '<script type="text/javascript">parent.side.location="' . $_SESSION['Side_PHP_SELF'] . '?modcat="+parent.side.document.forms[0].modcat.value;</script>'; } $functions = array('ATTENDANCE_CODE' => '_makeCodePulldown', 'ATTENDANCE_TEACHER_CODE' => '_makeCode', 'ATTENDANCE_REASON' => '_makeReasonInput', 'COMMENT' => '_makeReason'); //modif Francois: days numbered //modif Francois: multiple school periods for a course period if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) { $schedule_RET = DBGet(DBQuery("SELECT\n\t\t\t\t\t\t\t\t\t\t\ts.STUDENT_ID,c.TITLE AS COURSE,cpsp.PERIOD_ID,cp.COURSE_PERIOD_ID,p.TITLE AS PERIOD_TITLE,\n\t\t\t\t\t\t\t\t\t\t\ts.STUDENT_ID AS ATTENDANCE_CODE,s.STUDENT_ID AS ATTENDANCE_TEACHER_CODE,s.STUDENT_ID AS ATTENDANCE_REASON,s.STUDENT_ID AS COMMENT\n\t\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t\tSCHEDULE s,COURSES c,COURSE_PERIODS cp,SCHOOL_PERIODS p,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\t\t\t\t\t\t\ts.SYEAR='" . UserSyear() . "' AND s.SCHOOL_ID='" . UserSchool() . "' AND s.MARKING_PERIOD_ID IN (" . $all_mp . ")\n\t\t\t\t\t\t\t\t\t\t\tAND s.COURSE_ID=c.COURSE_ID\n\t\t\t\t\t\t\t\t\t\t\tAND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND cpsp.PERIOD_ID=p.PERIOD_ID AND position(',{$_REQUEST['table']},' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\t\t\t\t\t\t\tAND s.STUDENT_ID='" . $_REQUEST['student_id'] . "' AND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\t\t\t\t\t\t\tAND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<='{$date}' AND end_date>='{$date}' AND mp='QTR') AND school_date<='{$date}') AS INT) FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\t\t\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_DATE='{$date}' AND ac.MINUTES!='0'\n\t\t\t\t\t\t\t\t\t\tORDER BY p.SORT_ORDER"), $functions); } else { $schedule_RET = DBGet(DBQuery("SELECT\n\t\t\t\t\t\t\t\t\t\t\ts.STUDENT_ID,c.TITLE AS COURSE,cpsp.PERIOD_ID,cp.COURSE_PERIOD_ID,p.TITLE AS PERIOD_TITLE,\n\t\t\t\t\t\t\t\t\t\t\ts.STUDENT_ID AS ATTENDANCE_CODE,s.STUDENT_ID AS ATTENDANCE_TEACHER_CODE,s.STUDENT_ID AS ATTENDANCE_REASON,s.STUDENT_ID AS COMMENT\n\t\t\t\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t\t\t\tSCHEDULE s,COURSES c,COURSE_PERIODS cp,SCHOOL_PERIODS p,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\t\t\t\t\t\t\t\tWHERE \n\t\t\t\t\t\t\t\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\t\t\t\t\t\t\t\ts.SYEAR='" . UserSyear() . "' AND s.SCHOOL_ID='" . UserSchool() . "' AND s.MARKING_PERIOD_ID IN (" . $all_mp . ")\n\t\t\t\t\t\t\t\t\t\t\tAND s.COURSE_ID=c.COURSE_ID\n\t\t\t\t\t\t\t\t\t\t\tAND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND cpsp.PERIOD_ID=p.PERIOD_ID AND position(',{$_REQUEST['table']},' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\t\t\t\t\t\t\t\tAND s.STUDENT_ID='" . $_REQUEST['student_id'] . "' AND ('{$date}' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '{$date}'>=s.START_DATE))\n\t\t\t\t\t\t\t\t\t\t\tAND position(substring('UMTWHFS' FROM cast(extract(DOW FROM cast('{$date}' AS DATE)) AS INT)+1 FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\t\t\t\t\t\t\tAND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_DATE='{$date}' AND ac.MINUTES!='0'\n\t\t\t\t\t\t\t\t\t\tORDER BY p.SORT_ORDER"), $functions); } $columns = array('PERIOD_TITLE' => _('Period'), 'COURSE' => _('Course'), 'ATTENDANCE_CODE' => _('Attendance Code'), 'ATTENDANCE_TEACHER_CODE' => _('Teacher\'s Entry'), 'ATTENDANCE_REASON' => _('Office Comment'), 'COMMENT' => _('Teacher Comment')); echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=student&student_id=' . $_REQUEST['student_id'] . '&table=' . $_REQUEST['table'] . '" method="POST">'; DrawHeader(PrepareDate($date, '_date', false, array('submit' => true)), SubmitButton(_('Update'))); $headerr = '<A HREF="Modules.php?modname=' . $_REQUEST['modname'] . '&month_date=' . $_REQUEST['month_date'] . '&day_date=' . $_REQUEST['day_date'] . '&year_date=' . $_REQUEST['year_date'] . '&table=' . $_REQUEST['table'] . '">' . _('Student List') . '</A>'; echo '<TABLE class="width-100p cellspacing-0 cellpadding-0"><TR><TD style="text-align:left; background-color: #fff">' . $headerl . '</TD><TD style="text-align:right; background-color: #fff">' . $headerr . '</TD></TR></TABLE>'; ListOutput($schedule_RET, $columns, 'Course', 'Courses'); echo '</FORM>'; } else { if ($_REQUEST['expanded_view'] != 'true') { $extra['WHERE'] = $extra2['WHERE'] = " AND EXISTS (SELECT '' FROM {$table} ap,ATTENDANCE_CODES ac WHERE ap.SCHOOL_DATE='" . $date . "' AND ap.STUDENT_ID=ssm.STUDENT_ID AND ap.ATTENDANCE_CODE=ac.ID AND ac.SCHOOL_ID=ssm.SCHOOL_ID AND ac.SYEAR=ssm.SYEAR " . str_replace('TABLE_NAME', 'ac.TABLE_NAME', $extra_sql); } else { $extra['WHERE'] = " AND EXISTS (SELECT '' FROM {$table} ap,ATTENDANCE_CODES ac WHERE ap.SCHOOL_DATE='" . $date . "' AND ap.STUDENT_ID=ssm.STUDENT_ID AND ap.ATTENDANCE_CODE=ac.ID AND ac.SCHOOL_ID=ssm.SCHOOL_ID AND ac.SYEAR=ssm.SYEAR " . str_replace('TABLE_NAME', 'ac.TABLE_NAME', $extra_sql);
if ($optgroup !== FALSE && $optgroup != $period['COURSE_TITLE']) { //close optgroup echo '</optgroup>'; } //if(UserCoursePeriod()==$period['COURSE_PERIOD_ID']) if (UserCoursePeriodSchoolPeriod() == $period['COURSE_PERIOD_SCHOOL_PERIODS_ID']) { $selected = ' SELECTED="SELECTED"'; $_SESSION['UserPeriod'] = $period['PERIOD_ID']; $found = true; } else { $selected = ''; } //modif Francois: days display to locale $days_convert = array('U' => _('Sunday'), 'M' => _('Monday'), 'T' => _('Tuesday'), 'W' => _('Wednesday'), 'H' => _('Thursday'), 'F' => _('Friday'), 'S' => _('Saturday')); //modif Francois: days numbered if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) { $days_convert = array('U' => '7', 'M' => '1', 'T' => '2', 'W' => '3', 'H' => '4', 'F' => '5', 'S' => '6'); } $period_days = ''; for ($i = 0; $i < mb_strlen($period['DAYS']); $i++) { $period_days .= mb_substr($days_convert[$period['DAYS'][$i]], 0, 3) . '.'; } echo '<OPTION value="' . $period['COURSE_PERIOD_ID'] . '.' . $period['COURSE_PERIOD_SCHOOL_PERIODS_ID'] . '"' . $selected . '>' . $period['TITLE'] . (mb_strlen($period['DAYS']) < 5 ? mb_strlen($period['DAYS']) < 2 ? ' ' . _('Day') . ' ' . $period_days . ' - ' : ' ' . _('Days') . ' ' . $period_days . ' - ' : ' - ') . ($period['MARKING_PERIOD_ID'] != $fy_RET[1]['MARKING_PERIOD_ID'] ? GetMP($period['MARKING_PERIOD_ID'], 'SHORT_NAME') . ' - ' : '') . $period['CP_SHORT_NAME'] . '</OPTION>'; } if (!$found) { $_SESSION['UserCoursePeriod'] = $RET[1]['COURSE_PERIOD_ID']; $_SESSION['UserPeriod'] = $RET[1]['PERIOD_ID']; unset($_SESSION['student_id']); $_SESSION['unset_student'] = true; } echo '</SELECT>';
$sql = "UPDATE student_report_card_grades SET "; foreach ($columns as $column => $value) { $sql .= $column . "='" . str_replace("\\'", "''", $value) . "',"; } if ($_REQUEST['tab_id'] != 'new') { $sql = substr($sql, 0, -1) . " WHERE ID='{$id}'"; } else { $sql = substr($sql, 0, -1) . " WHERE ID='{$id}'"; } DBQuery($sql); } elseif ($columns['COURSE_TITLE']) { $sql = 'INSERT INTO student_report_card_grades '; $fields = 'SCHOOL_ID, STUDENT_ID, MARKING_PERIOD_ID, '; $values = UserSchool() . ", {$student_id}, {$mp_id}, "; if (!$columns['GP_SCALE']) { $columns['GP_SCALE'] = SchoolInfo('REPORTING_GP_SCALE'); } if (!$columns['CREDIT_ATTEMPTED']) { $columns['CREDIT_ATTEMPTED'] = 1; } if (!$columns['CREDIT_EARNED']) { if ($columns['UNWEIGHTED_GP'] > 0 || $columns['WEIGHTED_GP'] > 0) { $columns['CREDIT_EARNED'] = 1; } else { $columns['CREDIT_EARNED'] = 0; } } if (!$columns['CLASS_RANK']) { $columns['CLASS_RANK'] = 'Y'; } $go = false;
$periods_list = '(' . mb_substr($periods_list, 1) . ')'; foreach ($_REQUEST['student'] as $student_id => $yes) { $students_list .= ",'" . $student_id . "'"; } $students_list = '(' . mb_substr($students_list, 1) . ')'; $current_RET = DBGet(DBQuery("SELECT STUDENT_ID,PERIOD_ID,SCHOOL_DATE FROM ATTENDANCE_PERIOD WHERE EXTRACT(MONTH FROM SCHOOL_DATE)='" . $_REQUEST['month'] * 1 . "' AND EXTRACT(YEAR FROM SCHOOL_DATE)='{$_REQUEST['year']}' AND PERIOD_ID IN {$periods_list} AND STUDENT_ID IN {$students_list}"), array(), array('STUDENT_ID', 'SCHOOL_DATE', 'PERIOD_ID')); $state_code = DBGet(DBQuery("SELECT STATE_CODE FROM ATTENDANCE_CODES WHERE ID='{$_REQUEST['absence_code']}'")); $state_code = $state_code[1]['STATE_CODE']; foreach ($_REQUEST['student'] as $student_id => $yes) { foreach ($_REQUEST['dates'] as $date => $yes) { $current_mp = GetCurrentMP('QTR', $date); $all_mp = GetAllMP('QTR', $current_mp); //modif Francois: days numbered //modif Francois: multiple school periods for a course period if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) { $course_periods_RET = DBGet(DBQuery("SELECT s.COURSE_PERIOD_ID,cpsp.PERIOD_ID,cp.HALF_DAY FROM SCHEDULE s,COURSE_PERIODS cp,ATTENDANCE_CALENDAR ac,SCHOOL_PERIODS sp, COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND sp.PERIOD_ID=cpsp.PERIOD_ID AND ac.SCHOOL_DATE='{$date}' AND ac.CALENDAR_ID=cp.CALENDAR_ID AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL) AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='{$student_id}' AND cpsp.PERIOD_ID IN {$periods_list} AND position(',0,' IN cp.DOES_ATTENDANCE)>0 AND (ac.SCHOOL_DATE BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND ac.SCHOOL_DATE>=s.START_DATE)) AND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<=ac.SCHOOL_DATE AND end_date>=ac.SCHOOL_DATE AND mp='QTR') AND school_date<=ac.SCHOOL_DATE) AS INT) FOR 1) IN cpsp.DAYS)>0 AND s.MARKING_PERIOD_ID IN ({$all_mp})"), array(), array('PERIOD_ID')); } else { $course_periods_RET = DBGet(DBQuery("SELECT s.COURSE_PERIOD_ID,cpsp.PERIOD_ID,cp.HALF_DAY FROM SCHEDULE s,COURSE_PERIODS cp,ATTENDANCE_CALENDAR ac,SCHOOL_PERIODS sp, COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE sp.PERIOD_ID=cpsp.PERIOD_ID AND ac.SCHOOL_DATE='{$date}' AND ac.CALENDAR_ID=cp.CALENDAR_ID AND (ac.BLOCK=sp.BLOCK OR sp.BLOCK IS NULL) AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='{$student_id}' AND cpsp.PERIOD_ID IN {$periods_list} AND position(',0,' IN cp.DOES_ATTENDANCE)>0 AND (ac.SCHOOL_DATE BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND ac.SCHOOL_DATE>=s.START_DATE)) AND position(substring('UMTWHFS' FROM cast(extract(DOW FROM ac.SCHOOL_DATE) AS INT)+1 FOR 1) IN cpsp.DAYS)>0 AND s.MARKING_PERIOD_ID IN ({$all_mp})"), array(), array('PERIOD_ID')); } //echo '<pre>'; var_dump($course_periods_RET); echo '</pre>'; foreach ($_REQUEST['period'] as $period_id => $yes) { $course_period_id = $course_periods_RET[$period_id][1]['COURSE_PERIOD_ID']; if ($course_period_id && !($course_periods_RET[$period_id][1]['COURSE_PERIOD_ID'] == 'Y' && $state_code == 'H')) { if (!$current_RET[$student_id][$date][$period_id]) { $sql = "INSERT INTO ATTENDANCE_PERIOD (STUDENT_ID,SCHOOL_DATE,PERIOD_ID,MARKING_PERIOD_ID,COURSE_PERIOD_ID,ATTENDANCE_CODE,ATTENDANCE_REASON,ADMIN)\n\t\t\t\t\t\t\t\t\t\tvalues('{$student_id}','{$date}','{$period_id}','{$current_mp}','{$course_period_id}','{$_REQUEST['absence_code']}','{$_REQUEST['absence_reason']}','Y')"; DBQuery($sql); } else { $sql = "UPDATE ATTENDANCE_PERIOD SET ATTENDANCE_CODE='{$_REQUEST['absence_code']}',ATTENDANCE_REASON='{$_REQUEST['absence_reason']}',ADMIN='Y',COURSE_PERIOD_ID='{$course_period_id}'\n\t\t\t\t\t\t\t\tWHERE STUDENT_ID='{$student_id}' AND SCHOOL_DATE='{$date}' AND PERIOD_ID='{$period_id}'"; DBQuery($sql); } }
ListOutput($polls_RET, array('PUBLISHED_DATE' => _('Date Posted'), 'TITLE' => _('Title'), 'OPTIONS' => _('Poll'), 'SCHOOL' => _('School')), 'Poll', 'Polls', array(), array(), array('save' => false, 'search' => false)); } //modif Francois: add translation $events_RET = DBGet(DBQuery("SELECT ce.TITLE,ce.DESCRIPTION,ce.SCHOOL_DATE,to_char(ce.SCHOOL_DATE,'Day') AS DAY,s.TITLE AS SCHOOL FROM CALENDAR_EVENTS ce,SCHOOLS s WHERE ce.SCHOOL_DATE BETWEEN CURRENT_DATE AND CURRENT_DATE+11 AND ce.SYEAR='" . UserSyear() . "' AND position(','||ce.SCHOOL_ID||',' IN (SELECT SCHOOLS FROM STAFF WHERE STAFF_ID='" . User('STAFF_ID') . "'))>0 AND s.ID=ce.SCHOOL_ID AND s.SYEAR=ce.SYEAR ORDER BY ce.SCHOOL_DATE,s.TITLE"), array('SCHOOL_DATE' => 'ProperDate', 'DAY' => '_eventDay'), array('SCHOOL_DATE')); if (count($events_RET)) { ListOutput($events_RET, array('DAY' => _('Day'), 'SCHOOL_DATE' => _('Date'), 'TITLE' => _('Event'), 'DESCRIPTION' => _('Description'), 'SCHOOL' => _('School')), 'Day With Upcoming Events', 'Days With Upcoming Events', array(), array('SCHOOL_DATE'), array('save' => false, 'search' => false)); } //RSSOutput(USER('PROFILE')); if (Preferences('HIDE_ALERTS') != 'Y') { // warn if missing attendances $categories_RET = DBGet(DBQuery("SELECT '0' AS ID,'Attendance' AS TITLE,0,NULL AS SORT_ORDER UNION SELECT ID,TITLE,1,SORT_ORDER FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='" . UserSyear() . "' AND SCHOOL_ID='" . UserSchool() . "' ORDER BY 3,SORT_ORDER")); foreach ($categories_RET as $category) { //modif Francois: days numbered //modif Francois: multiple school periods for a course period if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) { $RET = DBGET(DBQuery("SELECT cp.COURSE_PERIOD_ID,acc.SCHOOL_DATE,cp.TITLE FROM ATTENDANCE_CALENDAR acc,COURSE_PERIODS cp,SCHOOL_PERIODS sp, COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND acc.SYEAR='" . UserSyear() . "' AND (acc.MINUTES IS NOT NULL AND acc.MINUTES>0) AND cp.SCHOOL_ID=acc.SCHOOL_ID AND cp.SYEAR=acc.SYEAR AND acc.SCHOOL_DATE<'" . DBDate() . "' AND cp.CALENDAR_ID=acc.CALENDAR_ID AND cp.TEACHER_ID='" . User('STAFF_ID') . "'\n\t\t\t\tAND cp.MARKING_PERIOD_ID IN (SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE UNION SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='SEM' AND SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE UNION SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='QTR' AND SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE)\n\t\t\t\tAND sp.PERIOD_ID=cpsp.PERIOD_ID AND (sp.BLOCK IS NULL AND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<=acc.SCHOOL_DATE AND end_date>=acc.SCHOOL_DATE AND mp='QTR') AND school_date<=acc.SCHOOL_DATE) AS INT) FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tOR sp.BLOCK IS NOT NULL AND acc.BLOCK IS NOT NULL AND sp.BLOCK=acc.BLOCK)\n\t\t\t\tAND NOT exists(SELECT '' FROM ATTENDANCE_COMPLETED ac WHERE ac.SCHOOL_DATE=acc.SCHOOL_DATE AND ac.STAFF_ID=cp.TEACHER_ID AND ac.PERIOD_ID=cpsp.PERIOD_ID AND TABLE_NAME='{$category['ID']}') AND position(',{$category['ID']},' IN cp.DOES_ATTENDANCE)>0 ORDER BY cp.TITLE,acc.SCHOOL_DATE"), array('SCHOOL_DATE' => 'ProperDate'), array('COURSE_PERIOD_ID')); } else { $RET = DBGET(DBQuery("SELECT cp.COURSE_PERIOD_ID,acc.SCHOOL_DATE,cp.TITLE FROM ATTENDANCE_CALENDAR acc,COURSE_PERIODS cp,SCHOOL_PERIODS sp, COURSE_PERIOD_SCHOOL_PERIODS cpsp WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND acc.SYEAR='" . UserSyear() . "' AND (acc.MINUTES IS NOT NULL AND acc.MINUTES>0) AND cp.SCHOOL_ID=acc.SCHOOL_ID AND cp.SYEAR=acc.SYEAR AND acc.SCHOOL_DATE<'" . DBDate() . "' AND cp.CALENDAR_ID=acc.CALENDAR_ID AND cp.TEACHER_ID='" . User('STAFF_ID') . "'\n\t\t\t\tAND cp.MARKING_PERIOD_ID IN (SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE UNION SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='SEM' AND SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE UNION SELECT MARKING_PERIOD_ID FROM SCHOOL_MARKING_PERIODS WHERE MP='QTR' AND SCHOOL_ID=acc.SCHOOL_ID AND acc.SCHOOL_DATE BETWEEN START_DATE AND END_DATE)\n\t\t\t\tAND sp.PERIOD_ID=cpsp.PERIOD_ID AND (sp.BLOCK IS NULL AND position(substring('UMTWHFS' FROM cast(extract(DOW FROM acc.SCHOOL_DATE) AS INT)+1 FOR 1) IN cpsp.DAYS)>0\n\t\t\t\t\tOR sp.BLOCK IS NOT NULL AND acc.BLOCK IS NOT NULL AND sp.BLOCK=acc.BLOCK)\n\t\t\t\tAND NOT exists(SELECT '' FROM ATTENDANCE_COMPLETED ac WHERE ac.SCHOOL_DATE=acc.SCHOOL_DATE AND ac.STAFF_ID=cp.TEACHER_ID AND ac.PERIOD_ID=cpsp.PERIOD_ID AND TABLE_NAME='{$category['ID']}') AND position(',{$category['ID']},' IN cp.DOES_ATTENDANCE)>0 ORDER BY cp.TITLE,acc.SCHOOL_DATE"), array('SCHOOL_DATE' => 'ProperDate'), array('COURSE_PERIOD_ID')); } if (count($RET)) { echo '<div class="error"><p><IMG SRC="assets/x.png" class="alignImg"> <span style="color:red"><b>' . _('Warning!') . '</b></span> ' . Localize('colon', _('You have missing attendance data')) . '</div></p>'; ListOutput($RET, array('SCHOOL_DATE' => _('Date'), 'TITLE' => _('Period') . ' ' . _('Days') . ' - ' . _('Short Name') . ' - ' . _('Teacher')), 'Course Period with missing attendance data', 'Course Periods with missing attendance data', array(), array('COURSE_PERIOD_ID'), array('save' => false, 'search' => false)); // echo '</p>'; } } } if ($RosarioModules['Food_Service'] && Preferences('HIDE_ALERTS') != 'Y') { // warn if negative food service balance $staff = DBGet(DBQuery("SELECT (SELECT STATUS FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS STATUS,(SELECT BALANCE FROM FOOD_SERVICE_STAFF_ACCOUNTS WHERE STAFF_ID=s.STAFF_ID) AS BALANCE FROM STAFF s WHERE s.STAFF_ID='" . User('STAFF_ID') . "'")); $staff = $staff[1]; if ($staff['BALANCE'] && $staff['BALANCE'] < 0) {
unset($_SESSION['_REQUEST_vars']['values']); unset($_SESSION['_REQUEST_vars']['modfunc']); } if (empty($_REQUEST['modfunc'])) { if (!empty($note)) { echo ErrorMessage($note, 'note'); } if (!empty($error)) { echo ErrorMessage($error, 'error'); } echo '<FORM ACTION="Modules.php?modname=' . $_REQUEST['modname'] . '&modfunc=update" METHOD="POST">'; if (AllowEdit()) { DrawHeader('', SubmitButton(_('Save'))); } echo '<BR />'; PopTable('header', SchoolInfo('TITLE')); $program_config = DBGet(DBQuery("SELECT * FROM PROGRAM_CONFIG WHERE SCHOOL_ID='" . UserSchool() . "' AND SYEAR='" . UserSyear() . "'"), array(), array('TITLE')); echo '<FIELDSET><legend><b>' . ParseMLField(Config('TITLE')) . '</b></legend><TABLE>'; echo '<TR style="text-align:left;"><TD>' . MLTextInput(Config('TITLE'), 'values[CONFIG][TITLE]', _('Program Title'), 'required') . '</TD></TR>'; echo '</TABLE></FIELDSET>'; echo '<BR /><FIELDSET><legend><b>' . _('School') . '</b></legend><TABLE>'; //modif Francois: school year over one/two calendar years format echo '<TR style="text-align:left;"><TD>' . CheckboxInput(Config('SCHOOL_SYEAR_OVER_2_YEARS'), 'values[CONFIG][SCHOOL_SYEAR_OVER_2_YEARS]', _('School year over two calendar years'), '', false, '<img src="assets/check.png" height="15" /> ', '<img src="assets/x.png" height="15" /> ') . '</TD></TR>'; echo '</TABLE></FIELDSET>'; echo '<BR /><FIELDSET><legend><b>' . _('Students') . '</b></legend><TABLE>'; echo '<TR style="text-align:left;"><TD>' . CheckboxInput(Config('STUDENTS_USE_MAILING'), 'values[CONFIG][STUDENTS_USE_MAILING]', _('Display Mailing Address'), '', false, '<img src="assets/check.png" height="15" /> ', '<img src="assets/x.png" height="15" /> ') . '</TD></TR>'; echo '<TR style="text-align:left;"><TD>' . CheckboxInput($program_config['STUDENTS_USE_BUS'][1]['VALUE'], 'values[PROGRAM_CONFIG][STUDENTS_USE_BUS]', _('Check Bus Pickup / Dropoff by default'), '', false, '<img src="assets/check.png" height="15" /> ', '<img src="assets/x.png" height="15" /> ') . '</TD></TR>'; echo '<TR style="text-align:left;"><TD>' . CheckboxInput($program_config['STUDENTS_USE_CONTACT'][1]['VALUE'], 'values[PROGRAM_CONFIG][STUDENTS_USE_CONTACT]', _('Enable Legacy Contact Information'), '', false, '<img src="assets/check.png" height="15" /> ', '<img src="assets/x.png" height="15" /> ') . '</TD></TR>'; echo '<TR style="text-align:left;"><TD>' . CheckboxInput($program_config['STUDENTS_SEMESTER_COMMENTS'][1]['VALUE'], 'values[PROGRAM_CONFIG][STUDENTS_SEMESTER_COMMENTS]', _('Use Semester Comments instead of Quarter Comments'), '', false, '<img src="assets/check.png" height="15" /> ', '<img src="assets/x.png" height="15" /> ') . '</TD></TR>'; echo '</TABLE></FIELDSET>'; echo '<BR /><FIELDSET><legend><b>' . _('Grades') . '</b></legend><TABLE>';
$i = 0; foreach ($RET as $staff) { $staff_id = $staff['STAFF_ID']; //modif Francois: change parent password generation $password = $staff['USERNAME'] . rand(1000, 9999); //modif Francois: add password encryption $password_encrypted = encrypt_password($password); DBQuery("UPDATE STAFF SET PASSWORD='******' WHERE STAFF_ID='{$staff_id}'"); $students_RET = DBGet(DBQuery("SELECT s.FIRST_NAME||' '||s.LAST_NAME AS FULL_NAME FROM STUDENTS s,STUDENT_ENROLLMENT sse,STUDENTS_JOIN_USERS sju WHERE sju.STAFF_ID='{$staff_id}' AND s.STUDENT_ID=sju.STUDENT_ID AND sse.STUDENT_ID=sju.STUDENT_ID AND sse.SYEAR='" . UserSyear() . "' AND sse.END_DATE IS NULL")); //echo '<pre>'; var_dump($students_RET); echo '</pre>'; $student_list = ''; foreach ($students_RET as $student) { $student_list .= str_replace(' ', ' ', $student['FULL_NAME']) . "\r"; } $msg = str_replace('__ASSOCIATED_STUDENTS__', $student_list, $message); $msg = str_replace('__SCHOOL_ID__', SchoolInfo('TITLE'), $msg); $msg = str_replace('__PARENT_NAME__', $staff['NAME'], $msg); $msg = str_replace('__USERNAME__', $staff['USERNAME'], $msg); //modif Francois: add password encryption // $msg = str_replace('__PASSWORD__',$staff['PASSWORD'],$msg); $msg = str_replace('__PASSWORD__', $password, $msg); $result = @mail(empty($test_email) ? $staff['EMAIL'] : $test_email, utf8_decode($subject), utf8_decode($msg), $headers, $params); $RESULT[] = array('PARENT' => $staff['FULL_NAME'], 'USERNAME' => $staff['USERNAME'], 'EMAIL' => !$test_email ? $staff['EMAIL'] : $test_email, 'RESULT' => $result ? _('Success') : _('Fail')); $i++; } unset($RESULT[0]); $columns = array('PARENT' => _('Parent'), 'USERNAME' => _('Username'), 'EMAIL' => _('Email'), 'RESULT' => _('Result')); ListOutput($RESULT, $columns, 'Notification Result', 'Notification Results'); } else { $error[] = _('You must choose at least one user'); unset($_SESSION['_REQUEST_vars']['modfunc']);
} $category_select .= "</SELECT>"; $QI = DBQuery("SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp WHERE sp.SCHOOL_ID='" . UserSchool() . "' AND sp.SYEAR='" . UserSyear() . "' AND EXISTS (SELECT '' FROM COURSE_PERIODS WHERE SYEAR=sp.SYEAR AND PERIOD_ID=sp.PERIOD_ID AND position(',{$_REQUEST['table']},' IN DOES_ATTENDANCE)>0) ORDER BY sp.SORT_ORDER"); $periods_RET = DBGet($QI, array(), array('PERIOD_ID')); $period_select = "<SELECT name=period onChange='this.form.submit();'><OPTION value=''>" . _('All') . "</OPTION>"; foreach ($periods_RET as $id => $period) { $period_select .= '<OPTION value="' . $id . '"' . ($_REQUEST['period'] == $id ? ' SELECTED="SELECTED"' : '') . ">" . $period[1]['TITLE'] . "</OPTION>"; } $period_select .= "</SELECT>"; echo '<FORM action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="POST">'; DrawHeader(PrepareDate($date, '_date', false, array('submit' => true)) . ' - ' . $period_select, $category_select); echo '</FORM>'; //modif Francois: days numbered //modif Francois: multiple school periods for a course period if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null) { $sql = "SELECT s.STAFF_ID,s.LAST_NAME||', '||s.FIRST_NAME AS FULL_NAME,sp.TITLE,cpsp.PERIOD_ID,cp.TITLE AS COURSE_TITLE,\n\t\t\t(SELECT 'Y' FROM ATTENDANCE_COMPLETED ac WHERE ac.STAFF_ID=cp.TEACHER_ID AND ac.SCHOOL_DATE=acc.SCHOOL_DATE AND ac.PERIOD_ID=sp.PERIOD_ID AND TABLE_NAME='{$_REQUEST['table']}') AS COMPLETED\n\t\t\tFROM STAFF s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR acc, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\tWHERE \n\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\tsp.PERIOD_ID = cpsp.PERIOD_ID AND position(',{$_REQUEST['table']},' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\tAND cp.TEACHER_ID=s.STAFF_ID AND cp.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\tAND cp.SYEAR='" . UserSyear() . "' AND cp.SCHOOL_ID='" . UserSchool() . "' AND s.PROFILE='teacher'\n\t\t\t\t" . ($_REQUEST['period'] ? " AND cpsp.PERIOD_ID='{$_REQUEST['period']}'" : '') . " AND acc.CALENDAR_ID=cp.CALENDAR_ID AND acc.SCHOOL_DATE='{$date}'\n\t\t\t\tAND acc.SYEAR='" . UserSyear() . "' AND (acc.MINUTES IS NOT NULL AND acc.MINUTES>0)\n\t\t\t\tAND (sp.BLOCK IS NULL AND position(substring('MTWHFSU' FROM cast((SELECT CASE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " WHEN 0 THEN " . SchoolInfo('NUMBER_DAYS_ROTATION') . " ELSE COUNT(school_date)% " . SchoolInfo('NUMBER_DAYS_ROTATION') . " END AS day_number FROM attendance_calendar WHERE school_date>=(SELECT start_date FROM school_marking_periods WHERE start_date<=acc.SCHOOL_DATE AND end_date>=acc.SCHOOL_DATE AND mp='QTR') AND school_date<=acc.SCHOOL_DATE) AS INT) FOR 1) IN cpsp.DAYS)>0\n\t\t\t\tOR sp.BLOCK IS NOT NULL AND acc.BLOCK IS NOT NULL AND sp.BLOCK=acc.BLOCK)\n\t\t\tORDER BY FULL_NAME"; } else { $sql = "SELECT s.STAFF_ID,s.LAST_NAME||', '||s.FIRST_NAME AS FULL_NAME,sp.TITLE,cpsp.PERIOD_ID,cp.TITLE AS COURSE_TITLE,\n\t\t\t(SELECT 'Y' FROM ATTENDANCE_COMPLETED ac WHERE ac.STAFF_ID=cp.TEACHER_ID AND ac.SCHOOL_DATE=acc.SCHOOL_DATE AND ac.PERIOD_ID=sp.PERIOD_ID AND TABLE_NAME='{$_REQUEST['table']}') AS COMPLETED\n\t\t\tFROM STAFF s,COURSE_PERIODS cp,SCHOOL_PERIODS sp,ATTENDANCE_CALENDAR acc, COURSE_PERIOD_SCHOOL_PERIODS cpsp \n\t\t\tWHERE \n\t\t\t\tcp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND\n\t\t\t\tsp.PERIOD_ID = cpsp.PERIOD_ID AND position(',{$_REQUEST['table']},' IN cp.DOES_ATTENDANCE)>0\n\t\t\t\tAND cp.TEACHER_ID=s.STAFF_ID AND cp.MARKING_PERIOD_ID IN (" . GetAllMP('QTR', GetCurrentMP('QTR', $date)) . ")\n\t\t\t\tAND cp.SYEAR='" . UserSyear() . "' AND cp.SCHOOL_ID='" . UserSchool() . "' AND s.PROFILE='teacher'\n\t\t\t\t" . ($_REQUEST['period'] ? " AND cpsp.PERIOD_ID='{$_REQUEST['period']}'" : '') . " AND acc.CALENDAR_ID=cp.CALENDAR_ID AND acc.SCHOOL_DATE='{$date}'\n\t\t\t\tAND acc.SYEAR='" . UserSyear() . "' AND (acc.MINUTES IS NOT NULL AND acc.MINUTES>0)\n\t\t\t\tAND (sp.BLOCK IS NULL AND position(substring('UMTWHFS' FROM cast(extract(DOW FROM acc.SCHOOL_DATE) AS INT)+1 FOR 1) IN cpsp.DAYS)>0\n\t\t\t\tOR sp.BLOCK IS NOT NULL AND acc.BLOCK IS NOT NULL AND sp.BLOCK=acc.BLOCK)\n\t\t\tORDER BY FULL_NAME"; } $RET = DBGet(DBQuery($sql), array(), array('STAFF_ID')); if (!$_REQUEST['period']) { foreach ($RET as $staff_id => $periods) { $i++; $staff_RET[$i]['FULL_NAME'] = $periods[1]['FULL_NAME']; foreach ($periods as $period) { if (!isset($_REQUEST['_ROSARIO_PDF'])) { $staff_RET[$i][$period['PERIOD_ID']] .= button($period['COMPLETED'] == 'Y' ? 'check' : 'x', '', '"#" onMouseOver=\'stm(["' . _('Course Title') . '","' . str_replace('"', '\\"', str_replace("'", ''', $period['COURSE_TITLE'])) . '"],tipmessageStyle);\' onMouseOut=\'htm()\'') . ' '; } else { $staff_RET[$i][$period['PERIOD_ID']] = ($period['COMPLETED'] == 'Y' ? _('Yes') : _('No')) . " "; } }