X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=www%2Findex.pl;h=7546d658ac8a4b5bf14bf8a30b8e46d408c4092b;hb=854c8eb6e0a3f9836043faaf2f43c05c190619fb;hp=109caae89e568f69e70bb1e0ecc47ec3ee6ebe82;hpb=efea57bacf3357ae3be8c4f3053e9272e29a502b;p=wloh diff --git a/www/index.pl b/www/index.pl index 109caae..7546d65 100755 --- a/www/index.pl +++ b/www/index.pl @@ -40,12 +40,12 @@ sub color { } sub get_divisions { - my ($dbh, $season) = @_; + my ($dbh, $locale, $season) = @_; my @divisions = (); - my $q = $dbh->prepare('SELECT DISTINCT(divisjon) FROM fotballserier WHERE sesong=? ORDER BY divisjon'); - $q->execute($season); + my $q = $dbh->prepare('SELECT DISTINCT(divisjon) FROM fotballserier se JOIN fotballspraak sp ON se.spraak=sp.id WHERE kultur=? AND sesong=? ORDER BY divisjon'); + $q->execute($locale, $season); while (my $ref = $q->fetchrow_hashref) { push @divisions, $ref->{'divisjon'}; @@ -55,12 +55,12 @@ sub get_divisions { } sub get_subdivisions { - my ($dbh, $season, $division) = @_; + my ($dbh, $locale, $season, $division) = @_; my @subdivisions = (); - my $q = $dbh->prepare('SELECT DISTINCT(avdeling) FROM fotballserier WHERE sesong=? AND divisjon=? ORDER BY avdeling'); - $q->execute($season, $division); + my $q = $dbh->prepare('SELECT DISTINCT(avdeling) FROM fotballserier se JOIN fotballspraak sp ON se.spraak=sp.id WHERE kultur=? AND sesong=? AND divisjon=? ORDER BY avdeling'); + $q->execute($locale, $season, $division); while (my $ref = $q->fetchrow_hashref) { push @subdivisions, $ref->{'avdeling'}; @@ -70,10 +70,10 @@ sub get_subdivisions { } sub print_division_selector { - my ($dbh, $divisions, $subdivisions, $division, $subdivision) = @_; + my ($dbh, $locale, $divisions, $subdivisions, $division, $subdivision) = @_; print <<"EOF"; -