コード例 #1
0
 public function get_form($prefix_url = "", $flag = "", $action = "save")
 {
     $form = parent::get_form($prefix_url, $flag, $action);
     if ($flag != "concept_selector_form") {
         $aut_link = new aut_link(AUT_TABLE_CONCEPT, onto_common_uri::get_id($this->get_uri()));
         $form = str_replace('<!-- aut_link -->', $aut_link->get_form(onto_common_uri::get_name_from_uri($this->get_uri(), $this->onto_class->pmb_name)), $form);
     } else {
         $form = str_replace('<!-- aut_link -->', "", $form);
     }
     return $form;
 }
コード例 #2
0
ファイル: author_see.inc.php プロジェクト: bouchra012/PMB
     print pmb_bidi("<h3><span>" . $msg["author_see_title"] . " {$renvoi}</span></h3>\n");
 }
 print "<div id='aut_details_container'>\n";
 print "<div id='aut_see'>\n";
 print pmb_bidi($ourAuteur->print_resume());
 // récupération des formes rejetées pour affichage
 $requete = "select distinct author_id as aut from authors where author_id {$clause_auteurs} and author_id!={$id} ";
 $res = mysql_query($requete, $dbh);
 while ($obj = mysql_fetch_object($res)) {
     $objRenvoi = new auteur($obj->aut);
     pmb_strlen($renvoi) ? $renvoi .= ', (' . $objRenvoi->isbd_entry . ")" : ($renvoi = $objRenvoi->isbd_entry);
 }
 if (pmb_strlen($renvoi)) {
     print pmb_bidi("<font class=number_results>{$renvoi}</font><br />\n");
 }
 $aut_link = new aut_link(AUT_TABLE_AUTHORS, $id);
 print pmb_bidi($aut_link->get_display());
 print "</div><!-- fermeture #aut_see -->\n";
 // affichage des notices associées
 print "<div id='aut_details_liste'>\n";
 if ($ourAuteur->type == 72) {
     //Congrès
     print pmb_bidi("<h3>{$msg['documents_disponibles_meme_congres']}");
 } else {
     print pmb_bidi("<h3>{$msg['documents_disponibles_meme_auteur']}");
 }
 print "</h3>\n";
 //droits d'acces emprunteur/notice
 $acces_j = '';
 if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) {
     require_once "{$class_path}/acces.class.php";
コード例 #3
0
ファイル: categ_form.inc.php プロジェクト: bouchra012/PMB
    }
    //Remplacement
    $button_remplace = "<input type='button' class='bouton' value='{$msg['158']}' ";
    $button_remplace .= "onclick='unload_off();document.location=\"./autorites.php?categ=categories&sub=categ_replace&id={$id}&parent={$parent}\"'/>";
    $category_form = str_replace("<!-- remplace_categ -->", $button_remplace, $category_form);
    //Suppression
    $category_form = str_replace('<!-- delete_button -->', $delete_button, $category_form);
} else {
    $category_form = str_replace("<!-- numero_autorite -->", $num_aut, $category_form);
}
if ($import_denied == 1) {
    $import_denied_checked = "checked='checked'";
} else {
    $import_denied_checked = "";
}
$category_form = str_replace('!!authority_import_denied!!', $import_denied_checked, $category_form);
require_once "{$class_path}/aut_link.class.php";
$aut_link = new aut_link(AUT_TABLE_CATEG, $id);
$category_form = str_replace('<!-- aut_link -->', $aut_link->get_form('categ_form'), $category_form);
$aut_pperso = new aut_pperso("categ", $id);
$category_form = str_replace('!!aut_pperso!!', $aut_pperso->get_form(), $category_form);
$category_form = str_replace('!!voir_notices!!', $button_voir, $category_form);
if ($pmb_type_audit && $id) {
    $bouton_audit = "&nbsp;<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=" . AUDIT_CATEG . "&object_id=" . $id . "', 'audit_popup', 700, 500, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" title=\"" . $msg['audit_button'] . "\" value=\"" . $msg['audit_button'] . "\" />&nbsp;";
}
$category_form = str_replace('!!audit_bt!!', $bouton_audit, $category_form);
$category_form = str_replace('!!user_input!!', htmlentities($user_input, ENT_QUOTES, $charset), $category_form);
$category_form = str_replace('!!nbr_lignes!!', $nbr_lignes, $category_form);
$category_form = str_replace('!!page!!', $page, $category_form);
$category_form = str_replace('!!nb_per_page!!', $nb_per_page, $category_form);
print $category_form;
コード例 #4
0
ファイル: collection.class.php プロジェクト: bouchra012/PMB
 function update($value, $force_creation = false)
 {
     global $dbh;
     global $msg, $charset;
     global $include_path;
     // nettoyage des valeurs en entrée
     $value['name'] = clean_string($value['name']);
     $value['issn'] = clean_string($value['issn']);
     if (!$value['parent']) {
         if ($value['publisher']) {
             //on les a, on crée l'éditeur
             $value['publisher'] = stripslashes_array($value['publisher']);
             //La fonction d'import fait les addslashes contrairement à l'update
             $value['parent'] = editeur::import($value['publisher']);
         }
     }
     if (!$value['name'] || !$value['parent']) {
         return false;
     }
     // construction de la requête
     $requete = "SET collection_name='{$value['name']}', ";
     $requete .= "collection_parent='{$value['parent']}', ";
     $requete .= "collection_issn='{$value['issn']}', ";
     $requete .= "collection_web='{$value['collection_web']}', ";
     $requete .= "collection_comment='{$value['comment']}', ";
     $requete .= "index_coll=' " . strip_empty_words($value[name]) . " " . strip_empty_words($value["issn"]) . " '";
     if ($this->id) {
         // update
         $requete = 'UPDATE collections ' . $requete;
         $requete .= ' WHERE collection_id=' . $this->id . ' ;';
         if (mysql_query($requete, $dbh)) {
             $requete = "update notices set ed1_id='" . $value[parent] . "' WHERE coll_id='" . $this->id . "' ";
             $res = mysql_query($requete, $dbh);
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("collection", $this->id);
             $aut_pperso->save_form();
             collection::update_index($this->id);
             audit::insert_modif(AUDIT_COLLECTION, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[167], htmlentities($msg[169] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
     } else {
         if (!$force_creation) {
             // création : s'assurer que la collection n'existe pas déjà
             if ($id_collection_exists = collection::check_if_exists($value)) {
                 $collection_exists = new collection($id_collection_exists);
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[167], htmlentities($msg[171] . " -> " . $collection_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
         $requete = 'INSERT INTO collections ' . $requete . ';';
         if (mysql_query($requete, $dbh)) {
             $this->id = mysql_insert_id();
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id);
             $aut_link->save_form();
             audit::insert_creation(AUDIT_COLLECTION, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[167], htmlentities($msg[170] . " -> " . $requete, ENT_QUOTES, $charset));
             return FALSE;
         }
     }
     if ($value['subcollections']) {
         for ($i = 0; $i < count($value['subcollections']); $i++) {
             $subcoll = stripslashes_array($value['subcollections'][$i]);
             //La fonction d'import fait les addslashes contrairement à l'update
             $subcoll['coll_parent'] = $this->id;
             subcollection::import($subcoll);
         }
     }
     return true;
 }
コード例 #5
0
 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 "";
 }
コード例 #6
0
 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;
 }
コード例 #7
0
 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;
 }
コード例 #8
0
ファイル: indexint.class.php プロジェクト: hogsim/PMB
 function update($nom, $comment, $id_pclass = 0)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $thesaurus_classement_mode_pmb, $thesaurus_classement_defaut;
     global $thesaurus_concepts_active;
     if (!$nom) {
         return false;
     }
     // nettoyage de la chaîne en entrée
     $nom = clean_string($nom);
     if ($thesaurus_classement_mode_pmb == 0 || $id_pclass == 0) {
         $id_pclass = $thesaurus_classement_defaut;
     }
     $requete = "SET indexint_name='{$nom}', ";
     $requete .= "indexint_comment='{$comment}', ";
     $requete .= "num_pclass='{$id_pclass}', ";
     $requete .= "index_indexint=' " . strip_empty_words($nom . " " . $comment) . " '";
     if ($this->indexint_id) {
         // update
         $requete = 'UPDATE indexint ' . $requete;
         $requete .= ' WHERE indexint_id=' . $this->indexint_id . ' LIMIT 1;';
         if (pmb_mysql_query($requete, $dbh)) {
             $aut_link = new aut_link(AUT_TABLE_INDEXINT, $this->indexint_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("indexint", $this->indexint_id);
             $aut_pperso->save_form();
             indexint::update_index($this->indexint_id);
             audit::insert_modif(AUDIT_INDEXINT, $this->indexint_id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[indexint_update], $msg[indexint_unable]);
             return FALSE;
         }
     } else {
         // création : s'assurer que le nom n'existe pas déjà
         $dummy = "SELECT * FROM indexint WHERE indexint_name = '" . $nom . "' and num_pclass='" . $id_pclass . "' LIMIT 1 ";
         $check = pmb_mysql_query($dummy, $dbh);
         if (pmb_mysql_num_rows($check)) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[indexint_create], $msg[indexint_exists]);
             return FALSE;
         }
         $requete = 'INSERT INTO indexint ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->indexint_id = pmb_mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_INDEXINT, $this->indexint_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("indexint", $this->indexint_id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_INDEXINT, $this->indexint_id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[indexint_create], $msg[indexint_unable_create]);
             return FALSE;
         }
     }
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->indexint_id, TYPE_INDEXINT);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->indexint_id, "indexint");
     return TRUE;
 }
コード例 #9
0
ファイル: editor.class.php プロジェクト: hogsim/PMB
 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;
 }
コード例 #10
0
    $noeud->autorite = $num_aut;
    $noeud->num_thesaurus = $thes->id_thesaurus;
    $noeud->authority_import_denied = $authority_import_denied;
    $noeud->not_use_in_indexation = $not_use_in_indexation;
    $noeud->num_statut = $authority_statut;
    $noeud->save();
    $id = $noeud->id_noeud;
}
// Indexation concepts
if ($thesaurus_concepts_active == 1) {
    $index_concept = new index_concept($id, TYPE_CATEGORY);
    $index_concept->save();
}
// liens entre autorités
require_once "{$class_path}/aut_link.class.php";
$aut_link = new aut_link(AUT_TABLE_CATEG, $id);
$aut_link->save_form();
global $pmb_map_activate;
if ($pmb_map_activate) {
    $map = new map_edition_controler(AUT_TABLE_CATEG, $id);
    $map->save_form();
}
$aut_pperso = new aut_pperso("categ", $id);
$aut_pperso->save_form();
//traitement categories
foreach ($lg as $key => $value) {
    if ($category_libelle[$key] !== NULL) {
        if ($category_libelle[$key] !== '' || $category_libelle[$key] === '' && categories::exists($id, $key)) {
            $cat = new categories($id, $key);
            $cat->libelle_categorie = stripslashes($category_libelle[$key]);
            $cat->note_application = stripslashes($category_na[$key]);
コード例 #11
0
ファイル: author.class.php プロジェクト: hogsim/PMB
 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;
 }
コード例 #12
0
 function update($value, $force_creation = false)
 {
     global $dbh;
     global $msg, $charset;
     global $include_path;
     //si on a pas d'id, on peut avoir les infos de la collection
     if (!$value['parent']) {
         if ($value['collection']) {
             //on les a, on crée l'éditeur
             $value['collection'] = stripslashes_array($value['collection']);
             //La fonction d'import fait les addslashes contrairement à l'update
             $value['parent'] = collection::import($value['collection']);
         }
     }
     if (!$value['name'] || !$value['parent']) {
         return false;
     }
     // nettoyage des valeurs en entrée
     $value['name'] = clean_string($value['name']);
     // construction de la requête
     $requete = "SET sub_coll_name='{$value['name']}', ";
     $requete .= "sub_coll_parent='{$value['parent']}', ";
     $requete .= "sub_coll_issn='{$value['issn']}', ";
     $requete .= "subcollection_web='{$value['subcollection_web']}', ";
     $requete .= "subcollection_comment='{$value['comment']}', ";
     $requete .= "index_sub_coll=' " . strip_empty_words($value[name]) . " " . strip_empty_words($value["issn"]) . " '";
     if ($this->id) {
         // update
         $requete = 'UPDATE sub_collections ' . $requete;
         $requete .= ' WHERE sub_coll_id=' . $this->id . ' ';
         if (mysql_query($requete, $dbh)) {
             $requete = "select collection_parent from collections WHERE collection_id='" . $value[parent] . "' ";
             $res = mysql_query($requete, $dbh);
             $ed_parent = mysql_result($res, 0, 0);
             $requete = "update notices set ed1_id='{$ed_parent}', coll_id='" . $value[parent] . "' WHERE subcoll_id='" . $this->id . "' ";
             $res = mysql_query($requete, $dbh);
             $aut_link = new aut_link(AUT_TABLE_SUB_COLLECTIONS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("subcollection", $this->id);
             $aut_pperso->save_form();
             audit::insert_modif(AUDIT_SUB_COLLECTION, $this->id);
             subcollection::update_index($this->id);
             return TRUE;
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[178], htmlentities($msg[182] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
     } else {
         if (!$force_creation) {
             // création : s'assurer que la sous-collection n'existe pas déjà
             if ($id_subcollection_exists = subcollection::check_if_exists($value)) {
                 $subcollection_exists = new subcollection($id_subcollection_exists);
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[177], htmlentities($msg[219] . " -> " . $subcollection_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
         $requete = 'INSERT INTO sub_collections ' . $requete . ';';
         if (mysql_query($requete, $dbh)) {
             $this->id = mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_SUB_COLLECTIONS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("subcollection", $this->id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_SUB_COLLECTION, $this->id);
             return TRUE;
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[177], htmlentities($msg[182] . " -> " . $requete, ENT_QUOTES, $charset));
             return FALSE;
         }
     }
 }
コード例 #13
0
ファイル: serie.class.php プロジェクト: bouchra012/PMB
 function update($value)
 {
     global $dbh;
     global $msg;
     global $include_path;
     if (!$value) {
         return false;
     }
     // nettoyage de la chaîne en entrée
     $value = clean_string($value);
     $requete = "SET serie_name='" . $value . "', ";
     $requete .= "serie_index=' " . strip_empty_words($value) . " '";
     if ($this->s_id) {
         // update
         $requete = 'UPDATE series ' . $requete;
         $requete .= ' WHERE serie_id=' . $this->s_id . ' LIMIT 1;';
         if (mysql_query($requete, $dbh)) {
             $rqt_notice = "select notice_id,tit1,tit2,tit3,tit4 from notices where tparent_id=" . $this->s_id;
             $r_notice = mysql_query($rqt_notice);
             while ($r = mysql_fetch_object($r_notice)) {
                 $rq_serie = "update notices, series set notices.index_serie=serie_index, notices.index_wew=concat(serie_name,' ',tit1,' ',tit2,' ',tit3,' ',tit4),notices.index_sew=concat(' ',serie_index,' ','" . addslashes(strip_empty_words($r->tit1 . " " . $r->tit2 . " " . $r->tit3 . " " . $r->tit4)) . "',' ') where notice_id=" . $r->notice_id . " and serie_id=tparent_id";
                 mysql_query($rq_serie);
             }
             $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("serie", $this->s_id);
             $aut_pperso->save_form();
             serie::update_index($this->s_id);
             audit::insert_modif(AUDIT_SERIE, $this->s_id);
             return TRUE;
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[337], $msg[341]);
             return FALSE;
         }
     } else {
         // création : s'assurer que le titre n'existe pas déjà
         $dummy = "SELECT * FROM series WHERE serie_name REGEXP '^{$value}\$' LIMIT 1 ";
         $check = mysql_query($dummy, $dbh);
         if (mysql_num_rows($check)) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[336], $msg[340]);
             return FALSE;
         }
         $requete = 'INSERT INTO series ' . $requete . ';';
         if (mysql_query($requete, $dbh)) {
             $this->s_id = mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("serie", $this->s_id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_SERIE, $this->s_id);
             return TRUE;
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[336], $msg[342]);
             return FALSE;
         }
     }
 }
コード例 #14
0
 protected function proceed_delete($force_delete = false)
 {
     global $dbh, $msg;
     // On déclare un flag pour savoir si on peut continuer la suppression
     $deletion_allowed = true;
     $message = $this->item->get_label($this->handler->get_display_label($this->handler->get_class_uri($this->params->categ)));
     // on  déjà vérifier l'utilisation dans les notices d'un concept
     $query = "select num_object from index_concept where type_object =1 and num_concept = " . onto_common_uri::get_id($this->item->get_uri());
     $result = pmb_mysql_query($query, $dbh);
     if (pmb_mysql_num_rows($result)) {
         $deletion_allowed = false;
         $message .= "<br/>" . $msg['concept_use_in_notices_cant_delete'];
     }
     // On regarde si l'autorité est utilisée dans des vedettes composées
     $attached_vedettes = vedette_composee::get_vedettes_built_with_element(onto_common_uri::get_id($this->item->get_uri()), "concept");
     if (count($attached_vedettes)) {
         // Cette autorité est utilisée dans des vedettes composées, impossible de la supprimer
         $deletion_allowed = false;
         $message .= "<br/>" . $msg['vedette_dont_del_autority'];
     }
     if ($deletion_allowed) {
         // On peut continuer la suppression
         $id_vedette = vedette_link::get_vedette_id_from_object(onto_common_uri::get_id($this->item->get_uri()), TYPE_CONCEPT_PREFLABEL);
         $vedette = new vedette_composee($id_vedette);
         $vedette->delete();
         //suppression des autorités liées...
         // liens entre autorités
         if (get_class($this->item) == "onto_skos_concept_item") {
             $aut_link = new aut_link(AUT_TABLE_CONCEPT, onto_common_uri::get_id($this->item->get_uri()));
             $aut_link->delete();
         }
         parent::proceed_delete($force_delete);
     } else {
         error_message($msg[132], $message, 1, "./autorites.php?categ=concepts&sub=concept&action=edit&id=" . onto_common_uri::get_id($this->item->get_uri()));
     }
 }
コード例 #15
0
 function update($value, $force_creation = false)
 {
     global $dbh;
     global $msg, $charset;
     global $include_path;
     global $thesaurus_concepts_active;
     // nettoyage des valeurs en entrée
     $value['name'] = clean_string($value['name']);
     $value['issn'] = clean_string($value['issn']);
     if (!$value['parent']) {
         if ($value['publisher']) {
             //on les a, on crée l'éditeur
             $value['publisher'] = stripslashes_array($value['publisher']);
             //La fonction d'import fait les addslashes contrairement à l'update
             $value['parent'] = editeur::import($value['publisher']);
         }
     }
     if (!$value['name'] || !$value['parent']) {
         return false;
     }
     // construction de la requête
     $requete = 'SET collection_name="' . $value['name'] . '", ';
     $requete .= 'collection_parent="' . $value['parent'] . '", ';
     $requete .= 'collection_issn="' . $value['issn'] . '", ';
     $requete .= 'collection_web="' . $value['collection_web'] . '", ';
     $requete .= 'collection_comment="' . $value['comment'] . '", ';
     $requete .= 'index_coll=" ' . strip_empty_words($value['name']) . ' ' . strip_empty_words($value['issn']) . ' "';
     if ($this->id) {
         // update
         $requete = 'UPDATE collections ' . $requete;
         $requete .= ' WHERE collection_id=' . $this->id . ' ;';
         if (pmb_mysql_query($requete, $dbh)) {
             $requete = "update notices set ed1_id='" . $value[parent] . "' WHERE coll_id='" . $this->id . "' ";
             $res = pmb_mysql_query($requete, $dbh);
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("collection", $this->id);
             $aut_pperso->save_form();
             audit::insert_modif(AUDIT_COLLECTION, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[167], htmlentities($msg[169] . " -> " . $this->display, ENT_QUOTES, $charset));
             return FALSE;
         }
     } else {
         if (!$force_creation) {
             // création : s'assurer que la collection n'existe pas déjà
             if ($id_collection_exists = collection::check_if_exists($value)) {
                 $collection_exists = new collection($id_collection_exists);
                 require_once "{$include_path}/user_error.inc.php";
                 warning($msg[167], htmlentities($msg[171] . " -> " . $collection_exists->display, ENT_QUOTES, $charset));
                 return FALSE;
             }
         }
         $requete = 'INSERT INTO collections ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->id = pmb_mysql_insert_id();
             // liens entre autorités
             $aut_link = new aut_link(AUT_TABLE_COLLECTIONS, $this->id);
             $aut_link->save_form();
             audit::insert_creation(AUDIT_COLLECTION, $this->id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[167], htmlentities($msg[170] . " -> " . $requete, ENT_QUOTES, $charset));
             return FALSE;
         }
     }
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_COLLECTION);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->id, "collection");
     if ($value['subcollections']) {
         for ($i = 0; $i < count($value['subcollections']); $i++) {
             $subcoll = stripslashes_array($value['subcollections'][$i]);
             //La fonction d'import fait les addslashes contrairement à l'update
             $subcoll['coll_parent'] = $this->id;
             subcollection::import($subcoll);
         }
     }
     //update authority informations
     $authority = new authority(0, $this->id, AUT_TABLE_COLLECTIONS);
     $authority->set_num_statut($value['statut']);
     $authority->update();
     collection::update_index($this->id);
     return true;
 }
