Bug 766: Update POD for AuthorisedValues TT plugin
[koha.git] / Koha / Template / Plugin / AuthorisedValues.pm
1 package Koha::Template::Plugin::AuthorisedValues;
2
3 use Modern::Perl;
4
5 use Template::Plugin;
6 use base qw( Template::Plugin );
7
8 use Encode qw{encode decode};
9
10 use C4::Koha;
11 use C4::Charset;
12
13 sub GetByCode {
14     my ( $self, $category, $code, $opac ) = @_;
15     return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) );
16 }
17
18 sub Get {
19     my ( $self, $category, $selected, $opac ) = @_;
20     return GetAuthorisedValues( $category, $selected, $opac );
21 }
22
23 sub GetAuthValueDropbox {
24     my ( $self, $category, $default ) = @_;
25     return C4::Koha::GetAuthvalueDropbox($category, $default);
26 }
27
28 1;
29
30 =head1 NAME
31
32 Koha::Template::Plugin::AuthorisedValues - TT Plugin for authorised values
33
34 =head1 SYNOPSIS
35
36 [% USE AuthorisedValues %]
37
38 [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
39
40 [% AuthorisedValues.GetAuthValueDropbox( $category, $default ) %]
41
42 =head1 ROUTINES
43
44 =head2 GetByCode
45
46 In a template, you can get the description for an authorised value with
47 the following TT code: [% AuthorisedValues.GetByCode( 'CATEGORY', 'AUTHORISED_VALUE_CODE', 'IS_OPAC' ) %]
48
49 The parameters are identical to those used by the subroutine C4::Koha::GetAuthorisedValueByCode.
50
51 =head2 GetAuthValueDropbox
52
53 The parameters are identical to those used by the subroutine C4::Koha::GetAuthValueDropbox
54
55 =head1 AUTHOR
56
57 Kyle M Hall <kyle@bywatersolutions.com>
58
59 Jonathan Druart <jonathan.druart@biblibre.com>
60
61 =head1 COPYRIGHT
62
63 Copyright ByWater Solutions 2012
64
65 Copyright BibLibre 2013
66
67 =head1 LICENSE
68
69 This file is part of Koha.
70
71 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
72 Foundation; either version 3 of the License, or (at your option) any later version.
73
74 You should have received a copy of the GNU General Public License along
75 with Koha; if not, write to the Free Software Foundation, Inc.,
76 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
77
78 =cut