8 use Koha
::SuggestionEngine
;
9 use Module
::Load
::Conditional
qw(can_load);
14 my ($template, $loggedinuser, $cookie)
15 = get_template_and_user
({template_name
=> "admin/didyoumean.tt",
19 flagsrequired
=> {parameters
=> 'parameters_remaining_permissions'},
23 my $opacplugins = from_json
(C4
::Context
->preference('OPACdidyoumean') || '[]');
25 my $intraplugins = from_json
(C4
::Context
->preference('INTRAdidyoumean') || '[]');
27 my @pluginlist = Koha
::SuggestionEngine
::AvailablePlugins
();
28 foreach my $plugin (@pluginlist) {
29 next if $plugin eq 'Koha::SuggestionEngine::Plugin::Null';
30 next unless (can_load
( modules
=> { "$plugin" => undef } ));
31 push @
$opacplugins, { name
=> $plugin->NAME } unless grep { $_->{name
} eq $plugin->NAME } @
$opacplugins;
32 push @
$intraplugins, { name
=> $plugin->NAME } unless grep { $_->{name
} eq $plugin->NAME } @
$intraplugins;
34 $template->{VARS
}->{OPACpluginlist
} = $opacplugins;
35 $template->{VARS
}->{INTRApluginlist
} = $intraplugins;
36 output_html_with_http_headers
$input, $cookie, $template->output;