Line 0
Link Here
|
|
|
1 |
package Koha::Template::Plugin::KohaNews; |
2 |
|
3 |
# Copyright ByWater Solutions 2012 |
4 |
# Copyright BibLibre 2014 |
5 |
# Parts copyright Athens County Public Libraries 2019 |
6 |
|
7 |
# This file is part of Koha. |
8 |
# |
9 |
# Koha is free software; you can redistribute it and/or modify it |
10 |
# under the terms of the GNU General Public License as published by |
11 |
# the Free Software Foundation; either version 3 of the License, or |
12 |
# (at your option) any later version. |
13 |
# |
14 |
# Koha is distributed in the hope that it will be useful, but |
15 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
17 |
# GNU General Public License for more details. |
18 |
# |
19 |
# You should have received a copy of the GNU General Public License |
20 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
21 |
|
22 |
use Modern::Perl; |
23 |
|
24 |
use Template::Plugin; |
25 |
use base qw( Template::Plugin ); |
26 |
|
27 |
use C4::Koha; |
28 |
use C4::Context; |
29 |
use C4::NewsChannels; # GetNewsToDisplay |
30 |
|
31 |
sub get { |
32 |
my ( $self, $params ) = @_; |
33 |
|
34 |
my $display_location = $params->{location}; |
35 |
my $lang = $params->{lang}; |
36 |
my $library = $params->{library} || ""; |
37 |
my $news_lang; |
38 |
|
39 |
if( !$display_location ){ |
40 |
$news_lang = $lang; |
41 |
} else { |
42 |
$news_lang = $display_location."_".$lang; |
43 |
} |
44 |
|
45 |
my $content = &GetNewsToDisplay( $news_lang, $library ); |
46 |
|
47 |
return $content; |
48 |
} |
49 |
|
50 |
1; |
51 |
|
52 |
=head1 NAME |
53 |
|
54 |
Koha::Template::Plugin::KohaNews - TT Plugin for displaying Koha news |
55 |
|
56 |
=head1 SYNOPSIS |
57 |
|
58 |
[% USE KohaNews %] |
59 |
|
60 |
[% KohaNews.get() %] |
61 |
|
62 |
=head1 ROUTINES |
63 |
|
64 |
=head2 get |
65 |
|
66 |
In a template, you can get the all categories with |
67 |
the following TT code: [% KohaNews.get() %] |
68 |
|
69 |
=head1 AUTHOR |
70 |
|
71 |
Owen Leonard <oleonard@myacpl.org> |
72 |
|
73 |
=cut |