commit | author | age
|
175a52
|
1 |
<?php |
JK |
2 |
__autoload('ibd'); |
|
3 |
|
|
4 |
class YAZ_ibd implements ibd_module { |
|
5 |
var $name, $yaz_server; |
|
6 |
|
|
7 |
function __construct($name, $server) { |
|
8 |
$this->name = $name; |
|
9 |
$this->yaz_server = $server; |
|
10 |
} |
|
11 |
|
|
12 |
function zapytanie_info($ISBN=NULL, $ISSN=NULL, $tytul=NULL, $autor=NULL, $wydawnictwo=NULL) { |
|
13 |
if(!empty($ISBN)) { |
|
14 |
$attrs[] = '@attr 1=7 "'.$ISBN.'"'; |
|
15 |
} |
|
16 |
if(!empty($ISSN)) { |
|
17 |
$attrs[] = '@attr 1=8 "'.$ISSN.'"'; |
|
18 |
} |
|
19 |
if(!empty($tytul)) { |
|
20 |
$attrs[] = '@attr 1=4 "'.$tytul.'"'; |
|
21 |
} |
|
22 |
if(!empty($autor)) { |
|
23 |
$attrs[] = '@attr 1=1003 "'.$autor.'"'; |
|
24 |
} |
|
25 |
if(!empty($wydawnictwo)) { |
|
26 |
$attrs[] = '@attr 1=1018 "'.$wydawnictwo.'"'; |
|
27 |
} |
|
28 |
|
|
29 |
if(count($attrs)==1) { |
|
30 |
return $attrs[0]; |
|
31 |
} |
|
32 |
elseif(count($attrs)>1) { |
|
33 |
$return = '@and '.array_pop($attrs).' '.array_pop($attrs); |
|
34 |
} |
|
35 |
|
|
36 |
if(count($attrs)>0) { |
|
37 |
foreach($attrs as $value) { |
|
38 |
$return = '@and '.$value.' '.$return; |
|
39 |
} |
|
40 |
} |
|
41 |
|
|
42 |
return $return; |
|
43 |
} |
|
44 |
|
|
45 |
function szukaj_info($tytul=NULL, $autor=NULL, $wydawnictwo=NULL) { |
|
46 |
YAZ::connect( $this->yaz_server ); |
|
47 |
YAZ::search( self::zapytanie_info( NULL, NULL, $tytul, $autor, $wydawnictwo ) ); |
|
48 |
|
|
49 |
return YAZ::return_arrays(); |
|
50 |
} |
|
51 |
|
|
52 |
function szukaj_ISBN($kod) { |
|
53 |
YAZ::connect( $this->yaz_server ); |
|
54 |
YAZ::search( self::zapytanie_info( $kod ) ); |
|
55 |
if(substr($kod, 0, 3)=='978') { |
|
56 |
YAZ::search( self::zapytanie_info( convert::ISBN13_to_ISBN10( $kod ) ) ); |
|
57 |
} |
|
58 |
|
|
59 |
return YAZ::return_arrays(); |
|
60 |
} |
|
61 |
|
|
62 |
function szukaj_ISSN($kod) { |
|
63 |
YAZ::connect( $this->yaz_server ); |
|
64 |
YAZ::search( self::zapytanie_info( convert::ISSN13_to_ISSN8( $kod ) ) ); |
|
65 |
|
|
66 |
return YAZ::return_arrays(); |
|
67 |
} |
|
68 |
} |
|
69 |
?> |