$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 "

"; //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; $max_n_aut=9; //numero massimo di autori $first_sec_aut=3; //ndx del primo autore secondario $xaa=array('','','','','','','','',''); //lista vuota campi autore (9) $ret=""; $aax=$xaa; $xx=explode('/',$campi['Title']); $at=explode(';',$xx[1]); $x=$campi['Authors']; if (strpos($x,$sep)>0) $ax=explode($sep,$x); else $ax=array($x); if (count($ax)>$first_sec_aut) $i=$first_sec_aut; else $i=0; 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; } } } } } } 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]); $ret=$t[0].$sep.$sep.$sep.str_replace(' :',' ',$t[1]).$sep; return $ret; } function sut_edition(){ global $campi, $sep; $ret=sut_dummy(1); return $ret; } function sut_editor(){ global $campi, $sep; $ret=""; $t=explode(' - ',$campi['Title']); $x=""; for ($k=1;$k0) { $x=$t[$k]; break; } } // data edithors in $t[1] format = city : name , year //preg_match('/^(.*)\:(.*)\,(.*)$/',$t[1],$xx); $xx=array('','',''); $i=strpos($x,':'); if ($i>0) { $xx[0]=trim(substr($x,0,$i)); $x=substr($x,$i+1); } $i=strpos($x,','); if ($i>0) { $xx[1]=trim(substr($x,0,$i)); $x=substr($x,$i+1); }else{ $xx[1]=$x; $x=""; } $xx[2]=trim(str_replace('.','',$x)); $ret=$xx[0].$sep.$xx[1].$sep.$xx[2].$sep; //printr($t,'','TITOLO'); //printr($xx,'','EDITORE'); return $ret; } function sut_collation(){ global $campi, $sep; $ret=""; $t=explode(' - ',$campi['Title']); // data edithors in $t[1] format = pages : ill. ; dim // preg_match('/^(.*):(.*);(.*)$/',$t[2],$xx); $x=""; for ($k=1;$k0 or strpos($t[$k],'ill')>0 or strpos($t[$k],'cm')>0) { $x=$t[$k]; break; } } $xx=array('','',''); $i=strpos($x,'p.'); if ($i>0) { $xx[0]=trim(substr($x,0,$i+2)); $x=str_replace(':',' ',substr($x,$i+2)); } $i=strpos($x,';'); if ($i>0) { $xx[1]=trim(substr($x,0,$i)); $x=substr($x,$i+1); }else{ $xx[1]=""; } $x=trim($x); $i=strpos($x,'cm'); if ($i>0) $x=substr($x,0,$i+3); $xx[2]=$x; $ret=$xx[0].$sep.$xx[1].$sep.$xx[2].$sep; //printr($xx,'','COLLAZIONE'); return $ret; } function sut_collection(){ global $campi, $sep; $ret=trim($Campi['Collection']).$sep.$sep.$sep.$sep; return $ret; } function sut_notes(){ global $campi, $sep; $ret=sut_dummy(3); return $ret; } 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=''; if (strpos($campi['DecimalIndex'],'|')) $x=explode('|',$campi['DecimalIndex']); else $x=array($campi['DecimalIndex']); foreach ($x as $dummykey=>$d){ $dd=explode(' ',trim($d)); if ($dd[0]=='D') { $ret=$dd[1]; break; } } $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; } ?>