Commit 00c33cac authored by François Jacquet's avatar François Jacquet
Browse files

Fix PHP notices

Format PHP code
parent fd868e34
......@@ -142,13 +142,13 @@ function ListOutput( $result, $column_names, $singular = '.', $plural = '.', $li
//$_LIST['output'] = true;
$display_zero = false;
// PRINT HEADINGS, PREPARE PDF, AND SORT THE LIST ---.
if ( $result_count != 0 )
{
$count = 0;
$display_zero = false;
if ( isset( $link['remove']['variables'] ) )
{
$remove = count( $link['remove']['variables'] );
......
......@@ -2,12 +2,15 @@
//FJ move Attendance.php from functions/ to modules/Attendance/includes
require_once 'modules/Attendance/includes/UpdateAttendanceDaily.fnc.php';
$_REQUEST['table'] = issetVal( $_REQUEST['table'] );
$_REQUEST['expanded_view'] = issetVal( $_REQUEST['expanded_view'], '' );
DrawHeader( ProgramTitle() );
// Set date.
$date = RequestedDate( 'date', DBDate(), 'set' );
if ( $_SESSION['Administration.php']['date']
if ( ! empty( $_SESSION['Administration.php']['date'] )
&& $_SESSION['Administration.php']['date'] !== $date )
{
// Unset attendance & attendance day & redirect URL.
......@@ -98,17 +101,17 @@ else
// TODO: can be optimized? Remove PERIOD_ID index.
$current_RET = DBGet( $current_Q, array(), array( 'STUDENT_ID', 'PERIOD_ID' ) );
if ( $_REQUEST['attendance']
if ( ! empty( $_REQUEST['attendance'] )
&& $_POST['attendance']
&& AllowEdit() )
{
foreach ( (array) $_REQUEST['attendance'] as $student_id => $values )
{
if ( ! $current_schedule_RET[$student_id] )
if ( empty( $current_schedule_RET[$student_id] ) )
{
$current_schedule_RET[$student_id] = DBGet( str_replace( '__student_id__', $student_id, $current_schedule_Q ), array(), array( 'PERIOD_ID' ) );
if ( ! $current_schedule_RET[$student_id] )
if ( empty( $current_schedule_RET[$student_id] ) )
{
$current_schedule_RET[$student_id] = true;
}
......@@ -211,7 +214,12 @@ 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" );
$categories_RET = DBGet( "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() . "'" );
$headerl = '';
if ( ! empty( $categories_RET ) )
{
......@@ -304,6 +312,8 @@ if ( isset( $_REQUEST['student_id'] ) && $_REQUEST['student_id'] !== 'new' )
}
else
{
$extra2['WHERE'] = '';
if ( $_REQUEST['expanded_view'] != 'true' )
{
$extra['WHERE'] = $extra2['WHERE'] = " AND EXISTS (SELECT '' FROM " . DBEscapeIdentifier( $table ) . " ap,ATTENDANCE_CODES ac
......@@ -323,6 +333,8 @@ else
AND ac.SYEAR=ssm.SYEAR " . str_replace( 'TABLE_NAME', 'ac.TABLE_NAME', $extra_sql );
}
$abs = false;
if ( ! empty( $_REQUEST['codes'] ) )
{
$REQ_codes = $_REQUEST['codes'];
......@@ -393,11 +405,16 @@ else
if ( $_REQUEST['expanded_view'] != 'true' && ! isset( $_REQUEST['_ROSARIO_PDF'] ) )
{
$extra2['WHERE'] .= ')';
$extra2['SELECT_ONLY'] = 'ssm.STUDENT_ID,p.PERSON_ID,p.FIRST_NAME,p.LAST_NAME,p.MIDDLE_NAME,
sjp.STUDENT_RELATION,pjc.TITLE,pjc.VALUE,a.PHONE,sjp.ADDRESS_ID ';
$extra2['FROM'] .= ',ADDRESS a,STUDENTS_JOIN_ADDRESS sja LEFT OUTER JOIN STUDENTS_JOIN_PEOPLE sjp ON (sja.STUDENT_ID=sjp.STUDENT_ID AND sja.ADDRESS_ID=sjp.ADDRESS_ID AND (sjp.CUSTODY=\'Y\' OR sjp.EMERGENCY=\'Y\')) LEFT OUTER JOIN PEOPLE p ON (p.PERSON_ID=sjp.PERSON_ID) LEFT OUTER JOIN PEOPLE_JOIN_CONTACTS pjc ON (pjc.PERSON_ID=p.PERSON_ID) ';
$extra2['FROM'] = ',ADDRESS a,STUDENTS_JOIN_ADDRESS sja LEFT OUTER JOIN STUDENTS_JOIN_PEOPLE sjp ON (sja.STUDENT_ID=sjp.STUDENT_ID AND sja.ADDRESS_ID=sjp.ADDRESS_ID AND (sjp.CUSTODY=\'Y\' OR sjp.EMERGENCY=\'Y\')) LEFT OUTER JOIN PEOPLE p ON (p.PERSON_ID=sjp.PERSON_ID) LEFT OUTER JOIN PEOPLE_JOIN_CONTACTS pjc ON (pjc.PERSON_ID=p.PERSON_ID) ';
$extra2['WHERE'] .= ' AND a.ADDRESS_ID=sja.ADDRESS_ID AND sja.STUDENT_ID=ssm.STUDENT_ID ';
$extra2['ORDER_BY'] .= 'COALESCE(sjp.CUSTODY,\'N\') DESC';
$extra2['ORDER_BY'] = 'COALESCE(sjp.CUSTODY,\'N\') DESC';
$extra2['group'] = array( 'STUDENT_ID', 'PERSON_ID' );
$contacts_RET = GetStuList( $extra2 );
......@@ -405,7 +422,11 @@ else
}
$columns = array();
$extra['SELECT'] = issetVal( $extra['SELECT'], '' );
$extra['SELECT'] .= ',s.STUDENT_ID AS PHONE';
$extra['functions']['PHONE'] = 'makeContactInfo';
if ( $_REQUEST['table'] == '0' )
......@@ -414,7 +435,7 @@ else
$extra['SELECT'] .= ",(SELECT COMMENT FROM ATTENDANCE_DAY WHERE STUDENT_ID=ssm.STUDENT_ID AND SCHOOL_DATE='" . $date . "') AS DAILY_COMMENT";
$extra['functions']['STATE_VALUE'] = '_makeStateValue';
$extra['functions']['DAILY_COMMENT'] = '_makeStateValue';
//FJ add translation
$extra['columns_after']['STATE_VALUE'] = _( 'Present' );
$extra['columns_after']['DAILY_COMMENT'] = _( 'Day Comment' );
}
......@@ -433,8 +454,10 @@ else
$extra['columns_after']['PERIOD_' . $period['PERIOD_ID']] = $period['SHORT_NAME'];
}
if ( $REQ_codes )
if ( ! empty( $REQ_codes ) )
{
$code_pulldowns = '';
foreach ( (array) $REQ_codes as $code )
{
$code_pulldowns .= _makeCodeSearch( $code );
......@@ -458,6 +481,8 @@ else
SubmitButton( _( 'Update' ) )
);
$current_student_link = '';
if ( UserStudentID() )
{
$current_student_link = '<a href="' .
......@@ -526,7 +551,8 @@ function _makeCodePulldown( $value, $title )
}
}
$val = $current_RET[$value][$period_id][1]['ATTENDANCE_CODE'];
$val = isset( $current_RET[$value][$period_id][1]['ATTENDANCE_CODE'] ) ?
$current_RET[$value][$period_id][1]['ATTENDANCE_CODE'] : null;
return SelectInput( $val, 'attendance[' . $value . '][' . $period_id . '][ATTENDANCE_CODE]', '', $options );
}
......@@ -562,9 +588,14 @@ function _makeReasonInput( $value, $title )
{
global $THIS_RET, $codes_RET, $current_RET;
$val = $current_RET[$value][$THIS_RET['PERIOD_ID']][1]['ATTENDANCE_REASON'];
$val = isset( $current_RET[$value][$THIS_RET['PERIOD_ID']][1]['ATTENDANCE_REASON'] ) ?
$current_RET[$value][$THIS_RET['PERIOD_ID']][1]['ATTENDANCE_REASON'] : '';
return TextInput( $val, 'attendance[' . $value . '][' . $THIS_RET['PERIOD_ID'] . '][ATTENDANCE_REASON]', '', $options );
return TextInput(
$val,
'attendance[' . $value . '][' . $THIS_RET['PERIOD_ID'] . '][ATTENDANCE_REASON]',
''
);
}
/**
......
......@@ -2,11 +2,19 @@
require_once 'ProgramFunctions/TipMessage.fnc.php';
$_REQUEST['table'] = issetVal( $_REQUEST['table'] );
$_REQUEST['period'] = issetVal( $_REQUEST['period'] );
// Set date.
$date = RequestedDate( 'date', DBDate(), 'set' );
DrawHeader( ProgramTitle() );
$categories_RET = DBGet( "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'] == '' )
{
......@@ -120,6 +128,8 @@ $RET = DBGet( $sql, array(), array( 'STAFF_ID' ) );
if ( ! isset( $_REQUEST['period'] )
|| ! $_REQUEST['period'] )
{
$i = 0;
foreach ( (array) $RET as $staff_id => $periods )
{
$i++;
......
......@@ -8,7 +8,7 @@ if ( $_REQUEST['modfunc'] === 'save' )
{
if ( ! empty( $_REQUEST['student'] ) )
{
// FJ fix bug add the same activity more than once
// Fix bug add the same activity more than once.
// $current_RET = DBGet( "SELECT STUDENT_ID FROM STUDENT_ELIGIBILITY_ACTIVITIES WHERE ACTIVITY_ID='".$_SESSION['activity_id']."' AND SYEAR='".UserSyear()."'",array(),array('STUDENT_ID'));
$current_RET = DBGet( "SELECT STUDENT_ID
FROM STUDENT_ELIGIBILITY_ACTIVITIES
......@@ -20,10 +20,10 @@ if ( $_REQUEST['modfunc'] === 'save' )
foreach ( (array) $_REQUEST['student'] as $student_id )
{
if ( ! $current_RET[$student_id] )
if ( empty( $current_RET[$student_id] ) )
{
$sql .= "INSERT INTO STUDENT_ELIGIBILITY_ACTIVITIES (SYEAR,STUDENT_ID,ACTIVITY_ID)
values('" . UserSyear() . "','" . $student_id . "','" . $_REQUEST['activity_id'] . "');";
VALUES('" . UserSyear() . "','" . $student_id . "','" . $_REQUEST['activity_id'] . "');";
}
}
......
......@@ -103,7 +103,7 @@ SelectInput( $END_DAY, 'values[END_DAY]', '', $day_options, false, '', false ) .
SelectInput( $END_HOUR, 'values[END_HOUR]', '', $hour_options, false, '', false ) . ' <b>:</b> ' .
SelectInput( $END_MINUTE, 'values[END_MINUTE]', '', $minute_options, false, '', false ) . ' ' .
SelectInput( $END_M, 'values[END_M]', '', $m_options, false, '', false ) . '</td></tr></table>';
echo '<div class="center">' . SubmitButton() . '</div>';
echo '<br /><div class="center">' . SubmitButton() . '</div>';
echo '</form>';
PopTable( 'footer' );
<?php
require_once 'ProgramFunctions/TipMessage.fnc.php';
$_REQUEST['period'] = issetVal( $_REQUEST['period'] );
DrawHeader( ProgramTitle() );
// GET ALL THE CONFIG ITEMS FOR ELIGIBILITY
......@@ -44,7 +46,7 @@ if ( empty( $_REQUEST['start_date'] ) )
$start_date = date( 'Y-m-d', $start_time );
$end_date = date( 'Y-m-d', DBDate() );
$end_date = date( 'Y-m-d' );
}
else
{
......@@ -72,7 +74,7 @@ foreach ( (array) $periods_RET as $period )
$period_select .= '</select>';
echo '<form action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="POST">';
echo '<form action="Modules.php?modname=' . $_REQUEST['modname'] . '" method="GET">';
$begin_year = DBGetOne( "SELECT min(date_part('epoch',SCHOOL_DATE)) AS SCHOOL_DATE
FROM ATTENDANCE_CALENDAR
......@@ -94,7 +96,7 @@ if ( $start
}
}
DrawHeader( _( 'Timeframe' ) . ': <select name="start_date">' . $date_select . '</select> - ' .
DrawHeader( _( 'Timeframe' ) . ': <select name="start_date">' . $date_select . '</select> &mdash; ' .
_( 'Period' ) . ': ' . $period_select . ' ' . SubmitButton( _( 'Go' ) ) );
echo '</form>';
......@@ -130,6 +132,8 @@ $RET = DBGet( $sql, array(), array( 'STAFF_ID', 'PERIOD_ID' ) );
$i = 0;
$staff_RET = array();
foreach ( (array) $RET as $staff_id => $periods )
{
$i++;
......
......@@ -288,6 +288,8 @@ else
|| ! empty( $_REQUEST['address_group'] ) )
&& count( (array) $students_RET ) == 1 ) )
{
$header_left = '';
if ( ! isset( $_REQUEST['_ROSARIO_PDF'] ) )
{
if ( ! isset( $_REQUEST['expanded_view'] ) || $_REQUEST['expanded_view'] !== 'true' )
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment