function _get_footer_($output_params)
{
    $export = new synchro_rdf(session_id());
    $contenuRdf = $export->exportStoreXml();
    //Suppression des tables temporaires
    $res = pmb_mysql_query("SHOW TABLES LIKE '" . session_id() . "%'");
    while ($row = pmb_mysql_fetch_array($res)) {
        pmb_mysql_query("DROP TABLE " . $row[0]);
    }
    return $contenuRdf;
}
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: reindex_synchrordfstore.inc.php,v 1.3 2015-04-03 11:16:18 jpermanne Exp $
if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) {
    die("no access");
}
require_once $class_path . '/synchro_rdf.class.php';
require_once $class_path . '/notice.class.php';
require_once $class_path . '/serials.class.php';
// la taille d'un paquet de notices
$lot = REINDEX_PAQUET_SIZE;
// defini dans ./params.inc.php
// taille de la jauge pour affichage
$jauge_size = GAUGE_SIZE;
$jauge_size .= "px";
$synchro_rdf = new synchro_rdf();
// initialisation de la borne de départ
if (!isset($start)) {
    $start = 0;
    //remise a zero des tables de synchro rdf
    $synchro_rdf->truncateStore();
}
$v_state = urldecode($v_state);
if (!$count) {
    $notices = pmb_mysql_query("SELECT count(1) FROM notices", $dbh);
    $count = pmb_mysql_result($notices, 0, 0);
}
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)) {
 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;
 }
