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


PHP yaz_syntax函数代码示例

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


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

示例1: switch

 if ($keywords) {
     // parsing keywords and map query to RPN
     switch ($_GET['field']) {
         case 'ti':
             $query = '@or @and @attr 1=4 ' . $keywords . ' @and @attr 1=5 ' . $keywords;
             break;
         case 'au':
             $query = '@attr 1=1 @and ' . $keywords;
             break;
         default:
             $query = '@or @attr 1=7 ' . $keywords . ' @attr 1=8 ' . $keywords;
             break;
     }
     for ($h = 0; $h < $num_hosts; $h++) {
         $id[] = yaz_connect($zserver[$h]);
         yaz_syntax($id[$h], 'usmarc');
         yaz_range($id[$h], 1, $sysconf['z3950_max_result']);
         yaz_search($id[$h], 'rpn', $query);
     }
     yaz_wait();
     // 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 {
开发者ID:indonesia,项目名称:slims5_meranti,代码行数:31,代码来源:z3950.php

示例2: antall_treff

function antall_treff($q)
{
    global $config;
    $bib = $_GET['bib'];
    $debug = 0;
    if ($config['libraries'][$bib]['sru']) {
        // SRU
        $qu = urlencode($q);
        $query = '(dc.author=' . $qu . '+or+dc.title=' . $qu . ')+and+dc.title=lydopptak';
        $sruurl = $config['libraries'][$bib]['sru'] . '?version=1.1&operation=searchRetrieve&query=' . $query;
        if ($xml = file_get_contents($sruurl)) {
            preg_match("/numberOfRecords>(.*?)</", $xml, $matches);
            return $matches[1];
        } else {
            echo 'error';
        }
    } else {
        //Z39.50
        $ccl = "(fo={$q} or in={$q} or ti={$q}) and ti=lydopptak";
        $host = $config['libraries'][$bib]['z3950'];
        $zconfig = get_zconfig();
        $type = 'xml';
        $syntax = 'NORMARC';
        $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 $debug ? 'Error: ' . $cclresult["errorstring"] : 'error';
        } else {
            $rpn = $cclresult["rpn"];
            yaz_search($id, "rpn", utf8_decode($rpn));
        }
        yaz_wait();
        $error = yaz_error($id);
        if (!empty($error)) {
            echo $debug ? "Error yazCclArray: {$error}" : 'error';
        } else {
            return yaz_hits($id);
        }
    }
}
开发者ID:pode,项目名称:musikkmashup,代码行数:44,代码来源:mod.artist.php

示例3: connect

 static function connect($host)
 {
     self::$connection = yaz_connect($host, array('charset' => 'UTF-8'));
     yaz_syntax(self::$connection, 'marc21');
 }
开发者ID:Alambos,项目名称:books,代码行数:5,代码来源:YAZ.php

示例4: 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

