Main Koha release repository
https://koha-community.org
Ви не можете вибрати більше 25 тем
Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.
82 рядки
1.9 KiB
82 рядки
1.9 KiB
package Koha::Template::Plugin::KohaNews;
|
|
|
|
# Copyright ByWater Solutions 2012
|
|
# Copyright BibLibre 2014
|
|
# Parts copyright Athens County Public Libraries 2019
|
|
|
|
# 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 3 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, see <http://www.gnu.org/licenses>.
|
|
|
|
use Modern::Perl;
|
|
|
|
use Template::Plugin;
|
|
use base qw( Template::Plugin );
|
|
|
|
use C4::Koha;
|
|
use C4::Context;
|
|
use C4::NewsChannels; # GetNewsToDisplay
|
|
|
|
sub get {
|
|
my ( $self, $params ) = @_;
|
|
|
|
my $display_location = $params->{location};
|
|
my $blocktitle = $params->{blocktitle};
|
|
my $lang = $params->{lang};
|
|
my $library = $params->{library} || "";
|
|
my $news_lang;
|
|
|
|
if( !$display_location ){
|
|
$news_lang = $lang;
|
|
} else {
|
|
$news_lang = $display_location."_".$lang;
|
|
}
|
|
|
|
my $content = &GetNewsToDisplay( $news_lang, $library );
|
|
|
|
if( @$content ){
|
|
return {
|
|
content => $content,
|
|
location => $display_location,
|
|
blocktitle => $blocktitle
|
|
};
|
|
} else {
|
|
return;
|
|
}
|
|
}
|
|
|
|
1;
|
|
|
|
=head1 NAME
|
|
|
|
Koha::Template::Plugin::KohaNews - TT Plugin for displaying Koha news
|
|
|
|
=head1 SYNOPSIS
|
|
|
|
[% USE KohaNews %]
|
|
|
|
[% KohaNews.get() %]
|
|
|
|
=head1 ROUTINES
|
|
|
|
=head2 get
|
|
|
|
In a template, you can get the all categories with
|
|
the following TT code: [% KohaNews.get() %]
|
|
|
|
=head1 AUTHOR
|
|
|
|
Owen Leonard <oleonard@myacpl.org>
|
|
|
|
=cut
|
|
|