Exemple #4
0
function _export_($id, $keep_expl = 0, $params = array())
{
    $export = new synchro_rdf(session_id());
    $export->addRdf($id, 0);
    return;
}
Exemple #5
0
}
if ($acces_m == 0) {
    error_message('', htmlentities($dom_1->getComment('mod_noti_error'), ENT_QUOTES, $charset), 1, '');
} else {
    //Pour les champs personnalises
    require_once $class_path . "/parametres_perso.class.php";
    require_once $class_path . "/notice.class.php";
    require_once $class_path . "/notice_doublon.class.php";
    require_once $class_path . "/authperso_notice.class.php";
    require_once $class_path . "/map/map_edition_controler.class.php";
    require_once $class_path . "/map_info.class.php";
    require_once $class_path . "/nomenclature/nomenclature_record_ui.class.php";
    //Pour la synchro rdf
    require_once $class_path . "/synchro_rdf.class.php";
    if ($pmb_synchro_rdf) {
        $synchro_rdf = new synchro_rdf();
    }
    // Pour l'indexation des concepts
    require_once $class_path . "/index_concept.class.php";
    $sign = new notice_doublon();
    $signature = $sign->gen_signature();
    if ($forcage == 1) {
        $tab = unserialize(stripslashes($ret_url));
        foreach ($tab->GET as $key => $val) {
            if (get_magic_quotes_gpc()) {
                $GLOBALS[$key] = $val;
            } else {
                add_sl($val);
                $GLOBALS[$key] = $val;
            }
        }
 function update($value)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $pmb_synchro_rdf;
     if (!$value['name']) {
         return false;
     }
     // nettoyage des chaînes en entrée
     $value['name'] = clean_string($value['name']);
     $value['num_author'] = clean_string($value['num_author']);
     $value['form'] = clean_string($value['form']);
     $value['date'] = clean_string($value['date']);
     $value['subject'] = clean_string($value['subject']);
     $value['place'] = clean_string($value['place']);
     $value['history'] = clean_string($value['history']);
     $value['characteristic'] = clean_string($value['characteristic']);
     $value['intended_termination'] = clean_string($value['intended_termination']);
     $value['intended_audience'] = clean_string($value['intended_audience']);
     $value['context'] = clean_string($value['context']);
     $value['equinox'] = clean_string($value['equinox']);
     $value['coordinates'] = clean_string($value['coordinates']);
     $value['tonalite'] = clean_string($value['tonalite']);
     $value['comment'] = clean_string($value['comment']);
     $titre = titre_uniforme::import_tu_exist($value, 1, $this->id);
     if ($titre) {
         require_once "{$include_path}/user_error.inc.php";
         warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_doublon_erreur"]);
         return FALSE;
     }
     $tu_auteur = new auteur($value['num_author']);
     if (!$tu_auteur->id) {
         $value['num_author'] = 0;
     } else {
         $value['num_author'] = $tu_auteur->id;
     }
     $flag_index = 0;
     $requete = "SET ";
     $requete .= "tu_name='" . $value["name"] . "', ";
     $requete .= "tu_num_author='" . $value['num_author'] . "', ";
     $requete .= "tu_forme='" . $value["form"] . "', ";
     $requete .= "tu_date='" . $value["date"] . "', ";
     $requete .= "tu_sujet='" . $value["subject"] . "', ";
     $requete .= "tu_lieu='" . $value["place"] . "', ";
     $requete .= "tu_histoire='" . $value["history"] . "', ";
     $requete .= "tu_caracteristique='" . $value["characteristic"] . "', ";
     $requete .= "tu_completude='" . $value["intended_termination"] . "', ";
     $requete .= "tu_public='" . $value["intended_audience"] . "', ";
     $requete .= "tu_contexte='" . $value["context"] . "', ";
     $requete .= "tu_equinoxe='" . $value["equinox"] . "', ";
     $requete .= "tu_coordonnees='" . $value["coordinates"] . "', ";
     $requete .= "tu_tonalite='" . $value["tonalite"] . "', ";
     $requete .= "tu_comment='" . $value["comment"] . "', ";
     $requete .= "tu_import_denied='" . $value["import_denied"] . "'";
     if ($this->id) {
         // update
         $requete = 'UPDATE titres_uniformes ' . $requete;
         $requete .= ' WHERE tu_id=' . $this->id . ' ;';
         if (mysql_query($requete, $dbh)) {
             $flag_index = 1;
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_modif_erreur"]);
             return FALSE;
         }
         audit::insert_modif(AUDIT_TITRE_UNIFORME, $this->id);
     } else {
         // creation
         $requete = 'INSERT INTO titres_uniformes ' . $requete . ' ';
         $result = mysql_query($requete, $dbh);
         if ($result) {
             $this->id = mysql_insert_id();
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_creation_erreur"]);
             return FALSE;
         }
         audit::insert_creation(AUDIT_TITRE_UNIFORME, $this->id);
     }
     $aut_link = new aut_link(AUT_TABLE_TITRES_UNIFORMES, $this->id);
     $aut_link->save_form();
     $aut_pperso = new aut_pperso("tu", $this->id);
     $aut_pperso->save_form();
     // Gestion des champ répétables
     $requete = "DELETE FROM tu_distrib WHERE distrib_num_tu='{$this->id}' ";
     mysql_query($requete, $dbh);
     $requete = "DELETE FROM tu_ref WHERE ref_num_tu='{$this->id}' ";
     mysql_query($requete, $dbh);
     $requete = "DELETE FROM tu_subdiv WHERE subdiv_num_tu='{$this->id}' ";
     mysql_query($requete, $dbh);
     // Distribution instrumentale et vocale (pour la musique)
     for ($i = 0; $i < count($value['distrib']); $i++) {
         $requete = "INSERT INTO tu_distrib SET\n\t\t\tdistrib_num_tu='{$this->id}',\n\t\t\tdistrib_name='" . $value['distrib'][$i] . "',\n\t\t\tdistrib_ordre='{$i}' ";
         mysql_query($requete, $dbh);
     }
     // Référence numérique (pour la musique)
     for ($i = 0; $i < count($value['ref']); $i++) {
         $requete = "INSERT INTO tu_ref SET\n\t\tref_num_tu='{$this->id}',\n\t\tref_name='" . $value['ref'][$i] . "',\n\t\tref_ordre='{$i}' ";
         mysql_query($requete, $dbh);
     }
     // Subdivison de forme
     for ($i = 0; $i < count($value['subdiv']); $i++) {
         $requete = "INSERT INTO tu_subdiv SET\n\t\tsubdiv_num_tu='{$this->id}',\n\t\tsubdiv_name='" . $value['subdiv'][$i] . "',\n\t\tsubdiv_ordre='{$i}' ";
         mysql_query($requete, $dbh);
     }
     // mise à jour du champ index du titre uniforme
     if ($this->id) {
         titre_uniforme::update_index_tu($this->id);
     }
     // réindexation de la notice
     if ($flag_index) {
         titre_uniforme::update_index($this->id);
     }
     //mise à jour de l'oeuvre rdf
     if ($flag_index && $pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->updateAuthority($this->id, 'oeuvre');
     }
     return TRUE;
 }
Exemple #7
0
 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 replace($by = 0, $link_save = 0)
 {
     global $msg, $dbh;
     global $pmb_synchro_rdf;
     if ($this->id_noeud == $by || !$this->id_noeud || !$by) {
         return $msg["categ_imposible_remplace_elle_meme"];
     }
     $aut_link = new aut_link(AUT_TABLE_CATEG, $this->id_noeud);
     // "Conserver les liens entre autorités" est demandé
     if ($link_save) {
         // liens entre autorités
         $aut_link->add_link_to(AUT_TABLE_CATEG, $by);
     }
     $aut_link->delete();
     //synchro_rdf : on empile les noeuds impactés pour les traiter plus loin
     if ($pmb_synchro_rdf) {
         $arrayIdImpactes = array();
         $arrayThesImpactes = array();
         $thes = thesaurus::getByEltId($this->id_noeud);
         $arrayThesImpactes[] = $thes->id_thesaurus;
         //parent
         if ($this->num_parent != $thes->num_noeud_racine) {
             $arrayIdImpactes[] = $this->num_parent;
         }
         //enfants
         $res = noeuds::listChilds($this->id_noeud, 1);
         if (pmb_mysql_num_rows($res)) {
             while ($row = pmb_mysql_fetch_array($res)) {
                 $arrayIdImpactes[] = $row[0];
             }
         }
         //renvoi_voir
         if ($this->num_renvoi_voir) {
             $arrayIdImpactes[] = $this->num_renvoi_voir;
         }
     }
     $noeuds_a_garder = new noeuds($by);
     //Si les noeuds sont du même thésaurus
     if ($noeuds_a_garder->num_thesaurus == $this->num_thesaurus) {
         //On déplace les catégories qui renvoi vers l'ancien noeuds pour qu'elle renvoie vers le nouveau
         if (noeuds::isTarget($this->id_noeud)) {
             $requete = "UPDATE noeuds SET num_renvoi_voir='" . $by . "' WHERE num_renvoi_voir='" . $this->id_noeud . "' and id_noeud!='" . $by . "' ";
             @pmb_mysql_query($requete, $dbh);
         }
         //On garde les liens voir_aussi
         $requete = "UPDATE ignore voir_aussi SET num_noeud_orig='" . $by . "' WHERE num_noeud_orig='" . $this->id_noeud . "' and num_noeud_dest!='" . $by . "' ";
         @pmb_mysql_query($requete, $dbh);
         $requete = "UPDATE ignore voir_aussi SET num_noeud_dest='" . $by . "' WHERE num_noeud_dest='" . $this->id_noeud . "' and num_noeud_orig!='" . $by . "'";
         @pmb_mysql_query($requete, $dbh);
     }
     if (noeuds::isTarget($this->id_noeud)) {
         //Si le noeuds à supprimé est utilisé pour des renvois et qu'il reste des liens on les supprime
         //On supprime les renvoies
         $requete = "UPDATE noeuds SET num_renvoi_voir='0' WHERE num_renvoi_voir='" . $this->id_noeud . "'";
         @pmb_mysql_query($requete, $dbh);
     }
     //On déplace les notices liées
     $requete = "UPDATE ignore notices_categories SET num_noeud='" . $by . "' where num_noeud = '" . $this->id_noeud . "' ";
     @pmb_mysql_query($requete, $dbh);
     //nettoyage d'autorities_sources
     $query = "select * from authorities_sources where num_authority = " . $this->id_noeud . " and authority_type = 'category'";
     $result = pmb_mysql_query($query);
     if (pmb_mysql_num_rows($result)) {
         while ($row = pmb_mysql_fetch_object($result)) {
             if ($row->authority_favorite == 1) {
                 //on suprime les références si l'autorité a été importée...
                 $query = "delete from notices_authorities_sources where num_authority_source = " . $row->id_authority_source;
                 pmb_mysql_result($query);
                 $query = "delete from authorities_sources where id_authority_source = " . $row->id_authority_source;
                 pmb_mysql_result($query);
             } else {
                 //on fait suivre le reste
                 $query = "update authorities_sources set num_authority = " . $by . " where num_authority_source = " . $row->id_authority_source;
                 pmb_mysql_query($query);
             }
         }
     }
     //On supprime le noeuds
     $this->delete();
     // effacement de l'identifiant unique d'autorité
     $authority = new authority(0, $this->id_noeud, AUT_TABLE_CATEG);
     $authority->delete();
     //synchro_rdf
     if ($pmb_synchro_rdf) {
         //on ajoute les noeuds impactés par le $by
         $thesBy = thesaurus::getByEltId($by);
         if (!in_array($thesBy->id_thesaurus, $arrayThesImpactes)) {
             $arrayThesImpactes[] = $thesBy->id_thesaurus;
         }
         $arrayIdImpactes[] = $by;
         //parent
         if ($noeuds_a_garder->num_parent != $thesBy->num_noeud_racine) {
             $arrayIdImpactes[] = $noeuds_a_garder->num_parent;
         }
         //enfants
         $res = noeuds::listChilds($noeuds_a_garder->id_noeud, 1);
         if (pmb_mysql_num_rows($res)) {
             while ($row = pmb_mysql_fetch_array($res)) {
                 $arrayIdImpactes[] = $row[0];
             }
         }
         //renvoi_voir
         if ($noeuds_a_garder->num_renvoi_voir) {
             $arrayIdImpactes[] = $noeuds_a_garder->num_renvoi_voir;
         }
         //On met le tout à jour
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delConcept($this->id_noeud);
         if (count($arrayIdImpactes)) {
             foreach ($arrayIdImpactes as $idNoeud) {
                 $synchro_rdf->delConcept($idNoeud);
                 $synchro_rdf->storeConcept($idNoeud);
             }
         }
         if (count($arrayThesImpactes)) {
             foreach ($arrayThesImpactes as $idThes) {
                 $synchro_rdf->updateAuthority($idThes, 'thesaurus');
             }
         }
     }
     return "";
 }
    //enfants
    $res = noeuds::listChilds($id, 1);
    if (pmb_mysql_num_rows($res)) {
        while ($row = pmb_mysql_fetch_array($res)) {
            if (!count($arrayIdImpactes) || !in_array($row[0], $arrayIdImpactes)) {
                $arrayIdImpactes[] = $row[0];
            }
        }
    }
    //renvoi_voir
    if ($noeud->num_renvoi_voir) {
        if (!count($arrayIdImpactes) || !in_array($noeud->num_renvoi_voir, $arrayIdImpactes)) {
            $arrayIdImpactes[] = $noeud->num_renvoi_voir;
        }
    }
    //on met le tout à jour
    $synchro_rdf = new synchro_rdf();
    if (count($arrayIdImpactes)) {
        foreach ($arrayIdImpactes as $idNoeud) {
            $synchro_rdf->delConcept($idNoeud);
            $synchro_rdf->storeConcept($idNoeud);
        }
    }
    //On met à jour le thésaurus pour les topConcepts
    $synchro_rdf->updateAuthority($id_thes, 'thesaurus');
}
if ($user_input != "") {
    include './autorites/subjects/search.inc.php';
} else {
    include './autorites/subjects/default.inc.php';
}
 static function del_notice($id)
 {
     global $dbh, $class_path, $pmb_synchro_rdf, $pmb_notice_img_folder_id;
     //Suppression de la vignette de la notice si il y en a une d'uploadée
     if ($pmb_notice_img_folder_id) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = pmb_mysql_query($req, $dbh);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             $img = $rep->repertoire_path . "img_" . $id;
             @unlink($img);
         }
     }
     //synchro_rdf (à laisser en premier : a besoin des éléments de la notice pour retirer du graphe rdf)
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($id, 0);
     }
     $p_perso = new parametres_perso("notices");
     $p_perso->delete_values($id);
     $requete = "DELETE FROM notices_categories WHERE notcateg_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM notices_langues WHERE num_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM notices WHERE notice_id='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     audit::delete_audit(AUDIT_NOTICE, $id);
     // Effacement de l'occurence de la notice ds la table notices_global_index :
     $requete = "DELETE FROM notices_global_index WHERE num_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     // Effacement des occurences de la notice ds la table notices_mots_global_index :
     $requete = "DELETE FROM notices_mots_global_index WHERE id_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     // Effacement des occurences de la notice ds la table notices_fields_global_index :
     $requete = "DELETE FROM notices_fields_global_index WHERE id_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     $requete = "delete from notices_relations where num_notice='{$id}' OR linked_notice='{$id}' ";
     @pmb_mysql_query($requete, $dbh);
     // elimination des docs numeriques
     $req_explNum = "select explnum_id from explnum where explnum_notice=" . $id . " ";
     $result_explNum = @pmb_mysql_query($req_explNum, $dbh);
     while ($explNum = pmb_mysql_fetch_object($result_explNum)) {
         $myExplNum = new explnum($explNum->explnum_id);
         $myExplNum->delete();
     }
     // Clean des vedettes
     notice::delete_vedette_links($id);
     $requete = "DELETE FROM responsability WHERE responsability_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM bannette_contenu WHERE num_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     $requete = "delete from caddie_content using caddie, caddie_content where caddie_id=idcaddie and type='NOTI' and object_id='" . $id . "' ";
     @pmb_mysql_query($requete, $dbh);
     $requete = "delete from analysis where analysis_notice='" . $id . "' ";
     @pmb_mysql_query($requete, $dbh);
     $requete = "update bulletins set num_notice=0 where num_notice='" . $id . "' ";
     @pmb_mysql_query($requete, $dbh);
     //Suppression de la reference a la notice dans la table suggestions
     $requete = "UPDATE suggestions set num_notice = 0 where num_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     //Suppression de la reference a la notice dans la table lignes_actes
     $requete = "UPDATE lignes_actes set num_produit=0, type_ligne=0 where num_produit='" . $id . "' and type_ligne in ('1','5') ";
     @pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces user_notice
     $requete = "delete from acces_res_1 where res_num=" . $id;
     @pmb_mysql_query($requete, $dbh);
     // suppression des tags
     $rqt_del = "delete from tags where num_notice=" . $id;
     @pmb_mysql_query($rqt_del, $dbh);
     //suppression des avis
     $requete = "delete from avis where num_notice=" . $id;
     @pmb_mysql_query($requete, $dbh);
     //suppression des droits d'acces empr_notice
     $requete = "delete from acces_res_2 where res_num=" . $id;
     @pmb_mysql_query($requete, $dbh);
     // Supression des liens avec les titres uniformes
     $requete = "DELETE FROM notices_titres_uniformes WHERE ntu_num_notice='{$id}'";
     @pmb_mysql_query($requete, $dbh);
     //Suppression dans les listes de lecture partagées
     $requete = "SELECT id_liste, notices_associees from opac_liste_lecture";
     $res = pmb_mysql_query($requete, $dbh);
     $id_tab = array();
     while ($notices = pmb_mysql_fetch_object($res)) {
         $id_tab = explode(',', $notices->notices_associees);
         for ($i = 0; $i < sizeof($id_tab); $i++) {
             if ($id_tab[$i] == $id) {
                 unset($id_tab[$i]);
             }
         }
         $requete = "UPDATE opac_liste_lecture set notices_associees='" . addslashes(implode(',', $id_tab)) . "' where id_liste='" . $notices->id_liste . "'";
         pmb_mysql_query($requete, $dbh);
     }
     // Suppression des résas
     $requete = "DELETE FROM resa WHERE resa_idnotice=" . $id;
     pmb_mysql_query($requete, $dbh);
     // Suppression des transferts_demande
     $requete = "DELETE FROM transferts_demande using transferts_demande, transferts WHERE num_transfert=id_transfert and num_notice=" . $id;
     pmb_mysql_query($requete, $dbh);
     // Suppression des transferts
     $requete = "DELETE FROM transferts WHERE num_notice=" . $id;
     pmb_mysql_query($requete, $dbh);
     //si intégré depuis une source externe, on supprime aussi la référence
     $query = "delete from notices_externes where num_notice=" . $id;
     @pmb_mysql_query($query, $dbh);
     $req = "delete from notices_authperso where notice_authperso_notice_num=" . $id;
     pmb_mysql_query($req, $dbh);
     //Suppression des emprises liées à la notice
     $req = "select map_emprise_id from map_emprises where map_emprise_type=11 and map_emprise_obj_num=" . $id;
     $result = pmb_mysql_query($req, $dbh);
     if (pmb_mysql_num_rows($result)) {
         $row = pmb_mysql_fetch_object($result);
         $query = "delete from map_emprises where map_emprise_obj_num=" . $id . " and map_emprise_type=11";
         pmb_mysql_query($query, $dbh);
         $req_areas = "delete from map_hold_areas where type_obj=11 and id_obj=" . $row->map_emprise_id;
         pmb_mysql_query($req_areas, $dbh);
     }
     $query = "update docwatch_items set item_num_notice=0 where item_num_notice = " . $id;
     pmb_mysql_query($query, $dbh);
     // Nettoyage indexation concepts
     $index_concept = new index_concept($id, TYPE_NOTICE);
     $index_concept->delete();
 }
