Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
buechereielektrik:unapi:unapi.inc.php [2010-01-27 20:29] – rosenke | buechereielektrik:unapi:unapi.inc.php [2010-03-03 17:13] – strols | ||
---|---|---|---|
Line 52: | Line 52: | ||
| | ||
* | * | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
| | ||
| | ||
Line 262: | Line 268: | ||
| | ||
| | ||
- | | + | |
**/ | **/ | ||
function getArrayNice($array_raw) { | function getArrayNice($array_raw) { | ||
Line 322: | Line 328: | ||
$res[' | $res[' | ||
$res[' | $res[' | ||
+ | |||
// edition | // edition | ||
$res[' | $res[' | ||
Line 332: | Line 339: | ||
$res[' | $res[' | ||
$res[' | $res[' | ||
+ | // Erscheinungsverlauf | ||
+ | $res[' | ||
+ | $res[' | ||
+ | $res[' | ||
+ | $res[' | ||
// pages | // pages | ||
Line 348: | Line 360: | ||
$res[' | $res[' | ||
$res[' | $res[' | ||
+ | |||
+ | // ISSN | ||
+ | $res[' | ||
+ | $res[' | ||
+ | $res[' | ||
+ | $res[' | ||
// DNB Number | // DNB Number | ||
Line 366: | Line 384: | ||
$res[' | $res[' | ||
$res[' | $res[' | ||
+ | |||
+ | // ZDB identification number | ||
+ | $res[' | ||
+ | $res[' | ||
+ | $res[' | ||
+ | $res[' | ||
// PPN | // PPN | ||
Line 386: | Line 410: | ||
// DDC | // DDC | ||
- | $res['DDC'] = strtr($record[' | + | $res['ddc'] = strtr($record[' |
- | $res[' | + | $res[' |
- | $res[' | + | $res[' |
- | $res[' | + | $res[' |
// RVK | // RVK | ||
- | $res['RVK'] = strtr($record[' | + | $res['rvk'] = strtr($record[' |
- | $res[' | + | $res[' |
- | $res[' | + | $res[' |
- | $res[' | + | $res[' |
+ | |||
+ | // EZB link | ||
+ | $res[' | ||
+ | $res[' | ||
+ | $res[' | ||
+ | $res[' | ||
// return result | // return result | ||
Line 804: | Line 834: | ||
| | ||
| | ||
+ | | ||
| | ||
| | ||
Line 886: | Line 917: | ||
| | ||
| | ||
- | | + | |
**/ | **/ | ||
function getArray() { | function getArray() { | ||
Line 947: | Line 978: | ||
if (!empty($record_nice[' | if (!empty($record_nice[' | ||
- | // check type and choose right BibTeX-type | + | /* |
+ | | ||
+ | | ||
+ | **/ | ||
if (preg_match('/ | if (preg_match('/ | ||
- | // type | + | // type: book |
$res = "@book {"; | $res = "@book {"; | ||
Line 959: | Line 993: | ||
$i = array(' | $i = array(' | ||
' | ' | ||
+ | |||
+ | // fetch them from array, format and output them | ||
+ | foreach ($i as $j) { | ||
+ | $res .= $this-> | ||
+ | } | ||
+ | |||
+ | // get call number, format and output it | ||
+ | $res .= $this-> | ||
+ | } elseif (preg_match('/ | ||
+ | // type: journal | ||
+ | $res = "@misc {"; | ||
+ | |||
+ | // create identifier | ||
+ | $res .= $this-> | ||
+ | $res .= $this-> | ||
+ | |||
+ | // set the field which are fetched: title et al. | ||
+ | $i = array(' | ||
// fetch them from array, format and output them | // fetch them from array, format and output them | ||
Line 969: | Line 1021: | ||
} | } | ||
- | // | + | // |
if (isset($res)) { | if (isset($res)) { | ||
+ | // check if last characters of $res are ", | ||
+ | $res = rtrim($res, ", | ||
+ | // trailing element | ||
$res .= " | $res .= " | ||
+ | } | ||
+ | |||
+ | // return result | ||
+ | return $res; | ||
+ | } | ||
+ | |||
+ | /* | ||
+ | | ||
+ | | ||
+ | | ||
+ | | ||
+ | **/ | ||
+ | function getCsv() { | ||
+ | // check if $this-> | ||
+ | if ($this-> | ||
+ | |||
+ | // get pica data as array | ||
+ | $record_raw = $this-> | ||
+ | // transform raw to nice array | ||
+ | $record_nice = $this-> | ||
+ | // declare $res | ||
+ | $res = ''; | ||
+ | |||
+ | // set categories to used for CSV | ||
+ | $i = array(' | ||
+ | ' | ||
+ | |||
+ | // fetch them from array, format and output them | ||
+ | foreach ($i as $j) { | ||
+ | $res .= '"' | ||
+ | } | ||
+ | |||
+ | // stripping et al. | ||
+ | if (isset($res)) { | ||
+ | // check if last characters of $res are ", | ||
+ | $res = rtrim($res, " | ||
} | } | ||
Line 985: | Line 1076: | ||
**/ | **/ | ||
function getData($ppn) { | function getData($ppn) { | ||
+ | // get global $use_curl as switch for the following conditional | ||
+ | global $use_curl; | ||
+ | |||
// check whether curl-Module is available, if not available use fallback | // check whether curl-Module is available, if not available use fallback | ||
- | if (function_exists(' | + | if (function_exists(' |
$ch = curl_init(" | $ch = curl_init(" | ||
curl_setopt($ch, | curl_setopt($ch, | ||
Line 1122: | Line 1216: | ||
$keys_nice[' | $keys_nice[' | ||
- | // type | + | // type: book |
$res .= '& | $res .= '& | ||
$res .= '& | $res .= '& | ||
Line 1129: | Line 1223: | ||
$i = array(' | $i = array(' | ||
' | ' | ||
+ | |||
+ | // fetch them from array, format, url-encode and output them | ||
+ | foreach ($i as $j) { | ||
+ | $record_nice[$j] = urlencode($record_nice[$j]); | ||
+ | $res .= $this-> | ||
+ | } | ||
+ | } elseif (preg_match('/ | ||
+ | // type: journal/ | ||
+ | $res .= '& | ||
+ | $res .= '& | ||
+ | |||
+ | // set the field which are fetched: author et al. | ||
+ | $i = array(' | ||
// fetch them from array, format, url-encode and output them | // fetch them from array, format, url-encode and output them | ||
Line 1139: | Line 1246: | ||
// strip trailing "& | // strip trailing "& | ||
if (isset($res)) { | if (isset($res)) { | ||
- | | + | $res = rtrim($res, "& |
- | $last = strrpos($res,"& | + | |
- | if ( $length == $last+5 ) { | + | |
- | $res = substr($res, | + | |
- | } | + | |
} | } | ||
Line 1218: | Line 1321: | ||
// check type and choose right type | // check type and choose right type | ||
if (preg_match('/ | if (preg_match('/ | ||
- | // type | + | // type: book |
$res .= $keys_nice[' | $res .= $keys_nice[' | ||
// set the field which are fetched: author et al. | // set the field which are fetched: author et al. | ||
$i = array(' | $i = array(' | ||
- | ' | + | ' |
' | ' | ||
+ | |||
+ | // fetch them from array, format and output them | ||
+ | foreach ($i as $j) { | ||
+ | $res .= $this-> | ||
+ | } | ||
+ | |||
+ | // call number | ||
+ | $i = 1; | ||
+ | $j = 0; | ||
+ | while ( $i <= 99 ) { | ||
+ | if (($i <= 9) && ($j == 0)) { | ||
+ | $j = " | ||
+ | } elseif (($i > 9) && ($j == 0)) { | ||
+ | $j = $i; | ||
+ | } | ||
+ | $res .= $this-> | ||
+ | $i++; | ||
+ | if ($i <= 9 ) { | ||
+ | $j = " | ||
+ | } else { | ||
+ | $j = $i; | ||
+ | } | ||
+ | if (empty($record_raw[" | ||
+ | } | ||
+ | } elseif (preg_match('/ | ||
+ | // type: journal | ||
+ | $res .= $keys_nice[' | ||
+ | |||
+ | // set the field which are fetched: title et al. | ||
+ | $i = array(' | ||
+ | ' | ||
// fetch them from array, format and output them | // fetch them from array, format and output them |