Lines 25-30
use base qw( Template::Plugin );
Link Here
|
25 |
use Encode qw{encode decode}; |
25 |
use Encode qw{encode decode}; |
26 |
|
26 |
|
27 |
use C4::Koha; |
27 |
use C4::Koha; |
|
|
28 |
use C4::Charset; |
28 |
|
29 |
|
29 |
=pod |
30 |
=pod |
30 |
|
31 |
|
Lines 43-46
sub GetByCode {
Link Here
|
43 |
return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) ); |
44 |
return encode( 'UTF-8', GetAuthorisedValueByCode( $category, $code, $opac ) ); |
44 |
} |
45 |
} |
45 |
|
46 |
|
|
|
47 |
sub BuildDropbox { |
48 |
my ( $self, $name, $category, $default, $params ) = @_; |
49 |
my $class = $params->{class}; |
50 |
my $avs = C4::Koha::GetAuthvalueDropbox($category, $default); |
51 |
my $size = $params->{size} || 20; |
52 |
my $html; |
53 |
if ( @$avs ) { |
54 |
$html = qq|<select id="$name" name="$name" class="$class" >|; |
55 |
for my $av ( @$avs ) { |
56 |
if ( $av->{default} ) { |
57 |
$html .= qq|<option value="$av->{value}" selected="selected">$av->{label}</option>|; |
58 |
} else { |
59 |
$html .= qq|<option value="$av->{value}">$av->{label}</option>|; |
60 |
} |
61 |
} |
62 |
$html .= q|</select>|; |
63 |
} else { |
64 |
$html .= qq|<input type="text" id="$name" name="$name" size="$size" value="$default" class="$class" />|; |
65 |
|
66 |
} |
67 |
|
68 |
return encode( 'UTF-8', $html ); |
69 |
} |
70 |
|
46 |
1; |
71 |
1; |
47 |
- |
|
|