#!/usr/bin/perl # Copyright 2001-2006 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 $self = 'rptshorrost.pl'; my %lex = ('Short Student Roster' => 'Short Student Roster', 'Main' => 'Main', 'Name' => 'Name', 'Address' => 'Address', 'Phone' => 'Phone', 'Parent 1' => 'Parent 1', 'Parent 2' => 'Parent 2', 'Emergency' => 'Emergency', 'Sn' => 'Sn', 'Dob' => 'Dob', 'Rm' => 'Rm', 'Gr' => 'Gr', 'Sort by' => 'Sort by', 'Lastname' => 'Lastname', 'Grade' => 'Grade', 'Homeroom' => 'Homeroom', ); use DBI; use CGI; my @month = ('January','February','March','April','May','June','July', 'August','September','October','November','December'); my @dow = ('Sunday','Monday','Tuesday','Wednesday','Thursday', 'Friday','Saturday'); my ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime(time); $year = $year + 1900; my $currdate = "$dow[$wday], $month[$mon] $mday, $year"; my $q = new CGI; print $q->header; my %arr = $q->Vars; # Read config variables require "../etc/admin.conf" || die "Cannot read admin.conf!"; my $dsn = "DBI:$dbtype:dbname=$dbase"; my $dbh = DBI->connect($dsn,$user,$password); my $select; if ($arr{homeroom}) { $select = "where homeroom = '$arr{homeroom}'"; } my $sortorder = "lastname, firstname"; if ( $arr{sortorder} eq $lex{Homeroom} ) { $sortorder = "homeroom, lastname, firstname"; } elsif ( $arr{sortorder} eq $lex{Grade} ) { $sortorder = "grade, lastname, firstname"; } my $sth = $dbh->prepare("select * from student $select order by $sortorder"); $sth->execute; if ($DBI::errstr){ print $DBI::errstr; die $DBI::errstr; } $rows = $sth->rows; print "$doctype\n
| '. $lex{Name}. ' | '. $lex{Address}. '/'. $lex{Phone}. ' | '; print $lex{'Parent 1'}. ' | '. $lex{'Parent 2'}. ' | '. $lex{Emergency}. " |
|---|---|---|---|---|
| $arr[1], $arr[2] $arr[3] \n"; print ''. $lex{Sn}. ":$arr[4] ". $lex{Dob}. ":$arr[8] \n"; print "". $lex{Rm}. ": $arr[6] ". $lex{Gr}. ": $arr[5] | \n";
print "$arr[34] $arr[36] Ph: $arr[30] | \n";
# Address1, Pcode1, hphone1
print "$arr[29] $arr[31] $arr[32] | \n";
# Name 1, wphone1, cell1
print "$arr[40] $arr[42] $arr[43] | \n";
# Name 2, wphone2, cell2
print "$arr[50] H: $arr[51] W:$arr[52] C:$arr[53] |