#!/usr/bin/perl # Copyright 2001-2006 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; my %lex = ('View Date Records' => 'View Date Records', 'Eoy' => 'Eoy', 'Main' => 'Main', 'Dates' => 'Dates', 'School Year' => 'School Year', 'School Start' => 'School Start', 'School End' => 'School End', 'Term' => 'Term', 'Start' => 'Start', 'End' => 'End', 'Date' => 'Date', 'Type' => 'Type', 'Description' => 'Description', 'Day In Cycle?' => 'Day In Cycle?', 'Grade Grouping' => 'Grade Grouping', ); my $q = new CGI; print $q->header; my %arr = $q->Vars; # Read config variables unless (require "../../etc/admin.conf") { print "Cannot read admin.conf!"; die "Cannot read admin.conf!"; } my $dsn = "DBI:$dbtype:dbname=$dbase"; my $dbh = DBI->connect($dsn,$user,$password); my $sth = $dbh->prepare("select * from dates order by date"); $sth->execute; if ($DBI::errstr) { print $DBI::errstr; die;} my $rows = $sth->rows; print "$doctype\n". $lex{'View Date Records'}. " $chartype\n\n"; print "[ ". $lex{Main}. " | \n"; print "". $lex{Eoy}. " ]\n"; print "

$schoolname ". $lex{Dates}. "

\n"; # Print Term Dates stored in /etc/admin.conf print "\n"; print "\n"; print "\n"; print "\n"; foreach my $trm (sort keys %g_termstart) { if ( ref( $g_termstart{$trm} ) eq 'ARRAY') { print "\n"; next; } print "\n"; } print "
". $lex{'School Year'}. " $schoolyear
". $lex{'School Start'}. " $schoolstart
". $lex{'School End'}. " $schoolend
\n"; print "

". $lex{'Grade Grouping'}. " $trm
\n"; foreach my $grade (sort keys %g_termtype) { if ($g_termtype{$grade} eq $trm) { print "$grade "; } } print "

\n"; for my $t (1..$#{ $g_termstart{$trm} } ) { print $lex{Term}. " $t : $g_termstart{$trm}[$t] - "; print "$g_termend{$trm}[$t]
\n"; } print "
". $lex{Term}. " $trm: $g_termstart{$trm}\n"; print "- $g_termend{$trm}

\n"; # Print the Stored Dates (in Dates Table) print "\n"; print "\n\n"; for ($i=1; $i <= $rows; ++$i) { my @arr = $sth->fetchrow; print "\n"; print ""; } print "
". $lex{Date}. "". $lex{Type}. ""; print $lex{Description}. " 1". $lex{Description}. " 2"; print $lex{'Day In Cycle?'}. "
$arr[1]$arr[2]$arr[3]$arr[4]$arr[5]
\n";