#!/usr/bin/perl
use strict;
use CGI qw(:standard);
use XML::Simple;
BEGIN {
chdir("/home/devi/cvs/lilalo");
require l3config;
};
my %filter;
for my $key (qw(login_from)) {
$filter{$key} = param($key) if param($key);
$filter{$key} = $ENV{$key} if defined $ENV{$key};
}
my %Trainings;
my $XMLTraining;
my %Machines;
my $print = "";
sub load_training
{
my $classfile =
$_[0]||
$l3config::Config{"classfile"} ||
$l3config::Config{"path_classes"}."/".$l3config::Config{"class"}.$l3config::Config{"class_suffix"};
my $XMLTraining = XMLin($classfile , ForceArray => [ 'student' ] )
or die "Can't open file of the training ",$classfile,"\n";
for my $student (@{$XMLTraining->{"student"}}) {
$XMLTraining->{host}->{$student->{"host"}}=$student;
}
return $XMLTraining;
}
$print .= header(
-charset => "utf-8",
);
if ($ENV{PATH_INFO} eq "/index") {
# Показываем индекс курсов
my @training_files = glob($l3config::Config{"path_classes"}."/*".$l3config::Config{"class_suffix"});
if (@training_files) {
for my $training_file (@training_files) {
my $training = load_training($training_file);
$Trainings{$training->{"date"}}=$training;
}
$print .= "\n";
$print .= "