#!/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 = ('Subject Entry Form' => 'Subject Entry Form', 'Main' => 'Main', 'Report Card' => 'Report Card', 'Subject Entry - Add a New Subject-Section' => 'Subject Entry - Add a New Subject-Section', 'Clone' => 'Clone', 'Subject-Section' => 'Subject-Section', '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', 'Yes' => 'Yes', 'No' => 'No', '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', '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', ); use DBI; use CGI; my $self = 'subjadd0.pl'; my $defaultsequence = 100; # Starting value for sequence number. require "../../etc/admin.conf" or die "Cannot open admin.conf!"; $dsn = "DBI:$dbtype:dbname=$dbase"; $dbh = DBI->connect($dsn,$user,$password); my $q = new CGI; print $q->header; %arr = $q->Vars; # If 'cloning' selected while looping, pull in the record. my @subj; if ($arr{subjsec}){ $sth = $dbh->prepare("select * from subject where subjsec = ?"); $sth->execute( $arr{subjsec} ); if ($DBI::errstr){ print $DBI::errstr; die $DBI::errstr; } @subj = $sth->fetchrow; } # Load teachers into an array $sth = $dbh->prepare("select lastname, firstname, userid from staff order by lastname, firstname"); $sth->execute; if ($DBI::errstr){ print $DBI::errstr; die;} while (my ($lastname, $firstname, $userid) = $sth->fetchrow) { push @teacherarray, "$lastname, $firstname ($userid)"; } # Set sequence number; if cloning, keep existing val if ($subj[7]){ $defaultsequence = $subj[7];} print "$doctype\n