koha-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Koha-cvs] koha koha-tmpl/opac-tmpl/prog/en/includes/navig... [rel_3_0]


From: paul poulain
Subject: [Koha-cvs] koha koha-tmpl/opac-tmpl/prog/en/includes/navig... [rel_3_0]
Date: Wed, 20 Dec 2006 10:44:51 +0000

CVSROOT:        /sources/koha
Module name:    koha
Branch:         rel_3_0
Changes by:     paul poulain <tipaul>   06/12/20 10:44:51

Modified files:
        koha-tmpl/opac-tmpl/prog/en/includes: navigation.inc 
Added files:
        koha-tmpl/opac-tmpl/prog/en: opac-topissues.tmpl 
        opac           : opac-topissues.pl 

Log message:
        NEW FEATURE : opac-topissues
        
        Shows the most issued books in the library.
        
        I also have added topissues & tags_subject to the (left) navigation 
bar, but it may not be the best place for this.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc?cvsroot=koha&only_with_tag=rel_3_0&r1=1.1.2.3&r2=1.1.2.4
http://cvs.savannah.gnu.org/viewcvs/koha/koha-tmpl/opac-tmpl/prog/en/opac-topissues.tmpl?cvsroot=koha&only_with_tag=rel_3_0&rev=1.1.2.1
http://cvs.savannah.gnu.org/viewcvs/koha/opac/opac-topissues.pl?cvsroot=koha&only_with_tag=rel_3_0&rev=1.1.2.1

Patches:
Index: koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc
===================================================================
RCS file: 
/sources/koha/koha/koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc,v
retrieving revision 1.1.2.3
retrieving revision 1.1.2.4
diff -u -b -r1.1.2.3 -r1.1.2.4
--- koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc 7 Dec 2006 16:35:27 
-0000       1.1.2.3
+++ koha-tmpl/opac-tmpl/prog/en/includes/navigation.inc 20 Dec 2006 10:44:51 
-0000      1.1.2.4
@@ -4,6 +4,8 @@
             <li><a href="/cgi-bin/koha/opac-main.pl">Search Home</a></li>
             <li><a href="/cgi-bin/koha/opac-search.pl">Advanced Search</a></li>
             <li><a href="/cgi-bin/koha/opac-authorities-home.pl">Authorities 
Headings</a></li>
+            <li><a href="/cgi-bin/koha/opac-topissues.pl">Top issues</a></li>
+            <li><a href="/cgi-bin/koha/opac-tags_subject.pl">Subject 
cloud</a></li>
             <li>
                 <a href="#" onclick="javascript:openBasket();" title="A 
&quot;shopping cart&quot; for your selections">Book Bag<span id="basket">
                     <script language="javascript" type="text/javascript">

