Commit 60fa3ea1 authored by François Jacquet's avatar François Jacquet
Browse files

Omit DBQuery call for DBGet SELECT, 6

parent b8fefcde
......@@ -18,7 +18,7 @@
*/
function GetSyear( $date )
{
//$RET = DBGet(DBQuery("SELECT SYEAR FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND '".$date."' BETWEEN START_DATE AND END_DATE"));
//$RET = DBGet( "SELECT SYEAR FROM SCHOOL_MARKING_PERIODS WHERE MP='FY' AND '".$date."' BETWEEN START_DATE AND END_DATE" );
// Get greatest SYEAR where START_DATE <= $date.
$RET = DBGet( "SELECT max(SYEAR) AS SYEAR
......
......@@ -77,12 +77,12 @@ if ( ! isset( $_REQUEST['accounting'] )
if (isset($_REQUEST['staff_payroll']) || isset($_REQUEST['student_billing']))
$name_col_sql = "'' AS FULL_NAME,";
$RET = DBGet(DBQuery("SELECT ".$name_col_sql."f.AMOUNT AS CREDIT,'' AS DEBIT,f.TITLE||' '||COALESCE(f.COMMENTS,' ') AS EXPLANATION,f.ASSIGNED_DATE AS DATE,f.ID AS ID
$RET = DBGet( "SELECT ".$name_col_sql."f.AMOUNT AS CREDIT,'' AS DEBIT,f.TITLE||' '||COALESCE(f.COMMENTS,' ') AS EXPLANATION,f.ASSIGNED_DATE AS DATE,f.ID AS ID
FROM ACCOUNTING_INCOMES f
WHERE f.SYEAR='".UserSyear()."'
AND f.SCHOOL_ID='".UserSchool()."'
AND f.ASSIGNED_DATE BETWEEN '".$start_date."'
AND '".$end_date."'"),$extra['functions']);
AND '".$end_date."'",$extra['functions']);
$payments_SQL = "SELECT ".$name_col_sql."'' AS CREDIT,p.AMOUNT AS DEBIT,COALESCE(p.COMMENTS,' ') AS EXPLANATION,p.PAYMENT_DATE AS DATE,p.ID AS ID
FROM ACCOUNTING_PAYMENTS p
......
......@@ -29,7 +29,7 @@ if ( $_REQUEST['values']
elseif ( $columns['AMOUNT'] !== ''
&& $columns['PAYMENT_DATE'] )
{
$id = DBGet(DBQuery("SELECT ".db_seq_nextval('ACCOUNTING_PAYMENTS_SEQ').' AS ID'));
$id = DBGet( "SELECT ".db_seq_nextval('ACCOUNTING_PAYMENTS_SEQ').' AS ID' );
$id = $id[1]['ID'];
$sql = "INSERT INTO ACCOUNTING_PAYMENTS ";
......@@ -89,7 +89,7 @@ if ( ! $_REQUEST['modfunc'] )
'COMMENTS' => '_makePaymentsTextInput',
);
$payments_RET = DBGet(DBQuery("SELECT '' AS REMOVE,ID,AMOUNT,PAYMENT_DATE,COMMENTS FROM ACCOUNTING_PAYMENTS WHERE SYEAR='".UserSyear()."' AND STAFF_ID IS NULL AND SCHOOL_ID='".UserSchool()."' ORDER BY ID"),$functions);
$payments_RET = DBGet( "SELECT '' AS REMOVE,ID,AMOUNT,PAYMENT_DATE,COMMENTS FROM ACCOUNTING_PAYMENTS WHERE SYEAR='".UserSyear()."' AND STAFF_ID IS NULL AND SCHOOL_ID='".UserSchool()."' ORDER BY ID",$functions);
$i = 1;
$RET = array();
foreach ( (array) $payments_RET as $payment)
......@@ -136,7 +136,7 @@ if ( ! $_REQUEST['modfunc'] )
echo '<br />';
$incomes_total = DBGet(DBQuery("SELECT SUM(f.AMOUNT) AS TOTAL FROM ACCOUNTING_INCOMES f WHERE f.SYEAR='".UserSyear()."' AND f.SCHOOL_ID='".UserSchool()."'"));
$incomes_total = DBGet( "SELECT SUM(f.AMOUNT) AS TOTAL FROM ACCOUNTING_INCOMES f WHERE f.SYEAR='".UserSyear()."' AND f.SCHOOL_ID='".UserSchool()."'" );
$table = '<table class="align-right"><tr><td>'._('Total from Incomes').': '.'</td><td>'.Currency($incomes_total[1]['TOTAL']).'</td></tr>';
......@@ -149,7 +149,7 @@ if ( ! $_REQUEST['modfunc'] )
if ( $RosarioModules['Student_Billing'])
{
$student_payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM BILLING_PAYMENTS p WHERE p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'"));
$student_payments_total = DBGet( "SELECT SUM(p.AMOUNT) AS TOTAL FROM BILLING_PAYMENTS p WHERE p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'" );
$table .= '<tr><td>& '._('Total from Student Payments').': '.'</td><td>'.Currency($student_payments_total[1]['TOTAL']).'</td></tr>';
}
......@@ -158,7 +158,7 @@ if ( ! $_REQUEST['modfunc'] )
$table .= '<tr><td>'._('Less').': '._('Total from Expenses').': '.'</td><td>'.Currency($payments_total).'</td></tr>';
$Staff_payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID IS NOT NULL AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'"));
$Staff_payments_total = DBGet( "SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID IS NOT NULL AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'" );
$table .= '<tr><td>& '._('Total from Staff Payments').': '.'</td><td>'.Currency($Staff_payments_total[1]['TOTAL']).'</td></tr>';
......
......@@ -82,7 +82,7 @@ if ( ! $_REQUEST['modfunc'] )
'AMOUNT' => '_makeIncomesAmount',
);
$incomes_RET = DBGet(DBQuery("SELECT '' AS REMOVE,f.ID,f.TITLE,f.ASSIGNED_DATE,f.COMMENTS,f.AMOUNT FROM ACCOUNTING_INCOMES f WHERE f.SYEAR='".UserSyear()."' AND f.SCHOOL_ID='".UserSchool()."' ORDER BY f.ASSIGNED_DATE"),$functions);
$incomes_RET = DBGet( "SELECT '' AS REMOVE,f.ID,f.TITLE,f.ASSIGNED_DATE,f.COMMENTS,f.AMOUNT FROM ACCOUNTING_INCOMES f WHERE f.SYEAR='".UserSyear()."' AND f.SCHOOL_ID='".UserSchool()."' ORDER BY f.ASSIGNED_DATE",$functions);
$i = 1;
$RET = array();
foreach ( (array) $incomes_RET as $income)
......@@ -134,7 +134,7 @@ if ( ! $_REQUEST['modfunc'] )
echo '<br />';
$payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID IS NULL AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'"));
$payments_total = DBGet( "SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID IS NULL AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'" );
$table = '<table class="align-right"><tr><td>'._('Total from Incomes').': '.'</td><td>'.Currency($incomes_total).'</td></tr>';
......@@ -147,7 +147,7 @@ if ( ! $_REQUEST['modfunc'] )
if ( $RosarioModules['Student_Billing'])
{
$student_payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM BILLING_PAYMENTS p WHERE p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'"));
$student_payments_total = DBGet( "SELECT SUM(p.AMOUNT) AS TOTAL FROM BILLING_PAYMENTS p WHERE p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'" );
$table .= '<tr><td>& '._('Total from Student Payments').': '.'</td><td>'.Currency($student_payments_total[1]['TOTAL']).'</td></tr>';
}
else
......@@ -155,7 +155,7 @@ if ( ! $_REQUEST['modfunc'] )
$table .= '<tr><td>'._('Less').': '._('Total from Expenses').': '.'</td><td>'.Currency($payments_total[1]['TOTAL']).'</td></tr>';
$Staff_payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID IS NOT NULL AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'"));
$Staff_payments_total = DBGet( "SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID IS NOT NULL AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'" );
$table .= '<tr><td>& '._('Total from Staff Payments').': '.'</td><td>'.Currency($Staff_payments_total[1]['TOTAL']).'</td></tr>';
$table .= '<tr><td>' . _( 'General Balance' ) . ': </td>
......
......@@ -80,7 +80,7 @@ if (UserStaffID() && ! $_REQUEST['modfunc'])
{
$salaries_total = 0;
$functions = array('REMOVE' => '_makeSalariesRemove','ASSIGNED_DATE' => 'ProperDate','DUE_DATE' => '_makeSalariesDateInput','COMMENTS' => '_makeSalariesTextInput','AMOUNT' => '_makeSalariesAmount');
$salaries_RET = DBGet(DBQuery("SELECT '' AS REMOVE,f.ID,f.TITLE,f.ASSIGNED_DATE,f.DUE_DATE,f.COMMENTS,f.AMOUNT FROM ACCOUNTING_SALARIES f WHERE f.STAFF_ID='".UserStaffID()."' AND f.SYEAR='".UserSyear()."' AND f.SCHOOL_ID='".UserSchool()."' ORDER BY f.ASSIGNED_DATE"),$functions);
$salaries_RET = DBGet( "SELECT '' AS REMOVE,f.ID,f.TITLE,f.ASSIGNED_DATE,f.DUE_DATE,f.COMMENTS,f.AMOUNT FROM ACCOUNTING_SALARIES f WHERE f.STAFF_ID='".UserStaffID()."' AND f.SYEAR='".UserSyear()."' AND f.SCHOOL_ID='".UserSchool()."' ORDER BY f.ASSIGNED_DATE",$functions);
$i = 1;
$RET = array();
foreach ( (array) $salaries_RET as $salary)
......@@ -115,7 +115,7 @@ if (UserStaffID() && ! $_REQUEST['modfunc'])
if ( empty( $_REQUEST['print_statements'] ) )
{
$payments_total = DBGet(DBQuery("SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID='".UserStaffID()."' AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'"));
$payments_total = DBGet( "SELECT SUM(p.AMOUNT) AS TOTAL FROM ACCOUNTING_PAYMENTS p WHERE p.STAFF_ID='".UserStaffID()."' AND p.SYEAR='".UserSyear()."' AND p.SCHOOL_ID='".UserSchool()."'" );
$table = '<table class="align-right"><tr><td>'._('Total from Salaries').': '.'</td><td>'.Currency($salaries_total).'</td></tr>';
......
......@@ -98,7 +98,7 @@ if (UserStaffID() && ! $_REQUEST['modfunc'])
'COMMENTS' => '_makePaymentsTextInput',
);
$payments_RET = DBGet(DBQuery("SELECT '' AS REMOVE,ID,AMOUNT,PAYMENT_DATE,COMMENTS FROM ACCOUNTING_PAYMENTS WHERE STAFF_ID='".UserStaffID()."' AND SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' ORDER BY ID"),$functions);
$payments_RET = DBGet( "SELECT '' AS REMOVE,ID,AMOUNT,PAYMENT_DATE,COMMENTS FROM ACCOUNTING_PAYMENTS WHERE STAFF_ID='".UserStaffID()."' AND SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' ORDER BY ID",$functions);
$i = 1;
$RET = array();
foreach ( (array) $payments_RET as $payment)
......@@ -145,7 +145,7 @@ if (UserStaffID() && ! $_REQUEST['modfunc'])
echo '<br />';
$salaries_total = DBGet(DBQuery("SELECT SUM(f.AMOUNT) AS TOTAL FROM ACCOUNTING_SALARIES f WHERE f.STAFF_ID='".UserStaffID()."' AND f.SYEAR='".UserSyear()."' AND f.SCHOOL_ID='".UserSchool()."'"));
$salaries_total = DBGet( "SELECT SUM(f.AMOUNT) AS TOTAL FROM ACCOUNTING_SALARIES f WHERE f.STAFF_ID='".UserStaffID()."' AND f.SYEAR='".UserSyear()."' AND f.SCHOOL_ID='".UserSchool()."'" );
$table = '<table class="align-right"><tr><td>'._('Total from Salaries').': '.'</td><td>'.Currency($salaries_total[1]['TOTAL']).'</td></tr>';
......
......@@ -169,7 +169,7 @@ if ( ! $_REQUEST['modfunc'] )
echo '<td><table><tr>';
//FJ multiple school periods for a course period
//$periods_RET = DBGet(DBQuery("SELECT SHORT_NAME,PERIOD_ID FROM SCHOOL_PERIODS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND EXISTS (SELECT '' FROM COURSE_PERIODS WHERE PERIOD_ID=SCHOOL_PERIODS.PERIOD_ID AND position(',0,' IN DOES_ATTENDANCE)>0) ORDER BY SORT_ORDER"));
//$periods_RET = DBGet( "SELECT SHORT_NAME,PERIOD_ID FROM SCHOOL_PERIODS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND EXISTS (SELECT '' FROM COURSE_PERIODS WHERE PERIOD_ID=SCHOOL_PERIODS.PERIOD_ID AND position(',0,' IN DOES_ATTENDANCE)>0) ORDER BY SORT_ORDER" );
$periods_RET = DBGet( "SELECT SHORT_NAME,PERIOD_ID
FROM SCHOOL_PERIODS
WHERE SYEAR='" . UserSyear() . "'
......
......@@ -206,16 +206,16 @@ if ( count( $_REQUEST['attendance_day'] ) )
RedirectURL( 'attendance_day' );
}
$codes_RET = DBGet(DBQuery("SELECT ID,SHORT_NAME,TITLE,STATE_CODE FROM ATTENDANCE_CODES WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' AND TABLE_NAME='".$_REQUEST['table']."'"));
$codes_RET = DBGet( "SELECT ID,SHORT_NAME,TITLE,STATE_CODE FROM ATTENDANCE_CODES WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' AND TABLE_NAME='".$_REQUEST['table']."'" );
$periods_RET = DBGet(DBQuery("SELECT PERIOD_ID,SHORT_NAME,TITLE
$periods_RET = DBGet( "SELECT PERIOD_ID,SHORT_NAME,TITLE
FROM SCHOOL_PERIODS
WHERE SCHOOL_ID='".UserSchool()."'
AND SYEAR='".UserSyear()."'
AND EXISTS (SELECT '' FROM COURSE_PERIODS WHERE PERIOD_ID=SCHOOL_PERIODS.PERIOD_ID AND position(',".$_REQUEST['table'].",' IN DOES_ATTENDANCE)>0)
ORDER BY SORT_ORDER"));
ORDER BY SORT_ORDER" );
$categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'"));
$categories_RET = DBGet( "SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'" );
if (count($categories_RET))
{
......@@ -241,7 +241,7 @@ if (isset($_REQUEST['student_id']) && $_REQUEST['student_id']!='new')
//FJ multiple school periods for a course period
if (SchoolInfo('NUMBER_DAYS_ROTATION') !== null)
{
$schedule_RET = DBGet(DBQuery("SELECT
$schedule_RET = DBGet( "SELECT
s.STUDENT_ID,c.TITLE AS COURSE,cpsp.PERIOD_ID,cp.COURSE_PERIOD_ID,p.TITLE AS PERIOD_TITLE,
s.STUDENT_ID AS ATTENDANCE_CODE,s.STUDENT_ID AS ATTENDANCE_TEACHER_CODE,s.STUDENT_ID AS ATTENDANCE_REASON,s.STUDENT_ID AS COMMENT
FROM SCHEDULE s,COURSES c,COURSE_PERIODS cp,SCHOOL_PERIODS p,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp
......@@ -257,9 +257,9 @@ if (isset($_REQUEST['student_id']) && $_REQUEST['student_id']!='new')
AND school_date<='".$date."' AND SCHOOL_ID=s.SCHOOL_ID) AS INT) FOR 1)
IN cpsp.DAYS)>0
AND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_DATE='".$date."' AND ac.MINUTES!='0'
ORDER BY p.SORT_ORDER"),$functions);
ORDER BY p.SORT_ORDER",$functions);
} else {
$schedule_RET = DBGet(DBQuery("SELECT
$schedule_RET = DBGet( "SELECT
s.STUDENT_ID,c.TITLE AS COURSE,cpsp.PERIOD_ID,cp.COURSE_PERIOD_ID,p.TITLE AS PERIOD_TITLE,
s.STUDENT_ID AS ATTENDANCE_CODE,s.STUDENT_ID AS ATTENDANCE_TEACHER_CODE,s.STUDENT_ID AS ATTENDANCE_REASON,s.STUDENT_ID AS COMMENT
FROM SCHEDULE s,COURSES c,COURSE_PERIODS cp,SCHOOL_PERIODS p,ATTENDANCE_CALENDAR ac, COURSE_PERIOD_SCHOOL_PERIODS cpsp
......@@ -272,7 +272,7 @@ if (isset($_REQUEST['student_id']) && $_REQUEST['student_id']!='new')
AND ('".$date."' BETWEEN s.START_DATE AND s.END_DATE OR (s.END_DATE IS NULL AND '".$date."'>=s.START_DATE))
AND position(substring('UMTWHFS' FROM cast(extract(DOW FROM cast('".$date."' AS DATE)) AS INT)+1 FOR 1) IN cpsp.DAYS)>0
AND ac.CALENDAR_ID=cp.CALENDAR_ID AND ac.SCHOOL_DATE='".$date."' AND ac.MINUTES!='0'
ORDER BY p.SORT_ORDER"),$functions);
ORDER BY p.SORT_ORDER",$functions);
}
$columns = array(
......@@ -356,7 +356,7 @@ else
}
elseif ( $abs)
{
$RET = DBGet(DBQuery("SELECT ID FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL) AND TABLE_NAME='".$_REQUEST['table']."'"));
$RET = DBGet( "SELECT ID FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL) AND TABLE_NAME='".$_REQUEST['table']."'" );
if (count($RET))
{
$extra['WHERE'] .= "AND ac.ID IN (";
......
......@@ -11,7 +11,7 @@ if ( ! empty( $_REQUEST['month_date'] )
else
$date = DBDate();
$current_RET = DBGet(DBQuery("SELECT ATTENDANCE_TEACHER_CODE,ATTENDANCE_CODE,ATTENDANCE_REASON,STUDENT_ID,ADMIN,COURSE_PERIOD_ID FROM ATTENDANCE_PERIOD WHERE SCHOOL_DATE='".$date."'"),array(),array('STUDENT_ID','COURSE_PERIOD_ID'));
$current_RET = DBGet( "SELECT ATTENDANCE_TEACHER_CODE,ATTENDANCE_CODE,ATTENDANCE_REASON,STUDENT_ID,ADMIN,COURSE_PERIOD_ID FROM ATTENDANCE_PERIOD WHERE SCHOOL_DATE='".$date."'",array(),array('STUDENT_ID','COURSE_PERIOD_ID'));
if ( $_REQUEST['attendance'] && $_POST['attendance'] && AllowEdit())
{
foreach ( (array) $_REQUEST['attendance'] as $student_id => $values)
......@@ -30,7 +30,7 @@ if ( $_REQUEST['attendance'] && $_POST['attendance'] && AllowEdit())
}
else
{
$period_id = DBGet(DBQuery("SELECT PERIOD_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='".$period."'"));
$period_id = DBGet( "SELECT PERIOD_ID FROM COURSE_PERIODS WHERE COURSE_PERIOD_ID='".$period."'" );
$period_id = $period_id[1]['PERIOD_ID'];
$sql = "INSERT INTO ATTENDANCE_PERIOD ";
......@@ -56,14 +56,14 @@ if ( $_REQUEST['attendance'] && $_POST['attendance'] && AllowEdit())
}
UpdateAttendanceDaily($student_id,$date);
}
$current_RET = DBGet(DBQuery("SELECT ATTENDANCE_TEACHER_CODE,ATTENDANCE_CODE,ATTENDANCE_REASON,STUDENT_ID,ADMIN,COURSE_PERIOD_ID FROM ATTENDANCE_PERIOD WHERE SCHOOL_DATE='".$date."'"),array(),array('STUDENT_ID','COURSE_PERIOD_ID'));
$current_RET = DBGet( "SELECT ATTENDANCE_TEACHER_CODE,ATTENDANCE_CODE,ATTENDANCE_REASON,STUDENT_ID,ADMIN,COURSE_PERIOD_ID FROM ATTENDANCE_PERIOD WHERE SCHOOL_DATE='".$date."'",array(),array('STUDENT_ID','COURSE_PERIOD_ID'));
// Unset attendance & redirect URL.
RedirectURL( 'attendance' );
}
$codes_RET = DBGet(DBQuery("SELECT ID,SHORT_NAME,TITLE FROM ATTENDANCE_CODES WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."'"));
$periods_RET = DBGet(DBQuery("SELECT PERIOD_ID,SHORT_NAME,TITLE FROM SCHOOL_PERIODS WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER"));
$codes_RET = DBGet( "SELECT ID,SHORT_NAME,TITLE FROM ATTENDANCE_CODES WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."'" );
$periods_RET = DBGet( "SELECT PERIOD_ID,SHORT_NAME,TITLE FROM SCHOOL_PERIODS WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."' ORDER BY SORT_ORDER" );
if (isset($_REQUEST['student_id']) && $_REQUEST['student_id']!='new')
{
......@@ -71,17 +71,21 @@ if (isset($_REQUEST['student_id']) && $_REQUEST['student_id']!='new')
SetUserStudentID($_REQUEST['student_id']);
$functions = array('ATTENDANCE_CODE' => '_makeCodePulldown','ATTENDANCE_TEACHER_CODE' => '_makeCode','ATTENDANCE_REASON' => '_makeReasonInput');
$schedule_RET = DBGet(DBQuery("SELECT
s.STUDENT_ID,c.TITLE AS COURSE,cp.PERIOD_ID,cp.COURSE_PERIOD_ID,p.TITLE AS PERIOD_TITLE,
'' AS ATTENDANCE_CODE,'' AS ATTENDANCE_TEACHER_CODE,'' AS ATTENDANCE_REASON
FROM
SCHEDULE s,COURSES c,COURSE_PERIODS cp,SCHOOL_PERIODS p
WHERE
s.SYEAR='".UserSyear()."' AND s.SCHOOL_ID='".UserSchool()."' AND s.MARKING_PERIOD_ID IN (".GetAllMP('QTR',GetCurrentMP('QTR',$date)).")
AND s.COURSE_ID=c.COURSE_ID
AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND cp.PERIOD_ID=p.PERIOD_ID AND cp.DOES_ATTENDANCE='Y'
AND s.STUDENT_ID='".$_REQUEST['student_id']."' AND ('".$date."' BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL)
ORDER BY p.SORT_ORDER"),$functions);
$schedule_RET = DBGet( "SELECT s.STUDENT_ID,c.TITLE AS COURSE,cp.PERIOD_ID,cp.COURSE_PERIOD_ID,
p.TITLE AS PERIOD_TITLE,'' AS ATTENDANCE_CODE,'' AS ATTENDANCE_TEACHER_CODE,'' AS ATTENDANCE_REASON
FROM SCHEDULE s,COURSES c,COURSE_PERIODS cp,SCHOOL_PERIODS p
WHERE s.SYEAR='".UserSyear()."'
AND s.SCHOOL_ID='".UserSchool()."'
AND s.MARKING_PERIOD_ID IN (".GetAllMP('QTR',GetCurrentMP('QTR',$date)).")
AND s.COURSE_ID=c.COURSE_ID
AND s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID
AND cp.PERIOD_ID=p.PERIOD_ID
AND cp.DOES_ATTENDANCE='Y'
AND s.STUDENT_ID='".$_REQUEST['student_id']."'
AND ('".$date."' BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL)
ORDER BY p.SORT_ORDER",$functions);
$columns = array('PERIOD_TITLE' => _('Period'),'COURSE' => _('Course'),'ATTENDANCE_CODE' => _('Attendance Code'),'ATTENDANCE_TEACHER_CODE' => _('Teacher\'s Entry'),'ATTENDANCE_REASON' => _('Comments'));
echo '<form action="Modules.php?modname='.$_REQUEST['modname'].'&modfunc=student&student_id='.$_REQUEST['student_id'].'" method="POST">';
DrawHeader(ProgramTitle(),'<input type="submit" value="'._('Update').'" />');
......@@ -124,7 +128,7 @@ else
}
elseif ( $abs)
{
$RET = DBGet(DBQuery("SELECT ID FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL)"));
$RET = DBGet( "SELECT ID FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL)" );
if (count($RET))
{
$extra['WHERE'] .= "AND ac.ID IN (";
......@@ -187,7 +191,7 @@ function _makeCodePulldown($value,$title)
if ( !isset($current_schedule_RET[$THIS_RET['STUDENT_ID']]) || !is_array($current_schedule_RET[$THIS_RET['STUDENT_ID']]))
{
$current_schedule_RET[$THIS_RET['STUDENT_ID']] = DBGet(DBQuery("SELECT cp.PERIOD_ID,cp.COURSE_PERIOD_ID
$current_schedule_RET[$THIS_RET['STUDENT_ID']] = DBGet( "SELECT cp.PERIOD_ID,cp.COURSE_PERIOD_ID
FROM SCHEDULE s,COURSE_PERIODS cp
WHERE s.STUDENT_ID='".$THIS_RET['STUDENT_ID']."'
AND s.SYEAR='".UserSyear()."'
......@@ -195,7 +199,7 @@ function _makeCodePulldown($value,$title)
AND cp.COURSE_PERIOD_ID = s.COURSE_PERIOD_ID
AND cp.DOES_ATTENDANCE='Y'
AND s.MARKING_PERIOD_ID IN (".GetAllMP('QTR',GetCurrentMP('QTR',$date)).")
AND ('".$date."' BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL)"),array(),array('PERIOD_ID'));
AND ('".$date."' BETWEEN s.START_DATE AND s.END_DATE OR s.END_DATE IS NULL)",array(),array('PERIOD_ID'));
if ( ! $current_schedule_RET[$THIS_RET['STUDENT_ID']])
$current_schedule_RET[$THIS_RET['STUDENT_ID']] = array();
}
......@@ -264,7 +268,7 @@ function _makeCodeSearch($value='')
function _makeStateValue($value,$name)
{ global $THIS_RET,$date;
$value = DBGet(DBQuery("SELECT STATE_VALUE FROM ATTENDANCE_DAY WHERE STUDENT_ID='".$THIS_RET['STUDENT_ID']."' AND SCHOOL_DATE='".$date."'"));
$value = DBGet( "SELECT STATE_VALUE FROM ATTENDANCE_DAY WHERE STUDENT_ID='".$THIS_RET['STUDENT_ID']."' AND SCHOOL_DATE='".$date."'" );
$value = $value[1]['STATE_VALUE'];
if ( $value=='0.0')
......
......@@ -125,7 +125,7 @@ if ( ! $_REQUEST['modfunc'] )
}
$tabs = array(array('title' => _('Attendance'),'link' => 'Modules.php?modname='.$_REQUEST['modname'].'&table=0'));
$categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'"));
$categories_RET = DBGet( "SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."'" );
foreach ( (array) $categories_RET as $category)
$tabs[] = array('title' => $category['TITLE'],'link' => 'Modules.php?modname='.$_REQUEST['modname'].'&table='.$category['ID']);
......
......@@ -114,7 +114,7 @@ if ( $_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || User('PROFILE')==
if ( User( 'PROFILE' ) === 'admin' )
{
//FJ multiple school periods for a course period
//$periods_RET = DBGet(DBQuery("SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp WHERE sp.SYEAR='".UserSyear()."' AND sp.SCHOOL_ID='".UserSchool()."' AND (SELECT count(1) FROM COURSE_PERIODS WHERE position(',0,' IN DOES_ATTENDANCE)>0 AND PERIOD_ID=sp.PERIOD_ID AND SYEAR=sp.SYEAR AND SCHOOL_ID=sp.SCHOOL_ID)>0 ORDER BY sp.SORT_ORDER"));
//$periods_RET = DBGet( "SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp WHERE sp.SYEAR='".UserSyear()."' AND sp.SCHOOL_ID='".UserSchool()."' AND (SELECT count(1) FROM COURSE_PERIODS WHERE position(',0,' IN DOES_ATTENDANCE)>0 AND PERIOD_ID=sp.PERIOD_ID AND SYEAR=sp.SYEAR AND SCHOOL_ID=sp.SCHOOL_ID)>0 ORDER BY sp.SORT_ORDER" );
$periods_RET = DBGet( "SELECT sp.PERIOD_ID,sp.TITLE
FROM SCHOOL_PERIODS sp
WHERE sp.SYEAR='" . UserSyear() . "'
......@@ -132,7 +132,7 @@ if ( $_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || User('PROFILE')==
else
{
//FJ multiple school periods for a course period
//$periods_RET = DBGet(DBQuery("SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp,COURSE_PERIODS cp WHERE position(',0,' IN cp.DOES_ATTENDANCE)>0 AND sp.PERIOD_ID=cp.PERIOD_ID AND cp.COURSE_PERIOD_ID='".UserCoursePeriod()."'"));
//$periods_RET = DBGet( "SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp,COURSE_PERIODS cp WHERE position(',0,' IN cp.DOES_ATTENDANCE)>0 AND sp.PERIOD_ID=cp.PERIOD_ID AND cp.COURSE_PERIOD_ID='".UserCoursePeriod()."'" );
$periods_RET = DBGet( "SELECT sp.PERIOD_ID,sp.TITLE
FROM SCHOOL_PERIODS sp,COURSE_PERIODS cp, COURSE_PERIOD_SCHOOL_PERIODS cpsp
WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID
......
......@@ -17,7 +17,7 @@ if (Prompt(_('Confirm'),_('When do you want to recalculate the daily attendance?
flush();
set_time_limit(0);
$current_RET = DBGet(DBQuery("SELECT DISTINCT SCHOOL_DATE FROM ATTENDANCE_CALENDAR WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."'"),array(),array('SCHOOL_DATE'));
$current_RET = DBGet( "SELECT DISTINCT SCHOOL_DATE FROM ATTENDANCE_CALENDAR WHERE SCHOOL_ID='".UserSchool()."' AND SYEAR='".UserSyear()."'",array(),array('SCHOOL_DATE'));
$students_RET = GetStuList();
$begin = mktime(0,0,0,MonthNWswitch ( $_REQUEST['month_min'],'to_num'),$_REQUEST['day_min']*1,$_REQUEST['year_min']) + 43200;
......
......@@ -79,7 +79,7 @@ if ( ! $_REQUEST['modfunc'] )
{
$cal_days = 1;
$student_days_absent = DBGet(DBQuery("SELECT ad.SCHOOL_DATE,ssm.GRADE_ID,COALESCE(sum(ad.STATE_VALUE-1)*-1,0) AS STATE_VALUE
$student_days_absent = DBGet( "SELECT ad.SCHOOL_DATE,ssm.GRADE_ID,COALESCE(sum(ad.STATE_VALUE-1)*-1,0) AS STATE_VALUE
FROM ATTENDANCE_DAY ad,STUDENT_ENROLLMENT ssm,STUDENTS s".$extra['FROM']."
WHERE s.STUDENT_ID=ssm.STUDENT_ID
AND ad.STUDENT_ID=ssm.STUDENT_ID
......@@ -88,9 +88,9 @@ if ( ! $_REQUEST['modfunc'] )
AND ad.SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."'
AND (ad.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND ssm.START_DATE <= ad.SCHOOL_DATE))
".$extra['WHERE']."
GROUP BY ad.SCHOOL_DATE,ssm.GRADE_ID"),array(''),array('SCHOOL_DATE','GRADE_ID'));
GROUP BY ad.SCHOOL_DATE,ssm.GRADE_ID",array(''),array('SCHOOL_DATE','GRADE_ID'));
//FJ ORDER BY Date
$student_days_possible = DBGet(DBQuery("SELECT ac.SCHOOL_DATE,ssm.GRADE_ID,'' AS DAYS_POSSIBLE,count(*) AS ATTENDANCE_POSSIBLE,count(*) AS STUDENTS,'' AS PRESENT,'' AS ABSENT,'' AS ADA,'' AS AVERAGE_ATTENDANCE,'' AS AVERAGE_ABSENT
$student_days_possible = DBGet( "SELECT ac.SCHOOL_DATE,ssm.GRADE_ID,'' AS DAYS_POSSIBLE,count(*) AS ATTENDANCE_POSSIBLE,count(*) AS STUDENTS,'' AS PRESENT,'' AS ABSENT,'' AS ADA,'' AS AVERAGE_ATTENDANCE,'' AS AVERAGE_ABSENT
FROM STUDENT_ENROLLMENT ssm,ATTENDANCE_CALENDAR ac,STUDENTS s".$extra['FROM']."
WHERE s.STUDENT_ID=ssm.STUDENT_ID
AND ssm.SYEAR='".UserSyear()."'
......@@ -102,7 +102,7 @@ if ( ! $_REQUEST['modfunc'] )
AND '".$end_date."'
".$extra['WHERE']."
GROUP BY ac.SCHOOL_DATE,ssm.GRADE_ID
ORDER BY ac.SCHOOL_DATE"),
ORDER BY ac.SCHOOL_DATE",
array('SCHOOL_DATE' => 'ProperDate','GRADE_ID' => 'GetGrade','STUDENTS' => '_makeByDay','PRESENT' => '_makeByDay','ABSENT' => '_makeByDay','ADA' => '_makeByDay','AVERAGE_ATTENDANCE' => '_makeByDay','AVERAGE_ABSENT' => '_makeByDay','DAYS_POSSIBLE' => '_makeByDay'));
$columns = array('SCHOOL_DATE' => _('Date'),'GRADE_ID' => _('Grade Level'),'STUDENTS' => _('Students'),'DAYS_POSSIBLE' => _('Days Possible'),'PRESENT' => _('Present'),'ABSENT' => _('Absent'),'ADA' => _('ADA'),'AVERAGE_ATTENDANCE' => _('Average Attendance'),'AVERAGE_ABSENT' => _('Average Absent'));
......@@ -111,12 +111,12 @@ if ( ! $_REQUEST['modfunc'] )
}
else
{
$cal_days = DBGet(DBQuery("SELECT count(*) AS COUNT,CALENDAR_ID FROM ATTENDANCE_CALENDAR WHERE ".($_REQUEST['_search_all_schools']!='Y'?"SCHOOL_ID='".UserSchool()."' AND ":'')." SYEAR='".UserSyear()."' AND SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."' GROUP BY CALENDAR_ID"),array(),array('CALENDAR_ID'));
$calendars_RET = DBGet(DBQuery("SELECT CALENDAR_ID,TITLE FROM ATTENDANCE_CALENDARS WHERE SYEAR='".UserSyear()."' ".($_REQUEST['_search_all_schools']!='Y'?" AND SCHOOL_ID='".UserSchool()."'":'')),array(),array('CALENDAR_ID'));
$cal_days = DBGet( "SELECT count(*) AS COUNT,CALENDAR_ID FROM ATTENDANCE_CALENDAR WHERE ".($_REQUEST['_search_all_schools']!='Y'?"SCHOOL_ID='".UserSchool()."' AND ":'')." SYEAR='".UserSyear()."' AND SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."' GROUP BY CALENDAR_ID",array(),array('CALENDAR_ID'));
$calendars_RET = DBGet( "SELECT CALENDAR_ID,TITLE FROM ATTENDANCE_CALENDARS WHERE SYEAR='".UserSyear()."' ".($_REQUEST['_search_all_schools']!='Y'?" AND SCHOOL_ID='".UserSchool()."'":''),array(),array('CALENDAR_ID'));
$extra['WHERE'] .= " GROUP BY ssm.GRADE_ID,ssm.CALENDAR_ID";
$student_days_absent = DBGet(DBQuery("SELECT ssm.GRADE_ID,ssm.CALENDAR_ID,COALESCE(sum(ad.STATE_VALUE-1)*-1,0) AS STATE_VALUE
$student_days_absent = DBGet( "SELECT ssm.GRADE_ID,ssm.CALENDAR_ID,COALESCE(sum(ad.STATE_VALUE-1)*-1,0) AS STATE_VALUE
FROM ATTENDANCE_DAY ad,STUDENT_ENROLLMENT ssm,STUDENTS s".$extra['FROM']."
WHERE s.STUDENT_ID=ssm.STUDENT_ID
AND ad.STUDENT_ID=ssm.STUDENT_ID
......@@ -124,8 +124,8 @@ if ( ! $_REQUEST['modfunc'] )
AND ad.SYEAR=ssm.SYEAR
AND ad.SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."'
AND (ad.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND ssm.START_DATE <= ad.SCHOOL_DATE))
".$extra['WHERE']),array(''),array('GRADE_ID','CALENDAR_ID'));
$student_days_possible = DBGet(DBQuery("SELECT ssm.GRADE_ID,ssm.CALENDAR_ID,'' AS DAYS_POSSIBLE,count(*) AS ATTENDANCE_POSSIBLE,count(*) AS STUDENTS,'' AS PRESENT,'' AS ABSENT,'' AS ADA,'' AS AVERAGE_ATTENDANCE,'' AS AVERAGE_ABSENT
".$extra['WHERE'],array(''),array('GRADE_ID','CALENDAR_ID'));
$student_days_possible = DBGet( "SELECT ssm.GRADE_ID,ssm.CALENDAR_ID,'' AS DAYS_POSSIBLE,count(*) AS ATTENDANCE_POSSIBLE,count(*) AS STUDENTS,'' AS PRESENT,'' AS ABSENT,'' AS ADA,'' AS AVERAGE_ATTENDANCE,'' AS AVERAGE_ABSENT
FROM STUDENT_ENROLLMENT ssm,ATTENDANCE_CALENDAR ac,STUDENTS s".$extra['FROM']."
WHERE s.STUDENT_ID=ssm.STUDENT_ID
AND ssm.SYEAR='".UserSyear()."'
......@@ -135,7 +135,7 @@ if ( ! $_REQUEST['modfunc'] )
AND (ac.SCHOOL_DATE BETWEEN ssm.START_DATE AND ssm.END_DATE OR (ssm.END_DATE IS NULL AND ssm.START_DATE <= ac.SCHOOL_DATE))
AND ac.SCHOOL_DATE BETWEEN '".$start_date."'
AND '".$end_date."'
".$extra['WHERE']),
".$extra['WHERE'],
array('GRADE_ID' => '_make','STUDENTS' => '_make','PRESENT' => '_make','ABSENT' => '_make','ADA' => '_make','AVERAGE_ATTENDANCE' => '_make','AVERAGE_ABSENT' => '_make','DAYS_POSSIBLE' => '_make'));
$columns = array('GRADE_ID' => _('Grade Level'),'STUDENTS' => _('Students'),'DAYS_POSSIBLE' => _('Days Possible'),'PRESENT' => _('Present'),'ABSENT' => _('Absent'),'ADA' => _('ADA'),'AVERAGE_ATTENDANCE' => _('Average Attendance'),'AVERAGE_ABSENT' => _('Average Absent'));
......
......@@ -46,8 +46,8 @@ if ( $_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || User('PROFILE')==
if ( !UserStudentID() && ! $_REQUEST['student_id'])
{
//FJ multiple school periods for a course period
//$periods_RET = DBGet(DBQuery("SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp WHERE sp.SYEAR='".UserSyear()."' AND sp.SCHOOL_ID='".UserSchool()."' AND EXISTS(SELECT '' FROM COURSE_PERIODS cp WHERE cp.PERIOD_ID=sp.PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0".(User('PROFILE')=='teacher'?" AND cp.PERIOD_ID='".UserPeriod()."'":'').") ORDER BY sp.SORT_ORDER"));
$periods_RET = DBGet(DBQuery("SELECT sp.PERIOD_ID,sp.TITLE
//$periods_RET = DBGet( "SELECT sp.PERIOD_ID,sp.TITLE FROM SCHOOL_PERIODS sp WHERE sp.SYEAR='".UserSyear()."' AND sp.SCHOOL_ID='".UserSchool()."' AND EXISTS(SELECT '' FROM COURSE_PERIODS cp WHERE cp.PERIOD_ID=sp.PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0".(User('PROFILE')=='teacher'?" AND cp.PERIOD_ID='".UserPeriod()."'":'').") ORDER BY sp.SORT_ORDER" );
$periods_RET = DBGet( "SELECT sp.PERIOD_ID,sp.TITLE
FROM SCHOOL_PERIODS sp
WHERE sp.SYEAR='".UserSyear()."'
AND sp.SCHOOL_ID='".UserSchool()."'
......@@ -58,7 +58,7 @@ if ( $_REQUEST['search_modfunc'] || $_REQUEST['student_id'] || User('PROFILE')==
AND cpsp.PERIOD_ID=sp.PERIOD_ID
AND position(',0,' IN cp.DOES_ATTENDANCE)>0
".(User('PROFILE')=='teacher'?" AND cp.COURSE_PERIOD_ID IN (SELECT COURSE_PERIOD_ID FROM COURSE_PERIOD_SCHOOL_PERIODS WHERE COURSE_PERIOD_SCHOOL_PERIODS_ID='".UserCoursePeriodSchoolPeriod()."')":'').")
ORDER BY sp.SORT_ORDER"));
ORDER BY sp.SORT_ORDER" );
$period_select = '<select name="period_id" onchange="ajaxPostForm(this.form,true);"><option value="">'._('Daily').'</option>';
if (count($periods_RET))
......@@ -124,7 +124,7 @@ if ( ! empty( $_REQUEST['period_id'] ) )
AND ap.SCHOOL_DATE BETWEEN '".$start_date."' AND '".$end_date."' AND ac.SYEAR=ssm.SYEAR) AS STATE_ABS";
$extra['columns_after']['STATE_ABS'] = _('State Abs');
$codes_RET = DBGet(DBQuery("SELECT ID,TITLE FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND TABLE_NAME='0' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL)"));
$codes_RET = DBGet( "SELECT ID,TITLE FROM ATTENDANCE_CODES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' AND TABLE_NAME='0' AND (DEFAULT_CODE!='Y' OR DEFAULT_CODE IS NULL)" );
if (count($codes_RET)>1)
{
......@@ -200,7 +200,7 @@ if ( UserStudentID() )
}
//FJ multiple school periods for a course period
//$periods_RET = DBGet(DBQuery("SELECT sp.PERIOD_ID,sp.SHORT_NAME FROM SCHOOL_PERIODS sp,SCHEDULE s,COURSE_PERIODS cp WHERE sp.SCHOOL_ID='".UserSchool()."' AND sp.SYEAR='".UserSyear()."' AND s.STUDENT_ID='".UserStudentID()."' AND cp.COURSE_PERIOD_ID=s.COURSE_PERIOD_ID AND cp.PERIOD_ID=sp.PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0 ORDER BY sp.SORT_ORDER"));
//$periods_RET = DBGet( "SELECT sp.PERIOD_ID,sp.SHORT_NAME FROM SCHOOL_PERIODS sp,SCHEDULE s,COURSE_PERIODS cp WHERE sp.SCHOOL_ID='".UserSchool()."' AND sp.SYEAR='".UserSyear()."' AND s.STUDENT_ID='".UserStudentID()."' AND cp.COURSE_PERIOD_ID=s.COURSE_PERIOD_ID AND cp.PERIOD_ID=sp.PERIOD_ID AND position(',0,' IN cp.DOES_ATTENDANCE)>0 ORDER BY sp.SORT_ORDER" );
$periods_RET = DBGet( "SELECT sp.PERIOD_ID,sp.SHORT_NAME
FROM SCHOOL_PERIODS sp,SCHEDULE s,COURSE_PERIODS cp,COURSE_PERIOD_SCHOOL_PERIODS cpsp
WHERE cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID
......
......@@ -23,7 +23,7 @@ else
}
DrawHeader(ProgramTitle());
$categories_RET = DBGet(DBQuery("SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' ORDER BY SORT_ORDER,TITLE"));
$categories_RET = DBGet( "SELECT ID,TITLE FROM ATTENDANCE_CODE_CATEGORIES WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' ORDER BY SORT_ORDER,TITLE" );
if ( $_REQUEST['table']=='')
$_REQUEST['table'] = '0';
$category_select = "<select name=table onChange='ajaxPostForm(this.form,true);'><option value='0'".($_REQUEST['table']=='0'?' selected':'').">"._('Attendance')."</option>";
......
......@@ -86,7 +86,7 @@ function UpdateAttendanceDaily( $student_id, $date = '', $comment = false )
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."'"));
$current_RET = DBGet( "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 || $current_RET[1]['STATE_VALUE']!=$length))
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)
......
<?php
//FJ multiple school periods for a course period
/*$requests_RET = DBGet(DBQuery("SELECT r.COURSE_ID AS CRS,
/*$requests_RET = DBGet( "SELECT r.COURSE_ID AS CRS,
r.COURSE_ID,cp.COURSE_PERIOD_ID,
c.TITLE AS COURSE_TITLE,cp.PERIOD_ID,
(cp.TOTAL_SEATS-cp.FILLED_SEATS) AS OPEN_SEATS,s.STUDENT_ID AS SCHEDULED
FROM SCHEDULE_REQUESTS r,
COURSES c,SCHOOL_PERIODS sp,
COURSE_PERIODS cp LEFT OUTER JOIN SCHEDULE s ON
COURSE_PERIODS cp LEFT OUTER JOIN SCHEDULE s ON
(s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='".UserStudentID()."')
WHERE
WHERE
r.SYEAR='".UserSyear()."' AND r.SCHOOL_ID='".UserSchool()."'
AND r.COURSE_ID=cp.COURSE_ID AND c.COURSE_ID=cp.COURSE_ID
AND r.STUDENT_ID='".UserStudentID()."'
AND sp.PERIOD_ID=cp.PERIOD_ID
ORDER BY ".db_case(array('s.STUDENT_ID',"''","NULL",'sp.SORT_ORDER'))."
"),array(),array('CRS','PERIOD_ID'));*/
$requests_RET = DBGet(DBQuery("SELECT r.COURSE_ID AS CRS,
",array(),array('CRS','PERIOD_ID'));*/
$requests_RET = DBGet( "SELECT r.COURSE_ID AS CRS,
r.COURSE_ID,cp.COURSE_PERIOD_ID,
c.TITLE AS COURSE_TITLE,cp.PERIOD_ID,
(cp.TOTAL_SEATS-cp.FILLED_SEATS) AS OPEN_SEATS,s.STUDENT_ID AS SCHEDULED
FROM SCHEDULE_REQUESTS r,
COURSES c,SCHOOL_PERIODS sp, COURSE_PERIOD_SCHOOL_PERIODS cpsp,
COURSE_PERIODS cp LEFT OUTER JOIN SCHEDULE s ON
COURSE_PERIODS cp LEFT OUTER JOIN SCHEDULE s ON
(s.COURSE_PERIOD_ID=cp.COURSE_PERIOD_ID AND s.STUDENT_ID='".UserStudentID()."')
WHERE
WHERE
cp.COURSE_PERIOD_ID=cpsp.COURSE_PERIOD_ID AND
r.SYEAR='".UserSyear()."' AND r.SCHOOL_ID='".UserSchool()."'
AND r.COURSE_ID=cp.COURSE_ID AND c.COURSE_ID=cp.COURSE_ID
AND r.STUDENT_ID='".UserStudentID()."'
AND sp.PERIOD_ID=cpsp.PERIOD_ID
ORDER BY ".db_case(array('s.STUDENT_ID',"''","NULL",'sp.SORT_ORDER'))."
"),array(),array('CRS','PERIOD_ID'));
",array(),array('CRS','PERIOD_ID'));
$periods_RET = DBGet(DBQuery("SELECT PERIOD_ID,SHORT_NAME FROM SCHOOL_PERIODS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' ORDER BY SORT_ORDER"));
$periods_RET = DBGet( "SELECT PERIOD_ID,SHORT_NAME FROM SCHOOL_PERIODS WHERE SYEAR='".UserSyear()."' AND SCHOOL_ID='".UserSchool()."' ORDER BY SORT_ORDER" );
echo '<table class="center" style="border: 1px solid;">';
echo '<tr><td></td>';
foreach ( (array) $periods_RET as $period)
......@@ -55,7 +55,7 @@
$color = 'CCCCCC';
echo '<td style="height:10px; width:6px; background-color:#'.$color.';"></td>';
}
echo '</tr>';
}
echo '</table>';
......@@ -23,7 +23,7 @@ if ( $_REQUEST['values']
// New: check for Title.
elseif ( $columns['TITLE'] )
{
$id = DBGet(DBQuery("SELECT ".db_seq_nextval('DISCIPLINE_FIELDS_SEQ').' AS ID'));
$id = DBGet( "SELECT ".db_seq_nextval('DISCIPLINE_FIELDS_SEQ').' AS ID' );
$id = $id[1]['ID'];
$sql = "INSERT INTO DISCIPLINE_FIELDS ";
......
......@@ -63,7 +63,7 @@ if ( isset( $_POST['values'] )