#! /usr/bin/perl
# Copyright 2001-2008 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.
# This is a DUAL RUN script. It runs in /tcgi and also /cgi/repcard.
# Outline: This prints a full xtab report for a single grade/class. All
# objectives are perpendicular.
# Outline: 1) Find all the students in the group (class/section/grade).
# 2) Loop through all eval records for the selected term to find all
# of the subjects.
# 3) Load all subjects into a 2D array. Baseref->Arrayptr1->[0], etc.
# Order by subjsec, name of subject, then any objectives next (start
# at array index 2)
my %lex = ('Final Evaluation Record' => 'Final Evaluation Record',
'No Grade or Homeroom Entered' => 'No Grade or Homeroom Entered',
'Final Evaluation Record' => 'Final Evaluation Record',
'Grade' => 'Grade',
'Homeroom' => 'Homeroom',
'grade' => 'grade',
'View/Download Final Evaluation Record' => 'View/Download Final Evaluation Record',
'Teacher' => 'Teacher',
'Principal' => 'Principal',
'View Log File' => 'View Log File',
'Report Card' => 'Report Card',
'Main' => 'Main',
'There are missing short subject descriptions' =>
'There are missing short subject descriptions',
'NOTE' => 'NOTE',
'Cl-Sec' => 'Cl-Sec',
'Page' => 'Page',
'Trm' => 'Trm',
'No Students Found' => 'No Students Found',
'Y' => 'Y',
'N' => 'N',
'Error' => 'Error',
);
use DBI;
use CGI;
use Date::Business;
use Cwd;
# Now in repcard.conf
# $additionalcomments = 'Additional Comments'; # subject to skip, this is
# $markfield = 'a1'; # Find in eval table holding the numeric score (for evaluation purposes)
# Constants
# These two settings control the vertical height of the header.
my $objectivelength = 36; # number of characters to truncate objectives to.
my $offset = "1in"; # Strut length in print_header fn.
my $maxstudents = 36; # Number of student rows per page; if you adjust above,
# this may have to change also.
my $maxlegalcols = 36; # maximum number of columns per printed page.
my $maxlettercols = 28;
# Get current dir so know what path for config files.
my $configpath;
if (getcwd() =~ /tcgi/){ # we are in tcgi
$configpath = '..'; # go back one to get to etc.
} else {
$configpath = '../..'; # go back two to get to etc.
}
eval require "$configpath/etc/admin.conf";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
eval require "$configpath/etc/repcard.conf";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
eval require "$configpath/lib/liblatex.pl";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
eval require "$configpath/lib/libattend.pl";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
# Get current dir so know what CSS to display;
if (getcwd() =~ /tcgi/){ # we are in tcgi
$css = $tchcss;
}
my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday,
$iddst) = localtime(time);
$year = $year + 1900;
$mon++;
$wday++;
my $currlongdate = "$dow[$wday], $month[$mon] $mday, $year";
my $currdate = "$month[$mon] $year"; # $mday removed
if (length($mon) == 1){ $mon = '0'.$mon;}
if (length($mday) == 1){ $mday = '0'.$mday;}
my $currsdate = "$year-$mon-$mday";
my $dsn = "DBI:$dbtype:dbname=$dbase";
$dbh = DBI->connect($dsn,$user,$password);
# Leave $dbh alone since libraries depend on it.
my $q = new CGI;
print $q->header;
my %arr = $q->Vars;
# passed values from HTML.
my $grade = $arr{grade};
#my $term = $arr{term};
my $group = $arr{group}; # type of group: grade or homeroom.
# values: 'homeroom' or 'grade'
#foreach my $key (keys %arr ) { print "K:$key V:$arr{$key}
\n"; }
# Set paper size.
my ($papersize, $textheight,$maxcolumns);
$papersize = $defaultpapersize;
if ( $papersize eq 'legalpaper'){
$textheight = '13.5in';
$maxcolumns = $maxlegalcols;
} elsif ( $papersize eq 'a4paper' ) {
$textheight = '13.5in';
$maxcolumns = $maxlettercols;
} else {
$textheight = '10.5in';
$maxcolumns = $maxlettercols;
}
# $schoolstart and $schoolend defined in the admin.conf config file.
my $schoolDaysInYear = calcTermDays($schoolstart,$schoolend);
#print "School Days: $schoolDaysInYear\n";
# Print the Page Header
print "$doctype\n