#!/usr/bin/perl
# Copyright 2001-2008 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; version 2 of
# the License (only)
# Passed values will be method - snap,sa4,sa6; date, and then all the
# "studnum:period:subjsec:reason:late:date" (now with date) with value of 1
# This is common for all attendance entry methods.
my %lex = ('Attendance Entry' => 'Attendance Entry',
'Main' => 'Main',
'Enter More Attendance Records (clear)' => 'Enter More Attendance Records (clear)',
'Your attendance is now stored' => 'Your attendance is now stored',
'There was an error storing your data' => 'There was an error storing your data',
'Please contact' => 'Please contact',
'Please record the following error' => 'Please record the following error',
'Enter More Attendance Records (go back)' => 'Enter More Attendance Records (go back)',
'Error' => 'Error',
);
use DBI;
use CGI;
use CGI::Session;
my @tim = localtime(time);
my $year = $tim[5] + 1900;
my $month = $tim[4] + 1;
my $day = $tim[3];
if ( length( $month ) == 1 ) { $month = '0'. $month; }
if ( length( $day ) == 1 ) { $day = '0'. $day; }
my $currdate = "$year-$month-$day";
my $q = new CGI;
my %arr = $q->Vars;
eval require "../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
# fix incoming date value for day and month size.
my ( $tempyr, $tempmon, $tempday ) = split /-/, $arr{date};
if ( length( $tempmon ) == 1 ) { $tempmon = '0'. $tempmon; }
if ( length( $tempday ) == 1 ) { $tempday = '0'. $tempday; }
$arr{date} = "$tempyr-$tempmon-$tempday";
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
# Get Session
my $session = new CGI::Session("driver:mysql;serializer:FreezeThaw",
undef,{Handle => $dbh}) or die CGI::Session->errstr;
my $userid = $session->param('userid');
print $session->header;
print "$doctype\n
[ ". $lex{Main}. " ]\n"; print "
\n"; if ($arr{method} eq 'multiday'){ # 3 jumps back. print "\n"; } else { print "\n"; } print "