%
use Time::Local;
my %VA = ();
my $projekt;
my $cap;
my $oldcap;
require "se_mysql.pl";
my $dbh = &mysql_connect("va");
my $mandant_id = "33";
my $sql = qq(
SELECT va_objekte.id,
va_objekte.name,
DATE_FORMAT(va_objekte.datum,'%d.%m.%y') as datum,
va_locations.name as location,
va_locations.ort as location_ort,
va_objekte.text,
va_objekte.attribute,
DATE_FORMAT(va_objekte.datum,'%H:%i') as uhrzeit,
UNIX_TIMESTAMP(va_objekte.datum) as epoche,
DATE_FORMAT(va_objekte.datum_bis,'%d.%m.%Y %H:%i') as datum_bis,
va_objekte.press,
va_objekte.redsys,
va_objekte.location2,
va_locations.text
FROM va_objekte
LEFT JOIN va_locations ON va_locations.id= va_objekte.location
WHERE (va_objekte.mandant_id = "$mandant_id")
AND va_objekte.datum >= NOW()
GROUP BY va_objekte.id
ORDER BY va_objekte.datum ASC
LIMIT 0, 10
);
my $sth = $dbh->prepare( $sql );
$sth->execute;
my @sulzberg;
my @waltenhofen;
my @buchenberg;
my @weitnau;
my $debug;
while (my $va = $sth->fetchrow_hashref)
{
# Sonderfall, keine Veranstaltungen anzeigen die das
# "keine Ausspielung auf allgaeuer-seenland.de"-Attribut (No.: 323) besitzen.
next if ($va->{attribute} =~ /323/);
$va->{name} =~ s/^(.{24}).+/$1.../;
$va->{name} =~ s/&[a-zA-Z]*...$/.../;
my $txt = qq(
$va->{datum} | |
);
push(@sulzberg, qq($txt)) if (($va->{location_ort} eq "Sulzberg") && (@sulzberg < 2));
push(@waltenhofen, qq($txt)) if (($va->{location_ort} eq "Waltenhofen") && (@waltenhofen < 2));
push(@buchenberg, qq($txt)) if (($va->{location_ort} eq "Buchenberg") && (@buchenberg < 2));
push(@weitnau, qq($txt)) if (($va->{location_ort} eq "Weitnau") && (@weitnau < 2));
last if ((@sulzberg >= 2) && (@waltenhofen >= 2) && (@buchenberg >= 2) && (@weitnau >= 2));
}
return qq(
Buchenberg: |
$buchenberg[0]
|
|
Waltenhofen: |
$waltenhofen[0]
|
|
);
%>