View | Details | Raw Unified | Return to bug 11139
Collapse All | Expand All

(-)a/Koha/Template/Plugin/ItemTypes.pm (+6 lines)
Lines 35-38 sub GetDescription { Link Here
35
35
36
}
36
}
37
37
38
sub Get {
39
    my @itemtypes = @{ GetItemTypes(style => 'array') };
40
    @itemtypes = sort { $a->{description} cmp $b->{description} } @itemtypes;
41
    return \@itemtypes;
42
}
43
38
1;
44
1;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-topissues.inc (-14 / +35 lines)
Lines 1-3 Link Here
1
[% USE Koha %]
2
1
<div id="search-facets">
3
<div id="search-facets">
2
    <form method="get" action="/cgi-bin/koha/opac-topissues.pl">
4
    <form method="get" action="/cgi-bin/koha/opac-topissues.pl">
3
    <h4><a href="#" class="menu-collapse-toggle">Refine your search</a></h4>
5
    <h4><a href="#" class="menu-collapse-toggle">Refine your search</a></h4>
Lines 27-49 Link Here
27
                                [% END %]
29
                                [% END %]
28
                            </select></li>
30
                            </select></li>
29
31
30
                <li><label for="itemtype">Limit to: </label>
32
                [% AdvancedSearchTypes = Koha.Preference('AdvancedSearchTypes').split('\|') %]
31
                            <select name="itemtype" id="itemtype">
33
                [% IF AdvancedSearchTypes.grep('^itemtypes$').size %]
32
                                [% IF ( ccodesearch ) %]
34
                    <li>
33
                                    <option value="">All collections</option>
35
                        <label for="itemtype">Limit to: </label>
36
                        <select name="itemtype" id="itemtype">
37
                            <option value="">All item types</option>
38
                            [% FOREACH itemtype IN ItemTypes.Get() %]
39
                                [% IF itemtype.itemtype == selected_itemtype %]
40
                                    <option value="[% itemtype.itemtype %]" selected="selected">
34
                                [% ELSE %]
41
                                [% ELSE %]
35
                                    <option value="">All item types</option>
42
                                    <option value="[% itemtype.itemtype %]">
36
                                [% END %]
43
                                [% END %]
37
                                [% FOREACH itemtypeloo IN itemtypeloop %]
44
                                    [% itemtype.description %]
38
                                    [% IF ( itemtypeloo.selected ) %]
45
                                </option>
39
                                        <option value="[% itemtypeloo.value %]" selected="selected">
46
                            [% END %]
40
                                    [% ELSE %]
47
                        </select>
41
                                        <option value="[% itemtypeloo.value %]">
48
                    </li>
42
                                    [% END %]
49
                [% END %]
43
                                        [% itemtypeloo.description %]
50
44
                                    </option>
51
                [% IF AdvancedSearchTypes.grep('^ccode$').size %]
52
                    <li>
53
                        <label for="ccode">Limit to:</label>
54
                        <select name="ccode" id="ccode">
55
                            <option value="">All collections</option>
56
                            [% FOREACH ccode IN AuthorisedValues.Get('CCODE', selected_ccode, 1) %]
57
                                [% IF ccode.selected %]
58
                                    <option value="[% ccode.authorised_value %]" selected="selected">
59
                                [% ELSE %]
60
                                    <option value="[% ccode.authorised_value %]">
45
                                [% END %]
61
                                [% END %]
46
                            </select></li>
62
                                    [% ccode.lib %]
63
                                </option>
64
                            [% END %]
65
                        </select>
66
                    </li>
67
                [% END %]
47
68
48
                <li><label for="timeLimit">Acquired in the last:</label>
69
                <li><label for="timeLimit">Acquired in the last:</label>
49
                            <select name="timeLimit" id="timeLimit">
70
                            <select name="timeLimit" id="timeLimit">
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-topissues.tt (-73 / +8 lines)
Lines 22-41 Link Here
22
        <div class="container-fluid">
22
        <div class="container-fluid">
23
            <div class="row-fluid">
23
            <div class="row-fluid">
24
                <div class="span2">
24
                <div class="span2">
25
                    [% IF ( results ) %]
25
                    <div id="usertopissues">
26
                        <div id="usertopissues">
26
                        [% INCLUDE 'opac-topissues.inc' %]
27
                            [% INCLUDE 'opac-topissues.inc' %]
28
                            [% IF ( OpacNav || OpacNavBottom ) %]
29
                                [% INCLUDE 'navigation.inc' %]
30
                            [% END %]
31
                        </div>
32
                    [% ELSE %]
33
                        [% IF ( OpacNav || OpacNavBottom ) %]
27
                        [% IF ( OpacNav || OpacNavBottom ) %]
34
                            <div id="leftmenus">
28
                            [% INCLUDE 'navigation.inc' %]
35
                                [% INCLUDE 'navigation.inc' %]
36
                            </div>
37
                        [% END %]
29
                        [% END %]
38
                    [% END %]
30
                    </div>
39
                </div>
31
                </div>
40
                <div class="span10">
32
                <div class="span10">
41
                    <div id="topissues" class="maincontent">
33
                    <div id="topissues" class="maincontent">