コード例 #16
0
 function replace($id, $by, $link_save = 0)
 {
     global $msg;
     global $dbh;
     global $pmb_synchro_rdf;
     if ($id == $by || !$id || !$by) {
         return $msg[223];
     }
     $aut_link = new aut_link($this->id + 1000, $id);
     // "Conserver les liens entre autorités" est demandé
     if ($link_save) {
         // liens entre autorités
         $aut_link->add_link_to($this->id + 1000, $by);
     }
     $aut_link->delete();
     // remplacement dans les notices
     $requete = "UPDATE notices_authperso SET notice_authperso_authority_num='{$by}' WHERE notice_authperso_authority_num='{$id}' ";
     @pmb_mysql_query($requete, $dbh);
     // effacement de
     $this->delete($id);
     // effacement de l'identifiant unique d'autorité
     $authority = new authority(0, $id, AUT_TABLE_AUTHPERSO);
     $authority->delete();
     $this->update_global_index($by);
 }
コード例 #17
0
ファイル: serie.class.php プロジェクト: noble82/proyectos-ULS
 function update($value)
 {
     global $dbh;
     global $msg;
     global $include_path;
     global $thesaurus_concepts_active;
     global $authority_statut;
     if (!$value) {
         return false;
     }
     // nettoyage de la chaîne en entrée
     $value = clean_string($value);
     $requete = 'SET serie_name="' . $value . '", ';
     $requete .= 'serie_index=" ' . strip_empty_words($value) . '" ';
     if ($this->s_id) {
         // update
         $requete = 'UPDATE series ' . $requete;
         $requete .= ' WHERE serie_id=' . $this->s_id . ' LIMIT 1;';
         if (pmb_mysql_query($requete, $dbh)) {
             $rqt_notice = "select notice_id,tit1,tit2,tit3,tit4 from notices where tparent_id=" . $this->s_id;
             $r_notice = pmb_mysql_query($rqt_notice);
             while ($r = pmb_mysql_fetch_object($r_notice)) {
                 $rq_serie = "update notices, series set notices.index_serie=serie_index, notices.index_wew=concat(serie_name,' ',tit1,' ',tit2,' ',tit3,' ',tit4),notices.index_sew=concat(' ',serie_index,' ','" . addslashes(strip_empty_words($r->tit1 . " " . $r->tit2 . " " . $r->tit3 . " " . $r->tit4)) . "',' ') where notice_id=" . $r->notice_id . " and serie_id=tparent_id";
                 pmb_mysql_query($rq_serie);
             }
             $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("serie", $this->s_id);
             $aut_pperso->save_form();
             audit::insert_modif(AUDIT_SERIE, $this->s_id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[337], $msg[341]);
             return FALSE;
         }
     } else {
         // création : s'assurer que le titre n'existe pas déjà
         $dummy = "SELECT * FROM series WHERE serie_name REGEXP '^{$value}\$' LIMIT 1 ";
         $check = pmb_mysql_query($dummy, $dbh);
         if (pmb_mysql_num_rows($check)) {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[336], $msg[340]);
             return FALSE;
         }
         $requete = 'INSERT INTO series ' . $requete . ';';
         if (pmb_mysql_query($requete, $dbh)) {
             $this->s_id = pmb_mysql_insert_id();
             $aut_link = new aut_link(AUT_TABLE_SERIES, $this->s_id);
             $aut_link->save_form();
             $aut_pperso = new aut_pperso("serie", $this->s_id);
             $aut_pperso->save_form();
             audit::insert_creation(AUDIT_SERIE, $this->s_id);
         } else {
             require_once "{$include_path}/user_error.inc.php";
             warning($msg[336], $msg[342]);
             return FALSE;
         }
     }
     //update authority informations
     $authority = new authority(0, $this->s_id, AUT_TABLE_SERIES);
     $authority->set_num_statut($authority_statut);
     $authority->update();
     // Indexation concepts
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->s_id, TYPE_SERIE);
         $index_concept->save();
     }
     // Mise à jour des vedettes composées contenant cette autorité
     vedette_composee::update_vedettes_built_with_element($this->s_id, "serie");
     serie::update_index($this->s_id);
     return TRUE;
 }
