function toiso($notice, $s, $islast, $isfirst, $param_path) { $x2i = new xml_unimarc(); $x2i->XMLtoiso2709_notice($notice, $s['ENCODING']); if ($x2i->warning_msg[0]) { $r['WARNING'] = $x2i->warning_msg[0]; } if ($x2i->n_valid == 0) { $r['VALID'] = false; $r['DATA'] = ""; $r['ERROR'] = $x2i->error_msg[0]; } else { $r['VALID'] = true; $r['DATA'] = $x2i->notices_[0]; $r['ERROR'] = ""; } return $r; }
${$op} = $corresp_op[$use[0]]; return $idf; } } return; } switch ($command) { case "search": //print $query."<br />"; construct_query($query, 0, 0); $s = new search(); $table = $s->make_search(); //print $s->make_human_query(); $sql_query = "select notice_id from {$table} limit 100"; $resultat = @mysql_query($sql_query); echo "0@No errors@"; echo @mysql_num_rows($resultat); while (list($id) = @mysql_fetch_row($resultat)) { echo "@{$id}"; } break; case "get_notice": $id = $query; $e = new export(array($id)); $e->get_next_notice(); $toiso = new xml_unimarc(); $toiso->XMLtoiso2709_notice($e->notice); echo "0@No errors@"; echo $toiso->notices_[0]; break; }
function get_notice_externe($notice_id) { global $charset, $msg; $memo = array(); $notice_extern_to_memo = array(); $notice_uni = $this->info['notice_base']; $req = "select * from notices where notice_id=" . $notice_id . " "; $resultat = pmb_mysql_query($req); if ($r = pmb_mysql_fetch_object($resultat)) { $code = $r->code; $notice_extern = $this->info['harvest']->havest_notice($code, $notice_id); // printr($notice_extern); // printr($notice_uni); $cpt = 0; foreach ($notice_extern as $contens) { $cpt++; $profil = $this->info['profil']->info['fields'][$contens['xml_id']]; // $pmb_fields=$this->info['harvest']->fields_id[$contens['xml_id']]; //printr($pmb_fields); $harvest = $this->info['harvest']->info['fields'][$contens['xml_id']]; if ($profil) { if ($profil['flagtodo'] == 1) { // on remplace les champs par les nouvelles valeurs foreach ($notice_uni['f'] as $index => $uni_field) { // printr($contens); // printr($uni_field); if ($contens['pmb_unimacfield'] && $uni_field['c'] == $contens['pmb_unimacfield'] && $contens['pmb_unimacsubfield']) { // si champ et sous champ, on delete les anciens champs/sous-champ foreach ($uni_field['s'] as $cpt => $ss_field) { if ($ss_field['c'] == $contens['pmb_unimacsubfield']) { array_splice($notice_uni['f'][$index]['s'], $cpt, 1); } } if (!count($uni_field['s'])) { array_splice($notice_uni['f'], $index, 1); } } elseif ($contens['pmb_unimacfield'] && $uni_field['c'] == $contens['pmb_unimacfield']) { // si pas de sous champ on efface tout array_splice($notice_uni['f'], $index, 1); } } } if ($profil['flagtodo'] == 1 || $profil['flagtodo'] == 2) { $notice_extern_to_memo[] = $contens; } } } //printr($notice_uni); //printr($notice_extern_to_memo); // Pour tout les champs nouveau à insérer $memo_prev = array(); foreach ($notice_extern_to_memo as $contens) { $nb = count($notice_uni['f']); $flag_create_unimacfield = 0; if ($contens['num_source'] != $memo_prev['num_source']) { $flag_create_unimacfield = 1; } if ($contens['pmb_unimacfield'] != $memo_prev['pmb_unimacfield']) { $flag_create_unimacfield = 1; } if ($contens['field_order'] != $memo_prev['field_order']) { $flag_create_unimacfield = 1; } if ($flag_create_unimacfield) { $index = $nb; } else { $index = $memo_prev['i']; } $notice_uni['f'][$index]['c'] = $contens['pmb_unimacfield']; $notice_uni['f'][$index]['ind'] = $contens['field_ind']; if ($contens['pmb_unimacsubfield']) { $sschamp = $contens['pmb_unimacsubfield']; } else { $sschamp = $contens['usubfield']; } $nb_ss = count($notice_uni['f'][$index]['s']); $notice_uni['f'][$index]['s'][$nb_ss]['c'] = $sschamp; $notice_uni['f'][$index]['s'][$nb_ss]['value'] = $contens['value']; $memo_prev = $contens; $memo_prev['i'] = $index; // $memo de l'enregistrement en cours // printr($memo_prev); } } else { //notice inexistante return ""; } // printr($notice_uni); // conversion du tableau en xml $export = new export($notice_id); $export->xml_array = $notice_uni; $export->toxml(); $notice_xml = $export->notice; // conversion du xml en unimarc $xml_unimarc = new xml_unimarc(); $xml_unimarc->XMLtoiso2709_notice($notice_xml, $charset); $notice = $xml_unimarc->notices_[0]; $z = new z3950_notice("unimarc", $notice); $z->libelle_form = $msg["notice_connecteur_remplace_catal"]; if ($z->bibliographic_level == "a" && $z->hierarchic_level == "2") { // article //$form=$z->get_form("catalog.php?categ=update&id=".$notice_id,$notice_id,'button',true); } else { $form = $z->get_form("catalog.php?categ=harvest&action=record¬ice_id=" . $notice_id, $notice_id, 'button'); } $form = str_replace("<!--!!form_title!!-->", "<h3>" . sprintf($msg["harvest_notice_build_title"], $notice_id, $item) . "</h3>", $form); print $form; }