[Koha-cvs] koha/opac opac-main.pl

Robert Lyon bob at katipo.co.nz
Wed Jun 7 06:56:55 CEST 2006


CVSROOT:	/sources/koha
Module name:	koha
Changes by:	Robert Lyon <bob_lyon>	06/06/07 04:56:55

Modified files:
	opac           : opac-main.pl 

Log message:
	merging katipo changes...
	
	Added the ability to display all branches opening/closing times on the opac
	homepage

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-main.pl?cvsroot=koha&r1=1.21&r2=1.22

Patches:
Index: opac-main.pl
===================================================================
RCS file: /sources/koha/koha/opac/opac-main.pl,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- opac-main.pl	21 May 2006 02:19:00 -0000	1.21
+++ opac-main.pl	7 Jun 2006 04:56:55 -0000	1.22
@@ -66,6 +66,32 @@
 if($languages_count > 1){
 		$template->param(languages => \@options);
 }
+
+my $branchinfo = getbranchinfo();
+my @loop_data =();
+foreach my $branch (@$branchinfo) {
+        my %row =();
+        $row{'branch_name'} = $branch->{'branchname'};
+        $row{'branch_hours'} = $branch->{'branchhours'};
+        $row{'branch_hours'} =~ s^\n^<br />^g;
+        push (@loop_data, \%row);
+    }
+
+sub getbranchinfo {
+        my $dbh = C4::Context->dbh;
+        my $sth;
+        $sth = $dbh->prepare("Select * from branches order by branchcode");
+        $sth->execute();
+    
+        my @results;
+        while(my $data = $sth->fetchrow_hashref) {
+	            push(@results, $data);
+	        }
+        $sth->finish;
+        return \@results;
+}
+
+
 $template->param(CGIitemtype => $CGIitemtype,
 				suggestion => C4::Context->preference("suggestion"),
 				virtualshelves => C4::Context->preference("virtualshelves"),
@@ -79,6 +105,7 @@
 				opaclayoutstylesheet => C4::Context->preference("opaclayoutstylesheet"),
 				opaccolorstylesheet => C4::Context->preference("opaccolorstylesheet"),
 				opaclanguagesdisplay => C4::Context->preference("opaclanguagesdisplay"),
+                                branches => \@loop_data,
 );
 
 $template->param('Disable_Dictionary'=>C4::Context->preference("Disable_Dictionary")) if (C4::Context->preference("Disable_Dictionary"));





More information about the Koha-cvs mailing list