コード例 #18
0
ファイル: authperso.class.php プロジェクト: hogsim/PMB
 function get_view($id)
 {
     global $dbh;
     $req = "select * from authperso_authorities,authperso where id_authperso=authperso_authority_authperso_num and id_authperso_authority=" . $id;
     $res = pmb_mysql_query($req, $dbh);
     if ($r = pmb_mysql_fetch_object($res)) {
         $p_perso = new custom_parametres_perso("authperso", "authperso", $r->authperso_authority_authperso_num, "./autorites.php?categ=authperso&sub=update&id_authperso=" . $this->id, $option_navigation, $option_visibilite);
         $fields = $p_perso->get_out_values($id);
         $authperso_fields = $p_perso->values;
         $aut_link = new aut_link($r->authperso_authority_authperso_num + 1000, $id);
         $authperso_fields['authorities_link'] = $aut_link->get_data();
         //printr($authperso_fields);
         if ($r->authperso_view_script) {
             $view = H2o::parseString($r->authperso_view_script)->render($authperso_fields);
         } else {
             foreach ($authperso_fields as $field) {
                 $view .= $field[values][0][format_value] . ".  ";
             }
         }
     }
     return $view;
 }
コード例 #19
0
ファイル: categ_see.inc.php プロジェクト: bouchra012/PMB
         // Affichage du commentaire par le layer sur les "Voir aussi"
         $result_com = categorie::zoom_categ($mesCategories_see_too->num_noeud, $note);
         $see_also .= "<li><a href=./index.php?lvl=categ_see&id=" . $mesCategories_see_too->num_noeud . ">";
         if (category::has_notices($mesCategories_see_too->num_noeud)) {
             $see_also .= " <img src='{$base_path}/images/folder_search.gif' border=0 align='absmiddle'>";
         } else {
             $see_also .= " <img src='./images/folder.gif' border='0' align='middle'>";
         }
         $see_also .= pmb_bidi("</a><a href=./index.php?lvl=categ_see&id=" . $mesCategories_see_too->num_noeud . "" . $result_com['java_com'] . ">" . $mesCategories_see_too->libelle_categorie . '</a>' . $result_com['zoom']);
         $see_also .= "</li>";
     }
 }
 if ($see_also) {
     print "\n\t\t<div id='categ_see_also' class='categ_see_also'>\n\n\t\t<h5><span>" . $msg["term_show_see_also"] . "</span></h5>\n\t\t<ul>" . $see_also . "\n\t\t</ul>\n\t\t</div>";
 }
 $aut_link = new aut_link(AUT_TABLE_CATEG, $id);
 $see_aut_link = $aut_link->get_display();
 if ($see_aut_link) {
     print "\n\t\t<div id='categ_see_aut_link' class='categ_see_aut_link'>\n\n\t\t\t<h5><span>" . $msg["categ_see_aut_link"] . "</span></h5>" . $see_aut_link . "\n\t\t</div>";
 }
 print "</div><!-- //fermeture aut_see -->\n";
 print "<div id='aut_details_liste'>\n";
 //Lire le champ path du noeud pour étendre la recherche éventuellement au fils et aux père de la catégorie
 // lien Etendre auto_postage
 if (!isset($nb_level_enfants)) {
     // non defini, prise des valeurs par défaut
     if (isset($_SESSION["nb_level_enfants"]) && $opac_auto_postage_etendre_recherche) {
         $nb_level_descendant = $_SESSION["nb_level_enfants"];
     } else {
         $nb_level_descendant = $opac_auto_postage_nb_descendant;
     }