Example #1
0
function from_sutrs($ss, $campo)
{
    $base_path = "../..";
    global $class_path;
    global $lang;
    global $include_path;
    global $charset;
    global $campi, $sep;
    global $fun;
    $campi = array();
    // strip \r\n and spaces
    $pattern = "/\r/";
    $ss = preg_replace($pattern, "", $ss);
    $pattern = "/\n /";
    $ss = preg_replace($pattern, " ", $ss);
    $pattern = "/\n/";
    $ss = preg_replace($pattern, " ", $ss);
    $pattern = "/\\s+/";
    $ss = preg_replace($pattern, " ", $ss);
    // put tag sutrs in sutrs record
    foreach ($campo as $dummykey => $v) {
        $dato[$v] = "";
        $ss = preg_replace("/{$v}:/", "|{$v}::", $ss);
    }
    // 	explode fields sutrs in $dato (array)
    $aX = preg_split("/\\|/", $ss);
    foreach ($aX as $dummykey => $vv) {
        $v = preg_split("/::/", $vv);
        if ($dato[$v[0]] == '') {
            $sep = '';
        } else {
            $sep = '|';
        }
        $dato[$v[0]] .= $sep . $v[1];
    }
    // copy $dato values to associative array $campi which keys are standard and in english
    reset($campo);
    while (list($k, $v) = each($campo)) {
        $campi[$k] = $dato[$v];
    }
    //* DEBUG
    // 			$fp = fopen ("../../temp/raw".rand().".unimarc","wb");
    // 			fwrite ($fp,$lista[3]);
    // 			fclose ($fp);
    // text record construction in $notice
    $sep = '|';
    $notice = "";
    //isbn
    $notice .= sut_numbers();
    // col. 1
    $notice .= del_more_garbage(sut_authors());
    // col. 2..28  (1 author = 3 col)
    $notice .= del_more_garbage(sut_title());
    // col.29..32
    $notice .= sut_edition();
    // col.33
    $notice .= del_more_garbage(sut_editor());
    // col.34..36
    $notice .= del_more_garbage(sut_collection());
    // col.37..40
    // serie
    $notice .= sut_dummy(2);
    // col.41..42
    $notice .= sut_decimalindex();
    // col.43
    $notice .= sut_freeindex();
    // col.44
    $notice .= sut_lang();
    // col.45
    // orig.lang
    $notice .= sut_dummy(1);
    // col.46
    $notice .= sut_collation();
    // col.47..50
    $notice .= sut_notes();
    // col.51..53
    //DEBUG: in z_progression_main expand size frame3 to 50%
    //print "<hr /><br />";
    //printr($campo,'','CAMPO');
    //printr($campi,'','CAMPI');
    //print "$ss<br /><hr />$notice";
    //Lecture des paramètres d'import
    $param_path = "sutrs2unimarciso";
    //Lecture des paramètres
    _parser_("{$base_path}/admin/convert/imports/" . $param_path . "/params.xml", array("IMPORTNAME" => "_import_name_", "NPERPASS" => "_n_per_pass_", "INPUT" => "_input_", "STEP" => "_step_", "OUTPUT" => "_output_"), "PARAMS");
    require_once "{$base_path}/admin/convert/xmltransform.php";
    //En fonction du type de fichier d'entrée, inclusion du script de gestion des entrées
    require_once "{$base_path}/admin/convert/imports/input_text.inc.php";
    //En fonction du type de fichier de sortie, inclusion du script de gestion des sorties
    require_once "{$base_path}/admin/convert/imports/output_iso_2709.inc.php";
    $n_current = 0;
    $n_errors = 0;
    $n_per_pass = 1;
    $notice_ = convert_notice($notice);
    return $notice_;
}
Example #2
0
function sut_notes()
{
    global $campi, $sep;
    $ret = sut_dummy(3);
    return $ret;
}