$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);
foreach ($campo as $k => $v) {
$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 "
";
//printr($campo,'','CAMPO');
//printr($campi,'','CAMPI');
//print "$ss
$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_;
}
function sut_dummy($nc){
global $sep;
$ret="";
for ($k=0;$k<$nc;$k++) $ret .= '|';
return $ret;
}
function sut_bibliolevel(){
global $campi, $sep;
return '';
}
function sut_typedoc(){
global $campi, $sep;
return $sep;
}
// AUTHORS: max 9 authors
// if n.authors > 3 all in 702
function sut_authors(){
global $campi, $sep;
$ret=""; $aay=array('','','','','','');
$xx=explode('/',$campi['Title']);
$at=explode(';',$xx[1]);
// per il momento gestisco solo un autore principale,nonostantel' "esplosione" :-)
$x=$campi['Authors'];
if (strpos($x,$sep)>0) $ax=explode($sep,$x);
else $ax=array($x);
$ax[0]=trim($ax[0]);
// invece gli autori secondari li "esplodiamo" dal campo nomi
$y=$campi['Names'];
$pattern = "/ (\#\{)([^\}]+)(\}) /";
$y= preg_replace($pattern, "|", $y);
//se gli autori principali sono nel campo Names li togliamo
$pattern ="/".$ax[0]."\|/";
$y= preg_replace($pattern, "", $y);
$ay=explode($sep,$y);
//mettiamo i primi 6 autori secondari in $aay
for ($k=0;$k $ff) {
$ff=str_replace('/','\/',$ff);
for ($k=0;$k0) // multifunc desc
$aff=explode('|',$ff);
else
$aff=array($ff);
foreach ($aff as $dummykey=>$fx){
$patt="/$fx/i" ;
if (preg_match($patt,$af[$k])){ //cerca funzione
if (strpos($af[$k],$a[0])){ //cerca cognome
$ret=$cf; //funzione identificata !!!
//$k=9999 ;
//break 3;
$end = true;
break;
}
}
}
}
if($end) break;
}
if($end) break;
}
return $ret;
}
function sut_title(){
global $campi, $sep;
$ret="";
$x=explode('/',$campi['Title']);
$x[0]=str_replace('*','',$x[0]);
$x[0]=str_replace('<<','',$x[0]);
$x[0]=str_replace('>>','',$x[0]);
$x[0]=str_replace('<','',$x[0]);
$x[0]=str_replace('>','',$x[0]);
$x[0]=preg_replace('/([1-9])\:/','vv $1 ',$x[0]);
$t=explode(':',$x[0],2); // titolo e complemento del titolo
preg_match('/(vv\s[1-9]\s)/',$t[0],$vol);
if ($vol[0]) $t[0]=str_replace($vol[0],'',$t[0])." ".str_replace('vv','',$vol[0]);
//printr($t,'','TITOLO');
$ret=$t[0].$sep.$sep.$sep.str_replace(' :',' ',$t[1]).$sep;
$ret=str_replace('*','',$ret);
return $ret;
}
function sut_edition(){
global $campi, $sep;
$ret=trim($campi['Edition']).$sep;
return $ret;
}
function sut_editor(){
global $campi, $sep;
$ax=array('','');
$bx=array('','');
$ax=explode(':',$campi['Editor']);
$bx=explode(',',$ax[1]);
$ret=$ax[0].$sep.$bx[0].$sep.$bx[1].$sep;
return $ret;
}
function sut_collation(){
global $campi, $sep;
$axyz=array('','','','');
$ret="";
$t=$campi['Collation'];
$ax=explode(':',$t);
if (count($ax)>1) {
$axyz[0]=$ax[0];
$ay=explode(';',$ax[1]);
$axyz[1]=$ay[0];
if (count($ax)>1) $axyz[2]=$ay[1];
}else{
$az=explode(';',$t);
$axyz[0]=$az[0];
if (count($az)>1) $axyz[2]=$az[1];
}
$ret=$axyz[0].$sep.$axyz[1].$sep.$axyz[2].$sep.$axyz[3].$sep;
//printr($xx,'','COLLAZIONE');
return $ret;
}
function sut_collection(){
global $campi, $sep;
$pattern = "/(\#\{)([^\}]+)(\})/";
$ret= preg_replace($pattern, "", $campi['Collection']);
$ret=str_replace('*','',$ret);
$ret=trim($ret);
$ret.=$sep.$sep.$sep.$sep;
return $ret;
}
function sut_notes(){
global $campi, $sep;
return $sep;
}
function sut_numbers(){
global $campi, $sep;
$x=explode(' ',trim($campi['Numbers']));
$s=array() ; $n=array() ; $i=0 ;$j=0; $l=-1;
for ($k=0;$k-1) $ret=$n[$l].$sep;
else $ret=$n[0].$sep;
return $ret;
}
function sut_names(){
global $campi, $sep;
return $sep;
}
function sut_freeindex(){
global $campi, $sep;
$ret=str_replace('|',' ',$campi['FreeIndex']);
$ret=trim(preg_replace('/\b.\s|\s\-\s/',' ',$ret));
$ret .= $sep;
return $ret;
}
function sut_decimalindex(){
global $campi, $sep;
$ret='';
$d=trim($campi['DecimalIndex']);
$dd=explode(' ',$d);
$ret=$dd[0];
$ret.=$sep;
return $ret;
}
function sut_country(){
global $campi, $sep;
$ret=trim($campi['Country']).$sep;
return $ret;
}
function sut_lang(){
global $campi, $sep;
global $codelang;
$cl=array_search(strtolower(trim($campi['Lang'])),$codelang);
$ret=$cl.$sep;
return $ret;
}
function sut_Linked_notices(){
global $campi, $sep;
$ret=dummy(1);
return $ret;
}
function sut_Places(){
global $campi, $sep;
$ret=dummy(1);
return $ret;
}
function sut_Series(){
global $campi, $sep;
$ret=dummy(1);
return $ret;
}
?>