#!/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.
my %lex=('Subject Edit' => 'Subject Edit',
'Main' => 'Main',
'Report Card' => 'Report Card',
'Codes' => 'Codes',
'Other Codes' => 'Other Codes',
'Save Subject' => 'Save Subject',
'Course Code' => 'Course Code',
'Section' => 'Section',
'Description' => 'Description',
'Short Description' => 'Short Description',
'Max' => 'Max',
'char' => 'char',
'Grade' => 'Grade',
'Start Term' => 'Start Term',
'End Term' => 'End Term',
'Teacher' => 'Teacher',
'Sequence' => 'Sequence',
'Controls printing order on report card' =>
'Controls printing order on report card',
'Web Visible' => 'Web Visible',
'Y' => 'Y',
'N' => 'N',
'Instructional Mode' => 'Instructional Mode',
'Class' => 'Class',
'Distance' => 'Distance',
'Exam Mix' => 'Exam Mix',
'School' => 'School',
'Blended' => 'Blended',
'Faculty' => 'Faculty',
'Location' => 'Location',
'Mark Scheme' => 'Mark Scheme',
'Objective' => 'Objective',
'Save Subject' => 'Save Subject',
'Credit' => 'Credit',
'Difficulty' => 'Difficulty',
'Subject Area' => 'Subject Area',
'Calc Average' => 'Calc Average',
'If your subject only has marks and comments, no objective entry' =>
'If your subject only has marks and comments, no objective entry',
'is required. If you have non-mark based objectives, please enter' =>
'is required. If you have non-mark based objectives, please enter',
'the description that will appear on the report card. These will' =>
'the description that will appear on the report card. These will',
'also appear for evaluation entry. Limit: 255 characters' =>
'also appear for evaluation entry. Limit: 255 characters',
'Changing Start/End Term will require adding/removing student mark records' =>
'Changing Start/End Term will require adding/removing student mark records',
'There is one mark record for every term for each student' =>
'There is one mark record for every term for each student',
'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',
'Your subject update is now stored' => 'Your subject update is now stored',
'Edit Another Subject' => 'Edit Another Subject',
'Required' => 'Required',
'Start Term cannot be larger than End Term' => 'Start Term cannot be larger than End Term',
'Terms cannot be larger than' => 'Terms cannot be larger than',
'Error' => 'Error',
);
my $self = 'subjed.pl';
my $maxterms = 12; # maximum value allowed in the start and end reporting period (terms)
use DBI;
use CGI;
eval require "../../etc/admin.conf";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
eval require "../../etc/transcript.conf";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
my $q = new CGI;
print $q->header( -charset, $charset );
my %arr = $q->Vars;
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
$dbh->{mysql_enable_utf8} = 1;
# Print Page Header
print "$doctype\n
". $lex{'Start Term cannot be larger than End Term'}. "
\n"; exit; } if ( $arr{startrptperiod} > $maxterms or $arr{endrptperiod} > $maxterms ) { print "". $lex{'Terms cannot be larger than'}. " $maxterms
\n"; exit; } # Join Subject and Section to make SubjSec; Add to %arr; not passed if restricted editing. if ( $arr{subjcode} and $arr{section} ) { # they have to exist $arr{subjsec} = $arr{subjcode}."-".$arr{section}; } # We'll leave full name along with bracketed UID for now. #($teachname,$teachid) = split /\(/,$arr{teacher}; #chop $teachid; # chop trailing bracket. #$teachid = $arr{teacher}; foreach my $key ( sort keys %arr ) { if ( not $arr{$key} ) { $sth = $dbh->prepare("update subject set $key = $sql{default} where id = ?"); $sth->execute( $id ); } else { $sth = $dbh->prepare("update subject set $key = ? where id = ?"); $sth->execute( $arr{$key}, $id ); } #print "K:$key V:$arr{$key}[ ". $lex{'Report Card'}. " | \n"; print "". $lex{'Edit Another Subject'}. " ]\n"; print "