View | Details | Raw Unified | Return to bug 15798
Collapse All | Expand All

(-)a/C4/Koha.pm (-70 lines)
Lines 50-56 BEGIN { Link Here
50
        &GetFrameworksLoop
50
        &GetFrameworksLoop
51
		&getallthemes
51
		&getallthemes
52
		&getFacets
52
		&getFacets
53
		&displayServers
54
		&getnbpages
53
		&getnbpages
55
		&get_infos_of
54
		&get_infos_of
56
		&get_notforloan_label_of
55
		&get_notforloan_label_of
Lines 1010-1083 SELECT lib, Link Here
1010
    return \%notforloan_label_of;
1009
    return \%notforloan_label_of;
1011
}
1010
}
1012
1011
1013
=head2 displayServers
1014
1015
   my $servers = displayServers();
1016
   my $servers = displayServers( $position );
1017
   my $servers = displayServers( $position, $type );
1018
1019
displayServers returns a listref of hashrefs, each containing
1020
information about available z3950 servers. Each hashref has a format
1021
like:
1022
1023
    {
1024
      'checked'    => 'checked',
1025
      'encoding'   => 'utf8',
1026
      'icon'       => undef,
1027
      'id'         => 'LIBRARY OF CONGRESS',
1028
      'label'      => '',
1029
      'name'       => 'server',
1030
      'opensearch' => '',
1031
      'value'      => 'lx2.loc.gov:210/',
1032
      'zed'        => 1,
1033
    },
1034
1035
=cut
1036
1037
sub displayServers {
1038
    my ( $position, $type ) = @_;
1039
    my $dbh = C4::Context->dbh;
1040
1041
    my $strsth = 'SELECT * FROM z3950servers';
1042
    my @where_clauses;
1043
    my @bind_params;
1044
1045
    if ($position) {
1046
        push @bind_params,   $position;
1047
        push @where_clauses, ' position = ? ';
1048
    }
1049
1050
    if ($type) {
1051
        push @bind_params,   $type;
1052
        push @where_clauses, ' type = ? ';
1053
    }
1054
1055
    # reassemble where clause from where clause pieces
1056
    if (@where_clauses) {
1057
        $strsth .= ' WHERE ' . join( ' AND ', @where_clauses );
1058
    }
1059
1060
    my $rq = $dbh->prepare($strsth);
1061
    $rq->execute(@bind_params);
1062
    my @primaryserverloop;
1063
1064
    while ( my $data = $rq->fetchrow_hashref ) {
1065
        push @primaryserverloop,
1066
          { label    => $data->{description},
1067
            id       => $data->{name},
1068
            name     => "server",
1069
            value    => $data->{host} . ":" . $data->{port} . "/" . $data->{database},
1070
            encoding => ( $data->{encoding} ? $data->{encoding} : "iso-5426" ),
1071
            checked  => "checked",
1072
            icon     => $data->{icon},
1073
            zed        => $data->{type} eq 'zed',
1074
            opensearch => $data->{type} eq 'opensearch'
1075
          };
1076
    }
1077
    return \@primaryserverloop;
1078
}
1079
1080
1081
=head2 GetKohaImageurlFromAuthorisedValues
1012
=head2 GetKohaImageurlFromAuthorisedValues
1082
1013
1083
$authhorised_value = GetKohaImageurlFromAuthorisedValues( $category, $authvalcode );
1014
$authhorised_value = GetKohaImageurlFromAuthorisedValues( $category, $authvalcode );
1084
- 

Return to bug 15798