function cleanSynchroRdfStore() { global $msg, $dbh, $charset, $PMBusername; if (SESSrights & ADMINISTRATION_AUTH) { $result .= "<h3>" . htmlentities($msg["nettoyage_synchrordfstore_reindexation"], ENT_QUOTES, $charset) . "</h3>"; $synchro_rdf = new synchro_rdf(); //remise a zero des tables de synchro rdf $synchro_rdf->truncateStore(); //reindex $query = mysql_query("select notice_id from notices order by notice_id"); if (mysql_num_rows($query)) { while ($mesNotices = mysql_fetch_assoc($query)) { $synchro_rdf->addRdf($mesNotices['notice_id'], 0); $notice = new notice($mesNotices['notice_id']); $niveauB = strtolower($notice->biblio_level); //Si c'est un article, il faut réindexer son bulletin if ($niveauB == 'a') { $bulletin = analysis::getBulletinIdFromAnalysisId($mesNotices['notice_id']); $synchro_rdf->addRdf(0, $bulletin); } } mysql_free_result($query); } $compte = 0; $q = "SELECT *\n\t\t\tWHERE {\n\t\t\t FILTER (!regex(?p, rdf:type,'i')) .\n\t\t\t ?s ?p ?o\n\t\t\t}"; $r = $synchro_rdf->store->query($q); if (is_array($r['result']['rows'])) { $compte = count($r['result']['rows']); } $result .= $compte . " " . htmlentities($msg["nettoyage_synchrordfstore_reindex_total"], ENT_QUOTES, $charset); } else { $result .= sprintf($msg["planificateur_rights_bad_user_rights"], $PMBusername); } return $result; }
print "<br /><br /><h2 align='center'>" . htmlentities($msg["nettoyage_synchrordfstore_reindexation"], ENT_QUOTES, $charset) . "</h2>"; $NoIndex = 1; $query = pmb_mysql_query("select notice_id from notices order by notice_id LIMIT {$start}, {$lot}"); if (pmb_mysql_num_rows($query)) { // définition de l'état de la jauge $state = floor($start / ($count / $jauge_size)); $state .= "px"; // mise à jour de l'affichage de la jauge print "<table border='0' align='center' width='{$jauge_size}' cellpadding='0'><tr><td class='jauge' width='100%'>"; print "<img src='../../images/jauge.png' width='{$state}' height='16px'></td></tr></table>"; // calcul pourcentage avancement $percent = floor($start / $count * 100); // affichage du % d'avancement et de l'état print "<div align='center'>{$percent}%</div>"; while ($mesNotices = pmb_mysql_fetch_assoc($query)) { $synchro_rdf->addRdf($mesNotices['notice_id'], 0); $notice = new notice($mesNotices['notice_id']); $niveauB = strtolower($notice->biblio_level); //Si c'est un article, il faut réindexer son bulletin if ($niveauB == 'a') { $bulletin = analysis::getBulletinIdFromAnalysisId($mesNotices['notice_id']); $synchro_rdf->addRdf(0, $bulletin); } } pmb_mysql_free_result($query); $next = $start + $lot; print "\n\t<form class='form-{$current_module}' name='current_state' action='./clean.php' method='post'>\n\t<input type='hidden' name='v_state' value=\"" . urlencode($v_state) . "\">\n\t<input type='hidden' name='spec' value=\"{$spec}\">\n\t<input type='hidden' name='start' value=\"{$next}\">\n\t<input type='hidden' name='count' value=\"{$count}\">\n\t</form>\n\t<script type=\"text/javascript\"><!-- \n\tsetTimeout(\"document.forms['current_state'].submit()\",1000); \n\t-->\n\t</script>"; } else { $spec = $spec - INDEX_SYNCHRORDFSTORE; $compte = 0; $q = "SELECT *\n\t\t\tWHERE {\n\t\t\t FILTER (!regex(?p, rdf:type,'i')) .\n\t\t\t ?s ?p ?o\n\t\t\t}";
function move($to_bul) { global $msg; global $dbh; global $pmb_synchro_rdf; // rattachement du dépouillement $requete = 'UPDATE analysis SET analysis_bulletin=' . $to_bul . ' WHERE analysis_notice=' . $this->analysis_id; @pmb_mysql_query($requete, $dbh); //dates $myBul = new bulletinage($to_bul); $year = substr($myBul->date_date, 0, 4); $date_parution = $myBul->date_date; $requete = 'UPDATE notices SET year="' . $year . '", date_parution="' . $date_parution . '", update_date=sysdate() WHERE notice_id=' . $this->analysis_id . ' LIMIT 1'; @pmb_mysql_query($requete, $dbh); //Indexation du dépouillement notice::majNoticesTotal($this->analysis_id); audit::insert_modif(AUDIT_NOTICE, $this->analysis_id); if ($pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->delRdf($this->analysis_id, 0); $synchro_rdf->addRdf($this->analysis_id, 0); } return false; }
function _export_($id, $keep_expl = 0, $params = array()) { $export = new synchro_rdf(session_id()); $export->addRdf($id, 0); return; }
function update_in_database($id_notice = 0) { global $dbh; global $pmb_synchro_rdf; $new_notice = 2; $notice_retour = $id_notice; if (!$id_notice) { $retour = array(2, 0); return $retour; } //synchro_rdf if ($pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $synchro_rdf->delRdf($notice_retour, 0); } // traitement des titres uniformes global $pmb_use_uniform_title; if ($pmb_use_uniform_title) { if (count($this->titres_uniformes)) { $ntu = new tu_notice($id_notice); $ntu->update($this->titres_uniformes); } } for ($i = 0; $i < 2; $i++) { if ($this->editors[$i]['id']) { $editor_ids[$i] = $this->editors[$i]['id']; } else { $editor_ids[$i] = editeur::import($this->editors[$i]); } } if ($this->collection["id"]) { $collection_id = $this->collection["id"]; } else { $this->collection['parent'] = $editor_ids[0]; $collection_id = collection::import($this->collection); } if ($this->subcollection["id"]) { $subcollection_id = $this->subcollection["id"]; } else { $this->subcollection['coll_parent'] = $collection_id; $subcollection_id = subcollection::import($this->subcollection); $serie_id = serie::import(stripslashes($this->serie)); } /* traitement de Dewey */ if (!$this->internal_index) { if (!$this->dewey["new_comment"]) { $this->dewey["new_comment"] = ""; } if (!$this->dewey["new_pclass"]) { $this->dewey["new_pclass"] = ""; } $this->internal_index = indexint::import(clean_string($this->dewey[0]), clean_string($this->dewey["new_comment"]), clean_string($this->dewey["new_pclass"])); } $date_parution_z3950 = notice::get_date_parution($this->year); /* Origine de la notice */ $this->orinot_id = origine_notice::import($this->origine_notice); if ($this->orinot_id == 0) { $this->orinot_id = 1; } $sql_ins = "update notices set\n\t\t\ttypdoc \t='" . $this->document_type . "',\n\t\t\tcode \t ='" . $this->isbn . "',\t \n\t\t\ttit1 ='" . $this->titles[0] . "', \n\t\t\ttit2 ='" . $this->titles[1] . "', \n\t\t\ttit3 ='" . $this->titles[2] . "', \n\t\t\ttit4 ='" . $this->titles[3] . "', \n\t\t\ttparent_id ='" . $serie_id . "', \n\t\t\ttnvol ='" . $this->nbr_in_serie . "', \n\t\t\ted1_id =" . $editor_ids[0] . " , \n\t\t\ted2_id =" . $editor_ids[1] . " , \n\t\t\tyear ='" . $this->year . "', \n\t\t\tnpages ='" . $this->page_nbr . "', \n\t\t\till ='" . $this->illustration . "', \n\t\t\tsize ='" . $this->size . "', \n\t\t\taccomp ='" . $this->accompagnement . "', \n\t\t\tcoll_id =" . $collection_id . " , \n\t\t\tsubcoll_id =" . $subcollection_id . " , \n\t\t\tnocoll ='" . $this->nbr_in_collection . "', \n\t\t\tmention_edition ='" . $this->mention_edition . "', \n\t\t\tn_gen ='" . $this->general_note . "', \n\t\t\tn_contenu ='" . $this->content_note . "', \n\t\t\tn_resume ='" . $this->abstract_note . "', \n\t\t\tindexint ='" . $this->internal_index . "', \n\t\t\tstatut\t\t\t\t\t='" . $this->statut . "',\n\t\t\tcommentaire_gestion\t\t='" . $this->commentaire_gestion . "',\n\t\t\tindexation_lang\t\t\t='" . $this->indexation_lang . "',\n\t\t\tthumbnail_url\t\t\t='" . $this->thumbnail_url . "',\n\t\t\tindex_l ='" . clean_tags($this->free_index) . "', \n\t\t\tniveau_biblio ='" . $this->bibliographic_level . "', \n\t\t\tniveau_hierar ='" . $this->hierarchic_level . "', \n\t\t\tlien ='" . $this->link_url . "', \n\t\t\teformat ='" . $this->link_format . "', \n\t\t\torigine_catalogage ='" . $this->orinot_id . "', \n\t\t\tprix ='" . $this->prix . "',\n\t\t\tdate_parution \t\t\t='" . $date_parution_z3950 . "' \n\t\t\twhere notice_id='{$id_notice}' "; //echo "<pre>"; //print_r($this->aut_array); //echo "</pre>"; //echo $sql_ins."<br />"; //echo "<pre>"; //print_r($this->categories); //echo "</pre>"; //exit; $sql_result_ins = pmb_mysql_query($sql_ins) or die("Couldn't update notices : " . $sql_ins); $notice_retour = $id_notice; audit::insert_modif(AUDIT_NOTICE, $id_notice); // purge de la base des responsabilités de la notice intégrée... if ($notice_retour) { $rqt_del = "delete from responsability where responsability_notice='{$notice_retour}'"; $sql_result_del = pmb_mysql_query($rqt_del) or die("Couldn't purge table responsability : " . $rqt_del); } $rqt_ins = "insert into responsability (responsability_author, responsability_notice, responsability_fonction, responsability_type, responsability_ordre) VALUES "; for ($i = 0; $i < sizeof($this->aut_array); $i++) { $aut['id'] = clean_string($this->aut_array[$i]['id']); $aut['name'] = clean_string($this->aut_array[$i]['entree']); $aut['rejete'] = clean_string($this->aut_array[$i]['rejete']); $aut['date'] = clean_string($this->aut_array[$i]['date']); $aut['type'] = $this->aut_array[$i]['type_auteur']; $aut['subdivision'] = clean_string($this->aut_array[$i]['subdivision']); $aut['numero'] = clean_string($this->aut_array[$i]['numero']); $aut['lieu'] = clean_string($this->aut_array[$i]['lieu']); $aut['ville'] = clean_string($this->aut_array[$i]['ville']); $aut['pays'] = clean_string($this->aut_array[$i]['pays']); $aut['web'] = clean_string($this->aut_array[$i]['web']); $aut['author_comment'] = clean_string($this->aut_array[$i]['author_comment']); $aut['authority_number'] = clean_string($this->aut_array[$i]['authority_number']); /* Origine de l'autorité : on reprend les infos d'origine de la notice pour les attribuées aux origines des autorités */ $id_origine_auth = 0; $id_origine_auth = origin_authorities::import($this->origine_notice); if ($id_origine_auth == 0) { $id_origine_auth = 1; } // import de l'autorité auteur si elle n'existe pas et conservation des infos sur l'origine de l'autorité if ($aut['authority_number'] != '' && $id_origine_auth) { $this->aut_array[$i]["id"] = $this->insert_authority_infos($aut['authority_number'], "author", $id_origine_auth, $aut); } if (!$this->aut_array[$i]["id"]) { $this->aut_array[$i]["id"] = auteur::import($aut); } if ($this->aut_array[$i]["id"]) { $rqt = $rqt_ins . " (" . $this->aut_array[$i]["id"] . "," . $notice_retour . ",'" . $this->aut_array[$i]['fonction'] . "'," . $this->aut_array[$i]['responsabilite'] . "," . $i . ") "; $res_ins = pmb_mysql_query($rqt, $dbh); } } // traitement des categories if ($this->categorisation_type == "categorisation_auto") { traite_categories_enreg($notice_retour, $this->categories); } else { $rqt_del = "delete from notices_categories where notcateg_notice='{$notice_retour}' "; $res_del = @pmb_mysql_query($rqt_del, $dbh); $rqt_ins = "insert into notices_categories (notcateg_notice, num_noeud, ordre_categorie) VALUES "; $rqt_ins_values = array(); foreach ($this->categories as $i => $category) { $id_categ = $category['categ_id']; if ($id_categ) { $rqt_ins_values[] = " ('{$notice_retour}','{$id_categ}', {$i}) "; } } $rqt_ins .= implode(",", $rqt_ins_values); $res_ins = @pmb_mysql_query($rqt_ins, $dbh); } // traitement des langues // langues de la publication $rqt_del = "delete from notices_langues where num_notice='{$notice_retour}' "; $res_del = pmb_mysql_query($rqt_del, $dbh); if (is_array($this->language_code) && count($this->language_code)) { $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES "; foreach ($this->language_code as $ordre_lang => $code_lang) { if ($code_lang) { $rqt = $rqt_ins . " ('{$notice_retour}',0, '{$code_lang}', {$ordre_lang}) "; $res_ins = @pmb_mysql_query($rqt, $dbh); } } } // langues originales if (is_array($this->original_language_code) && count($this->original_language_code)) { $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES "; foreach ($this->original_language_code as $ordre_lang => $code_lang) { if ($code_lang) { $rqt = $rqt_ins . " ('{$notice_retour}',1, '{$code_lang}', {$ordre_lang}) "; $res_ins = @pmb_mysql_query($rqt, $dbh); } } } //Traitement des champs personnalisés (du formulaire !!!) $p_perso = new parametres_perso("notices"); $nberrors = $p_perso->check_submited_fields(); $p_perso->rec_fields_perso($notice_retour); //Traitement import perso global $notice_id, $notice_org, $notice_type_org; if (function_exists('z_recup_noticeunimarc_suite') && function_exists('recup_noticeunimarc_suite')) { //Suppression des champs persos $requete = "delete from notices_custom_values where notices_custom_origine=" . $notice_retour; @pmb_mysql_query($requete); $notice_id = $notice_retour; z_recup_noticeunimarc_suite($notice_org); z_import_new_notice_suite(); } // Mise à jour des index de la notice notice::majNotices($notice_retour); // Mise à jour de la table notices_global_index notice::majNoticesGlobalIndex($notice_retour); // Mise à jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($notice_retour); //Documents numériques foreach ($this->doc_nums as $doc_num) { if (!$doc_num["a"]) { continue; } explnum_add_from_url($notice_retour, $this->bull_id, $doc_num["b"], $doc_num["a"], false, $this->source_id, $doc_num["f"], '', $doc_num["s"]); } //synchro_rdf if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($notice_retour, 0); } $retour = array($new_notice, $notice_retour); return $retour; }
} else { // echec de la requete error_message($libelle, $msg[281], 1, "./catalog.php"); } //Recherche du titre uniforme automatique global $opac_enrichment_bnf_sparql; $opac_enrichment_bnf_sparql = 1; $titre_uniforme = notice::getAutomaticTu($id); // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($id); // Mise a jour des index de la notice notice::majNotices($id); // Mise a jour de la table notices_global_index notice::majNoticesGlobalIndex($id); // Mise a jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($id); // restaure l'environnement de langue notice::indexation_restaure($info); //synchro_rdf if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($id, 0); } } else { if ($f_tit1 == "") { // erreur : le champ tit1 est vide error_message($libelle, $notitle_message, 1, "./catalog.php"); } else { error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1); } } }
// Mise à jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($update_result); if ($gestion_acces_active == 1 && $myBulletinage->bull_num_notice) { //mise a jour des droits d'acces user_notice (idem notice mere perio) if ($gestion_acces_user_notice == 1) { $q = "replace into acces_res_1 select {$myBulletinage->bull_num_notice}, res_prf_num, usr_prf_num, res_rights, res_mask from acces_res_1 where res_num=" . $myBulletinage->bulletin_notice; mysql_query($q, $dbh); } //mise a jour des droits d'acces empr_notice if ($gestion_acces_empr_notice == 1) { $dom_2 = $ac->setDomain(2); if ($bul_id) { $dom_2->storeUserRights(1, $myBulletinage->bull_num_notice, $res_prf, $chk_rights, $prf_rad, $r_rad); } else { $dom_2->storeUserRights(0, $myBulletinage->bull_num_notice, $res_prf, $chk_rights, $prf_rad, $r_rad); } } } } //Pour la synchro rdf if ($pmb_synchro_rdf) { $synchro_rdf->addRdf(0, $myBulletinage->bulletin_id); } if ($result) { print "<div class='row'><div class='msg-perio'>" . $msg["maj_encours"] . "</div></div>"; $retour = "./catalog.php?categ=serials&sub=view&sub=bulletinage&action=view&bul_id={$result}"; print "\n\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"{$retour}\" style=\"display:none\">\n\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t\t</form>\n\t\t\t<script type=\"text/javascript\">document.dummy.submit();</script>\n\t\t\t"; } else { error_message($msg['catalog_serie_modif_bull'], $msg['catalog_serie_modif_bull_imp'], 1, "./catalog.php?categ=serials&sub=view&serial_id={$serial_id}"); } }
// traitement des langues originales $rqt_ins = "insert into notices_langues (num_notice, type_langue, code_langue, ordre_langue) VALUES "; while (list($key, $val) = each($f_langorg_form)) { $tmpcode_langue = $val['code']; if ($tmpcode_langue) { $tmpordre_langue = $val['ordre']; $rqt = $rqt_ins . " ('{$update_result}',1, '{$tmpcode_langue}', {$tmpordre_langue}) "; $res_ins = @mysql_query($rqt, $dbh); } } //Traitement des champs perso $p_perso->rec_fields_perso($update_result); // permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($serial->serial_id); // Mise à jour de la table notices_global_index notice::majNoticesGlobalIndex($serial->serial_id); // Mise à jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($serial->serial_id); // restaure l'environnement de langue notice::indexation_restaure($info); //Pour la synchro rdf if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($serial->serial_id, 0); } print "<div class='row'><div class='msg-perio'>" . $msg[maj_encours] . "</div></div>"; $retour = "./catalog.php?categ=serials&sub=view&serial_id=" . $serial->serial_id; print "\n\t\t\t<form class='form-{$current_module}' name=\"dummy\" method=\"post\" action=\"{$retour}\" style=\"display:none\">\n\t\t\t\t<input type=\"hidden\" name=\"id_form\" value=\"{$id_form}\">\n\t\t\t</form>\n\t\t\t<script type=\"text/javascript\">document.dummy.submit();</script>\n\t\t\t"; } else { error_message($msg[4004], $msg['catalog_serie_impossible'], 1, './catalog.php?categ=serials'); } }
} //Traitement des périos et bulletins global $perio_type, $bull_type; global $f_perio_new, $f_perio_new_issn; global $f_bull_new_num, $f_bull_new_date, $f_bull_new_mention, $f_bull_new_titre; //Perios if ($perio_type == 'insert_new' && !$serial_id) { $new_serial = new serial(); $values = array(); $values['tit1'] = $f_perio_new; $values['code'] = $f_perio_new_issn; $values['niveau_biblio'] = "s"; $values['niveau_hierar'] = "1"; $serial_id = $new_serial->update($values); if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($serial_id, 0); } } //Bulletin if ($bull_type == 'insert_new' && !$bul_id) { $req = "insert into bulletins set bulletin_numero='" . $f_bull_new_num . "',\n\t\t\t mention_date='" . $f_bull_new_mention . "',\n\t\t\t date_date='" . $f_bull_new_date . "',\n\t\t\t bulletin_titre='" . $f_bull_new_titre . "',\n\t\t\t bulletin_notice='" . $serial_id . "'"; pmb_mysql_query($req, $dbh); $bul_id = pmb_mysql_insert_id(); if ($pmb_synchro_rdf) { $synchro_rdf->addRdf(0, $bul_id); } } $table['serial_id'] = $serial_id; $table['bul_id'] = $bul_id; if ($analysis_id) { $req_new = "select notice_is_new, notice_date_is_new from notices where notice_id={$analysis_id} ";
function replace($by, $del_article = 0) { global $msg; global $dbh; global $pmb_synchro_rdf; // traitement des dépouillements du bulletin if ($del_article) { // suppression des notices de dépouillement $this->delete_analysis(); } else { // sinon on ratache les dépouillements existants $requete = "UPDATE analysis SET analysis_bulletin={$by} where analysis_bulletin=" . $this->bulletin_id; @mysql_query($requete, $dbh); } // ratachement des exemplaires $requete = "UPDATE exemplaires SET expl_bulletin={$by} WHERE expl_bulletin=" . $this->bulletin_id; @mysql_query($requete, $dbh); // élimination des docs numériques $requete = "UPDATE explnum SET explnum_bulletin={$by} WHERE explnum_bulletin=" . $this->bulletin_id; @mysql_query($requete, $dbh); //Mise à jour des articles reliés if ($pmb_synchro_rdf) { $synchro_rdf = new synchro_rdf(); $requete = "SELECT analysis_notice FROM analysis WHERE analysis_bulletin='{$by}' "; $result = mysql_query($requete, $dbh); while ($row = mysql_fetch_object($result)) { $synchro_rdf->delRdf($row->analysis_notice, 0); $synchro_rdf->addRdf($row->analysis_notice, 0); } } $this->delete(); return false; }