Lines 19-27
package C4::NewsChannels;
Link Here
|
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
19 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
20 |
|
20 |
|
21 |
use Modern::Perl; |
21 |
use Modern::Perl; |
|
|
22 |
|
22 |
use C4::Context; |
23 |
use C4::Context; |
23 |
use Koha::DateUtils; |
24 |
use Koha::DateUtils; |
24 |
|
25 |
|
|
|
26 |
use Carp qw(croak); |
27 |
|
25 |
use vars qw(@ISA @EXPORT); |
28 |
use vars qw(@ISA @EXPORT); |
26 |
|
29 |
|
27 |
BEGIN { |
30 |
BEGIN { |
Lines 211-219
sub GetNewsToDisplay {
Link Here
|
211 |
my $sth = $dbh->prepare($query); |
214 |
my $sth = $dbh->prepare($query); |
212 |
$lang = $lang // q{}; |
215 |
$lang = $lang // q{}; |
213 |
$sth->execute($lang,$branch); |
216 |
$sth->execute($lang,$branch); |
|
|
217 |
|
218 |
my $use_template_cache = C4::Context->config('template_cache_dir') && defined $ENV{GATEWAY_INTERFACE}; |
219 |
my $template = Template->new( |
220 |
{ |
221 |
EVAL_PERL => 1, |
222 |
ABSOLUTE => 1, |
223 |
PLUGIN_BASE => 'Koha::Template::Plugin', |
224 |
COMPILE_EXT => $use_template_cache ? '.ttc' : '', |
225 |
COMPILE_DIR => $use_template_cache ? C4::Context->config('template_cache_dir') : '', |
226 |
FILTERS => {}, |
227 |
ENCODING => 'UTF-8', |
228 |
} |
229 |
) or die Template->error(); |
230 |
|
214 |
my @results; |
231 |
my @results; |
215 |
while ( my $row = $sth->fetchrow_hashref ){ |
232 |
while ( my $row = $sth->fetchrow_hashref ){ |
216 |
$row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ), dateonly => 1 }); |
233 |
$row->{newdate} = output_pref({ dt => dt_from_string( $row->{newdate} ), dateonly => 1 }); |
|
|
234 |
|
235 |
my $content = $row->{content}; |
236 |
my $output; |
237 |
$template->process( \$content, {}, \$output ) || croak "ERROR PROCESSING TEMPLATE: " . $template->error(); |
238 |
$row->{content} = $output; |
239 |
|
217 |
push @results, $row; |
240 |
push @results, $row; |
218 |
} |
241 |
} |
219 |
return \@results; |
242 |
return \@results; |
220 |
- |
|
|