示例5: htmlspecialchars

    		name="host[]" value="localhost:9999/Default" />
        local test
    <input type="checkbox" checked="checked"
    		name="host[]" value="z3950.loc.gov:7090/voyager" />
        Library of Congress
    <br />
    RPN Query:
    <input type="text" size="30" name="query" placeholder="ex: @attr 1=4 \\"mysql%\\" " />
    <input type="submit" name="action" value="Search" />
    </form>
    ';
} else {
    echo 'You searched for ' . htmlspecialchars($query) . '<br />';
    for ($i = 0; $i < $num_hosts; $i++) {
        $id[] = yaz_connect($host[$i]);
        yaz_syntax($id[$i], "usmarc");
        yaz_range($id[$i], 1, 10);
        yaz_search($id[$i], "rpn", $query);
    }
    yaz_wait();
    for ($i = 0; $i < $num_hosts; $i++) {
        echo '<hr />' . $host[$i] . ':';
        $error = yaz_error($id[$i]);
        if (!empty($error)) {
            echo "Error: {$error}";
        } else {
            $hits = yaz_hits($id[$i]);
            echo "Result Count {$hits}";
        }
        echo '<dl>';
        for ($p = 1; $p <= 10; $p++) {
开发者ID:Giordano-Bruno,项目名称:GiordanoBruno,代码行数:31,代码来源:yazTest.php

示例6: yaz_connect

 * hbz?isbn=ISBN
 *   ISBN ist eine 10- bzw. 13-stellige ISBN mit/ohne Bindestriche/Leerzeichen
 *   ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein
 * hbz?ppn=PPN
 *   PPN ist die eine ID-Nummer des HBZ
 * hbz?isbn=ISBN&format=json
 * hbz?ppn=PPN&format=json
 *   Ausgabe erfolgt als JSON
 *
 * Sucht übergebene ISBN bzw. PPN im HBZ-Katalog
 * und gibt maximal 10 Ergebnisse als MABXML zurück
 * bzw. als JSON.
 */
include 'lib.php';
$id = yaz_connect(HBZ_URL);
yaz_syntax($id, HBZ_SYNTAX);
yaz_range($id, 1, 10);
yaz_element($id, HBZ_ELEMENTSET);
if (isset($_GET['ppn'])) {
    $ppn = trim($_GET['ppn']);
    yaz_search($id, "rpn", '@attr 5=100 @attr 1=12 "' . $ppn . '"');
}
if (isset($_GET['isbn'])) {
    $n = trim($_GET['isbn']);
    $nArray = explode(",", $n);
    if (count($nArray) > 1) {
        //mehrere ISBNs, z.B. f @or @or @attr 1=7 "9783937219363" @attr 1=7 "9780521369107" @attr 1=7 "9780521518147"
        //Anfuehrungsstriche muessen demaskiert werden, egal ob String mit ' gemacht wird
        $suchString = str_repeat("@or ", count($nArray) - 1) . '@attr 1=7 \\"' . implode('\\" @attr 1=7 \\"', $nArray) . '\\"';
        yaz_search($id, "rpn", $suchString);
    } else {
开发者ID:stweil,项目名称:malibu,代码行数:31,代码来源:hbz.php

示例7: 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

示例8: nextRow

 /**
  * 
  * 
  * @param string $ps_source
  * @param array $pa_options
  * @return bool
  */
 public function nextRow()
 {
     if (!$this->opa_row_ids || !is_array($this->opa_row_ids) || !sizeof($this->opa_row_ids)) {
         return false;
     }
     if (isset($this->opa_row_ids[$this->opn_current_row]) && ($vn_worldcat_id = $this->opa_row_ids[$this->opn_current_row])) {
         $o_client = new Client(WorldCatDataReader::$s_worldcat_detail_url);
         // Create a request
         try {
             if ($this->opb_z3950_available && $this->ops_z3950_user) {
                 $r_conn = yaz_connect(WorldCatDataReader::$s_worldcat_z3950_host, array('user' => $this->ops_z3950_user, 'password' => $this->ops_z3950_password));
                 yaz_syntax($r_conn, "usmarc");
                 yaz_range($r_conn, 1, 10);
                 yaz_search($r_conn, "rpn", '@attr 1=12 @attr 4=2 "' . str_replace('"', '', $vn_worldcat_id) . '"');
                 yaz_wait();
                 $vs_data = simplexml_load_string(yaz_record($r_conn, 1, "xml; charset=marc-8,utf-8"));
             } elseif ($this->ops_api_key) {
                 $o_request = $o_client->get("{$vn_worldcat_id}?wskey=" . $this->ops_api_key);
                 $o_response = $o_request->send();
                 $vs_data = $o_response->xml();
             } else {
                 throw new Exception("Neither Z39.50 nor WorldCat web API is configured");
             }
             if (!$vs_data) {
                 throw new Exception("No data returned");
             }
             $o_row = $this->opo_handle_xml = dom_import_simplexml($vs_data);
             $this->opa_row_buf[$this->opn_current_row] = $o_row;
         } catch (Exception $e) {
             return false;
         }
         $this->opa_row_buf = array();
         $this->_extractXMLValues($o_row);
         $o_row_clone = $o_row->cloneNode(TRUE);
         $this->opo_handle_xml = new DOMDocument();
         $this->opo_handle_xml->appendChild($this->opo_handle_xml->importNode($o_row_clone, TRUE));
         $this->opo_handle_xpath = new DOMXPath($this->opo_handle_xml);
         if ($this->ops_xml_namespace_prefix && $this->ops_xml_namespace) {
             $this->opo_handle_xpath->registerNamespace($this->ops_xml_namespace_prefix, $this->ops_xml_namespace);
         }
         $this->opn_current_row++;
         if ($this->opn_current_row > $this->numRows()) {
             return false;
         }
         return true;
     }
     return false;
 }
开发者ID:samrahman,项目名称:providence,代码行数:55,代码来源:WorldCatDataReader.php

示例9: doZSearch

 function doZSearch($zid, $rpn, $start, $number)
 {
     yaz_range($zid, (int) $start, (int) $number);
     yaz_syntax($zid, $this->z_syntax);
     if ($this->z_sort) {
         yaz_sort($zid, $this->z_sort);
     }
     yaz_element($zid, 'F');
     yaz_search($zid, "rpn", $rpn);
     yaz_wait($options = array('timeout' => $this->z_timeout));
     if (yaz_errno($zid)) {
         $error_msg = yaz_error($zid);
         if ($error_info = yaz_addinfo($zid)) {
             $error_msg .= ' - ' . $error_info;
         }
         $this->addError("error", sprintf(_("Fehler bei der Suche: %s"), $error_msg));
         return false;
     } else {
         return yaz_hits($zid);
     }
 }
开发者ID:ratbird,项目名称:hope,代码行数:21,代码来源:StudipLitSearchPluginZ3950Abstract.class.php

示例10: yaz_connect

 * swb?isbn=ISBN
 *   ISBN ist eine 10- bzw. 13-stellige ISBN mit/ohne Bindestriche/Leerzeichen
 *   ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein
 * swb?ppn=PPN
 *   PPN ist die eine ID-Nummer des SWB
 * swb?isbn=ISBN&format=json
 * swb?ppn=PPN&format=json
 *   Ausgabe erfolgt als JSON
 *
 * Sucht übergebene ISBN bzw. PPN im SWB-Katalog
 * und gibt maximal 10 Ergebnisse als MARCXML zurück
 * bzw. als JSON.
 */
include 'lib.php';
$id = yaz_connect(SWB_URL);
yaz_syntax($id, SWB_SYNTAX);
//utf-8 Kodierung
yaz_range($id, 1, 10);
yaz_element($id, SWB_ELEMENTSET);
if (isset($_GET['ppn'])) {
    $ppn = trim($_GET['ppn']);
    yaz_search($id, "rpn", '@attr 5=100 @attr 1=12 "' . $ppn . '"');
}
if (isset($_GET['isbn'])) {
    $n = trim($_GET['isbn']);
    $nArray = explode(",", $n);
    if (count($nArray) > 1) {
        //mehrere ISBNs, z.B. f @or @or @attr 1=7 "9783937219363" @attr 1=7 "9780521369107" @attr 1=7 "9780521518147"
        //Anfuehrungsstriche muessen demaskiert werden, egal ob String mit ' gemacht wird
        $suchString = str_repeat("@or ", count($nArray) - 1) . '@attr 1=7 \\"' . implode('\\" @attr 1=7 \\"', $nArray) . '\\"';
        yaz_search($id, "rpn", $suchString);
开发者ID:stweil,项目名称:malibu,代码行数:31,代码来源:swb.php

示例11: 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

示例12: yaz_connect

 for ($reintentar = 0; $reintentar <= $intentos; $reintentar++) {
     for ($i = 0; $i < $num_hosts; $i++) {
         $id = yaz_connect($host[$i], $options);
         $ids[$i] = $id;
         if ($id <= 0) {
             continue;
         }
         if (!yaz_search($id, "rpn", $fullquery)) {
             echo $msgstr["expr_err"] . '<br>';
             $reintentar = 999;
             break;
         }
         if ($number > 1) {
             yaz_element($id, $element);
         } else {
             yaz_element($id, "F");
         }
         yaz_syntax($id, $syntax);
         yaz_range($id, $start, $number);
     }
     yaz_wait();
     $host_url = "term=" . urlencode($term) . "&field=";
     $host_url .= urlencode($field) . "&";
     $host_url .= "element={$element}&syntax={$syntax}";
     for ($i = 0; $i < $num_hosts; $i++) {
         $id = $ids[$i];
         if ($id <= 0) {
             continue;
         }
         $error = yaz_error($id);
         $errno = yaz_errno($id);
开发者ID:rgevaert,项目名称:ABCD,代码行数:31,代码来源:z3950-01.php

示例13: yazCclArray

function yazCclArray($ccl)
{
    global $config;
    $system = $config['lib']['system'];
    // Create an array to hold settings for the different systems
    $zopts = array();
    $zopts['aleph'] = array('syntax' => '', 'yaz_con_opts' => array('piggyback' => true));
    $zopts['bibliofil'] = array('syntax' => 'normarc', 'yaz_con_opts' => array('piggyback' => true));
    $zopts['bibsys'] = array('syntax' => '', 'yaz_con_opts' => array('piggyback' => false));
    $zopts['koha'] = array('syntax' => '', 'yaz_con_opts' => array('piggyback' => true));
    $zopts['mikromarc'] = array('syntax' => 'normarc', 'yaz_con_opts' => array('piggyback' => true));
    /*
    The Glitre project has not been able to find sample servers fot these
    systems, even after asking the vendors if any exist:
    
    $zopts['reindex'] = array(
      'syntax' => '', 
      'yaz_con_opts' => array(
    	'piggyback' => false,
      ),
    );
    $zopts['tidemann'] = array(
      'syntax' => '', 
      'yaz_con_opts' => array(
    	'piggyback' => false,
      ),	
    );
    */
    $hits = 0;
    $type = 'xml';
    $id = yaz_connect($config['lib']['z3950'], $zopts[$system]['yaz_con_opts']);
    yaz_element($id, "F");
    yaz_syntax($id, $zopts[$system]['syntax']);
    yaz_range($id, 1, 1);
    yaz_ccl_conf($id, get_zconfig());
    $cclresult = array();
    if (!yaz_ccl_parse($id, $ccl, $cclresult)) {
        echo 'Error yaz_ccl_parse: ' . $cclresult["errorstring"];
    } else {
        // Norwegian Z39.50 have no or limited support for yaz_sort
        // See http://wiki.biblab.no/index.php/Z39.50%2C_SRU_og_sortering for details
        // 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)) {
        $yaz_errno = yaz_errno($id);
        // echo "<p>Error yaz_wait: $error ($yaz_errno)</p>";
        $error = array('error' => true, 'stage' => 'yaz_wait', 'desc' => $error, 'num' => $yaz_errno);
        return $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 a max number of records is set for this library, respect it - otherwise use the default.
        $records_max = $config['lib']['records_max'] ? $config['lib']['records_max'] : $config['records_max'];
        if ($p == $records_max) {
            break;
        }
    }
    $ret = array("hits" => $hits, "result" => $data);
    return $ret;
}
开发者ID:glitre,项目名称:glitre,代码行数:71,代码来源:inc.glitre.php

示例14: yaz_connect

 * bl?isbn=ISBN
 *   ISBN ist eine 10- bzw. 13-stellige ISBN mit/ohne Bindestriche/Leerzeichen
 *   ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein
 * bl?ppn=PPN
 *   PPN ist die eine ID-Nummer des BL
 * bl?isbn=ISBN&format=json
 * bl?ppn=PPN&format=json
 *   Ausgabe erfolgt als JSON
 *
 * Sucht übergebene ISBN bzw. PPN im BL-Katalog
 * und gibt maximal 10 Ergebnisse als MARCXML zurück
 * bzw. als JSON.
 */
include 'lib.php';
$id = yaz_connect(BL_URL, array("user" => BL_USER, "password" => BL_PASSWORD));
yaz_syntax($id, BL_SYNTAX);
//utf-8 Kodierung
yaz_range($id, 1, 10);
yaz_element($id, BL_ELEMENTSET);
if (isset($_GET['ppn'])) {
    $ppn = trim($_GET['ppn']);
    yaz_search($id, "rpn", '@attr 5=100 @attr 1=12 "' . $ppn . '"');
}
if (isset($_GET['isbn'])) {
    $n = trim($_GET['isbn']);
    $nArray = explode(",", $n);
    if (count($nArray) > 1) {
        //mehrere ISBNs, z.B. f @or @or @attr 1=7 "9783937219363" @attr 1=7 "9780521369107" @attr 1=7 "9780521518147"
        //Anfuehrungsstriche muessen demaskiert werden, egal ob String mit ' gemacht wird
        $suchString = str_repeat("@or ", count($nArray) - 1) . '@attr 1=7 \\"' . implode('\\" @attr 1=7 \\"', $nArray) . '\\"';
        yaz_search($id, "rpn", $suchString);
开发者ID:stweil,项目名称:malibu,代码行数:31,代码来源:bl.php

示例15: yaz_connect

 *   ISBN ist eine 10- bzw. 13-stellige ISBN mit/ohne Bindestriche/Leerzeichen
 *   ISBN kann ebenfalls eine Komma-separierte Liste von ISBNs sein
 * b3kat?ppn=PPN
 *   PPN ist die eine ID-Nummer des B3KAT
 * b3kat?isbn=ISBN&format=json
 * b3kat?ppn=PPN&format=json
 *   Ausgabe erfolgt als JSON
 *
 * Sucht übergebene ISBN bzw. PPN im B3KAT-Katalog
 * und gibt maximal 10 Ergebnisse als MABXML zurück
 * bzw. als JSON.
 */
include 'lib.php';
$id = yaz_connect(B3KAT_URL, array("user" => B3KAT_USER, "password" => B3KAT_PASSWORD));
//"mab2; charset=iso5426,utf8"
yaz_syntax($id, B3KAT_SYNTAX);
yaz_range($id, 1, 10);
yaz_element($id, B3KAT_ELEMENTSET);
if (isset($_GET['ppn'])) {
    $ppn = trim($_GET['ppn']);
    //aus der Doku: 53 Number local call (BV-Nr.)
    yaz_search($id, "rpn", '@attr 5=100 @attr 1=53 "' . $ppn . '"');
}
if (isset($_GET['isbn'])) {
    $n = trim($_GET['isbn']);
    $nArray = explode(",", $n);
    if (count($nArray) > 1) {
        //mehrere ISBNs, z.B. f @or @or @attr 1=7 "9783937219363" @attr 1=7 "9780521369107" @attr 1=7 "9780521518147"
        //Anfuehrungsstriche muessen demaskiert werden, egal ob String mit ' gemacht wird
        $suchString = str_repeat("@or ", count($nArray) - 1) . '@attr 1=7 \\"' . implode('\\" @attr 1=7 \\"', $nArray) . '\\"';
        yaz_search($id, "rpn", $suchString);
开发者ID:stweil,项目名称:malibu,代码行数:31,代码来源:b3kat.php


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