_( 'January' ),
2 => _( 'February' ),
3 => _( 'March' ),
4 => _( 'April' ),
5 => _( 'May' ),
6 => _( 'June' ),
7 => _( 'July' ),
8 => _( 'August' ),
9 => _( 'September' ),
10 => _( 'October' ),
11 => _( 'November' ),
12 => _( 'December' ),
);
// Check Social Security + Gender fields exists before adding them to SELECT.
$custom_RET = DBGet( "SELECT TITLE,ID
FROM CUSTOM_FIELDS
WHERE ID IN ('200000000','200000003')", array(), array( 'ID' ) );
$extra['SELECT'] = ",ssm.CALENDAR_ID,ssm.START_DATE,ssm.END_DATE";
foreach ( (array) $custom_RET as $id => $custom )
{
$extra['SELECT'] .= ",CUSTOM_" . $id;
}
// ACTIVE logic taken from GetStuList().
$active = "'" . DBEscapeString( _( 'Active' ) ) . "'";
$inactive = "'" . DBEscapeString( _( 'Inactive' ) ) . "'";
$extra['SELECT'] .= ',' . db_case( array(
"(ssm.SYEAR='" . UserSyear() . "' AND ('" . DBDate() . "'>=ssm.START_DATE AND ('" . DBDate() . "'<=ssm.END_DATE OR ssm.END_DATE IS NULL)))",
'TRUE',
$active,
$inactive,
) ) . ' AS STATUS';
$RET = GetStuList( $extra );
if ( empty( $RET ) )
{
BackPrompt( _( 'No Students were found.' ) );
}
// Change orientation to landscape.
$_SESSION['orientation'] = 'landscape';
$handle = PDFStart();
?>
=" . Config( 'ATTENDANCE_FULL_DAY_MINUTES' ) .
" THEN '1.0' ELSE '0.5' END AS POS,
trim(leading '0' from to_char(SCHOOL_DATE,'MM')) AS MON,
trim(leading '0' from to_char(SCHOOL_DATE,'DD')) AS DAY
FROM ATTENDANCE_CALENDAR
WHERE CALENDAR_ID='" . $student['CALENDAR_ID'] . "'
AND SCHOOL_DATE>='" . $student['START_DATE'] . "'" .
( $student['END_DATE'] ? " AND SCHOOL_DATE<='" . $student['END_DATE'] . "'" : '' ),
array(),
array( 'MON', 'DAY' ) );
$attendance_RET = DBGet( "SELECT
trim(leading '0' from to_char(ad.SCHOOL_DATE,'MM')) AS MON,
trim(leading '0' from to_char(ad.SCHOOL_DATE,'DD')) AS DAY,
ad.STATE_VALUE
FROM ATTENDANCE_DAY ad
WHERE ad.STUDENT_ID='" . $student['STUDENT_ID'] . "'
AND ad.SYEAR='" . UserSyear() . "'", array(), array( 'MON', 'DAY' ) );
//echo '
'; var_dump($calendar_RET); echo '
';
echo '' . $student['FULL_NAME'] . '
';
echo '
' . NoInput(
$student['FULL_NAME'],
_( 'Student Name' )
) . ' | ' . NoInput(
$student['STUDENT_ID'],
sprintf( _( '%s ID' ), Config( 'NAME' ) )
) . ' | ' . NoInput(
( SchoolInfo( 'SCHOOL_NUMBER' ) ? SchoolInfo( 'SCHOOL_NUMBER' ) : SchoolInfo( 'TITLE' ) ) .
' — ' . FormatSyear( UserSyear(), Config( 'SCHOOL_SYEAR_OVER_2_YEARS' ) ),
_( 'School' ) . ' — ' . _( 'Year' )
) . ' |
';
echo '
' . _( 'Demographics' ) . ' |
';
foreach ( (array) $custom_RET as $id => $custom )
{
echo '' . NoInput(
$student['CUSTOM_' . $id],
ParseMLField( $custom_RET[$id][1]['TITLE'] )
) . ' | ';
}
echo '
' . NoInput(
$student['STATUS'],
_( 'Status' )
) . ' | ' . NoInput(
$student['GRADE_ID'],
_( 'Grade Level' )
) . ' |
';
echo '
' . _( 'Attendance' ) . '
';
echo '' . _( 'Month' ) . ' | ';
for ( $day = 1; $day <= 31; $day++ )
{
echo '' . ( $day < 10 ? ' ' : '' ) . $day .
( $day < 10 ? ' ' : '' ) . ' | ';
}
echo '' . _( 'Absences' ) . ' |
' . _( 'Possible' ) . ' | ';
$abs_tot = $pos_tot = 0;
$FY_dates = DBGet( "SELECT START_DATE,END_DATE
FROM SCHOOL_MARKING_PERIODS
WHERE MP='FY'
AND SYEAR='" . UserSyear() . "'
AND SCHOOL_ID='" . UserSchool() . "'" );
$first_month = explode( '-', $FY_dates[1]['START_DATE'] );
$first_month = (int) $first_month[1];
$last_month = explode( '-', $FY_dates[1]['END_DATE'] );
$last_month = (int) $last_month[1];
//foreach ( array(7,8,9,10,11,12,1,2,3,4,5,6) as $month)
if ( $last_month > $first_month )
{
$last_month_tmp = $last_month;
}
else
{
$last_month_tmp = 12;
}
$attendance_codes_locale = array(
// Attendance codes.
'P' => _( 'Present' ),
'A' => _( 'Absent' ),
'H' => _( 'Half Day' ),
// Daily attendance.
'1.0' => _( 'Present' ),
'0.0' => _( 'Absent' ),
'0.5' => _( 'Half Day' ),
);
$attendance_code_classes = array(
// Attendance codes.
'P' => 'present',
'A' => 'absent',
'H' => 'half-day',
// Daily attendance.
'1.0' => 'present',
'0.0' => 'absent',
'0.5' => 'half-day',
);
for ( $month = $first_month; $month <= $last_month_tmp; $month++ )
{
if ( ! empty( $calendar_RET[$month] )
|| ! empty( $attendance_RET[$month] ) )
{
echo '' . $months[$month] . ' | ';
$abs = $pos = 0;
for ( $day = 1; $day <= 31; $day++ )
{
if ( ! empty( $calendar_RET[$month][$day] ) )
{
$calendar = $calendar_RET[$month][$day][1];
if ( ! empty( $attendance_RET[$month][$day] ) )
{
$attendance = $attendance_RET[$month][$day][1];
echo '' .
mb_substr( $attendance_codes_locale[ $attendance['STATE_VALUE'] ], 0, 1 ) . ' | ';
$abs += ( $attendance['STATE_VALUE'] == '0.0' ?
$calendar['POS'] :
( $attendance['STATE_VALUE'] == '0.5' ? $calendar['POS'] / 2 : 0 )
);
}
else
//green box
{
echo ' | ';
}
$pos += $calendar['POS'];
}
else
{
// Attendance record before attendance start date!
if ( ! empty( $attendance_RET[$month][$day] ) )
{
$attendance = $attendance_RET[$month][$day][1];
//red box
echo '' .
$attendance_codes_locale[ $attendance['STATE_VALUE'] ] . ' | ';
}
else
//pink box
{
echo ' | ';
}
}
}
echo '' . (float) number_format( $abs, 1 ) . ' |
' . (float) number_format( $pos, 1 ) . ' | ';
$abs_tot += $abs;
$pos_tot += $pos;
}
if ( $month == 12 && $last_month != 12 )
{
// School year over 2 calendar years, reset month to January.
$month = 0;
$last_month_tmp = $last_month;
}
}
echo '' .
_( 'Year to Date Totals' ) . ' | ';
echo '' . (float) number_format( $abs_tot, 1 ) . ' |
' . (float) number_format( $pos_tot, 1 ) . ' | ';
echo ' |
';
echo '';
}
PDFStop( $handle );
}
if ( ! $_REQUEST['modfunc'] )
{
DrawHeader( ProgramTitle() );
if ( $_REQUEST['search_modfunc'] === 'list' )
{
echo '';
}
}