#! /usr/bin/perl
# Copyright 2001-2018 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',
'Continue' => 'Continue',
'Grade' => 'Grade',
'Select by' => 'Select by',
'Error' => 'Error',
'Sort by' => 'Sort by',
'Name' => 'Name',
'Common Math Assessment' => 'Common Math Assessment',
'School Year' => 'School Year',
'Show Withdrawn' => 'Show Withdrawn',
);
my $self = 'feederMathView.pl';
use DBI;
use CGI;
use Cwd;
use Number::Format qw(:all);
my @strands = qw(P N SS SP);
my %strandnames = ('P' => 'Patterns and Relations',
'N' => 'Numbers and Operations',
'SS' => 'Shape and Space',
'SP' => 'Stats and Prob'
);
my $teachermode;
my $configpath = '../..';
if ( getcwd() =~ /tcgi/ ){ # we are in tcgi
$teachermode = 1;
$configpath = '..';
}
# only load passwords and users
eval require "$configpath/etc/admin.conf.root";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
my $dbtype = 'mysql';
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
$dbh->{mysql_enable_utf8} = 1;
# Load Configuration Variables;
my $sth = $dbh->prepare("select id, datavalue from conf_system where filename = 'admin'");
$sth->execute;
if ( $DBI::errstr ) { print $DBI::errstr; die $DBI::errstr; }
while ( my ($id, $datavalue) = $sth->fetchrow ) {
eval $datavalue;
if ( $@ ) {
print "$lex{Error}: $@
\n";
die "$lex{Error}: $@\n";
}
}
# Load global user and password
if ( not -e "$globdir/global.conf" ) {
print qq{Cannot read the global.conf file!\n};
print qq{