当前位置: 首页>>代码示例>>PHP>>正文


PHP yaz_record函数代码示例

本文整理汇总了PHP中yaz_record函数的典型用法代码示例。如果您正苦于以下问题:PHP yaz_record函数的具体用法?PHP yaz_record怎么用?PHP yaz_record使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了yaz_record函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: return_MARCs

 static function return_MARCs()
 {
     $hits = self::hits();
     $records = array();
     $time = time();
     for ($i = 1; $i <= $hits; $i++) {
         if ($time + self::$timeout <= time()) {
             break;
         }
         $record = yaz_record(self::$connection, $i, 'raw');
         $records[] = MARC21::from_string($record);
     }
     return $records;
 }
开发者ID:Alambos,项目名称:books,代码行数:14,代码来源:YAZ.php

示例2: yaz_search

        yaz_search($id, "rpn", '@attr 5=100 @attr 1=7 "' . $n . '"');
    }
    // @attr 5=100 -> no truncation, ist aber Standardeinstellung, kann daher auch weg
}
yaz_wait();
$error = yaz_error($id);
if (!empty($error)) {
    echo "Error Number: " . yaz_errno($id);
    echo "Error Description: " . $error;
    echo "Additional Error Information: " . yaz_addinfo($id);
}
$outputString = "<?xml version=\"1.0\"?>\n";
$outputString .= "<datei>\n";
$outputArray = [];
for ($p = 1; $p <= yaz_hits($id); $p++) {
    $record = yaz_record($id, $p, "render;charset=iso5426,utf8");
    //render;charset=iso5426,utf8
    $error = yaz_error($id);
    if (!empty($error)) {
        echo "Error Number: " . yaz_errno($id);
        echo "Error Description: " . $error;
        echo "Additional Error Information: " . yaz_addinfo($id);
    }
    $recordArray = explode("", $record);
    $header = substr($recordArray[0], 0, 24);
    $recordContent = '<datensatz id="" typ="' . substr($header, 23, 1) . '" status="' . substr($header, 5, 1) . '" mabVersion="' . substr($header, 6, 4) . '">' . "\n";
    $recordContent .= printLine(substr($recordArray[0], 24));
    for ($j = 1; $j < count($recordArray); $j++) {
        $recordContent .= printLine($recordArray[$j]);
    }
    $recordContent .= '</datensatz>' . "\n";
开发者ID:stweil,项目名称:malibu,代码行数:31,代码来源:hbz.php

示例3: yaz_connect

 $bib_id = '@attr 1=12 ' . $bib_id;
 // The backend server can be unreliable, so we'll try connecting multiple
 // times if we get an erroneous response.
 $xml_string;
 $maxTries = 5;
 for ($try = 1; $try <= $maxTries; $try++) {
     $id = yaz_connect($host);
     yaz_syntax($id, "usmarc");
     yaz_range($id, 1, 1);
     $host_options = array("timeout" => "10");
     yaz_search($id, "rpn", $bib_id);
     yaz_wait($host_options);
     $error = yaz_error($id);
     if (empty($error)) {
         // Successful Z39.50 Connection
         $rec = yaz_record($id, 1, 'xml');
         if (!empty($rec)) {
             // Successul record retrieval
             http_response_code(200);
             $doc = new DOMDocument();
             $doc->loadXML($rec);
             $doc->formatOutput = true;
             $xml_string = $doc->saveXML();
             break;
         } else {
             // No record
             http_response_code(404);
             $errordoc = new DOMDocument();
             $title = $errordoc->createElement('title');
             $title = $errordoc->appendChild($title);
             $text = $errordoc->createTextNode('Not Found');
开发者ID:OULibraries,项目名称:ltp-utils,代码行数:31,代码来源:bib_marcxml.php

示例4: fetchYazInfos

 function fetchYazInfos($book)
 {
     global $booklibrary_configuration;
     if (!extension_loaded('yaz')) {
         echo "<script> alert('Sorry, \\'yaz.so\\' isn\\'t loaded....'); window.history.go(-1);</script>\n";
         exit;
     }
     $param_ws = mosBooklibraryWS::getWsParamById($book->informationFrom) - 1;
     $hosts = mosBooklibraryWS::getWSArray();
     $str_conect = trim($hosts[$param_ws][3]) . ":" . trim($hosts[$param_ws][4]) . "/" . trim($hosts[$param_ws][5]);
     //$str_conect ="z3950.bibsys.no:2100";// "140.147.249.38:7090/voyager";
     //$str_conect = "troy.lib.sfu.ca:210/innopac";
     //echo $str_conect;
     $id = yaz_connect($str_conect);
     yaz_syntax($id, $hosts[$param_ws][6]);
     $query = '@attr 1=7  ' . $book->isbn;
     yaz_search($id, 'rpn', $query);
     yaz_wait();
     $error = yaz_error($id);
     if (!empty($error)) {
         echo "<script> alert('ERROR:" . addslashes($error) . "'); window.history.go(-1);</script>\n";
         exit;
     }
     $rec = yaz_record($id, 1, "array");
     $error = yaz_error($id);
     if (yaz_hits($id) == 0) {
         echo "<script> alert('On this ISBN(" . addslashes($book->isbn) . ") of the not found records'); window.history.go(-1);</script>\n";
         yaz_close($id);
         exit;
     } elseif (!empty($error)) {
         echo "<script> alert('ERROR:" . addslashes($error) . "'); window.history.go(-1);</script>\n";
         yaz_close($id);
         exit;
     }
     yaz_close($id);
     $book->comment = "";
     $book->title = "";
     $book->authors = "";
     $book->manufacturer = "";
     $book->release_Date = "";
     $book->URL = "";
     foreach ($rec as $i => $value) {
         $s = explode(")(", $rec[$i][0]);
         if (isset($s[2])) {
             switch (substr($s[0], 3, strlen($s[0]))) {
                 case '245':
                     $book->comment .= $rec[$i][1];
                     if (substr($s[2], 2, strlen($s[2]) - 3) == 'a') {
                         $book->title .= $rec[$i][1];
                     }
                     break;
                 case '100':
                     $book->authors .= $rec[$i][1];
                     break;
                 case '260':
                     $book->manufacturer .= $rec[$i][1];
                     if (substr($s[2], 2, strlen($s[2]) - 3) == 'c') {
                         $book->release_Date .= $rec[$i][1];
                     }
                     break;
                 case '856':
                     $book->URL .= $rec[$i][1];
                     break;
             }
         }
     }
     return $book;
 }
开发者ID:rdegennaro,项目名称:Check-It,代码行数:68,代码来源:admin.booklibrary.class.ws.php

示例5: yaz_hits

     echo "</td></tr>";
 } else {
     echo '<td align="center">';
     echo '<table cellspacing="0" cellpadding="2" width="97%" border="0"><tr><td>';
     $hits = yaz_hits($id);
     if ($hits > $max_hits) {
         $max_hits = $hits;
     }
     echo $msgstr["attempt"] . ": {$attempt}<br>";
     echo $msgstr["registros"] . " <b>{$hits}</b> ";
     $reintentar = 999;
     echo "</td></tr></table>\n";
     echo "</td></tr>";
     $end = $start + $number;
     $ixreg = -1;
     for ($pos = $start; $pos < $end; $pos++) {
         $rec = yaz_record($id, $pos, "string; charset=marc-8,xISO-8859-1");
         $ar = yaz_record($id, $pos, "array; charset=marc-8,xISO-8859-1");
         //	$ar = yaz_record($id,$pos,"array");
         //		$rec = yaz_record($id,$pos,"string");
         //	$rec=$ar[0];
         //	echo "<xmp>$rec</xmp>";
         $recStatus = substr($rec, 5, 1);
         $typeOfrec = substr($rec, 6, 1);
         $bibloLevel = substr($rec, 7, 1);
         $encodingLevel = substr($rec, 17, 1);
         $descriptive = substr($rec, 19, 1);
         //	$syntax = yaz_record($id,$pos,"syntax");
         if (empty($rec) && !is_array($ar)) {
             continue;
         }
开发者ID:rgevaert,项目名称:ABCD,代码行数:31,代码来源:z3950-01.php

示例6: array

 // preparing to buffer MARC XML result
 $errors = array();
 $hits = 0;
 ob_start();
 echo '<?xml version="1.0" standalone="yes"?>' . "\n";
 echo '<collection xmlns="http://www.loc.gov/MARC21/slim">' . "\n";
 for ($h = 0; $h < $num_hosts; $h++) {
     $error = yaz_error($id[$h]);
     if (!empty($error)) {
         $errors[] = $error;
     } else {
         // number of results
         $hits = yaz_hits($id[$h]);
     }
     for ($rnum = 1; $rnum <= $sysconf['z3950_max_result']; $rnum++) {
         $rec = yaz_record($id[$h], $rnum, 'xml; charset=marc-8,utf-8');
         if (empty($rec)) {
             continue;
         }
         echo $rec;
     }
 }
 echo '</collection>';
 $xml_result_string = ob_get_clean();
 // below is for debugging purpose
 // echo htmlentities($xml_result_string);
 if ($hits > 0) {
     echo '<div class="infoBox">Found ' . $hits . ' records from Z3950 Server, ' . $sysconf['z3950_max_result'] . ' listed.</div>';
     // parse XML
     $xmlrec = marcXMLsenayan($xml_result_string);
     // save it to session vars for retrieving later
开发者ID:indonesia,项目名称:slims5_meranti,代码行数:31,代码来源:z3950.php

示例7: search

 function search($source_id, $query, $search_id)
 {
     global $base_path, $charset, $include_path;
     //global $url,$z3950_base,$z3950_login,$z3950_password,$z3950_max_notices,$z3950_format,$z3950_port,$z3950_convert,$z3950_profil;
     $this->error = false;
     $this->error_message = "";
     $params = $this->get_source_params($source_id);
     $this->fetch_global_properties();
     if ($params["PARAMETERS"]) {
         //Affichage du formulaire avec $params["PARAMETERS"]
         $vars = unserialize($params["PARAMETERS"]);
         foreach ($vars as $key => $val) {
             global ${$key};
             ${$key} = $val;
         }
     }
     if (!($z3950_max_notices * 1)) {
         $z3950_max_notices = 100;
     }
     //Tranformation de la recherche en requete rpn bib1
     $rpn = $this->parse_query($query);
     $zurl = $url . ($z3950_port ? ":" . $z3950_port : "") . ($z3950_base ? "/" . $z3950_base : "");
     $opts = array();
     if ($z3950_login) {
         $opts["user"] = $z3950_login;
     }
     if ($z3950_password) {
         $opts["password"] = $z3950_password;
     }
     $opts["piggyback"] = false;
     $yaz_id = yaz_connect($zurl, $opts);
     yaz_element($yaz_id, "F");
     yaz_range($yaz_id, 1, $z3950_max_notices);
     yaz_syntax($yaz_id, strtolower($z3950_format));
     yaz_search($yaz_id, "rpn", $rpn . " ");
     $opts_wait = array("timeout" => $params["TIMEOUT"]);
     yaz_wait($opts_wait);
     if (yaz_error($yaz_id)) {
         $this->error = true;
         $this->error_message = yaz_error($yaz_id);
     } else {
         $n_results = yaz_hits($yaz_id);
         if ($n_results > $z3950_max_notices) {
             $n_results = $z3950_max_notices;
         }
         $convert_order = $this->get_convert_order($z3950_convert);
         for ($k = 1; $k <= $n_results; $k++) {
             $notice = yaz_record($yaz_id, $k, "raw");
             //Conversion de la notice
             if ($z3950_convert) {
                 $export = new convert($notice, $convert_order);
                 if (!$export->error) {
                     $cnotice = $export->output_notice;
                 } else {
                     $cnotice = "";
                 }
             } else {
                 $cnotice = $notice;
             }
             if ($cnotice) {
                 //Conversion de la notice en XML
                 $xmlunimarc = new xml_unimarc();
                 $nxml = $xmlunimarc->iso2709toXML_notice($cnotice);
                 if ($xmlunimarc->is_utf8) {
                     $rcharset = "utf-8";
                 } else {
                     $rcharset = $charset;
                 }
                 $xmlunimarc->notices_xml_[0] = '<?xml version="1.0" encoding="' . $rcharset . '"?>' . $xmlunimarc->notices_xml_[0];
                 if ($xslt_exemplaire) {
                     $xmlunimarc->notices_xml_[0] = $this->apply_xsl_to_xml($xmlunimarc->notices_xml_[0], $xslt_exemplaire["content"]);
                 }
                 //					print_r($xmlunimarc->notices_xml_[0]);
                 if ($nxml >= 1) {
                     $params = _parser_text_no_function_($xmlunimarc->notices_xml_[0], "NOTICE");
                     $this->rec_record($params, $source_id, $search_id);
                 }
             }
         }
     }
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:81,代码来源:z3950.class.php

示例8: fopen

 // DEBUG
 global $z3950_debug;
 if ($z3950_debug) {
     $fp = fopen("../../temp/raw" . rand() . ".marc", "wb");
     fwrite($fp, $rec);
     fclose($fp);
 }
 if (strpos($rec, chr(0x1d)) !== false) {
     $rec = substr($rec, 0, strpos($rec, chr(0x1d)) + 1);
 }
 $monEnr = new iso2709_record($rec);
 if ($monEnr->valid()) {
     $messageframe = " {$p} " . $msg['z3950_lu_bin'];
     $pb = 0;
 } else {
     $rec = yaz_record($id, $p, "string");
     $monEnr2 = new iso2709_record($rec);
     if ($monEnr2->valid()) {
         $messageframe = "{$p} " . $msg['z3950_lu_cok'];
         $pb = 0;
     } else {
         // DEBUG
         //$fp = fopen ("../../temp/raw".rand().".sutrs","wb");
         //fwrite ($fp, $rec);
         //fclose ($fp);
         $rec = sutrs_record($rec, $sutrs_lang);
         $messageframe = " {$p} " . $msg['z3950_lu_chs'];
         //$pb = 1;
         //$rec="";
     }
 }
开发者ID:noble82,项目名称:proyectos-ULS,代码行数:31,代码来源:z_progression_cache.php

示例9: _getLookupResult

 function _getLookupResult($server, $isbn)
 {
     // Now support YAZ only.
     $query = '@attr 1=7 ' . $isbn;
     $conn = yaz_connect($server['host'], array('user' => $server['user'], 'password' => $server['pw']));
     if (!$conn) {
         return array('error' => 'could not connect lookup');
     }
     yaz_database($conn, $server['db']);
     yaz_syntax($conn, "usmarc");
     yaz_element($conn, "F");
     //echo "sending: $qry <br />";
     if (!yaz_search($conn, 'rpn', $query)) {
         return array('error' => 'bad query');
     }
     $param = array('timeout' => 5);
     yaz_wait($param);
     $error = yaz_error($conn);
     if (!empty($error)) {
         return array('error' => 'lookup response error (' . yaz_errno($conn) . ') : ' . yaz_addinfo($conn));
     }
     if (yaz_hits($conn) < 1) {
         return array('error' => 'no result');
     }
     // For bulk actions, auto select first record
     require_once "../lookup2/lookupYazFunc.php";
     $data = extract_marc_fields(yaz_record($conn, 1, 'array'), true, 1, 1, $server['charset']);
     if (empty($data['callNmbr1']) && empty($data['050a']) || empty($data['100a'])) {
         // Require callNmbr1, continue search
         return array('error' => 'no result');
     }
     return $data;
 }
开发者ID:Giordano-Bruno,项目名称:GiordanoBruno,代码行数:33,代码来源:BulkLookup.php

示例10: getSearchResults

 public function getSearchResults($query, $start, $step, &$hits, &$pid)
 {
     $stop = $start + $step;
     if ($this->grabQueryFromCache($query)) {
         //pull from cache
         $hits = mysql_num_rows($this->results);
         for ($i = $start; $i < $stop; $i++) {
             $results[] = $this->getCachedBook($i);
         }
     } else {
         //pull from LoC
         //  			$mayDemandCache = ( ( $HTTP_GET_VARS['type'] != $HTTP_GET_VARS['sort'] ) &&
         //  								( $HTTP_GET_VARS['type'] != 'Keyword' ) &&
         //                                 ( !isset( $HTTP_GET_VARS['sort'] ) ) );
         $mayDemandCache = isset($_GET['sort']) && (!($HTTP_GET_VARS['sort'] == $HTTP_GET_VARS['type'] && !isset($_GET['desc'])) || isset($_GET['desc']));
         $willCache = (ShelveIt::$cachePolicy == 'always' || ShelveIt::$cachePolicy == 'demand' && $mayDemandCache) && !(ShelveIt::$cachePolicy == 'never');
         // connect to LoC server
         $LoC = yaz_connect('z3950.loc.gov:7090/voyager');
         //set server options
         yaz_syntax($LoC, 'marc21');
         if ($willCache) {
             // we're going to grab all results
             yaz_range($LoC, 1, $this->maxHits);
         } else {
             yaz_range($LoC, $start, $step);
         }
         // perform search
         yaz_search($LoC, 'rpn', $query);
         // wait for search to finish
         yaz_wait();
         // check for an error
         $error = yaz_error($LoC);
         if (!empty($error)) {
             ShelveIt::$messages['errors'][] = $error . " {$query}";
             $hits = 0;
         } else {
             //get results
             $hits = yaz_hits($LoC);
             if ($willCache && $hits > ShelveIt::$query_cache['maxHits']) {
                 ShelveIt::$messages['warnings'][] = "Your search has too many results to be quickly sorted. It has been limited from {$hits} to " . ShelveIt::$query_cache['maxHits'] . ". You can make your search more specific so it has a small enough number of hits, or not sort to see all of the results.";
                 $hits = ShelveIt::$query_cache['maxHits'];
             }
             if ($hits > 0) {
                 if ($willCache) {
                     for ($i = 1; $i < $start; $i++) {
                         $rec = yaz_record($LoC, $i, 'xml');
                         $this->cacheBook($query, new Brief_Book($rec));
                     }
                 } else {
                     $i = $start;
                 }
                 for (; $i < $stop; $i++) {
                     $rec = yaz_record($LoC, $i, 'xml');
                     $book = new Brief_Book($rec);
                     $results[] = $book;
                     if ($willCache) {
                         $this->cacheBook($query, $book);
                     }
                 }
                 if ($willCache) {
                     // 						// quick note: I can fork using pcntl_fork
                     // 						$pid = pcntl_fork();
                     // 						if( $pid == -1 ) {
                     // 							die( 'CRITICAL ERROR: Forking failed. The server is likely in trouble. Please come back later.' );
                     // 						} else if(  $pid == 0 ) {
                     // pick up where we left off
                     for (; $i <= $hits; $i++) {
                         $rec = yaz_record($LoC, $i, 'xml');
                         $this->cacheBook($query, new Brief_Book($rec));
                     }
                     $this->collectGarbage();
                     // 							exit( 0 );
                     // 						}
                 }
             }
         }
     }
     return $results;
 }
开发者ID:BackupTheBerlios,项目名称:shelveit-svn,代码行数:79,代码来源:Query_Cache.php

示例11: getExtendedInformation

 /** 
  * Fetch details about a specific item from WorldCat data service 
  *
  * @param array $pa_settings Plugin settings values
  * @param string $ps_url The URL originally returned by the data service uniquely identifying the item
  * @param array $pa_options Options include:
  *		APIKey = WorldCat API key to use. [Default is the key configured in worldcat_api_key in app.conf]
  *		user = Worldcat Z39.50 login name. [Default is the username configured in worldcat_z39.50_user in app.conf]
  *		password = WorldCAt Z39.50 password. [Default is the password configured in worldcat_z39.50_password in app.conf]
  *
  * @return array An array of data from the data server defining the item.
  */
 public function getExtendedInformation($pa_settings, $ps_url, $pa_options = null)
 {
     $va_config = $this->_getConfiguration($pa_settings, $pa_options);
     $va_tmp = explode("/", $ps_url);
     $vn_worldcat_id = array_pop($va_tmp);
     $va_data = array();
     if ($va_config['user'] && $va_config['z39IsAvailable']) {
         $r_conn = yaz_connect(WLPlugInformationServiceWorldCat::$s_worldcat_z3950_host, array('user' => $va_config['user'], 'password' => $va_config['password']));
         yaz_syntax($r_conn, "usmarc");
         yaz_range($r_conn, $vn_start + 1, $vn_start + $vn_count);
         yaz_search($r_conn, "rpn", '@attr 1=12 @attr 4=2 "' . str_replace('"', '', $vn_worldcat_id) . '"');
         yaz_wait();
         $vs_data = yaz_record($r_conn, 1, "xml; charset=marc-8,utf-8");
     } else {
         $o_client = new Client(WLPlugInformationServiceWorldCat::$s_worldcat_detail_url);
         try {
             if (!$va_config['curlIsAvailable']) {
                 throw new Exception(_t('CURL is required for WorldCat web API usage but not available on this server'));
             }
             if (!$va_config['APIKey']) {
                 if (!$va_config['z39IsAvailable']) {
                     throw new Exception(_t('Neither Z39.50 client is installed nor is WorldCat web API key configured'));
                 } else {
                     throw new Exception(_t('WorldCat web API key is not configured'));
                 }
             }
             // Create a request
             $o_request = $o_client->get("{$vn_worldcat_id}?wskey=" . $va_config['APIKey']);
             // Send the request and get the response
             $o_response = $o_request->send();
             $vs_data = (string) $o_response->getBody();
         } catch (Exception $e) {
             return array('display' => _t('WorldCat data could not be loaded: %1', $e->getMessage()));
         }
     }
     try {
         if (!$vs_data) {
             throw new Exception("No data returned");
         }
         $xml = new DOMDocument();
         $xml->loadXML($vs_data);
     } catch (Exception $e) {
         return array('display' => _t('WorldCat data could not be parsed: %1', $e->getMessage()));
     }
     switch ($pa_settings['detailStyle']) {
         case 'labels':
         default:
             $vs_template = file_get_contents(__CA_LIB_DIR__ . "/core/Plugins/InformationService/WorldCat/MARC21slim2English.xml");
             break;
         case 'codes':
             $vs_template = file_get_contents(__CA_LIB_DIR__ . "/core/Plugins/InformationService/WorldCat/MARC21slim2HTML.xml");
             break;
         case 'template':
             $vs_template = $pa_settings['detailXSLTemplate'];
             break;
     }
     try {
         $xsl = new DOMDocument();
         $xsl->loadXML($vs_template);
     } catch (Exception $e) {
         return array('display' => _t('WorldCat detail display template could not be parsed: %1', $e->getMessage()));
     }
     try {
         $proc = new XSLTProcessor();
         $proc->importStyleSheet($xsl);
         $vs_output = $proc->transformToXML($xml);
         $va_data = array('display' => $vs_output);
     } catch (Exception $e) {
         return array('display' => _t('WorldCat detail display template could not be created: %1', $e->getMessage()));
     }
     return $va_data;
 }
开发者ID:idiscussforum,项目名称:providence,代码行数:84,代码来源:WorldCat.php

示例12: yaz_connect

<?php

$z = yaz_connect("localhost:9999");
yaz_range($z, 1, 2);
yaz_search($z, "rpn", "computer");
yaz_wait();
$error = yaz_error($z);
if (!empty($error)) {
    echo "Error: {$error}\n";
} else {
    $hits = yaz_hits($z);
    echo "Result count {$hits}\n";
    for ($p = 1; $p <= 2; $p++) {
        $rec = yaz_record($z, $p, "string");
        if (empty($rec)) {
            break;
        }
        echo "----- {$p} -----\n{$rec}";
    }
}
开发者ID:indexdata,项目名称:phpyaz,代码行数:20,代码来源:client.php

示例13: do_search_and_show_hits

function do_search_and_show_hits()
{
    output_header("Search Results");
    echo "<br>";
    if (empty($_GET['start'])) {
        $start = 1;
    } else {
        $start = $_GET['start'];
    }
    if (!empty($_GET['fq'])) {
        $fullquery = unserialize(base64_decode($_GET['fq']));
    } else {
        $fullquery = query_format();
    }
    global $external_catalog_locator;
    $id = yaz_connect($external_catalog_locator);
    yaz_syntax($id, "usmarc");
    yaz_element($id, "F");
    yaz_search($id, "rpn", trim($fullquery));
    $extra_options = array("timeout" => 60);
    yaz_wait($extra_options);
    $errorMsg = yaz_error($id);
    if (!empty($errorMsg)) {
        echo "<center>";
        echo _("The following error has occurred:");
        echo "<br><br>";
        echo "<b><i>{$errorMsg}</i></b>";
        echo "<p>";
        $url = "editproject.php?action=createnew";
        echo sprintf(_("Please try again. If the problem recurs, please create your project manually by following this <a href='%s'>link</a>."), $url);
        echo "</center>";
        exit;
    }
    echo "<center>";
    if (yaz_hits($id) == 0) {
        echo "<b>";
        echo _("There were no results returned.");
        echo "</b>";
        echo "<br>";
        echo _("Please search again or click 'No Matches' to create the project manually.");
        echo "<br>";
    } else {
        echo "<b>";
        echo sprintf(_("%d results returned. Note that some non-book results may not be displayed."), yaz_hits($id));
        echo "<br>";
        echo _("Please pick a result from below:");
        echo "</b>";
    }
    echo "</center>";
    echo "<br><form method='post' action='editproject.php'>";
    echo "<input type='hidden' name='action' value='create_from_marc_record'>";
    echo "<table border='0 width='100%' cellpadding='0' cellspacing='0'>";
    // -----------------------------------------------------
    $hits_per_page = 20;
    // Perhaps later this can be a PM preference or an option on the form.
    $i = 1;
    while ($start <= yaz_hits($id) && $i <= $hits_per_page) {
        $rec = yaz_record($id, $start, "array");
        //if it's not a book don't display it.  we might want to uncomment in the future if there are too many records being returned - if (substr(yaz_record($id, $start, "raw"), 6, 1) != "a") { $start++; continue; }
        $marc_record = new MARCRecord();
        $marc_record->load_yaz_array($rec);
        if ($i % 2 == 1) {
            echo "<tr>";
        }
        echo "<td width='5%' align='center' valign='top'>";
        echo "<input type='radio' name='rec' value='" . base64_encode(serialize($rec)) . "'>";
        echo "</td>";
        echo "<td width='45%' align='left' valign='top'>";
        echo "<table border='0' width='100%' cellpadding='0' cellspacing='0'>";
        foreach (array(array('label' => _("Title"), 'value' => $marc_record->title), array('label' => _("Author"), 'value' => $marc_record->author), array('label' => _("Publisher"), 'value' => $marc_record->publisher), array('label' => _("Language"), 'value' => $marc_record->language), array('label' => _("LCCN"), 'value' => $marc_record->lccn), array('label' => _("ISBN"), 'value' => $marc_record->isbn)) as $couple) {
            $label = $couple['label'];
            $value = $couple['value'];
            echo "<tr>";
            echo "<td width='20%' align='left' valign='top'><b>{$label}</b>:</td>";
            echo "<td align='left' valign='top'>{$value}</td>";
            echo "</tr>\n";
        }
        echo "</table><p></td>";
        if ($i % 2 != 1) {
            echo "</tr>\n";
        }
        $i++;
        $start++;
    }
    if ($i % 2 != 1) {
        echo "</tr>\n";
    }
    // -----------------------------------------------------
    $encoded_fullquery = base64_encode(serialize($fullquery));
    echo "<tr>";
    echo "<td colspan='2' width='50%' align='left' valign='top'>";
    if (isset($_GET['start']) && $_GET['start'] - $hits_per_page > 0) {
        $url = "external_catalog_search.php?action=do_search_and_show_hits&start=" . ($_GET['start'] - $hits_per_page) . "&fq={$encoded_fullquery}";
        echo "<a href='{$url}'>Previous</a>";
    } else {
        echo "&nbsp;";
    }
    echo "</td>";
    echo "<td colspan='2' width='50%' align='right' valign='top'>";
    if ($start + $hits_per_page <= yaz_hits($id)) {
//.........这里部分代码省略.........
开发者ID:cpeel,项目名称:dproofreaders-shadow,代码行数:101,代码来源:external_catalog_search.php

示例14: getZRecord

 function getZRecord($zid, $rn)
 {
     $syntax = 'xml';
     if ($this->z_record_encoding != 'utf-8') {
         $syntax .= ";charset={$this->z_record_encoding},utf-8";
     }
     $record = yaz_record($zid, (int) $rn, $syntax);
     //echo "<pre>" .htmlReady( print_R($record,1)). '</pre>';
     $plugin_mapping = $this->mapping[$this->z_syntax];
     if ($record) {
         $cat_element = new StudipLitCatElement();
         $cat_element->setValue("user_id", $GLOBALS['auth']->auth['uid']);
         $cat_element->setValue("catalog_id", $this->sess_var_name . "__" . $rn);
         $cat_element->setValue("lit_plugin", $this->getPluginName());
         $xmlrecord = new SimpleXMLElement($record);
         foreach ($xmlrecord->controlfield as $field) {
             $code = (string) $field['tag'];
             $data = studip_utf8decode((string) $field);
             if (isset($plugin_mapping[$code])) {
                 $mapping = is_array($plugin_mapping[$code][0]) ? $plugin_mapping[$code] : array($plugin_mapping[$code]);
                 for ($j = 0; $j < count($mapping); ++$j) {
                     $map_method = $mapping[$j]['callback'];
                     $this->{$map_method}($cat_element, $data, $mapping[$j]['field'], $mapping[$j]['cb_args']);
                 }
             }
         }
         foreach ($xmlrecord->datafield as $field) {
             $code = (string) $field['tag'];
             $data = array();
             foreach ($field->subfield as $subfield) {
                 $subcode = (string) $subfield['code'];
                 if ($subcode && !isset($data[$subcode])) {
                     $data[$subcode] = studip_utf8decode((string) $subfield);
                 }
             }
             if (isset($plugin_mapping[$code])) {
                 $mapping = is_array($plugin_mapping[$code][0]) ? $plugin_mapping[$code] : array($plugin_mapping[$code]);
                 for ($j = 0; $j < count($mapping); ++$j) {
                     $map_method = $mapping[$j]['callback'];
                     $this->{$map_method}($cat_element, $data, $mapping[$j]['field'], $mapping[$j]['cb_args']);
                 }
             }
         }
         return $cat_element->getValues();
     } else {
         $this->addError("error", sprintf(_("Datensatz Nummer %s konnte nicht abgerufen werden."), $rn));
         return 0;
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:49,代码来源:StudipLitSearchPluginZ3950Abstract.class.php

示例15: yazCclArray

function yazCclArray($ccl, $syntax = 'marc21', $host = 'default')
{
    global $config;
    if ($host == 'default') {
        $host = $config['libraries'][$_GET['bib']]['z3950'];
    }
    $zconfig = get_zconfig();
    $hits = 0;
    $type = 'xml';
    $id = yaz_connect($host);
    yaz_element($id, "F");
    yaz_syntax($id, $syntax);
    yaz_range($id, 1, 1);
    yaz_ccl_conf($id, $zconfig);
    $cclresult = array();
    if (!yaz_ccl_parse($id, $ccl, $cclresult)) {
        echo 'Error: ' . $cclresult["errorstring"];
    } else {
        // NB! Ser ikke ut som Z39.50 fra Bibliofil støtter "sort"
        // Se nederst her: http://www.bibsyst.no/produkter/bibliofil/z3950.php
        // PHP/YAZ-funksjonen yaz-sort ville kunne dratt nytte av dette:
        // http://no.php.net/manual/en/function.yaz-sort.php
        // Sort Flags
        // a Sort ascending
        // d Sort descending
        // i Case insensitive sorting
        // s Case sensitive sorting
        // Bib1-attributter man kunne sortert på:
        // http://www.bibsyst.no/produkter/bibliofil/z/carl.xml
        // yaz_sort($id, "1=31 di");
        $rpn = $cclresult["rpn"];
        yaz_search($id, "rpn", utf8_decode($rpn));
    }
    yaz_wait();
    $error = yaz_error($id);
    if (!empty($error)) {
        echo "Error yazCclArray: {$error}";
    } else {
        $hits = yaz_hits($id);
    }
    $data = array();
    for ($p = 1; $p <= $hits; $p++) {
        $rec = yaz_record($id, $p, $type);
        if (empty($rec)) {
            continue;
        }
        $data[] = $rec;
        if ($p == $config['maks_poster']) {
            break;
        }
    }
    $ret = array("hits" => $hits, "result" => $data);
    return $ret;
}
开发者ID:pode,项目名称:musikkmashup,代码行数:54,代码来源:functions.php


注:本文中的yaz_record函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。