Index: koha-tmpl/opac-tmpl/prog/en/opac-topissues.tmpl
===================================================================
RCS file: koha-tmpl/opac-tmpl/prog/en/opac-topissues.tmpl
diff -N koha-tmpl/opac-tmpl/prog/en/opac-topissues.tmpl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ koha-tmpl/opac-tmpl/prog/en/opac-topissues.tmpl     20 Dec 2006 10:44:51 
-0000      1.1.2.1
@@ -0,0 +1,104 @@
+<!-- TMPL_INCLUDE NAME="doc-head-open.inc" --><!-- TMPL_VAR 
NAME="LibraryNameTitle" --> -- Library Catalog
+<!-- TMPL_INCLUDE NAME="doc-head-close.inc" -->
+<!--TMPL_INCLUDE NAME="masthead.inc" -->
+<!--TMPL_INCLUDE NAME="navigation.inc" -->
+
+<div id="main" >
+
+<!-- TMPL_IF NAME="do_it" -->
+<script language="JavaScript" type="text/javascript">
+function Dopop(link) {
+    
newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
+}
+</script>
+    <h1>The <!-- TMPL_VAR NAME="limit"--> most issued 
+        <!-- TMPL_IF name="itemtype" -->
+            <!-- TMPL_VAR name="itemtype" -->
+        <!-- TMPL_ELSE --> documents<!-- /TMPL_IF -->
+        available at
+        <!-- TMPL_IF name="branch" -->
+        <!-- TMPL_VAR name="branch" -->
+        <!-- TMPL_ELSE --> the library<!-- /TMPL_IF -->
+        <!-- TMPL_IF name="timeLimit" -->
+        since <!-- TMPL_VAR name="timeLimit" --> months
+        <!-- TMPL_ELSE --> (no time limit)<!-- /TMPL_IF -->
+    </h1>
+        <table>
+            <tr>
+                <th>Title</th>
+                <th>Itemtype</th>
+                <th>Issues</th>
+            </tr>
+                <!-- TMPL_LOOP NAME="results_loop" -->
+                    <tr>
+                        <td>
+                        <p><a 
href="/cgi-bin/koha/opac-detail.pl?biblionumber=<!-- TMPL_VAR 
name="biblionumber" -->">
+                        <!-- TMPL_VAR name="title" --></a>
+                        </p>
+                        <p>
+                        <!-- TMPL_VAR NAME="author" -->
+                        <!-- TMPL_IF name="publicationyear" --> - <!-- 
TMPL_VAR name="publicationyear" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="publishercode" -->- <!-- TMPL_VAR 
name="publishercode" --><!-- /TMPL_IF --> <!-- TMPL_IF name="seriestitle" 
-->(<!-- TMPL_VAR name="seriestitle" -->)<!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="place" --> ; <!-- TMPL_VAR 
name="place" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="pages" --> - <!-- TMPL_VAR 
name="pages" --><!-- /TMPL_IF -->
+                        <!-- TMPL_IF name="size" --> ; <!-- TMPL_VAR 
name="size" --><!-- /TMPL_IF -->
+                        </td>
+                        <td><!-- TMPL_VAR name="description" --></td>
+                        <td><!-- TMPL_VAR name="tot" --></td>
+                        </tr>
+                <!-- /TMPL_LOOP-->
+        </table>
+<!-- TMPL_ELSE -->
+    <h1 class = "reports">Our major success</h1>
+    <form method="post">
+        <p>Show the <select name="limit">
+                        <option value ="5" checked> 5</option>
+                        <option value ="10">10</option>
+                        <option value ="15">15</option>
+                        <option value ="20">20</option>
+                        <option value ="25">25</option>
+                        <option value ="40">40</option>
+                        <option value ="50">50</option>
+                        <option value ="100">100</option>
+                    </select>
+            most issued documents</p>
+        <p>Owned by branch 
+            <select name="branch">
+            <option value="">All branches</option>
+            <!-- TMPL_LOOP name="branchloop" -->
+                <option value="<!-- TMPL_VAR name="value" -->">
+                    <!-- TMPL_VAR name="branchname" -->
+                </option>
+            <!-- /TMPL_LOOP -->
+            </select>
+        </p>
+        <p>Limit palmares to
+                <select name="itemtype">
+                    <option value="">All item types</option>
+                    <!-- TMPL_LOOP name="itemtypeloop" -->
+                        <option value="<!-- TMPL_VAR name="value" -->">
+                            <!-- TMPL_VAR name="description" -->
+                        </option>
+                    <!-- /TMPL_LOOP -->
+                </select>
+        </p>
+        <p>and documents acquired in the last</p>
+        <p>
+        <label><input type="radio" name="timeLimit" value="3" CHECKED />3 
months</label>
+        </p>
+        <p>
+        <label><input type="radio" name="timeLimit" value="6" />6 
months</label>
+        </p>
+        <p>
+        <label><input type="radio" name="timeLimit" value="12" />12 
months</label>
+        </p>
+        <p>
+        <label><input type="radio" name="timeLimit" value="0" />No 
limit</label>
+        </p>
+        <p>
+    <input TYPE="submit" value="OK" class="button reports">
+    <input type="hidden" name="do_it" value="1">
+    </form>
+<!-- /TMPL_IF -->
+</div>
+<!-- TMPL_INCLUDE NAME="opac-bottom.inc" -->

