#!/usr/bin/perl
# Copyright 2001-2019 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.
my %lex = ('Main' => 'Main',
'Error' => 'Error',
'Reading Level' => 'Reading Level',
'Category' => 'Category',
'Name' => 'Name',
'Date' => 'Date',
'Author' => 'Author',
'Score' => 'Score',
'No Records Found' => 'No Records Found',
'Continue' => 'Continue',
'Select' => 'Select',
'Student' => 'Student',
'Chk' => 'Chk',
'Homeroom' => 'Homeroom',
'Grade' => 'Grade',
'Edit' => 'Edit',
'Tests' => 'Tests',
'Delete' => 'Delete',
'Start Date' => 'Start Date',
'End Date' => 'End Date',
'Equivalent' => 'Equivalent',
'Next Page' => 'Next Page',
'Report' => 'Report',
'Progress' => 'Progress',
'Starting Season' => 'Starting Season',
'Ending Season' => 'Ending Season',
'Age' => 'Age',
'Level' => 'Level',
'Test' => 'Test',
);
my %seasondates = ('Spring' => {'start' => '01-01', 'end' => '03-31' },
'Summer' => {'start' => '05-15', 'end' => '06-30' },
'Fall' => {'start' => '09-01', 'end' => '10-31' }
);
use DBI;
use CGI;
use Cwd;
use Number::Format qw(:all);
my $self = 'readRptProgress2.pl';
eval require "../../etc/admin.conf";
if ( $@ ) {
print "$lex{Error}: $self: $@
\n";
die "$lex{Error}: $self: $@\n";
}
my %feeder; # %feeder{schooldb}{studnum} = ref;
if ( @g_FeederSchools ) { # open links to those DRA records and suck in, converting them to provnum values.
# Get global RO credentials.
eval { require "$globdir/global.conf"; };
if ( $@ ) {
print $lex{Error}. " $self: $@
\n";
die $lex{Error}. "$self: $@\n";
}
foreach my $schooldb ( @g_FeederSchools ) {
# open a connection
my $dsn1 = "DBI:$dbtype:dbname=$dbase";
my $dbh1 = DBI->connect($dsn1,$guser,$gpassword);
# read all reading tests in along with student info.
my $sth = $dbh1->prepare("select s.lastname, s.firstname, s.grade, s.birthdate, s.provnum, r.*
from studentall s, read_test r where s.studnum = r.studnum");
my $sth1 = $dbh1->prepare("select sum(score) from read_test_score where testid = ?");
$sth->execute;
if ($DBI::errstr){ print $DBI::errstr; die $DBI::errstr; }
while ( my $ref = $sth->fetchrow_hashref ) {
my $id = $ref->{id};
$sth1->execute( $id );
if ($DBI::errstr){ print $DBI::errstr; die $DBI::errstr; }
my $totalscore = $sth1->fetchrow;
if ( $totalscore ) {
$ref->{score} = $totalscore;
$feeder{$schooldb}{$id} = $ref;
}
}
}
}
# Get current dir so know what CSS to display and shift settings.
if ( getcwd() !~ /tcgi/ ) { # we are in cgi
$tchcss = $css;
$tchpage = $homepage;
$tchdownloaddir = $downloaddir;
$tchwebdownloaddir = $webdownloaddir;
}
my $q = new CGI;
print $q->header;
my %arr = $q->Vars;
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
# Page Header
my $title = qq{$lex{Progress} $lex{Report} 2};
print qq{$doctype\n
Feeder
\n}; foreach my $db ( keys %feeder ) { foreach my $id ( sort keys %{ $feeder{$db} } ) { print "