Further breaking up of the TmplTokenizer module.
[koha.git] / opac / opac-main.pl
1 #!/usr/bin/perl
2 use strict;
3 require Exporter;
4 use CGI;
5 use HTML::Template;
6
7 use C4::Auth;       # get_template_and_user
8 use C4::Interface::CGI::Output;
9
10 my $input = new CGI;
11 my $dbh = C4::Context->dbh;
12 my $query="Select itemtype,description from itemtypes order by description";
13 my $sth=$dbh->prepare($query);
14 $sth->execute;
15 my  @itemtype;
16 my %itemtypes;
17 while (my ($value,$lib) = $sth->fetchrow_array) {
18         push @itemtype, $value;
19         $itemtypes{$value}=$lib;
20 }
21
22 my $CGIitemtype=CGI::scrolling_list( -name     => 'itemtype',
23                         -values   => \@itemtype,
24                         -labels   => \%itemtypes,
25                         -size     => 1,
26                         -multiple => 0 );
27 $sth->finish;
28 my ($template, $borrowernumber, $cookie)
29     = get_template_and_user({template_name => "opac-main.tmpl",
30                              type => "opac",
31                              query => $input,
32                              authnotrequired => 1,
33                              flagsrequired => {borrow => 1},
34                          });
35
36 $template->param(CGIitemtype => $CGIitemtype,
37                              LibraryName => C4::Context->preference("LibraryName"),
38 );
39 output_html_with_http_headers $input, $cookie, $template->output;