recursif=$recursif;
$this->id = $id;
$this->getData();
} else {
// la notice n'existe pas
$this->id = 0;
$this->getData();
}
}
// ---------------------------------------------------------------
// getData() : récupération infos titre_uniforme
// ---------------------------------------------------------------
function getData() {
global $dbh,$msg;
$this->name = '';
$this->tonalite = '';
$this->comment ='';
$this->distrib=array();
$this->ref=array();
$this->subdiv=array();
$this->libelle="";
$this->import_denied=0;
$this->form = '';
$this->date ='';
$this->date_date ='';
$this->characteristic = '';
$this->intended_termination = '';
$this->intended_audience = '';
$this->context = '';
$this->coordinates = '';
$this->equinox = '';
$this->subject = '';
$this->place = '';
$this->history = '';
$this->num_author = '';
$this->display = '';
if($this->id) {
$requete = "SELECT * FROM titres_uniformes WHERE tu_id=$this->id LIMIT 1 ";
$result = @mysql_query($requete, $dbh);
if(mysql_num_rows($result)) {
$temp = mysql_fetch_object($result);
$this->id = $temp->tu_id;
$this->name = $temp->tu_name;
$this->tonalite = $temp->tu_tonalite;
$this->comment = $temp->tu_comment ;
$this->import_denied = $temp->tu_import_denied;
$this->form = $temp->tu_forme;
$this->date = $temp->tu_date;
$this->date_date = $temp->tu_date_date;
$this->characteristic = $temp->tu_caracteristique;
$this->intended_termination = $temp->tu_completude;
$this->intended_audience = $temp->tu_public;
$this->context = $temp->tu_contexte;
$this->coordinates = $temp->tu_coordonnees;
$this->equinox = $temp->tu_equinoxe;
$this->subject = $temp->tu_sujet;
$this->place = $temp->tu_lieu;
$this->history = $temp->tu_histoire;
$this->num_author = $temp->tu_num_author;
$libelle[]=$this->name;
if($this->tonalite)$libelle[]=$this->tonalite;
$requete = "SELECT * FROM tu_distrib WHERE distrib_num_tu='$this->id' order by distrib_ordre";
$result = mysql_query($requete, $dbh);
if(mysql_num_rows($result)) {
while(($param=mysql_fetch_object($result))) {
$this->distrib[]["label"]=$param->distrib_name;
$libelle[]=$param->distrib_name;
}
}
$requete = "SELECT * FROM tu_ref WHERE ref_num_tu='$this->id' order by ref_ordre";
$result = mysql_query($requete, $dbh);
if(mysql_num_rows($result)) {
while(($param=mysql_fetch_object($result))) {
$this->ref[]["label"]=$param->ref_name;
$libelle[]=$param->ref_name;
}
}
$requete = "SELECT * FROM tu_subdiv WHERE subdiv_num_tu='$this->id' order by subdiv_ordre";
$result = mysql_query($requete, $dbh);
if(mysql_num_rows($result)) {
while(($param=mysql_fetch_object($result))) {
$this->subdiv[]["label"]=$param->subdiv_name;
$libelle[]=$param->subdiv_name;
}
}
$this->display = $this->name;
if($this->date){
$this->display.=" (".$this->date.")";
}
if($this->num_author){
$tu_auteur = new auteur($this->num_author);
$libelle[] = $tu_auteur->display;
$this->display.=" / ".$tu_auteur->rejete." ".$tu_auteur->name;
}
$this->libelle=implode("; ",$libelle);
} else {
// pas trouvé avec cette clé
$this->id = 0;
}
}
}
function gen_input_selection($label,$form_name,$item,$values,$what_sel,$class='saisie-80em' ) {
global $msg;
$select_prop = "scrollbars=yes, toolbar=no, dependent=yes, resizable=yes";
$link="'./select.php?what=$what_sel&caller=$form_name&p1=f_".$item."_code!!num!!&p2=f_".$item."!!num!!&deb_rech='+".pmb_escape()."(this.form.f_".$item."!!num!!.value), '$what_sel', 400, 400, -2, -2, '$select_prop'";
$size_item=strlen($item)+2;
$script_js="
";
//template de zone de texte pour chaque valeur
$aff="
!!bouton_parcourir!!";
// 1 seul auteur pour 1 oeuvre
if($item=="author"){
$aff.="
\n";
} else {
$aff.="!!bouton_ajouter!!
\n";
}
if($what_sel)$bouton_parcourir="";
else $bouton_parcourir="";
$aff= str_replace('!!bouton_parcourir!!', $bouton_parcourir, $aff);
$template=$script_js."";
$template.="
";
$num=0;
if(!$values[0]) $values[0] = array("id"=>"","label"=>"");
foreach($values as $value) {
$label_element=$value["label"];
$id_element=$value["id"];
$temp= str_replace('!!id_element!!', $id_element, $aff);
$temp= str_replace('!!label_element!!', $label_element, $temp);
$temp= str_replace('!!num!!', $num, $temp);
if(!$num) $temp= str_replace('!!bouton_ajouter!!', "
", $temp);
else $temp= str_replace('!!bouton_ajouter!!', "", $temp);
$template.=$temp;
$num++;
}
$template.="
";
$template.="
";
return $template;
}
// ---------------------------------------------------------------
// show_form : affichage du formulaire de saisie
// ---------------------------------------------------------------
function show_form() {
global $msg;
global $titre_uniforme_form;
global $charset;
global $user_input, $nbr_lignes, $page ;
global $pmb_type_audit;
if($this->id) {
$action = "./autorites.php?categ=titres_uniformes&sub=update&id=$this->id";
$libelle = $msg["aut_titre_uniforme_modifier"];
$button_remplace = "id\"'>";
$button_voir = "id\"'>";
$button_delete = "";
} else {
$action = './autorites.php?categ=titres_uniformes&sub=update&id=';
$libelle = $msg["aut_titre_uniforme_ajouter"];
$button_remplace = '';
$button_delete ='';
}
if($this->import_denied == 1){
$import_denied_checked = "checked='checked'";
}else{
$import_denied_checked = "";
}
// remplacement de tous les champs du formulaire par les données
$aut_link= new aut_link(AUT_TABLE_TITRES_UNIFORMES,$this->id);
$titre_uniforme_form = str_replace('', $aut_link->get_form('saisie_titre_uniforme') , $titre_uniforme_form);
$aut_pperso= new aut_pperso("tu",$this->id);
$titre_uniforme_form = str_replace('!!aut_pperso!!', $aut_pperso->get_form(), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!id!!', $this->id, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!action!!', $action, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!libelle!!', $libelle, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!nom!!', htmlentities($this->name,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!aut_id!!', htmlentities($this->num_author,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!form!!', htmlentities($this->form,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!date!!', htmlentities($this->date,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!subject!!', htmlentities($this->subject,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!place!!', htmlentities($this->place,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!history!!', htmlentities($this->history,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!intended_audience!!', htmlentities($this->intended_audience,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!context!!', htmlentities($this->context,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!tonalite!!', htmlentities($this->tonalite,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!coordinates!!', htmlentities($this->coordinates,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!equinox!!', htmlentities($this->equinox,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!characteristic!!', htmlentities($this->characteristic,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!comment!!', htmlentities($this->comment,ENT_QUOTES, $charset), $titre_uniforme_form);
// auteur
$tu_auteur_id = $this->num_author;
if($tu_auteur_id){
$tu_auteur = new auteur($tu_auteur_id);
}
$titre_uniforme_form = str_replace('!!aut_name!!',htmlentities($tu_auteur->display,ENT_QUOTES, $charset), $titre_uniforme_form);
// complétude
$intended_termination_id = $this->intended_termination;
$select_0=""; $select_1=""; $select_2="";
if($intended_termination_id == 1){
$select_1 = "selected";
} elseif($intended_termination_id == 2){
$select_2 = "selected";
} else {
$select_0 = "selected";
}
$titre_uniforme_form = str_replace('!!intended_termination_0!!', htmlentities($select_0,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!intended_termination_1!!', htmlentities($select_1,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!intended_termination_2!!', htmlentities($select_2,ENT_QUOTES, $charset), $titre_uniforme_form);
// distribution
$distribution_form=$this->gen_input_selection($msg["aut_titre_uniforme_form_distribution"],"saisie_titre_uniforme","distrib",$this->distrib,"","saisie-80em");
$titre_uniforme_form = str_replace("",$distribution_form, $titre_uniforme_form);
// reference
$ref_num_form=$this->gen_input_selection($msg["aut_titre_uniforme_form_ref_numerique"],"saisie_titre_uniforme","ref",$this->ref,"","saisie-80em");
$titre_uniforme_form = str_replace("",$ref_num_form, $titre_uniforme_form);
// subdivision
$sub_form=$this->gen_input_selection($msg["aut_titre_uniforme_form_subdivision_forme"],"saisie_titre_uniforme","subdiv",$this->subdiv,"","saisie-80em");
$titre_uniforme_form = str_replace('', $sub_form, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!remplace!!', $button_remplace, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!voir_notices!!', $button_voir, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!delete!!', $button_delete, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!user_input_url!!', rawurlencode(stripslashes($user_input)), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!user_input!!', htmlentities($user_input,ENT_QUOTES, $charset), $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!nbr_lignes!!', $nbr_lignes, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!page!!', $page, $titre_uniforme_form);
$titre_uniforme_form = str_replace('!!tu_import_denied!!', $import_denied_checked, $titre_uniforme_form);
if ($pmb_type_audit && $this->id)
$bouton_audit= " id."', 'audit_popup', 700, 500, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" title=\"".$msg['audit_button']."\" value=\"".$msg['audit_button']."\" /> ";
$titre_uniforme_form = str_replace('!!audit_bt!!', $bouton_audit, $titre_uniforme_form);
print $titre_uniforme_form;
}
// ---------------------------------------------------------------
// replace_form : affichage du formulaire de remplacement
// ---------------------------------------------------------------
function replace_form() {
global $titre_uniforme_replace;
global $msg;
global $include_path;
if(!$this->id || !$this->name) {
require_once("$include_path/user_error.inc.php");
error_message($msg[161], $msg[162], 1, './autorites.php?categ=titres_uniformes&sub=&id=');
return false;
}
$titre_uniforme_replace=str_replace('!!old_titre_uniforme_libelle!!', $this->display, $titre_uniforme_replace);
$titre_uniforme_replace=str_replace('!!id!!', $this->id, $titre_uniforme_replace);
print $titre_uniforme_replace;
return true;
}
// ---------------------------------------------------------------
// delete() : suppression
// ---------------------------------------------------------------
function delete() {
global $dbh;
global $msg;
if(!$this->id) // impossible d'accéder à cette notice titre uniforme
return $msg[403];
// effacement dans les notices
// récupération du nombre de notices affectées
$requete = "SELECT count(1) FROM notices_titres_uniformes WHERE ntu_num_tu='$this->id' ";
$res = mysql_query($requete, $dbh);
$nbr_lignes = mysql_result($res, 0, 0);
if($nbr_lignes) {
// Ce titre uniforme est utilisé dans des notices, impossible de le supprimer
return ''.$this->display."
${msg['titre_uniforme_delete']}";
}
// effacement dans la table des titres_uniformes
$requete = "DELETE FROM titres_uniformes WHERE tu_id='$this->id' ";
mysql_query($requete, $dbh);
// delete les champs 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);
//suppression dans la table de stockage des numéros d'autorités...
$this->delete_autority_sources($this->id);
// liens entre autorités
$aut_link= new aut_link(AUT_TABLE_TITRES_UNIFORMES,$this->id);
$aut_link->delete();
$aut_pperso= new aut_pperso("tu",$this->id);
$aut_pperso->delete();
audit::delete_audit(AUDIT_TITRE_UNIFORME,$this->id);
return false;
}
// ---------------------------------------------------------------
// delete_autority_sources($idcol=0) : Suppression des informations d'import d'autorité
// ---------------------------------------------------------------
function delete_autority_sources($idtu=0){
$tabl_id=array();
if(!$idtu){
$requete="SELECT DISTINCT num_authority FROM authorities_sources LEFT JOIN titres_uniformes ON num_authority=tu_id WHERE authority_type = 'uniform_title' AND tu_id IS NULL";
$res=mysql_query($requete);
if(mysql_num_rows($res)){
while ($ligne = mysql_fetch_object($res)) {
$tabl_id[]=$ligne->num_authority;
}
}
}else{
$tabl_id[]=$idtu;
}
foreach ( $tabl_id as $value ) {
//suppression dans la table de stockage des numéros d'autorités...
$query = "select id_authority_source from authorities_sources where num_authority = ".$value." and authority_type = 'uniform_title'";
$result = mysql_query($query);
if(mysql_num_rows($result)){
while ($ligne = mysql_fetch_object($result)) {
$query = "delete from notices_authorities_sources where num_authority_source = ".$ligne->id_authority_source;
mysql_query($query);
}
}
$query = "delete from authorities_sources where num_authority = ".$value." and authority_type = 'uniform_title'";
mysql_query($query);
}
}
// ---------------------------------------------------------------
// replace($by) : remplacement
// ---------------------------------------------------------------
function replace($by,$link_save) {
global $msg;
global $dbh;
global $pmb_synchro_rdf;
if (($this->id == $by) || (!$this->id)) {
return $msg[223];
}
$aut_link= new aut_link(AUT_TABLE_TITRES_UNIFORMES,$this->id);
// "Conserver les liens entre autorités" est demandé
if($link_save) {
// liens entre autorités
$aut_link->add_link_to(AUT_TABLE_TITRES_UNIFORMES,$by);
}
$aut_link->delete();
// remplacement dans les responsabilités
$requete = "UPDATE notices_titres_uniformes SET ntu_num_tu='$by' WHERE ntu_num_tu='$this->id' ";
@mysql_query($requete, $dbh);
// effacement dans la table des titres_uniformes
$requete = "DELETE FROM titres_uniformes WHERE tu_id='$this->id' ";
mysql_query($requete, $dbh);
// delete les champs 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);
//nettoyage d'autorities_sources
$query = "select * from authorities_sources where num_authority = ".$this->id." and authority_type = 'uniform_title'";
$result = mysql_query($query);
if(mysql_num_rows($result)){
while($row = 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;
mysql_result($query);
$query = "delete from authorities_sources where id_authority_source = ".$row->id_authority_source;
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;
mysql_query($query);
}
}
}
audit::delete_audit(AUDIT_TITRE_UNIFORME,$this->id);
titre_uniforme::update_index($by);
//mise à jour de l'oeuvre rdf
if($pmb_synchro_rdf){
$synchro_rdf = new synchro_rdf();
$synchro_rdf->replaceAuthority($this->id,$by,'oeuvre');
}
return FALSE;
}
// ---------------------------------------------------------------
// update($value) : mise à jour
// ---------------------------------------------------------------
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;$iid)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;
}
// ---------------------------------------------------------------
// import() : import d'un titre_uniforme
// ---------------------------------------------------------------
// fonction d'import de notice titre_uniforme
function import($value,$from_form=0) {
global $dbh;
// Si vide on sort
if(trim($value['name']) == '') return FALSE;
if(!$from_form) {
$value['name'] = addslashes($value['name']);
$value['num_author'] = addslashes($value['num_author']);
$value['form'] = addslashes($value['form']);
$value['date'] = addslashes($value['date']);
$value['subject'] = addslashes($value['subject']);
$value['place'] = addslashes($value['place']);
$value['history'] = addslashes($value['history']);
$value['characteristic'] = addslashes($value['characteristic']);
$value['intended_termination'] = addslashes($value['intended_termination']);
$value['intended_audience'] = addslashes($value['intended_audience']);
$value['context'] = addslashes($value['context']);
$value['equinox'] = addslashes($value['equinox']);
$value['coordinates'] = addslashes($value['coordinates']);
$value['tonalite'] = addslashes($value['tonalite']);
$value['comment'] = addslashes($value['comment']);
for($i=0;$itu_id;
return $tu->tu_id;
}*/
$tu_auteur = new auteur($value['num_author']);
if(!$tu_auteur->id){
$value['num_author']=0;
} else {
$value['num_author']=$tu_auteur->id;
}
$titre=titre_uniforme::import_tu_exist($value,$from_form);
if($titre){
return $titre;
}
$requete = "INSERT INTO titres_uniformes 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"]."'";
// insertion du titre uniforme et mise à jour de l'index tu
if(mysql_query($requete, $dbh)) {
$tu_id=mysql_insert_id();
} else {
return FALSE;
}
// Distribution instrumentale et vocale (pour la musique)
for($i=0;$itu_id;
$différent=false;
//Test si les titres de même nom ont aussi la (ou les) même distribution
if(count($value['distrib']) == 0){ //Si le titre que je veux ajouter n'a pas de distribution je regarde si celui qui existe en a une
$requete = "select distrib_num_tu from tu_distrib where
distrib_num_tu='$tu_id' ";
$test = mysql_query($requete, $dbh);
if (mysql_num_rows($test)) {
$différent = true; //S'il a une distribution, le titre que je veux ajouter est différent
}
}else{
//On teste s'il y a autant de distribution
$requete = "select distrib_num_tu from tu_distrib where distrib_num_tu='$tu_id' ";
$nb=mysql_num_rows(mysql_query($requete, $dbh));
if($nb != count($value['distrib'])){ //Si il y en a pas autant c'est un titre différent
$différent = true;
}else{ //Sinon on regarde si ce sont les mêmes
$nb_occurence=array_count_values($value['distrib']);//avoir le nombre d'occurence de chaque terme
for($i=0;$itu_id; }
// Subdivision de forme
for($i=0;$i', "".$msg["aut_titre_uniforme_derniers_crees"]."", $user_query);
$user_query = str_replace("!!user_input!!",htmlentities(stripslashes($user_input),ENT_QUOTES, $charset),$user_query);
print pmb_bidi($user_query) ;
}
//---------------------------------------------------------------
// update_index($id) : maj des n-uplets la table notice_global_index en rapport avec ce titre uniforme
//---------------------------------------------------------------
function update_index($id) {
global $dbh;
// On cherche tous les n-uplet de la table notice correspondant à ce titre_uniforme.
$found = mysql_query("select ntu_num_notice from notices_titres_uniformes where ntu_num_tu = ".$id,$dbh);
// Pour chaque n-uplet trouvés on met a jour la table notice_global_index avec l'auteur modifié :
while(($mesNotices = mysql_fetch_object($found))) {
$notice_id = $mesNotices->ntu_num_notice;
notice::majNoticesGlobalIndex($notice_id);
notice::majNoticesMotsGlobalIndex($notice_id,'uniformtitle'); //TODO preciser le datatype avant d'appeler cette fonction
}
}
//---------------------------------------------------------------
// get_informations_from_unimarc : ressort les infos d'un titre uniforme depuis une notice unimarc
//---------------------------------------------------------------
function get_informations_from_unimarc($fields,$zone){
$data = array();
if($zone == "2"){
$data['name'] = $fields[$zone.'30'][0]['a'][0];
$data['tonalite']= $fields[$zone.'30'][0]['u'][0];
$data['date']= $fields[$zone.'30'][0]['k'][0];
$data['distrib'] = array();
for($i=0 ; $itonalite." ".$oeuvre->subject." ".$oeuvre->place." ".$oeuvre->history." ";
$index.= $oeuvre->date." ".$oeuvre->context." ".$oeuvre->equinox." ".$oeuvre->coordinates." ";
$index.= $auteur->name." ".$auteur->rejete." ";
$req = "SELECT distrib_name FROM tu_distrib WHERE distrib_num_tu='$tu_id' ";
$res = mysql_query($req, $dbh);
if($distrib=mysql_fetch_object($res)){
$index.= $distrib->distrib_name." ";
}
$req = "SELECT ref_name FROM tu_ref WHERE ref_num_tu='$tu_id' ";
$res = mysql_query($req, $dbh);
if($ref=mysql_fetch_object($res)){
$index.= $ref->ref_name." ";
}
$requete .= "'".addslashes(strip_empty_chars($index))."' WHERE tu_id=".$tu_id;
$result = mysql_query($requete,$dbh);
}
return ;
}
// ---------------------------------------------------------------
// do_isbd() : génération de l'isbd du titre uniforme (AFNOR Z 44-061 de 1986)
// ---------------------------------------------------------------
function do_isbd() {
global $msg;
$this->tu_isbd="";
if(!$this->id) return;
if($this->num_author){
$tu_auteur = new auteur ($this->num_author);
$this->tu_isbd = $tu_auteur->display.". ";
}
if($this->name){
$this->tu_isbd.= $this->name;
}
return $this->tu_isbd;
}
} // class titre uniforme