#!/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{'Short Student Roster'}. " $chartype\n[ ". $lex{Main}. " ]\n"; # Selection Form. print "
\n"; print "\n"; print " ". $lex{Homeroom}; print " "; print "
\n"; print "

". $lex{'Short Student Roster'}. "

$currdate

\n"; print "\n"; print '\n"; for ($i=1; $i <= $rows; ++$i) { @arr = $sth->fetchrow; print "\n"; print "\n"; # Address1, Pcode1, hphone1 print "\n"; # Name 1, wphone1, cell1 print "\n"; # Name 2, wphone2, cell2 print "\n"; # Emname, emhphone, emwphone, emcell EOF } print "
'. $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]
$arr[34]
$arr[36]
Ph: $arr[30]
$arr[29]
$arr[31]
$arr[32]
$arr[40]
$arr[42]
$arr[43]
$arr[50]
H: $arr[51]
W:$arr[52] C:$arr[53]
\n";