Exemple #11
0
 function update($value, $force = false)
 {
     global $dbh;
     global $msg, $charset;
     global $include_path;
     global $pmb_synchro_rdf;
     global $thesaurus_concepts_active;
     global $opac_enrichment_bnf_sparql;
     if (!$value['name']) {
         return false;
     }
     // nettoyage des chaînes en entrée
     $value['name'] = clean_string($value['name']);
     $value['rejete'] = clean_string($value['rejete']);
     $value['date'] = clean_string($value['date']);
     $value['lieu'] = clean_string($value['lieu']);
     $value['ville'] = clean_string($value['ville']);
     $value['pays'] = clean_string($value['pays']);
     $value['subdivision'] = clean_string($value['subdivision']);
     $value['numero'] = clean_string($value['numero']);
     if (!$force) {
         if ($this->id) {
             // s'assurer que l'auteur n'existe pas déjà
             switch ($value['type']) {
                 case 71:
                     // Collectivité
                     $and_dedoublonnage = " and author_subdivision ='" . $value['subdivision'] . "' and author_lieu='" . $value['lieu'] . "' and author_ville = '" . $value['ville'] . "' and author_pays = '" . $value['pays'] . "' and author_numero ='" . $value['numero'] . "' ";
                     break;
                 case 72:
                     // Congrès
                     $and_dedoublonnage = " and author_subdivision ='" . $value['subdivision'] . "' and author_lieu='" . $value['lieu'] . "' and author_ville = '" . $value['ville'] . "' and author_pays = '" . $value['pays'] . "' and author_numero ='" . $value['numero'] . "' ";
                     break;
                 default:
                     $and_dedoublonnage = '';
                     break;
             }
             $dummy = "SELECT * FROM authors WHERE author_type='" . $value['type'] . "' AND author_name='" . $value['name'] . "'";
             $dummy .= " AND author_rejete='" . $value['rejete'] . "' ";
             $dummy .= "AND author_date='" . $value[date] . "' and author_id!='" . $this->id . "' {$and_dedoublonnage} ";
             $check = pmb_mysql_query($dummy, $dbh);
             if (pmb_mysql_num_rows($check)) {
                 $auteur_exists = new auteur(pmb_mysql_result($check, 0, "author_id"));
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[200], htmlentities($msg[220] . " -> " . $auteur_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         } else {
             // s'assurer que l'auteur n'existe pas déjà
             if ($id_auteur_exists = auteur::check_if_exists($value)) {
                 $auteur_exists = new auteur($id_auteur_exists);
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[200], htmlentities($msg[220] . " -> " . $auteur_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
         // s'assurer que la forme_retenue ne pointe pas dans les deux sens
         if ($this->id) {
             $dummy = "SELECT * FROM authors WHERE author_id='" . $value[voir_id] . "' and  author_see='" . $this->id . "'";
             $check = pmb_mysql_query($dummy, $dbh);
             if (pmb_mysql_num_rows($check)) {
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[200], htmlentities($msg['author_forme_retenue_error'] . " -> " . $this->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
     }
     $requete = "SET author_type='{$value['type']}', ";
     $requete .= "author_name='{$value['name']}', ";
     $requete .= "author_rejete='{$value['rejete']}', ";
     $requete .= "author_date='{$value['date']}', ";
     $requete .= "author_lieu='" . $value["lieu"] . "', ";
     $requete .= "author_ville='" . $value["ville"] . "', ";
     $requete .= "author_pays='" . $value["pays"] . "', ";
     $requete .= "author_subdivision='" . $value["subdivision"] . "', ";
     $requete .= "author_numero='" . $value["numero"] . "', ";
     $requete .= "author_web='{$value['author_web']}', ";
     $requete .= "author_see='{$value['voir_id']}', ";
     $requete .= "author_comment='{$value['author_comment']}', ";
     $word_to_index = $value["name"] . " " . $value["rejete"] . " " . $value["lieu"] . " " . $value["ville"] . " " . $value["pays"] . " " . $value["numero"] . " " . $value["subdivision"];
     if ($value['type'] == 72) {
         $word_to_index .= " " . $value["date"];
     }
     $requete .= "index_author=' " . strip_empty_chars($word_to_index) . " ',";
     $requete .= "author_import_denied= " . ($value['import_denied'] ? 1 : 0);
     if ($this->id) {
         audit::insert_modif(AUDIT_AUTHOR, $this->id);
         // update
         // on checke s'il n'y a pas un renvoi circulaire
         if ($this->id == $value['voir_id']) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[199], htmlentities($msg[222] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
         $requete = 'UPDATE authors ' . $requete;
         $requete .= ' WHERE author_id=' . $this->id . ' ;';
         if (pmb_mysql_query($requete, $dbh)) {
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_AUTHORS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("author", $this->id);
             $aut_pperso->save_form();
             auteur::update_index($this->id);
             // mise à jour de l'auteur dans la base rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf = new synchro_rdf();
                 $synchro_rdf->updateAuthority($this->id, 'auteur');
             }
             // ////////////////////////modif de l'update///////////////////////////////
             $query = "select 1 from authors where (author_enrichment_last_update < now()-interval '0' day) and author_id={$this->id}";
             $result = pmb_mysql_query($query, $dbh);
             if ($opac_enrichment_bnf_sparql && pmb_mysql_num_rows($result)) {
                 auteur::author_enrichment($this->id);
             }
             // ////////////////////////////////////////////////////////////////////////
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[199], htmlentities($msg[208] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
     } else {
         // creation
         $requete = 'INSERT INTO authors ' . $requete . ' ';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->id = pmb_mysql_insert_id();
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_AUTHORS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("author", $this->id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_AUTHOR, $this->id);
             // ajout des enrichissements si activés
             if ($opac_enrichment_bnf_sparql) {
                 auteur::author_enrichment($this->id);
             }
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[200], htmlentities($msg[221] . " -> " . $requete, ENT_QUOTES, $charset));
             return FALSE;
         }
     }
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_AUTHOR);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "author");
     return TRUE;
 }
Exemple #12
0
 function delete($id_thes = 0)
 {
     global $dbh;
     global $msg;
     global $pmb_synchro_rdf;
     if (!$id_thes) {
         $id_thes = $this->id_thesaurus;
     }
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
     }
     $q = "select id_noeud from noeuds where num_thesaurus = '" . $id_thes . "' ";
     $r = mysql_query($q, $dbh);
     while ($row = mysql_fetch_row($r)) {
         noeuds::delete($row[0]);
         /*$q1 = "delete from categories where num_noeud = '".$row[0]."' ";
         		$r1 = mysql_query($q1, $dbh);
         		$q2 = "delete from noeuds where id_noeud = '".$row[0]."' ";
         		$r2 = mysql_query($q2, $dbh);
         		*/
         if ($pmb_synchro_rdf) {
             $synchro_rdf->delConcept($row[0]);
         }
     }
     $q = "delete from thesaurus where id_thesaurus = '" . $id_thes . "' ";
     $r = mysql_query($q, $dbh);
     if ($pmb_synchro_rdf) {
         $synchro_rdf->delThesaurusDefinition($id_thes);
     }
 }
Exemple #13
0
         $f_categ[] = array('id' => ${$var_categid}, 'ordre' => $i);
     }
 }
 $table['f_indexint_id'] = $f_indexint_id;
 $table['f_indexation'] = clean_string($f_indexation);
 $table['f_lien'] = clean_string($f_lien);
 $table['f_eformat'] = clean_string($f_eformat);
 $table['signature'] = $signature;
 // mise à jour de l'entête de page
 echo str_replace('!!page_title!!', $msg[4000] . $msg[1003] . $msg[4023], $serial_header);
 $p_perso = new parametres_perso("notices");
 $nberrors = $p_perso->check_submited_fields();
 //Pour la synchro rdf
 if ($pmb_synchro_rdf) {
     require_once $class_path . "/synchro_rdf.class.php";
     $synchro_rdf = new synchro_rdf();
     if ($analysis_id) {
         $synchro_rdf->delRdf($analysis_id, 0);
     }
 }
 //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";
Exemple #14
0
 function analysis_delete()
 {
     global $dbh;
     global $pmb_synchro_rdf, $pmb_notice_img_folder_id;
     //Suppression de la vignette de la notice si il y en a une d'uploadée
     if ($pmb_notice_img_folder_id) {
         $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
         $res = mysql_query($req, $dbh);
         if (mysql_num_rows($res)) {
             $rep = mysql_fetch_object($res);
             $img = $rep->repertoire_path . "img_" . $this->analysis_id;
             @unlink($img);
         }
     }
     //synchro rdf
     if ($pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->delRdf($this->analysis_id, 0);
     }
     //elimination des docs numeriques
     $req_explNum = "select explnum_id from explnum where explnum_notice=" . $this->analysis_id . " ";
     $result_explNum = @mysql_query($req_explNum, $dbh);
     while ($explNum = mysql_fetch_object($result_explNum)) {
         $myExplNum = new explnum($explNum->explnum_id);
         $myExplNum->delete();
     }
     // suppression des entrees dans les caddies
     $query_caddie = "select caddie_id from caddie_content, caddie where type='NOTI' and object_id in ({$this->analysis_id}) and caddie_id=idcaddie ";
     $result_caddie = @mysql_query($query_caddie, $dbh);
     while ($cad = mysql_fetch_object($result_caddie)) {
         $req_suppr_caddie = "delete from caddie_content where caddie_id = '{$cad->caddie_id}' and object_id in ({$this->analysis_id}) ";
         @mysql_query($req_suppr_caddie, $dbh);
     }
     //elimination des champs persos
     $p_perso = new parametres_perso("notices");
     $p_perso->delete_values($this->analysis_id);
     // on supprime l'entree dans la table 'analysis'
     $requete = "DELETE FROM analysis WHERE analysis_notice=" . $this->analysis_id;
     mysql_query($requete, $dbh);
     $result = mysql_affected_rows($dbh);
     // on supprime la notice du dépouillement
     $requete = "DELETE FROM notices WHERE notice_id='" . $this->analysis_id . "' ";
     mysql_query($requete, $dbh);
     $result += mysql_affected_rows($dbh);
     //suppression des droits d'acces user_notice
     $requete = "delete from acces_res_1 where res_num=" . $this->analysis_id;
     @mysql_query($requete, $dbh);
     //suppression des droits d'acces empr_notice
     $requete = "delete from acces_res_2 where res_num=" . $this->analysis_id;
     @mysql_query($requete, $dbh);
     // suppression des audits
     audit::delete_audit(AUDIT_NOTICE, $this->analysis_id);
     // suppression des categories
     $rqt_del = "delete from notices_categories where notcateg_notice='" . $this->analysis_id . "' ";
     @mysql_query($rqt_del, $dbh);
     // suppression des responsabilités
     $rqt_del = "delete from responsability where responsability_notice='" . $this->analysis_id . "' ";
     @mysql_query($rqt_del, $dbh);
     // suppression des liens
     $rqt_del = "delete from notices_relations where num_notice='" . $this->analysis_id . "' OR linked_notice='" . $this->analysis_id . "'";
     @mysql_query($rqt_del, $dbh);
     // suppression des bannettes
     $rqt_del = "delete from bannette_contenu where num_notice='" . $this->analysis_id . "' ";
     @mysql_query($rqt_del, $dbh);
     // suppression des tags
     $rqt_del = "delete from tags where num_notice='" . $this->analysis_id . "' ";
     @mysql_query($rqt_del, $dbh);
     // suppression des avis
     $rqt_del = "delete from avis where num_notice='" . $this->analysis_id . "' ";
     @mysql_query($rqt_del, $dbh);
     //suppression des langues
     $query = "delete from notices_langues where num_notice='" . $this->analysis_id . "' ";
     @mysql_query($query, $dbh);
     // suppression index global
     $query = "delete from notices_global_index where num_notice='" . $this->analysis_id . "' ";
     @mysql_query($query, $dbh);
     // suppression notices_mots_global_index
     $query = "delete from notices_mots_global_index where id_notice='" . $this->analysis_id . "' ";
     @mysql_query($query, $dbh);
     // suppression notices_fields_global_index
     $query = "delete from notices_fields_global_index where id_notice='" . $this->analysis_id . "' ";
     @mysql_query($query, $dbh);
     //Suppression de la reference a la notice dans la table suggestions
     $query = "UPDATE suggestions set num_notice = 0 where num_notice=" . $this->analysis_id;
     @mysql_query($query, $dbh);
     //Suppression de la reference a la notice dans la table lignes_actes
     $requete = "UPDATE lignes_actes set num_produit=0, type_ligne=0 where num_produit='" . $this->analysis_id . "' and type_ligne in ('1','5') ";
     @mysql_query($requete, $dbh);
     //Suppression de la référence de la source si exitante..
     $query = "delete from notices_externes where num_notice=" . $this->analysis_id;
     @mysql_query($query, $dbh);
     //Suppression dans les listes de lecture partagées
     $requete = "SELECT id_liste, notices_associees from opac_liste_lecture";
     $res = mysql_query($requete, $dbh);
     $id_tab = array();
     while ($notices = mysql_fetch_object($res)) {
         $id_tab = explode(',', $notices->notices_associees);
         for ($i = 0; $i < sizeof($id_tab); $i++) {
             if ($id_tab[$i] == $this->analysis_id) {
                 unset($id_tab[$i]);
             }
         }
         $requete = "UPDATE opac_liste_lecture set notices_associees='" . addslashes(implode(',', $id_tab)) . "' where id_liste='" . $notices->id_liste . "'";
         mysql_query($requete, $dbh);
     }
     return $result;
 }
 function update($value)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $pmb_synchro_rdf;
     global $thesaurus_concepts_active, $max_aut0, $max_aut1;
     global $mc_oeuvre_nature;
     global $pmb_authors_qualification;
     if (!$value['name']) {
         return false;
     }
     // nettoyage des chaînes en entrée
     $value['name'] = clean_string($value['name']);
     $value['num_author'] = clean_string($value['num_author']);
     $value['form'] = clean_string($value['form']);
     $value['form_selector'] = clean_string($value['form_selector']);
     $value['date'] = clean_string($value['date']);
     $value['subject'] = clean_string($value['subject']);
     $value['place'] = clean_string($value['place']);
     $value['history'] = clean_string($value['history']);
     $value['characteristic'] = clean_string($value['characteristic']);
     $value['intended_termination'] = clean_string($value['intended_termination']);
     $value['intended_audience'] = clean_string($value['intended_audience']);
     $value['context'] = clean_string($value['context']);
     $value['equinox'] = clean_string($value['equinox']);
     $value['coordinates'] = clean_string($value['coordinates']);
     $value['tonalite'] = clean_string($value['tonalite']);
     $value['tonalite_selector'] = clean_string($value['tonalite_selector']);
     $value['comment'] = clean_string($value['comment']);
     $value['oeuvre_nature'] = clean_string($value['oeuvre_nature']);
     $value['oeuvre_nature_nature'] = clean_string($mc_oeuvre_nature->attributes[$value['oeuvre_nature']]['NATURE']);
     $value['oeuvre_type'] = clean_string($value['oeuvre_type']);
     $titre = titre_uniforme::import_tu_exist($value, 1, $this->id);
     if ($titre) {
         require_once "{$include_path}/user_error.inc.php";
         warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_doublon_erreur"]);
         return FALSE;
     }
     $tu_auteur = new auteur($value['num_author']);
     if (!$tu_auteur->id) {
         $value['num_author'] = 0;
     } else {
         $value['num_author'] = $tu_auteur->id;
     }
     $flag_index = 0;
     $requete = "SET ";
     $requete .= "tu_name='" . $value["name"] . "', ";
     $requete .= "tu_num_author='" . $value['num_author'] . "', ";
     $requete .= "tu_forme='" . $value["form"] . "', ";
     $requete .= "tu_forme_marclist='" . $value["form_selector"] . "', ";
     $requete .= "tu_date='" . $value["date"] . "', ";
     $requete .= "tu_sujet='" . $value["subject"] . "', ";
     $requete .= "tu_lieu='" . $value["place"] . "', ";
     $requete .= "tu_histoire='" . $value["history"] . "', ";
     $requete .= "tu_caracteristique='" . $value["characteristic"] . "', ";
     $requete .= "tu_completude='" . $value["intended_termination"] . "', ";
     $requete .= "tu_public='" . $value["intended_audience"] . "', ";
     $requete .= "tu_contexte='" . $value["context"] . "', ";
     $requete .= "tu_equinoxe='" . $value["equinox"] . "', ";
     $requete .= "tu_coordonnees='" . $value["coordinates"] . "', ";
     $requete .= "tu_tonalite='" . $value["tonalite"] . "', ";
     $requete .= "tu_tonalite_marclist='" . $value["tonalite_selector"] . "', ";
     $requete .= "tu_comment='" . $value["comment"] . "', ";
     $requete .= "tu_import_denied='" . $value["import_denied"] . "', ";
     $requete .= "tu_oeuvre_nature='" . $value["oeuvre_nature"] . "', ";
     $requete .= "tu_oeuvre_nature_nature='" . $value["oeuvre_nature_nature"] . "', ";
     $requete .= "tu_oeuvre_type='" . $value["oeuvre_type"] . "' ";
     if ($this->id) {
         // update
         $requete = 'UPDATE titres_uniformes ' . $requete;
         $requete .= ' WHERE tu_id=' . $this->id . ' ;';
         if (pmb_mysql_query($requete, $dbh)) {
             $flag_index = 1;
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_modif_erreur"]);
             return FALSE;
         }
         audit::insert_modif(AUDIT_TITRE_UNIFORME, $this->id);
     } else {
         // creation
         $requete = 'INSERT INTO titres_uniformes ' . $requete . ' ';
         $result = pmb_mysql_query($requete, $dbh);
         if ($result) {
             $this->id = pmb_mysql_insert_id();
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg["aut_titre_uniforme_creation"], $msg["aut_titre_uniforme_creation_erreur"]);
             return FALSE;
         }
         audit::insert_creation(AUDIT_TITRE_UNIFORME, $this->id);
     }
     $this->update_oeuvre_expression($value['oeuvre_expression']);
     $this->update_other_link($value['other_link']);
     $this->update_oeuvre_event($value['oeuvre_event']);
     // auteurs
     for ($i = 0; $i < $max_aut0; $i++) {
         eval("global \$f_aut0_id{$i}; \$var_autid=\$f_aut0_id{$i};");
         eval("global \$f_f0_code{$i}; \$var_autfonc=\$f_f0_code{$i};");
         $f_aut[] = array('id' => $var_autid, 'fonction' => $var_autfonc, 'type' => '0', 'ordre' => $i);
     }
     // interpretes
     for ($i = 0; $i < $max_aut1; $i++) {
         eval("global \$f_aut1_id{$i}; \$var_autid=\$f_aut1_id{$i};");
         eval("global \$f_f1_code{$i}; \$var_autfonc=\$f_f1_code{$i};");
         $f_aut[] = array('id' => $var_autid, 'fonction' => $var_autfonc, 'type' => '1', 'ordre' => $i);
     }
     // Clean des vedettes
     titre_uniforme::delete_vedette_links($this->id);
     // traitement des auteurs
     $rqt_del = "delete from responsability_tu where responsability_tu_num='" . $this->id . "' ";
     $res_del = pmb_mysql_query($rqt_del);
     $rqt_ins = "INSERT INTO responsability_tu (responsability_tu_author_num, responsability_tu_num, responsability_tu_fonction, responsability_tu_type, responsability_tu_ordre) VALUES ";
     $i = 0;
     $var_name = 'saisie_titre_uniforme_role_composed';
     global ${$var_name};
     $role_composed = ${$var_name};
     $var_name = 'saisie_titre_uniforme_role_autre_composed';
     global ${$var_name};
     $role_composed_autre = ${$var_name};
     while ($i <= count($f_aut) - 1) {
         $id_aut = $f_aut[$i]['id'];
         if ($id_aut) {
             $fonc_aut = $f_aut[$i]['fonction'];
             $type_aut = $f_aut[$i]['type'];
             $ordre_aut = $f_aut[$i]['ordre'];
             $rqt = $rqt_ins . " ('{$id_aut}','" . $this->id . "','{$fonc_aut}','{$type_aut}', {$ordre_aut}) ";
             $res_ins = @pmb_mysql_query($rqt);
             $id_responsability_tu = pmb_mysql_insert_id();
             if ($pmb_authors_qualification) {
                 switch ($type_aut) {
                     case 0:
                         $this->update_vedette(stripslashes_array($role_composed[$ordre_aut]), $id_responsability_tu, TYPE_TU_RESPONSABILITY);
                         break;
                     case 1:
                         $this->update_vedette(stripslashes_array($role_composed_autre[$ordre_aut]), $id_responsability_tu, TYPE_TU_RESPONSABILITY_INTERPRETER);
                         break;
                 }
             }
         }
         $i++;
     }
     $aut_link = new aut_link(AUT_TABLE_TITRES_UNIFORMES, $this->id);
     $aut_link->save_form();
     $aut_pperso = new aut_pperso("tu", $this->id);
     $aut_pperso->save_form();
     //update authority informations
     $authority = new authority(0, $this->id, AUT_TABLE_TITRES_UNIFORMES);
     $authority->set_num_statut($value['statut']);
     $authority->update();
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_TITRE_UNIFORME);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "titre_uniforme");
     // Gestion des champ répétables
     $requete = "DELETE FROM tu_distrib WHERE distrib_num_tu='{$this->id}' ";
     pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM tu_ref WHERE ref_num_tu='{$this->id}' ";
     pmb_mysql_query($requete, $dbh);
     $requete = "DELETE FROM tu_subdiv WHERE subdiv_num_tu='{$this->id}' ";
     pmb_mysql_query($requete, $dbh);
     // Distribution instrumentale et vocale (pour la musique)
     for ($i = 0; $i < count($value['distrib']); $i++) {
         $requete = "INSERT INTO tu_distrib SET\n\t\t\tdistrib_num_tu='{$this->id}',\n\t\t\tdistrib_name='" . $value['distrib'][$i] . "',\n\t\t\tdistrib_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     // Référence numérique (pour la musique)
     for ($i = 0; $i < count($value['ref']); $i++) {
         $requete = "INSERT INTO tu_ref SET\n\t\t\tref_num_tu='{$this->id}',\n\t\t\tref_name='" . $value['ref'][$i] . "',\n\t\t\tref_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     // Subdivison de forme
     for ($i = 0; $i < count($value['subdiv']); $i++) {
         $requete = "INSERT INTO tu_subdiv SET\n\t\t\tsubdiv_num_tu='{$this->id}',\n\t\t\tsubdiv_name='" . $value['subdiv'][$i] . "',\n\t\t\tsubdiv_ordre='{$i}' ";
         pmb_mysql_query($requete, $dbh);
     }
     // mise à jour du champ index du titre uniforme
     if ($this->id) {
         titre_uniforme::update_index_tu($this->id);
     }
     // réindexation de la notice
     // 		if ($flag_index)
     titre_uniforme::update_index($this->id);
     //Enrichissement
     if ($this->id && $opac_enrichment_bnf_sparql) {
         titre_uniforme::tu_enrichment($this->id);
     }
     //mise à jour de l'oeuvre rdf
     if ($flag_index && $pmb_synchro_rdf) {
         $synchro_rdf = new synchro_rdf();
         $synchro_rdf->updateAuthority($this->id, 'oeuvre');
     }
     return TRUE;
 }
     if ($res && pmb_mysql_num_rows($res)) {
         while ($categ = pmb_mysql_fetch_object($res)) {
             if (trim($categ->libelle_categorie)) {
                 creer_categ_xml($dom, $noeudthes, 0, $categ->num_noeud, $categ->libelle_categorie, $categ->note_application, $categ->comment_public, $categ->num_parent);
             }
         }
     }
 } elseif ($output == "xmlskos" || $output == "xmlent") {
     if (!$uri_thes_skos) {
         $uri_thes_skos = $pmb_opac_url . "thesaurus/" . $aff_num_thesaurus;
     }
     $uri_thes_skos .= "/";
     $uri_noeud_skos = $uri_thes_skos;
     $uri_thes_skos .= "#Thesaurus";
     if ($output == "xmlent") {
         $synchro_rdf = new synchro_rdf();
         $uri_thes_skos = $synchro_rdf->baseURI . "thesaurus#" . $aff_num_thesaurus;
         $uri_noeud_skos = $synchro_rdf->baseURI . "concept#";
     }
     //uri_thes_skos, do_polyhierarchie
     $racine = creer_noeud_xml($dom, $dom, "rdf:RDF", "", array("xmlns:rdf" => "http://www.w3.org/1999/02/22-rdf-syntax-ns#", "xmlns:skos" => "http://www.w3.org/2004/02/skos/core#"));
     $conceptScheme = creer_noeud_xml($dom, $racine, "skos:ConceptScheme", "", array("rdf:about" => $uri_thes_skos));
     $prefLabel = creer_noeud_xml($dom, $conceptScheme, "skos:prefLabel", $thes->libelle_thesaurus, array("xml:lang" => substr($thes->langue_defaut, 0, 2)));
     //hasTopConcept
     $requete = "SELECT id_noeud FROM noeuds WHERE num_parent='" . $id_noeud_debut . "' AND  num_renvoi_voir='0' AND autorite != 'ORPHELINS' AND num_thesaurus='" . $aff_num_thesaurus . "'";
     $res_hasTopConcept = pmb_mysql_query($requete);
     if ($res_hasTopConcept && pmb_mysql_num_rows($res_hasTopConcept)) {
         while ($hasTopConcept = pmb_mysql_fetch_object($res_hasTopConcept)) {
             creer_noeud_xml($dom, $conceptScheme, "skos:hasTopConcept", "", array("rdf:resource" => $uri_noeud_skos . $hasTopConcept->id_noeud));
         }
     }
Exemple #17
0
 function update($value)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $pmb_synchro_rdf;
     global $thesaurus_concepts_active;
     if (!$value['name']) {
         return false;
     }
     // nettoyage des valeurs en entree
     $value[name] = clean_string($value[name]);
     $value[adr1] = clean_string($value[adr1]);
     $value[adr2] = clean_string($value[adr2]);
     $value[cp] = clean_string($value[cp]);
     $value[ville] = clean_string($value[ville]);
     $value[pays] = clean_string($value[pays]);
     $value[web] = clean_string($value[web]);
     // construction de la requete
     $requete = "SET ed_name='{$value['name']}', ";
     $requete .= "ed_adr1='{$value['adr1']}', ";
     $requete .= "ed_adr2='{$value['adr2']}', ";
     $requete .= "ed_cp='{$value['cp']}', ";
     $requete .= "ed_ville='{$value['ville']}', ";
     $requete .= "ed_pays='{$value['pays']}', ";
     $requete .= "ed_web='{$value['web']}', ";
     $requete .= "ed_comment='{$value['ed_comment']}', ";
     $requete .= "index_publisher=' " . strip_empty_chars($value[name] . " " . $value[ville] . " " . $value[pays]) . " '";
     if ($this->id) {
         // update
         $requete = 'UPDATE publishers ' . $requete;
         $requete .= ' WHERE ed_id=' . $this->id . ' LIMIT 1;';
         if (pmb_mysql_query($requete, $dbh)) {
             $aut_link = new aut_link(AUT_TABLE_PUBLISHERS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("publisher", $this->id);
             $aut_pperso->save_form();
             editeur::update_index($this->id);
             audit::insert_modif(AUDIT_PUBLISHER, $this->id);
             //mise à jour de l'éditeur dans la base rdf
             if ($pmb_synchro_rdf) {
                 $synchro_rdf = new synchro_rdf();
                 $synchro_rdf->updateAuthority($this->id, 'editeur');
             }
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[145], $msg[150]);
             return FALSE;
         }
     } else {
         // s'assurer que l'editeur n'existe pas deja
         // on teste sur le nom et la ville seulement. voir a l'usage si necessaire de tester plus
         if (editeur::check_if_exists($value)) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[145], $msg[149] . " ({$value['name']}).");
             return FALSE;
         }
         $requete = 'INSERT INTO publishers ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->id = pmb_mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_PUBLISHERS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("publisher", $this->id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_PUBLISHER, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[145], $msg[151]);
             return FALSE;
         }
     }
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_PUBLISHER);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "publisher");
     return TRUE;
 }
 $id_list_orphans = noeuds::listTargetsOrphansOnly($id);
 if (count($id_list_orphans)) {
     foreach ($id_list_orphans as $id_orphan) {
         // on n'efface pas les termes orphelins avec terme spécifique
         // on n'efface pas les termes orphelins utilisées en indexation
         if (!noeuds::hasChild($id_orphan) && !noeuds::isUsedInNotices($id_orphan)) {
             $array_to_delete[] = $id_orphan;
         }
     }
 }
 $array_to_delete[] = $id;
 foreach ($array_to_delete as $id_to_delete) {
     //On met à jour le graphe rdf avant de supprimer
     if ($pmb_synchro_rdf) {
         $arrayIdImpactes = array();
         $synchro_rdf = new synchro_rdf();
         $noeud = new noeuds($id_to_delete);
         $thes = new thesaurus($noeud->num_thesaurus);
         //parent
         if ($noeud->num_parent != $thes->num_noeud_racine) {
             $arrayIdImpactes[] = $noeud->num_parent;
         }
         //renvoi_voir
         if ($noeud->num_renvoi_voir) {
             $arrayIdImpactes[] = $noeud->num_renvoi_voir;
         }
         //on supprime le rdf
         if (count($arrayIdImpactes)) {
             foreach ($arrayIdImpactes as $idNoeud) {
                 $synchro_rdf->delConcept($idNoeud);
             }
Exemple #19
0
 $table['niveau_hierar'] = $h_level;
 $table['signature'] = $signature;
 $table['indexation_lang'] = $indexation_lang;
 if ($a2z_opac_show) {
     $val = 0;
 } else {
     $val = 0x10;
 }
 $table['opac_visible_bulletinage'] = $opac_visible_bulletinage | $val;
 $p_perso = new parametres_perso("notices");
 $nberrors = $p_perso->check_submited_fields();
 if (!$nberrors) {
     //Pour la synchro rdf
     if ($pmb_synchro_rdf) {
         require_once $class_path . "/synchro_rdf.class.php";
         $synchro_rdf = new synchro_rdf();
         if ($serial_id) {
             $synchro_rdf->delRdf($serial_id, 0);
         }
     }
     $serial = new serial($serial_id);
     $update_result = $serial->update($table);
 } else {
     error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1);
     exit;
 }
 // vignette de la notice uploadé dans un répertoire
 if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
     $poids_fichier_max = 1024 * 1024;
     //Limite la taille de l'image à 1 Mo
     $req = "select repertoire_path from upload_repertoire where repertoire_id ='" . $pmb_notice_img_folder_id . "'";
Exemple #20
0
 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;
 }
Exemple #21
0
 if ($table['date_date'] == '0000-00-00' || !isset($date_date_lib)) {
     $table['year'] = "";
 } else {
     $table['year'] = substr($table['date_date'], 0, 4);
 }
 $table['date_parution'] = $table['date_date'];
 $p_perso = new parametres_perso("notices");
 $nberrors = $p_perso->check_submited_fields();
 $table['force_empty'] = $p_perso->presence_exclusion_fields();
 if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id) {
     $table['force_empty'] = "f_img_load";
 }
 //Pour la synchro rdf
 if ($pmb_synchro_rdf) {
     require_once $class_path . "/synchro_rdf.class.php";
     $synchro_rdf = new synchro_rdf();
     if ($bul_id) {
         $synchro_rdf->delRdf(0, $bul_id);
     }
 }
 if (!$nberrors) {
     $myBulletinage = new bulletinage($bul_id, $serial_id);
     $result = $myBulletinage->update($table);
 } else {
     error_message_history($msg["notice_champs_perso"], $p_perso->error_message, 1);
     exit;
 }
 // vignette de la notice uploadé dans un répertoire
 if ($_FILES['f_img_load']['name'] && $pmb_notice_img_folder_id && $myBulletinage->bull_num_notice) {
     $poids_fichier_max = 1024 * 1024;
     //Limite la taille de l'image à 1 Mo