#!/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; either version 2 of
# the License, or (at your option) any later version.
my %lex = ('Student Discipline' => 'Student Discipline',
'Discipline Entry' => 'Discipline Entry',
'Main' => 'Main',
'Use One or the Other to identify student, but not both.' =>
'Use One or the Other to identify student, but not both.',
'Student Number' => 'Student Number',
'disciplined' => 'disciplined',
'Students' => 'Students',
'Infraction' => 'Infraction',
'Repeated Behavior
Consequence' => 'Repeated Behavior
Consequence',
'Description' => 'Description',
'Action Taken' => 'Action Taken',
'Please Log In' => 'Please Log In',
'Lastname/Lastname,Firstname/Initials/StudentNumber' =>
'Lastname/Lastname,Firstname/Initials/StudentNumber',
'Select Student' => 'Select Student',
'Search' => 'Search',
'No Student(s) Found' => 'No Student(s) Found',
'Save Record' => 'Save Record',
'Parental Contact' => 'Parental Contact',
'None' => 'None',
'Phoned' => 'Phoned',
'Letter' => 'Letter',
'Interview (caregiver)' => 'Interview (caregiver)',
'Your discipline record is now stored.' => 'Your discipline record is now stored.',
'Mistake' => 'Mistake',
'Description' => 'Description',
'Action' => 'Action',
'If Repeated' => 'If Repeated',
'Please Contact' => 'Please Contact',
'Add another record' => 'Add another record',
'Back!' => 'Back!',
'Error' => 'Error',
'Please record the following error' => 'Please record the following error',
);
my $self = 'tdiscadd.pl';
use DBI;
use CGI;
use CGI::Session;
my @tim = localtime(time);
my $year = $tim[5] + 1900;
my $month = $tim[4] + 1;
my $currdate = "$year-$month-$tim[3]";
my $q = new CGI;
my %arr = $q->Vars;
eval require "../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
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;
# Get Session Values (a defined userid means it was passed)
if ( not $session->param('logged_in') ){
$userid = $session->param('userid');
print $q->header;
print "$doctype\n