Lines 44-51 Link Here
44
                            <table id="topissuest" class="table table-bordered table-striped">
36
                            <table id="topissuest" class="table table-bordered table-striped">
45
                                <caption>
37
                                <caption>
46
                                    The [% limit %] most checked-out
38
                                    The [% limit %] most checked-out
47
                                    [% IF ( itemtype ) %]
39
                                    [% IF selected_itemtype %]
48
                                        [% itemtype %]
40
                                        [% ItemTypes.GetDescription(selected_itemtype) %]
49
                                    [% END %]
41
                                    [% END %]
50
                                    [% IF ( branch ) %]
42
                                    [% IF ( branch ) %]
51
                                    at
43
                                    at
Lines 93-157 Link Here
93
                                </tbody>
85
                                </tbody>
94
                            </table>
86
                            </table>
95
                        [% ELSE %]
87
                        [% ELSE %]
96
                            <form method="post" action="/cgi-bin/koha/opac-topissues.pl">
88
                            No results, try to change filters.
97
                                <fieldset class="rows">
89
                        [% END # / IF results %]
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 -->
90
                    </div> <!-- / #topissues -->
156
                </div> <!-- / .span10 -->
91
                </div> <!-- / .span10 -->
157
            </div> <!-- / .row-fluid -->
92
            </div> <!-- / .row-fluid -->
(-)a/opac/opac-topissues.pl (-46 / +16 lines)
Lines 73-79 if (!$do_it && C4::Context->userenv && C4::Context->userenv->{'branch'} ) { Link Here
73
my $itemtype = $input->param('itemtype') || '';
73
my $itemtype = $input->param('itemtype') || '';
74
my $timeLimit = $input->param('timeLimit') || 3;
74
my $timeLimit = $input->param('timeLimit') || 3;
75
my $advanced_search_types = C4::Context->preference('AdvancedSearchTypes');
75
my $advanced_search_types = C4::Context->preference('AdvancedSearchTypes');
76
76
my @advanced_search_types = split /\|/, $advanced_search_types;
77
77
78
my $params = {
78
my $params = {
79
    count => $limit,
79
    count => $limit,
Lines 81-133 my $params = { Link Here
81
    newness => $timeLimit < 999 ? $timeLimit * 30 : undef,
81
    newness => $timeLimit < 999 ? $timeLimit * 30 : undef,
82
};
82
};
83
83
84
if($advanced_search_types eq 'ccode'){
84
@advanced_search_types = grep /^(ccode|itemtypes)$/, @advanced_search_types;
85
    $params->{ccode} = $itemtype;
85
foreach my $type (@advanced_search_types) {
86
    $template->param(ccodesearch => 1);
86
    if ($type eq 'itemtypes') {
87
} else {
87
        $type = 'itemtype';
88
    $params->{itemtype} = $itemtype;
88
    }
89
    $template->param(itemtypesearch => 1);
89
    $params->{$type} = $input->param($type);
90
    $template->param('selected_' . $type => $input->param($type));
90
}
91
}
91
92
92
my @results = GetTopIssues($params);
93
my @results = GetTopIssues($params);
93
94
94
$template->param(do_it => 1,
95
                limit => $limit,
96
                branch => $branches->{$branch}->{branchname},
97
                itemtype => $itemtypes->{$itemtype}->{description},
98
                timeLimit => $timeLimit,
99
                results => \@results,
100
                );
101
102
$template->param( branchloop => GetBranchesLoop($branch));
103
104
# the index parameter is different for item-level itemtypes
105
my $itype_or_itemtype = (C4::Context->preference("item-level_itypes"))?'itype':'itemtype';
106
$itemtypes = GetItemTypes;
107
my @itemtypesloop;
108
if (!$advanced_search_types or $advanced_search_types eq 'itemtypes') {
109
        foreach my $thisitemtype ( sort {$itemtypes->{$a}->{'description'} cmp $itemtypes->{$b}->{'description'} } keys %$itemtypes ) {
110
        my %row =( value => $thisitemtype,
111
                   description => $itemtypes->{$thisitemtype}->{'description'},
112
                   selected    => $thisitemtype eq $itemtype,
113
            );
114
        push @itemtypesloop, \%row;
115
        }
116
} else {
117
    my $advsearchtypes = GetAuthorisedValues($advanced_search_types, '', 'opac');
118
        for my $thisitemtype (@$advsearchtypes) {
119
                my $selected;
120
            $selected = 1 if $thisitemtype->{authorised_value} eq $itemtype;
121
                my %row =( value => $thisitemtype->{authorised_value},
122
                selected    => $thisitemtype eq $itemtype,
123
                description => $thisitemtype->{'lib'},
124
            );
125
                push @itemtypesloop, \%row;
126
        }
127
}
128
129
$template->param(
95
$template->param(
130
                 itemtypeloop =>\@itemtypesloop,
96
    limit => $limit,
131
                );
97
    branch => $branches->{$branch}->{branchname},
132
output_html_with_http_headers $input, $cookie, $template->output;
98
    timeLimit => $timeLimit,
99
    results => \@results,
100
);
133
101
134
- 
102
$template->param(branchloop => GetBranchesLoop($branch));
103
104
output_html_with_http_headers $input, $cookie, $template->output;

Return to bug 11139