#!/usr/bin/perl # Copyright 2001-2007 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 = ('Student' => 'Student', 'Subject' => 'Subject', 'Terms' => 'Terms', 'Main' => 'Main', 'Add Subject Enrollments' => 'Add Subject Enrollments', 'Report Card' => 'Report Card', 'Record exists for'=> 'Record exists for', 'Your enrollments are now stored' => 'Your enrollments are now stored', 'Please record the following error' => 'Please record the following error', 'There was an error storing your data' => 'There was an error storing your data', 'Please contact' => 'Please contact', ); use DBI; use CGI; unless (require "../../etc/admin.conf") { print "Cannot open admin.conf!"; die "Cannot open admin.conf!"; } my $q = new CGI; print $q->header; my %arr = $q->Vars; # print Page head print "$doctype\n
| '. $lex{Student}. ' | '. $lex{Subject}; print ' | '. $lex{Terms}. " |
|---|---|---|
| $lastname, $firstname ($studnum) | "; print "$description ($subjsec) | \n"; # Loop through and check where term is missing... for ($i = $startterm;$i <=$endterm; $i++){ if (not $terms{$i}){ # fill in holes! $sth = $dbh->prepare("insert into eval values ( $sql{default},'$subjsec','$studnum', $teacher ,'$i', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL)"); $sth->execute; if ($DBI::errstr){ print $DBI::errstr; die $DBI::errstr; } print " $i "; } else { print "(Skip $i) ";} } # Loop for Terms print " |
". $lex{'There was an error storing your data'}. ".\n"; print $lex{'Please contact'}. " $adminname "; print "$adminemail\n"; print $lex{'Please record the following error'}. " $DBI::errstr
\n"; } print "[ ". $lex{'Report Card'}. " ]\n"; print "