#! /usr/bin/perl
# Copyright 2001-2020 Leslie Richardson
# This file is part of Open Admin for Schools.
# Open Admin for Schools is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2 of
# the License, or (at your option) any later version.
use DBI;
use CGI;
use Cwd;
use Number::Format qw(:all);
my %lex = ('Attendance Profiles' => 'Attendance Profiles',
'Attendance' => 'Attendance',
'Cannot open tex file' => 'Cannot open tex file',
'Enrollment' => 'Enrollment',
'Not Found' => 'Not Found',
'Periods Per Day' => 'Periods Per Day',
'Perfect Attendance' => 'Perfect Attendance',
'View/Download' => 'View/Download',
'View Log File' => 'View Log File',
'Total' => 'Total',
'Absent' => 'Absent',
'Late' => 'Late',
'Excused' => 'Excused',
'Unexcused' => 'Unexcused',
'times' => 'times',
'day(s)' => 'day(s)',
'Main' => 'Main',
'Name' => 'Name',
'Select' => 'Select',
'Withdrawn Students' => 'Withdrawn Students',
'Subject' => 'Subject',
'Sort by' => 'Sort by',
'Select' => 'Select',
'Grade' => 'Grade',
'Homeroom' => 'Homeroom',
'Start Date' => 'Start Date',
'End Date' => 'End Date',
'Show' => 'Show',
'Continue' => 'Continue',
'No Student(s) Found' => 'No Student(s) Found',
'Days' => 'Days',
'Period' => 'Period',
'Error' => 'Error',
'Blank=All' => 'Blank=All',
'Band' => 'Band',
'Summary Records' => 'Summary Records',
'Count' => 'Count',
'Reason' => 'Reason',
'Teacher' => 'Teacher',
'Homeroom' => 'Homeroom',
'Font Size' => 'Font Size',
'Paper Size' => 'Paper Size',
'Letter' => 'Letter',
'Legal' => 'Legal',
'A4' => 'A4',
'Date' => 'Date',
'Not Found' => 'Not Found',
'Description' => 'Description',
);
my $grayshade = '0.80';
my $self = "rptattprof.pl";
# Get current dir so know what path for config files.
my $configpath;
my $teachermode;
if ( getcwd() =~ /tcgi/ ){ # we are in tcgi
$teachermode = 1;
$configpath = '..'; # go back one to get to etc.
} else {
$configpath = '../..'; # go back two to get to etc.
}
# main config file
eval require "$configpath/etc/admin.conf";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
# load attendance library
eval require "$configpath/lib/libattend.pl";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
# load latex filtering (for subject description field, band)
eval require "$configpath/lib/liblatex.pl";
if ( $@ ) {
print $lex{Error}. " $@
\n";
die $lex{Error}. " $@\n";
}
# Do a check for attendance strings
if ( not $absentUnexcused or not $lateUnexcused or
not $lateString or not $absentString ) {
print "