#! /usr/bin/perl
# Copyright 2001-2009 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.
# NOTE: This file is just an older version of customclasslist. Change
# existing customclasslist to print this table and remove this
# file. Perhaps allow passed table value? TODO.
my %lex = ('Empty Class List' => 'Empty Class List',
'Main' => 'Main',
'Eoy' => 'Eoy',
'Rm' => 'Rm',
'Classlist' => 'Classlist',
'Students' => 'Students',
'View/Download' => 'View/Download',
'Error' => 'Error',
'View Log File' => 'View Log File',
'No Record(s) Found' => 'No Record(s) Found',
);
use DBI;
use CGI;
my $maxlines = 26;
eval require "../../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. ": $@ \n";
die $lex{Error}. ": $@\n";
}
my ( $sec, $min, $hour, $mday, $mon, $year, $wday, $yday,
$iddst) = localtime(time);
$year = $year + 1900;
$mon++; $wday++;
my $currdate = "$dow[$wday], $month[$mon] $mday, $year";
my $q = new CGI;
print $q->header( -charset, $charset );
my %arr = $q->Vars;
print "$doctype\n
\n";
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
my $shortname = "eclasslist$$";
my $filename = "$shortname.tex";
my $logfile = "pdflog$$.txt";
open(TEX,">$filename") || die "Can't open tex file";
print TEX "\\documentclass[12pt,letterpaper]{article}
\\pagestyle{empty}
\\setlength{\\textwidth}{7.8in}
\\setlength{\\textheight}{10.6in}
\\setlength{\\hoffset}{-0.8in}
\\setlength{\\voffset}{-1.4in}
\\addtolength{\\evensidemargin}{-1in}
\\addtolength{\\oddsidemargin}{-1in}
\\setlength{\\tabcolsep}{3.5pt}\n";
print TEX "\\begin{document}\n";
my $sth = $dbh->prepare("select * from preset order by homeroom,lastname,firstname");
$sth->execute;
my $rows = $sth->rows;
if ( not $rows ) {
print "