Bug 14788: Move opac-topissues.pl code into C4::Circulation
[koha.git] / koha-tmpl / opac-tmpl / bootstrap / en / modules / opac-topissues.tt
1 [% USE Koha %]
2 [% USE AuthorisedValues %]
3 [% USE ItemTypes %]
4 [% INCLUDE 'doc-head-open.inc' %]
5 <title>[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog &rsaquo; Most popular titles</title>
6 [% INCLUDE 'doc-head-close.inc' %]
7 [% BLOCK cssinclude %]
8     <style type="text/css">
9         #search-facets fieldset { border: 0; margin: 0;padding:.3em;}#search-facets ol{padding:.3em;}#search-facets li {list-style-type:none;padding:4px 4px;}#search-facets label{font-weight:bold;display:block;margin:.2em 0;}#search-facets fieldset.action {padding-left:4px;margin:.3em;};
10     </style>
11 [% END %]
12 </head>
13 [% INCLUDE 'bodytag.inc' bodyid='opac-topissues' bodyclass='scrollto' %]
14 [% INCLUDE 'masthead.inc' %]
15
16     <div class="main">
17         <ul class="breadcrumb">
18             <li><a href="/cgi-bin/koha/opac-main.pl">Home</a> <span class="divider">&rsaquo;</span></li>
19             <li><a href="#">Most popular titles</a></li>
20         </ul>
21
22         <div class="container-fluid">
23             <div class="row-fluid">
24                 <div class="span2">
25                     [% IF ( results ) %]
26                         <div id="usertopissues">
27                             [% INCLUDE 'opac-topissues.inc' %]
28                             [% IF ( OpacNav || OpacNavBottom ) %]
29                                 [% INCLUDE 'navigation.inc' %]
30                             [% END %]
31                         </div>
32                     [% ELSE %]
33                         [% IF ( OpacNav || OpacNavBottom ) %]
34                             <div id="leftmenus">
35                                 [% INCLUDE 'navigation.inc' %]
36                             </div>
37                         [% END %]
38                     [% END %]
39                 </div>
40                 <div class="span10">
41                     <div id="topissues" class="maincontent">
42
43                         [% IF ( results ) %]
44                             <table id="topissuest" class="table table-bordered table-striped">
45                                 <caption>
46                                     The [% limit %] most checked-out
47                                     [% IF ( itemtype ) %]
48                                         [% itemtype %]
49                                     [% END %]
50                                     [% IF ( branch ) %]
51                                     at
52                                     [% branch %]
53                                     [% END %]
54                                     [% IF ( timeLimit != 999 ) %]
55                                     in the past [% timeLimit |html %] months
56                                     [% ELSE %] of all time[% END %]
57                                 </caption>
58                                 <thead>
59                                     <tr>
60                                         <th>Title</th>
61                                         <th>[% IF ( ccodesearch ) %]Collection[% ELSE %]Item type[% END %]</th>
62                                         <th>Checkouts</th>
63                                         [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]<th>&nbsp;</th>[% END %]
64                                     </tr>
65                                 </thead>
66                                 <tbody>
67                                     [% FOREACH result IN results %]
68                                         <tr>
69                                             <td><a class="title" href="/cgi-bin/koha/opac-detail.pl?biblionumber=[% result.biblionumber %]">[% result.title |html %]</a><p>[% result.author %]
70                                             [% IF ( result.publishercode ) %]- [% result.publishercode %][% END %]
71                                             [% IF ( result.place ) %][% result.place %][% END %]
72                                             [% IF ( result.publicationyear ) %]
73                                                 [% result.publicationyear %]
74                                             [% ELSIF ( result.copyrightdate ) %]
75                                                 [% result.copyrightdate %]
76                                             [% END %]
77                                             [% IF ( result.pages ) %] - [% result.pages %][% END %]
78                                             [% IF ( result.item('size') ) %][% result.item('size') %][% END %]</p>
79                                             </td>
80                                             <td>
81                                               [% IF Koha.Preference('AdvancedSearchTypes') == 'ccode' %]
82                                                 <span class="tdlabel">Collection</span>
83                                                 [% AuthorisedValues.GetByCode('ccode', result.ccode, 1) %]
84                                               [% ELSE %]
85                                                 <span class="tdlabel">Item type</span>
86                                                 [% ItemTypes.GetDescription(result.itemtype) %]
87                                               [% END %]
88                                             </td>
89                                             <td><span class="tdlabel">Checkouts: </span> <span title="[% result.count %]">[% result.count %]</span></td>
90                                             [% IF Koha.Preference( 'opacuserlogin' ) == 1 %]<td>[% IF Koha.Preference( 'RequestOnOpac' ) == 1 %][% UNLESS ( result.norequests ) %]<a href="/cgi-bin/koha/opac-reserve.pl?biblionumber=[% result.biblionumber %]">Place hold</a>[% END %][% END %]</td>[% END %]
91                                             </tr>
92                                     [% END %]
93                                 </tbody>
94                             </table>
95                         [% ELSE %]
96                             <form method="post" action="/cgi-bin/koha/opac-topissues.pl">
97                                 <fieldset class="rows">
98                                 <legend>See the most popular titles</legend>
99                                     <ol>
100                                         <li><label for="limit">Show the top </label> <select name="limit" id="limit">
101                                                     [% IF ( limit == 10 ) %]<option value ="10" selected="selected">10 titles</option>[% ELSE %]<option value="10">10 titles</option>[% END %]
102                                                     [% IF ( limit == 15 ) %]<option value ="15" selected="selected">15 titles</option>[% ELSE %]<option value="15">15 titles</option>[% END %]
103                                                     [% IF ( limit == 20 ) %]<option value ="20" selected="selected">20 titles</option>[% ELSE %]<option value="20">20 titles</option>[% END %]
104                                                     [% IF ( limit == 30 ) %]<option value ="30" selected="selected">30 titles</option>[% ELSE %]<option value="30">30 titles</option>[% END %]
105                                                     [% IF ( limit == 40 ) %]<option value ="40" selected="selected">40 titles</option>[% ELSE %]<option value="40">40 titles</option>[% END %]
106                                                     [% IF ( limit == 50 ) %]<option value ="50" selected="selected">50 titles</option>[% ELSE %]<option value="50">50 titles</option>[% END %]
107                                                     [% IF ( limit == 100 ) %]<option value ="100" selected="selected">100 titles</option>[% ELSE %]<option value="100">100 titles</option>[% END %]
108                                                 </select>
109                                         </li>
110                                         <li>
111                                             <label for="branch">From: </label>
112                                             <select name="branch" id="branch">
113                                             <option value="">All libraries</option>
114                                             [% FOREACH branchloo IN branchloop %]
115                                                 [% IF ( branchloo.selected ) %]
116                                                     <option value="[% branchloo.value %]" selected="selected">[% branchloo.branchname %]</option>
117                                                 [% ELSE %]
118                                                     <option value="[% branchloo.value %]">[% branchloo.branchname %]</option>
119                                                 [% END %]
120                                             [% END %]
121                                             </select>
122                                         </li>
123                                         <li>
124                                             <label for="itemtype">Limit to: </label>
125                                             <select name="itemtype" id="itemtype">
126                                                 [% IF ( ccodesearch ) %]
127                                                     <option value="">All collections</option>
128                                                 [% ELSE %]
129                                                     <option value="">All item types</option>
130                                                 [% END %]
131                                                 [% FOREACH itemtypeloo IN itemtypeloop %]
132                                                     [% IF ( itemtypeloo.selected ) %]<option value="[% itemtypeloo.value %]" selected="selected">[% ELSE %]<option value="[% itemtypeloo.value %]">[% END %]
133                                                         [% itemtypeloo.description %]
134                                                     </option>
135                                                 [% END %]
136                                             </select>
137                                         </li>
138                                         <li>
139                                             <label for="timeLimit">of the last:</label>
140                                             <select name="timeLimit" id="timeLimit">
141                                                 [% IF ( timeLimit == 3 ) %]<option value="3" selected="selected">3 months</option>[% ELSE %]<option value="3">3 months</option>[% END %]
142                                                  [% IF ( timeLimit == 6 ) %]<option value="6" selected="selected">6 months</option>[% ELSE %]<option value="6">6 months</option>[% END %]
143                                                  [% IF ( timeLimit == 12 ) %]<option value="12" selected="selected">12 months</option>[% ELSE %]<option value="12">12 months</option>[% END %]
144                                                  [% IF ( timeLimit == 999 ) %]<option value="999" selected="selected">No limit</option>[% ELSE %]<option value="999">No limit</option>[% END %]
145                                             </select>
146                                         </li>
147                                     </ol>
148                                     <input type="hidden" name="do_it" value="1" />
149                                 </fieldset>
150                                 <fieldset class="action">
151                                     <input type="submit" class="btn" value="Submit" />
152                                 </fieldset>
153                             </form>
154                        [% END # / IF results %]
155                     </div> <!-- / #topissues -->
156                 </div> <!-- / .span10 -->
157             </div> <!-- / .row-fluid -->
158         </div> <!-- / .container-fluid -->
159     </div> <!-- / .main -->
160
161 [% INCLUDE 'opac-bottom.inc' %]
162 [% BLOCK jsinclude %]
163 [% INCLUDE 'datatables.inc' %]
164 <script type="text/javascript">
165 //<![CDATA[
166     $(function() {
167         $("#topissuest").dataTable($.extend(true, {}, dataTablesDefaults, {
168             "aaSorting": [ [2, "desc"], [0, "asc"] ],
169             "aoColumnDefs": [
170               [% IF ( opacuserlogin ) %]{ "aTargets": [ -1 ], "bSortable": false, "bSearchable": false }[% END %]
171             ],
172             "aoColumns": [
173                 { "sType": "anti-the" },
174                 null,
175                 { "sType": "title-numeric" },
176                 [% IF ( opacuserlogin ) %]null,[% END %]
177             ]
178         }));
179     });
180 function Dopop(link) {
181     newin=window.open(link,'width=500,height=400,toolbar=false,scrollbars=yes');
182 }
183 //]]>
184 </script>
185 [% END %]