#!/usr/bin/perl
# Copyright 2001-2022 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 = ('Reset' => 'Reset',
'Subjects' => 'Subjects',
'Main' => 'Main',
'Report Card' => 'Report Card',
'Subject' => 'Subject',
'Teacher' => 'Teacher',
'Term' => 'Term',
'Grade' => 'Grade',
'Sort by' => 'Sort by',
'No Teacher' => 'No Teacher',
'Subj-Sec' => 'Subj-Sec',
'Terms' => 'Terms',
'Edit' => 'Edit',
'Delete' => 'Delete',
'Clone' => 'Clone',
'SmDesc' => 'SmDesc',
'Enrol' => 'Enrol',
'Error' => 'Error',
'Field' => 'Field',
'Credit' => 'Credit',
'Difficulty' => 'Diff',
'Start Term' => 'Start
Term',
'End Term' => 'End
Term',
'Record(s) Updated' => 'Record(s) Updated',
'Contact' => 'Contact',
'Location' => 'Location',
'Course' => 'Course',
'Section' => 'Section',
'Master' => 'Master',
'Homeroom' => 'Homeroom',
'Seq' => 'Seq',
'Course Name' => 'Course Name',
'Sequence' => 'Sequence',
'Code' => 'Code',
'Enrollment' => 'Enrollment',
'students' => 'students',
'Primary Sort' => 'Primary Sort',
'Secondary Sort' => 'Secondary Sort',
'No Enrollments' => 'No Enrollments',
'Sort Courses by' => 'Sort Courses by',
);
# NOTE: line 645 has stuff to check for students not in correct
# homeroom for the courses they are enrolled in .
use DBI;
use CGI;
use Number::Format qw(:all);
my $self = 'coursemstreset.pl';
eval require "../../etc/admin.conf.root";
if ( $@ ) {
print $lex{Error}. ": $@
\n";
die $lex{Error}. ": $@\n";
}
my $dbtype = 'mysql';
my $dsn = "DBI:$dbtype:dbname=$dbase";
my $dbh = DBI->connect($dsn,$user,$password);
$dbh->{mysql_enable_utf8} = 1;
# Load Configuration Variables;
my $sth = $dbh->prepare("select id, datavalue from conf_system where filename = 'admin'");
$sth->execute;
if ( $DBI::errstr ) { print $DBI::errstr; die $DBI::errstr; }
while ( my ($id, $datavalue) = $sth->fetchrow ) {
eval $datavalue;
if ( $@ ) {
print "$lex{Error}: $@
\n";
die "$lex{Error}: $@\n";
}
}
# Get Max terms defined in school year
my $maxterms;
foreach my $track ( keys %g_MTrackTerm ) {
foreach my $trm ( keys %{ $g_MTrackTerm{$track}} ) {
if ( $trm > $maxterms ) { $maxterms = $trm; }
}
}
my $q = CGI->new;
print $q->header( -charset, $charset );
my %arr = $q->Vars;
my $title = "$lex{Reset} $lex{Course} $lex{Master}";
print qq{$doctype\n