X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=common.pm;h=60cc243d608e275714f60edb17c65eef1e1b5dda;hb=1fac0677bbcba5dec26e11aa661c97e38f6c3d40;hp=832a61173f0f85932e164d0f828742ac78862df6;hpb=0ae9e34c70e35503e41d28af052c4957ca7b4f35;p=wloh diff --git a/common.pm b/common.pm index 832a611..60cc243 100644 --- a/common.pm +++ b/common.pm @@ -29,4 +29,42 @@ sub get_locale { return $1; } +sub get_auxillary_parameters { + my ($dbh, $locale) = @_; + + my $q = $dbh->prepare('SELECT * FROM aux_params WHERE kultur=?'); + $q->execute($locale); + + my $aux_parms = {}; + while (my $ref = $q->fetchrow_hashref) { + $aux_parms->{$ref->{'id'}} = $ref->{'value'}; + } + return $aux_parms; +} + +sub print_navbar { + my ($cgi, $dbh, $locale) = @_; + my $url = $cgi->url(-relative => 1); + + print "

"; + + my $q = $dbh->prepare('SELECT spraak, kultur FROM fotballspraak WHERE nyestesesong <> -1 ORDER BY id'); + $q->execute; + + my $first = 1; + while (my $ref = $q->fetchrow_hashref) { + if (!$first) { + print " :: "; + } + $first = 0; + + if ($ref->{'kultur'} eq $locale) { + printf "%s ", $ref->{'spraak'}; + } else { + printf "%s ", $ref->{'kultur'}, $url, $ref->{'spraak'}; + } + } + print "

\n"; +} + 1;