Index: opac/opac-topissues.pl
===================================================================
RCS file: opac/opac-topissues.pl
diff -N opac/opac-topissues.pl
--- /dev/null   1 Jan 1970 00:00:00 -0000
+++ opac/opac-topissues.pl      20 Dec 2006 10:44:51 -0000      1.1.2.1
@@ -0,0 +1,127 @@
+#!/usr/bin/perl
+
+# $Id: opac-topissues.pl,v 1.1.2.1 2006/12/20 10:44:51 tipaul Exp $
+
+# Copyright 2000-2002 Katipo Communications
+#
+# This file is part of Koha.
+#
+# Koha is free software; you can redistribute it and/or modify it under the
+# terms of the GNU General Public License as published by the Free Software
+# Foundation; either version 2 of the License, or (at your option) any later
+# version.
+#
+# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
+# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
+# A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along with
+# Koha; if not, write to the Free Software Foundation, Inc., 59 Temple Place,
+# Suite 330, Boston, MA  02111-1307 USA
+
+use strict;
+use C4::Auth;
+use CGI;
+use C4::Context;
+use HTML::Template;
+use C4::Search;
+use C4::Output;
+use C4::Koha;
+use C4::Branch;
+use C4::Interface::CGI::Output;
+use Date::Manip;
+
+=head1 NAME
+
+plugin that shows a stats on borrowers
+
+=head1 DESCRIPTION
+
+
+=over2
+
+=cut
+
+my $input = new CGI;
+my $do_it=$input->param('do_it');
+
+my $branches = GetBranches();
+my $itemtypes = GetItemTypes();
+
+#warn "calcul : ".$calc;
+my ($template, $borrowernumber, $cookie)
+       = get_template_and_user({template_name => 'opac-topissues.tmpl',
+                               query => $input,
+                               type => "opac",
+                               authnotrequired => 1,
+                               debug => 1,
+                               });
+my $dbh = C4::Context->dbh;
+if ($do_it) {
+    # Displaying results
+    my $limit = $input->param('limit') || 10;
+    my $branch = $input->param('branch');
+    my $itemtype = $input->param('itemtype');
+    my $timeLimit = $input->param('timeLimit') || 0;
+    my $whereclause;
+    $whereclause .= 'items.homebranch='.$dbh->quote($branch)." AND " if 
($branch); 
+    $whereclause .= 'biblioitems.itemtype='.$dbh->quote($itemtype)." AND " if 
$itemtype;
+    $whereclause .= 'TO_DAYS(NOW()) - TO_DAYS(biblio.timestamp) <= 
'.$timeLimit*30 if $timeLimit;
+    $whereclause =~ s/ AND $//;
+    $whereclause = " WHERE ".$whereclause if $whereclause;
+    my $query = "SELECT biblio.timestamp, biblio.biblionumber, title, 
+                    author, sum( items.issues ) AS tot, biblioitems.itemtype,
+                    biblioitems.publishercode,biblioitems.publicationyear,
+                    itemtypes.description
+                    FROM biblio
+                    LEFT JOIN items USING (biblionumber)
+                    LEFT JOIN biblioitems USING (biblionumber)
+                    LEFT JOIN itemtypes USING (itemtype)
+                    $whereclause
+                    GROUP BY biblio.biblionumber
+                    ORDER BY tot DESC
+                    LIMIT $limit
+                    ";
+    warn "QU : $query";
+    my $sth = $dbh->prepare($query);
+    $sth->execute();
+    my @results;
+    while (my $line= $sth->fetchrow_hashref) {
+        push @results, $line;
+    }
+    warn ">>>".Data::Dumper::Dumper($branches);
+    $template->param(do_it => 1,
+        limit => $limit,
+        branch => $branches->{$branch}->{branchname},
+        itemtype => $itemtypes->{$itemtype}->{description},
+        timeLimit => $timeLimit,
+                    results_loop => address@hidden);
+    
+} else {       
+       my $branches = GetBranches;
+       my @branchloop;
+       foreach my $thisbranch (keys %$branches) {
+                       my %row =(value => $thisbranch,
+                                                                       
branchname => $branches->{$thisbranch}->{'branchname'},
+                                                       );
+                       push @branchloop, \%row;
+       }
+
+       #doctype
+       my $itemtypes = GetItemTypes;
+       my @itemtypeloop;
+       foreach my $thisitemtype (keys %$itemtypes) {
+                       my %row =(value => $thisitemtype,
+                                                                       
description => $itemtypes->{$thisitemtype}->{'description'},
+                                                       );
+                       push @itemtypeloop, \%row;
+       }
+       
+       $template->param(
+                                       branchloop =>address@hidden,
+                                       itemtypeloop =>address@hidden,
+                                       );
+}
+output_html_with_http_headers $input, $cookie, $template->output;
+
+1;




reply via email to

[Prev in Thread] Current Thread [Next in Thread]