Example #1
0
 function analysis_update($values, $other_fields = "")
 {
     global $dbh, $pmb_notice_img_folder_id, $opac_url_base, $pmb_notice_img_pics_max_size;
     global $pmb_map_activate, $pmb_newrecord_timeshift;
     // clean des vieilles nouveautés
     if ($pmb_newrecord_timeshift) {
         $req_old = "UPDATE notices SET notice_date_is_new ='', notice_is_new=0, update_date=update_date where notice_date_is_new !='0000-00-00 00:00:00' and (notice_date_is_new < now() - interval {$pmb_newrecord_timeshift} day )";
         mysql_query($req_old, $dbh);
     }
     if (is_array($values)) {
         $this->analysis_biblio_level = 'a';
         $this->analysis_hierar_level = '2';
         $this->analysis_typdoc = $values['typdoc'];
         $this->analysis_statut = $values['statut'];
         $this->analysis_commentaire_gestion = $values['f_commentaire_gestion'];
         $this->analysis_thumbnail_url = $values['f_thumbnail_url'];
         $this->analysis_tit1 = $values['f_tit1'];
         $this->analysis_tit2 = $values['f_tit2'];
         $this->analysis_tit3 = $values['f_tit3'];
         $this->analysis_tit4 = $values['f_tit4'];
         $this->analysis_n_gen = $values['f_n_gen'];
         $this->analysis_n_contenu = $values['f_n_contenu'];
         $this->analysis_n_resume = $values['f_n_resume'];
         $this->analysis_indexint = $values['f_indexint_id'];
         $this->analysis_index_l = $values['f_indexation'];
         $this->analysis_lien = $values['f_lien'];
         $this->analysis_eformat = $values['f_eformat'];
         $this->analysis_pages = $values['pages'];
         $this->analysis_signature = $values['signature'];
         $this->analysis_indexation_lang = $values['indexation_lang'];
         $this->notice_is_new = $values['notice_is_new'];
         // insert de year à partir de la date de parution du bulletin
         if ($this->date_date) {
             $this->analysis_year = substr($this->date_date, 0, 4);
         }
         $this->date_parution_perio = $this->date_date;
         // construction de la requête :
         $data = "typdoc='" . $this->analysis_typdoc . "'";
         $data .= ", statut='" . $this->analysis_statut . "'";
         $data .= ", tit1='" . $this->analysis_tit1 . "'";
         $data .= ", tit3='" . $this->analysis_tit3 . "'";
         $data .= ", tit4='" . $this->analysis_tit4 . "'";
         $data .= ", year='" . $this->analysis_year . "'";
         $data .= ", npages='" . $this->analysis_pages . "'";
         $data .= ", n_contenu='" . $this->analysis_n_contenu . "'";
         $data .= ", n_gen='" . $this->analysis_n_gen . "'";
         $data .= ", n_resume='{$this->analysis_n_resume}'";
         $data .= ", lien='" . $this->analysis_lien . "'";
         $data .= ", eformat='" . $this->analysis_eformat . "'";
         $data .= ", indexint='" . $this->analysis_indexint . "'";
         $data .= ", index_l='" . clean_tags($this->analysis_index_l) . "'";
         $data .= ", niveau_biblio='" . $this->analysis_biblio_level . "'";
         $data .= ", niveau_hierar='" . $this->analysis_hierar_level . "'";
         $data .= ", commentaire_gestion='" . $this->analysis_commentaire_gestion . "'";
         $data .= ", thumbnail_url='" . $this->analysis_thumbnail_url . "'";
         $data .= ", signature='" . $this->analysis_signature . "'";
         $data .= ", date_parution='" . $this->date_parution_perio . "'";
         $data .= ", indexation_lang='" . $this->analysis_indexation_lang . "'";
         $data .= ", notice_is_new='" . $this->notice_is_new . "' \n\t\t\t{$other_fields}";
         $result = 0;
         if (!$this->analysis_id) {
             // si c'est une création
             // fabrication de la requête finale
             $requete = "INSERT INTO notices SET {$data} , create_date=sysdate(), update_date=sysdate() ";
             $myQuery = pmb_mysql_query($requete, $dbh);
             $this->analysis_id = pmb_mysql_insert_id($dbh);
             if ($myQuery) {
                 $result = $this->analysis_id;
             }
             // si l'insertion est OK, il faut créer l'entrée dans la table 'analysis'
             if ($this->analysis_id) {
                 // autorité personnalisées
                 $authperso = new authperso_notice($this->analysis_id);
                 $authperso->save_form();
                 // map
                 if ($pmb_map_activate) {
                     $map = new map_edition_controler(TYPE_RECORD, $this->analysis_id);
                     $map->save_form();
                     $map_info = new map_info($this->analysis_id);
                     $map_info->save_form();
                 }
                 // Mise à jour des index de la notice
                 notice::majNoticesTotal($this->analysis_id);
                 audit::insert_creation(AUDIT_NOTICE, $this->analysis_id);
                 $requete = 'INSERT INTO analysis SET';
                 $requete .= ' analysis_bulletin=' . $this->id_bulletinage;
                 $requete .= ', analysis_notice=' . $this->analysis_id;
                 $myQuery = pmb_mysql_query($requete, $dbh);
             }
         } else {
             $requete = "UPDATE notices SET {$data} , update_date=sysdate() WHERE notice_id='" . $this->analysis_id . "' LIMIT 1";
             $myQuery = pmb_mysql_query($requete, $dbh);
             // autorité personnalisées
             $authperso = new authperso_notice($this->analysis_id);
             $authperso->save_form();
             // map
             if ($pmb_map_activate) {
                 $map = new map_edition_controler(TYPE_RECORD, $this->analysis_id);
                 $map->save_form();
                 $map_info = new map_info($this->analysis_id);
                 $map_info->save_form();
             }
             // Mise à jour des index de la notice
             notice::majNoticesTotal($this->analysis_id);
             audit::insert_modif(AUDIT_NOTICE, $this->analysis_id);
             if ($myQuery) {
                 $result = $this->analysis_id;
             }
         }
         // vignette de la notice uploadé dans un répertoire
         $id = $this->analysis_id;
         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 . "'";
             $res = pmb_mysql_query($req, $dbh);
             if (pmb_mysql_num_rows($res)) {
                 $rep = pmb_mysql_fetch_object($res);
                 $filename_output = $rep->repertoire_path . "img_" . $id;
             }
             if (($fp = @fopen($_FILES['f_img_load']['tmp_name'], "rb")) && $filename_output) {
                 $image = "";
                 $size = 0;
                 $flag = true;
                 while (!feof($fp)) {
                     $image .= fread($fp, 4096);
                     $size = strlen($image);
                     if ($size > $poids_fichier_max) {
                         $flag = false;
                         break;
                     }
                 }
                 if ($flag) {
                     if ($img = imagecreatefromstring($image)) {
                         if (!($pmb_notice_img_pics_max_size * 1)) {
                             $pmb_notice_img_pics_max_size = 100;
                         }
                         $redim = false;
                         if (imagesx($img) >= imagesy($img)) {
                             if (imagesx($img) <= $pmb_notice_img_pics_max_size) {
                                 $largeur = imagesx($img);
                                 $hauteur = imagesy($img);
                             } else {
                                 $redim = true;
                                 $largeur = $pmb_notice_img_pics_max_size;
                                 $hauteur = $largeur * imagesy($img) / imagesx($img);
                             }
                         } else {
                             if (imagesy($img) <= $pmb_notice_img_pics_max_size) {
                                 $hauteur = imagesy($img);
                                 $largeur = imagesx($img);
                             } else {
                                 $redim = true;
                                 $hauteur = $pmb_notice_img_pics_max_size;
                                 $largeur = $hauteur * imagesx($img) / imagesy($img);
                             }
                         }
                         if ($redim) {
                             $dest = imagecreatetruecolor($largeur, $hauteur);
                             imagecopyresampled($dest, $img, 0, 0, 0, 0, $largeur, $hauteur, imagesx($img), imagesy($img));
                             imagepng($dest, $filename_output);
                             imagedestroy($dest);
                         } else {
                             imagepng($img, $filename_output);
                         }
                         imagedestroy($img);
                         $thumbnail_url = $opac_url_base . "getimage.php?noticecode=&vigurl=&notice_id=" . $id;
                         $req = "update notices set  thumbnail_url='" . $thumbnail_url . "' where notice_id ='" . $id . "'";
                         $res = pmb_mysql_query($req, $dbh);
                     }
                 }
             }
         }
         return $result;
     }
     //if(is_array($values))
 }
Example #2
0
     $sav_id = 0;
     $id = pmb_mysql_insert_id($dbh);
     audit::insert_creation(AUDIT_NOTICE, $id);
 } else {
     $sav_id = $id;
     audit::insert_modif(AUDIT_NOTICE, $id);
 }
 // autorité personnalisées
 $authperso = new authperso_notice($id);
 $authperso->save_form();
 // map
 global $pmb_map_activate;
 if ($pmb_map_activate) {
     $map = new map_edition_controler(TYPE_RECORD, $id);
     $map->save_form();
     $map_info = new map_info($id);
     $map_info->save_form();
 }
 // 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 . "'";
     $res = pmb_mysql_query($req, $dbh);
     if (pmb_mysql_num_rows($res)) {
         $rep = pmb_mysql_fetch_object($res);
         $filename_output = $rep->repertoire_path . "img_" . $id;
     }
     if (($fp = @fopen($_FILES['f_img_load']['tmp_name'], "rb")) && $filename_output) {
         $image = "";
         $size = 0;
Example #3
0
 function show_form()
 {
     global $msg;
     global $charset;
     global $lang;
     global $include_path, $class_path;
     global $current_module;
     global $pmb_type_audit, $select_categ_prop, $z3950_accessible;
     global $value_deflt_fonction, $value_deflt_relation;
     global $thesaurus_mode_pmb;
     global $PMBuserid, $pmb_form_editables, $thesaurus_classement_mode_pmb;
     global $xmlta_indexation_lang;
     global $thesaurus_concepts_active;
     global $pmb_map_activate;
     global $pmb_notices_show_dates;
     global $thesaurus_categories_affichage_ordre;
     include "{$include_path}/templates/catal_form.tpl.php";
     $fonction = new marc_list('function');
     // mise a jour de l'action en fonction de l'id
     $this->action .= $this->id;
     // mise a jour de l'en-tete du formulaire
     if ($this->notice_mere[0]) {
         $this->libelle_form .= " " . $msg["catalog_notice_fille_lib"] . " " . substr($this->notice_mere[0], 0, 100) . (count($this->notice_mere) > 1 ? ", ..." : "");
     }
     $form_notice = str_replace('!!libelle_form!!', $this->libelle_form, $form_notice);
     // mise a jour des flags de niveau hierarchique
     $form_notice = str_replace('!!b_level!!', $this->biblio_level, $form_notice);
     $form_notice = str_replace('!!h_level!!', $this->hierar_level, $form_notice);
     // mise a jour de l'onglet 0
     $ptab[0] = str_replace('!!tit1!!', htmlentities($this->tit1, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tit2!!', htmlentities($this->tit2, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tit3!!', htmlentities($this->tit3, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tit4!!', htmlentities($this->tit4, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tparent_id!!', $this->tparent_id, $ptab[0]);
     $ptab[0] = str_replace('!!tparent!!', htmlentities($this->tparent, ENT_QUOTES, $charset), $ptab[0]);
     $ptab[0] = str_replace('!!tnvol!!', htmlentities($this->tnvol, ENT_QUOTES, $charset), $ptab[0]);
     $form_notice = str_replace('!!tab0!!', $ptab[0], $form_notice);
     // mise a jour de l'onglet 1
     // constitution de la mention de responsabilite
     //$this->responsabilites
     $as = array_search("0", $this->responsabilites["responsabilites"]);
     if ($as !== FALSE && $as !== NULL) {
         $auteur_0 = $this->responsabilites["auteurs"][$as];
         $auteur = new auteur($auteur_0["id"]);
     }
     if ($value_deflt_fonction && $auteur_0["id"] == 0) {
         $auteur_0["fonction"] = $value_deflt_fonction;
     }
     if ($pmb_authors_qualification) {
         $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_0["id_responsability"], TYPE_NOTICE_RESPONSABILITY_PRINCIPAL), 'notice_authors'));
         $ptab[1] = str_replace('!!vedette_author!!', $vedette_ui->get_form('role', 0, 'notice'), $ptab[1]);
     } else {
         $ptab[1] = str_replace('!!vedette_author!!', "", $ptab[1]);
     }
     $ptab[1] = str_replace('!!iaut!!', 0, $ptab[1]);
     $ptab[1] = str_replace('!!aut0_id!!', $auteur_0["id"], $ptab[1]);
     $ptab[1] = str_replace('!!aut0!!', htmlentities($auteur->isbd_entry, ENT_QUOTES, $charset), $ptab[1]);
     $ptab[1] = str_replace('!!f0_code!!', $auteur_0["fonction"], $ptab[1]);
     $ptab[1] = str_replace('!!f0!!', $fonction->table[$auteur_0["fonction"]], $ptab[1]);
     $as = array_keys($this->responsabilites["responsabilites"], "1");
     $max_aut1 = count($as);
     if ($max_aut1 == 0) {
         $max_aut1 = 1;
     }
     for ($i = 0; $i < $max_aut1; $i++) {
         $indice = $as[$i];
         $auteur_1 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_1["id"]);
         if ($value_deflt_fonction && $auteur_1["id"] == 0 && $i == 0) {
             $auteur_1["fonction"] = $value_deflt_fonction;
         }
         $ptab_aut_autres = $ptab[11];
         $ptab_aut_tu = str_replace('!!iaut!!', $i, $tu_authors_tpl);
         if ($i) {
             $ptab_aut_autres = str_replace('!!bouton_add_display!!', 'display:none', $ptab_aut_autres);
         } else {
             $ptab_aut_autres = str_replace('!!bouton_add_display!!', '', $ptab_aut_autres);
         }
         if ($pmb_authors_qualification) {
             $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_1["id_responsability"], TYPE_NOTICE_RESPONSABILITY_AUTRE), 'notice_authors'));
             $ptab_aut_autres = str_replace('!!vedette_author!!', $vedette_ui->get_form('role_autre', $i, 'notice', '', 0), $ptab_aut_autres);
         } else {
             $ptab_aut_autres = str_replace('!!vedette_author!!', "", $ptab_aut_autres);
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut1_id!!', $auteur_1["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut1!!', htmlentities($auteur->isbd_entry, ENT_QUOTES, $charset), $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f1_code!!', $auteur_1["fonction"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f1!!', $fonction->table[$auteur_1["fonction"]], $ptab_aut_autres);
         $autres_auteurs .= $ptab_aut_autres;
     }
     $ptab[1] = str_replace('!!max_aut1!!', $max_aut1, $ptab[1]);
     $as = array_keys($this->responsabilites["responsabilites"], "2");
     $max_aut2 = count($as);
     if ($max_aut2 == 0) {
         $max_aut2 = 1;
     }
     for ($i = 0; $i < $max_aut2; $i++) {
         $indice = $as[$i];
         $auteur_2 = $this->responsabilites["auteurs"][$indice];
         $auteur = new auteur($auteur_2["id"]);
         if ($value_deflt_fonction && $auteur_2["id"] == 0 && $i == 0) {
             $auteur_2["fonction"] = $value_deflt_fonction;
         }
         $ptab_aut_autres = $ptab[12];
         if ($i) {
             $ptab_aut_autres = str_replace('!!bouton_add_display!!', 'display:none', $ptab_aut_autres);
         } else {
             $ptab_aut_autres = str_replace('!!bouton_add_display!!', '', $ptab_aut_autres);
         }
         if ($pmb_authors_qualification) {
             $vedette_ui = new vedette_ui(new vedette_composee(vedette_composee::get_vedette_id_from_object($auteur_2["id_responsability"], TYPE_NOTICE_RESPONSABILITY_SECONDAIRE), 'notice_authors'));
             $ptab_aut_autres = str_replace('!!vedette_author!!', $vedette_ui->get_form('role_secondaire', $i, 'notice', '', 0), $ptab_aut_autres);
         } else {
             $ptab_aut_autres = str_replace('!!vedette_author!!', "", $ptab_aut_autres);
         }
         $ptab_aut_autres = str_replace('!!iaut!!', $i, $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut2_id!!', $auteur_2["id"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!aut2!!', htmlentities($auteur->isbd_entry, ENT_QUOTES, $charset), $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f2_code!!', $auteur_2["fonction"], $ptab_aut_autres);
         $ptab_aut_autres = str_replace('!!f2!!', $fonction->table[$auteur_2["fonction"]], $ptab_aut_autres);
         $auteurs_secondaires .= $ptab_aut_autres;
     }
     $ptab[1] = str_replace('!!max_aut2!!', $max_aut2, $ptab[1]);
     $ptab[1] = str_replace('!!autres_auteurs!!', $autres_auteurs, $ptab[1]);
     $ptab[1] = str_replace('!!auteurs_secondaires!!', $auteurs_secondaires, $ptab[1]);
     $form_notice = str_replace('!!tab1!!', $ptab[1], $form_notice);
     // mise a jour de l'onglet 2
     $ptab[2] = str_replace('!!ed1_id!!', $this->ed1_id, $ptab[2]);
     $ptab[2] = str_replace('!!ed1!!', htmlentities($this->ed1, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!coll_id!!', $this->coll_id, $ptab[2]);
     $ptab[2] = str_replace('!!coll!!', htmlentities($this->coll, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!subcoll_id!!', $this->subcoll_id, $ptab[2]);
     $ptab[2] = str_replace('!!subcoll!!', htmlentities($this->subcoll, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!year!!', $this->year, $ptab[2]);
     $ptab[2] = str_replace('!!nocoll!!', htmlentities($this->nocoll, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!mention_edition!!', htmlentities($this->mention_edition, ENT_QUOTES, $charset), $ptab[2]);
     $ptab[2] = str_replace('!!ed2_id!!', $this->ed2_id, $ptab[2]);
     $ptab[2] = str_replace('!!ed2!!', htmlentities($this->ed2, ENT_QUOTES, $charset), $ptab[2]);
     $form_notice = str_replace('!!tab2!!', $ptab[2], $form_notice);
     // mise a jour de l'onglet 3
     $ptab[3] = str_replace('!!cb!!', $this->code, $ptab[3]);
     $ptab[3] = str_replace('!!notice_id!!', $this->id, $ptab[3]);
     $form_notice = str_replace('!!tab3!!', $ptab[3], $form_notice);
     // Gestion des titres uniformes
     global $pmb_use_uniform_title;
     if ($pmb_use_uniform_title) {
         if ($this->duplicate_from_id) {
             $tu = new tu_notice($this->duplicate_from_id);
         } else {
             $tu = new tu_notice($this->id);
         }
         $ptab[230] = str_replace("!!titres_uniformes!!", $tu->get_form("notice"), $ptab[230]);
         $form_notice = str_replace('!!tab230!!', $ptab[230], $form_notice);
     }
     // mise a jour de l'onglet 4
     $ptab[4] = str_replace('!!npages!!', htmlentities($this->npages, ENT_QUOTES, $charset), $ptab[4]);
     $ptab[4] = str_replace('!!ill!!', htmlentities($this->ill, ENT_QUOTES, $charset), $ptab[4]);
     $ptab[4] = str_replace('!!size!!', htmlentities($this->size, ENT_QUOTES, $charset), $ptab[4]);
     $ptab[4] = str_replace('!!prix!!', htmlentities($this->prix, ENT_QUOTES, $charset), $ptab[4]);
     $ptab[4] = str_replace('!!accomp!!', htmlentities($this->accomp, ENT_QUOTES, $charset), $ptab[4]);
     $form_notice = str_replace('!!tab4!!', $ptab[4], $form_notice);
     // mise a jour de l'onglet 5
     $ptab[5] = str_replace('!!n_gen!!', htmlentities($this->n_gen, ENT_QUOTES, $charset), $ptab[5]);
     $ptab[5] = str_replace('!!n_contenu!!', htmlentities($this->n_contenu, ENT_QUOTES, $charset), $ptab[5]);
     $ptab[5] = str_replace('!!n_resume!!', htmlentities($this->n_resume, ENT_QUOTES, $charset), $ptab[5]);
     $form_notice = str_replace('!!tab5!!', $ptab[5], $form_notice);
     // mise a jour de l'onglet 6
     // categories
     //tri ?
     if ($thesaurus_categories_affichage_ordre == 0 && count($this->categories)) {
         $tmp = array();
         foreach ($this->categories as $key => $value) {
             $tmp[$key] = strip_tags($value['categ_libelle']);
         }
         $tmp = array_map("convert_diacrit", $tmp);
         //On enlève les accents
         $tmp = array_map("strtoupper", $tmp);
         //On met en majuscule
         asort($tmp);
         //Tri sur les valeurs en majuscule sans accent
         foreach ($tmp as $key => $value) {
             $tmp[$key] = $this->categories[$key];
             //On reprend les bons couples
         }
         $this->categories = array_values($tmp);
     }
     if (sizeof($this->categories) == 0) {
         $max_categ = 1;
     } else {
         $max_categ = sizeof($this->categories);
     }
     $tab_categ_order = "";
     for ($i = 0; $i < $max_categ; $i++) {
         $categ_id = $this->categories[$i]["categ_id"];
         $categ = new category($categ_id);
         if ($i == 0) {
             $ptab_categ = str_replace('!!icateg!!', $i, $ptab[60]);
         } else {
             $ptab_categ = str_replace('!!icateg!!', $i, $ptab[601]);
         }
         $ptab_categ = str_replace('!!categ_id!!', $categ_id, $ptab_categ);
         if (sizeof($this->categories) == 0) {
             $ptab_categ = str_replace('!!categ_libelle!!', '', $ptab_categ);
         } else {
             if ($thesaurus_mode_pmb) {
                 $nom_thesaurus = '[' . $categ->thes->getLibelle() . '] ';
             } else {
                 $nom_thesaurus = '';
             }
             $ptab_categ = str_replace('!!categ_libelle!!', htmlentities($nom_thesaurus . $categ->catalog_form, ENT_QUOTES, $charset), $ptab_categ);
             if ($tab_categ_order != "") {
                 $tab_categ_order .= ",";
             }
             $tab_categ_order .= $i;
         }
         $categ_repetables .= $ptab_categ;
     }
     $ptab[6] = str_replace('!!max_categ!!', $max_categ, $ptab[6]);
     $ptab[6] = str_replace('!!categories_repetables!!', $categ_repetables, $ptab[6]);
     $ptab[6] = str_replace('!!tab_categ_order!!', $tab_categ_order, $ptab[6]);
     // indexation interne
     $ptab[6] = str_replace('!!indexint_id!!', $this->indexint, $ptab[6]);
     if ($this->indexint) {
         $indexint = new indexint($this->indexint);
         if ($indexint->comment) {
             $disp_indexint = $indexint->name . " - " . $indexint->comment;
         } else {
             $disp_indexint = $indexint->name;
         }
         if ($thesaurus_classement_mode_pmb) {
             // plusieurs classements/indexations decimales autorises en parametrage
             if ($indexint->name_pclass) {
                 $disp_indexint = "[" . $indexint->name_pclass . "] " . $disp_indexint;
             }
         }
         $ptab[6] = str_replace('!!indexint!!', htmlentities($disp_indexint, ENT_QUOTES, $charset), $ptab[6]);
         $ptab[6] = str_replace('!!num_pclass!!', $indexint->id_pclass, $ptab[6]);
     } else {
         $ptab[6] = str_replace('!!indexint!!', '', $ptab[6]);
         $ptab[6] = str_replace('!!num_pclass!!', '', $ptab[6]);
     }
     // indexation libre
     $ptab[6] = str_replace('!!f_indexation!!', htmlentities($this->index_l, ENT_QUOTES, $charset), $ptab[6]);
     global $pmb_keyword_sep;
     //if (!$pmb_keyword_sep) $pmb_keyword_sep=" ";
     $sep = "'{$pmb_keyword_sep}'";
     if (!$pmb_keyword_sep) {
         $sep = "' '";
     }
     if (ord($pmb_keyword_sep) == 0xa || ord($pmb_keyword_sep) == 0xd) {
         $sep = $msg['catalogue_saut_de_ligne'];
     }
     $ptab[6] = str_replace("!!sep!!", htmlentities($sep, ENT_QUOTES, $charset), $ptab[6]);
     // Indexation concept
     if ($thesaurus_concepts_active == 1) {
         $index_concept = new index_concept($this->id, TYPE_NOTICE);
         $ptab[6] = str_replace('!!index_concept_form!!', $index_concept->get_form("notice"), $ptab[6]);
     } else {
         $ptab[6] = str_replace('!!index_concept_form!!', "", $ptab[6]);
     }
     $form_notice = str_replace('!!tab6!!', $ptab[6], $form_notice);
     // mise a jour de l'onglet 7 : langues
     // langues repetables
     if (sizeof($this->langues) == 0) {
         $max_lang = 1;
     } else {
         $max_lang = sizeof($this->langues);
     }
     for ($i = 0; $i < $max_lang; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[701]);
         } else {
             $ptab_lang = str_replace('!!ilang!!', $i, $ptab[70]);
         }
         if (sizeof($this->langues) == 0) {
             $ptab_lang = str_replace('!!lang_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!lang_code!!', $this->langues[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!lang!!', htmlentities($this->langues[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $lang_repetables .= $ptab_lang;
     }
     $ptab[7] = str_replace('!!max_lang!!', $max_lang, $ptab[7]);
     $ptab[7] = str_replace('!!langues_repetables!!', $lang_repetables, $ptab[7]);
     // langues originales repetables
     if (sizeof($this->languesorg) == 0) {
         $max_langorg = 1;
     } else {
         $max_langorg = sizeof($this->languesorg);
     }
     for ($i = 0; $i < $max_langorg; $i++) {
         if ($i) {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[711]);
         } else {
             $ptab_lang = str_replace('!!ilangorg!!', $i, $ptab[71]);
         }
         if (sizeof($this->languesorg) == 0) {
             $ptab_lang = str_replace('!!langorg_code!!', '', $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', '', $ptab_lang);
         } else {
             $ptab_lang = str_replace('!!langorg_code!!', $this->languesorg[$i]["lang_code"], $ptab_lang);
             $ptab_lang = str_replace('!!langorg!!', htmlentities($this->languesorg[$i]["langue"], ENT_QUOTES, $charset), $ptab_lang);
         }
         $langorg_repetables .= $ptab_lang;
     }
     $ptab[7] = str_replace('!!max_langorg!!', $max_langorg, $ptab[7]);
     $ptab[7] = str_replace('!!languesorg_repetables!!', $langorg_repetables, $ptab[7]);
     $form_notice = str_replace('!!tab7!!', $ptab[7], $form_notice);
     // mise a jour de l'onglet 8
     global $pmb_curl_timeout;
     $ptab[8] = str_replace('!!lien!!', htmlentities($this->lien, ENT_QUOTES, $charset), $ptab[8]);
     $ptab[8] = str_replace('!!eformat!!', htmlentities($this->eformat, ENT_QUOTES, $charset), $ptab[8]);
     $ptab[8] = str_replace('!!pmb_curl_timeout!!', $pmb_curl_timeout, $ptab[8]);
     $form_notice = str_replace('!!tab8!!', $ptab[8], $form_notice);
     //Mise a jour de l'onglet 9
     $p_perso = new parametres_perso("notices");
     if (!$p_perso->no_special_fields) {
         // si on duplique, construire le formulaire avec les donnees de la notice d'origine
         if ($this->duplicate_from_id) {
             $perso_ = $p_perso->show_editable_fields($this->duplicate_from_id);
         } else {
             $perso_ = $p_perso->show_editable_fields($this->id);
         }
         $perso = "";
         for ($i = 0; $i < count($perso_["FIELDS"]); $i++) {
             $p = $perso_["FIELDS"][$i];
             $perso .= "<div id='move_" . $p["NAME"] . "' movable='yes' title=\"" . htmlentities($p["TITRE"], ENT_QUOTES, $charset) . "\">\n\t\t\t\t\t\t\t\t<div class='row'><label for='" . $p["NAME"] . "' class='etiquette'>" . htmlentities($p["TITRE"], ENT_QUOTES, $charset) . "</label>" . $p["COMMENT_DISPLAY"] . "</div>\n\t\t\t\t\t\t\t\t<div class='row'>" . $p["AFF"] . "</div>\n\t\t\t\t\t\t\t </div>";
         }
         $perso .= $perso_["CHECK_SCRIPTS"];
         $ptab[9] = str_replace("!!champs_perso!!", $perso, $ptab[9]);
     } else {
         $ptab[9] = "\n<script>function check_form() { return true; }</script>\n";
     }
     $form_notice = str_replace('!!tab9!!', $ptab[9], $form_notice);
     //Liens vers d'autres notices
     $string_relations = "";
     $n_rel = 0;
     foreach ($this->notice_link as $direction => $relations) {
         foreach ($relations as $relation) {
             //Selection du template
             if ($n_rel == 0) {
                 $pattern_rel = $ptab[130];
             } else {
                 $pattern_rel = $ptab[131];
             }
             //Construction du textbox
             $pattern_rel = str_replace("!!notice_relations_id!!", $relation['id_notice'], $pattern_rel);
             $pattern_rel = str_replace("!!notice_relations_libelle!!", htmlentities($relation['title_notice'], ENT_QUOTES, $charset), $pattern_rel);
             $pattern_rel = str_replace("!!notice_relations_rank!!", $relation['rank'], $pattern_rel);
             $pattern_rel = str_replace("!!n_rel!!", $n_rel, $pattern_rel);
             //Construction du combobox de type de lien
             $pattern_rel = str_replace("!!f_notice_type_relations_name!!", "f_rel_type_{$n_rel}", $pattern_rel);
             //Recuperation des types de relation
             $liste_type_relation_up = new marc_list("relationtypeup");
             $liste_type_relation_down = new marc_list("relationtypedown");
             $liste_type_relation_both = array();
             $corresp_relation_up_down = array();
             foreach ($liste_type_relation_up->table as $key_up => $val_up) {
                 foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                     if ($val_up == $val_down) {
                         $liste_type_relation_both['down'][$key_down] = $val_down;
                         $liste_type_relation_both['up'][$key_up] = $val_up;
                         $corresp_relation_up_down[$key_up] = $key_down;
                         unset($liste_type_relation_down->table[$key_down]);
                         unset($liste_type_relation_up->table[$key_up]);
                     }
                 }
             }
             $opts = '';
             if ($this->id) {
                 foreach ($liste_type_relation_up->table as $key => $val) {
                     if (preg_match('/^' . $key . '/', $relation['relation_type']) && $direction == 'up') {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
                     }
                 }
             } else {
                 foreach ($liste_type_relation_up->table as $key => $val) {
                     if ($key . '-up' == $value_deflt_relation) {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
                     }
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
             $opts = '';
             if ($this->id) {
                 foreach ($liste_type_relation_down->table as $key => $val) {
                     if (preg_match('/^' . $key . '/', $relation['relation_type']) && $direction == 'down') {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                     }
                 }
             } else {
                 foreach ($liste_type_relation_down->table as $key => $val) {
                     if ($key . '-down' == $value_deflt_relation) {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                     }
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_down!!", $opts, $pattern_rel);
             $opts = '';
             if (array_key_exists($relation['relation_type'], $liste_type_relation_both['up']) || array_key_exists($relation['relation_type'], $liste_type_relation_both['down'])) {
                 $opts .= '<option  style="color:#000000" value="' . $relation['relation_type'] . '-' . $direction . '" selected="selected" >' . $liste_type_relation_both[$direction][$relation['relation_type']] . '</option>';
                 if ($direction == "up") {
                     $notDirection = "down";
                 } else {
                     $notDirection = "up";
                     $corresp_relation_up_down = array_flip($corresp_relation_up_down);
                 }
                 $notRelationType = $corresp_relation_up_down[$relation['relation_type']];
                 unset($liste_type_relation_both[$direction][$relation['relation_type']]);
                 unset($liste_type_relation_both[$notDirection][$notRelationType]);
             }
             if ($this->id) {
                 foreach ($liste_type_relation_both['down'] as $key => $val) {
                     $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                 }
             } else {
                 foreach ($liste_type_relation_both['down'] as $key => $val) {
                     if ($key . '-down' == $value_deflt_relation) {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected">' . $val . '</option>';
                     } else {
                         $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
                     }
                 }
             }
             $pattern_rel = str_replace("!!f_notice_type_relations_both!!", $opts, $pattern_rel);
             $string_relations .= $pattern_rel;
             $n_rel++;
         }
     }
     if (!$n_rel) {
         $pattern_rel = $ptab[130];
         $pattern_rel = str_replace("!!notice_relations_id!!", "", $pattern_rel);
         $pattern_rel = str_replace("!!notice_relations_libelle!!", "", $pattern_rel);
         $pattern_rel = str_replace("!!notice_relations_rank!!", "0", $pattern_rel);
         $pattern_rel = str_replace("!!n_rel!!", $n_rel, $pattern_rel);
         $pattern_rel = str_replace("!!f_notice_type_relations_name!!", "f_rel_type_0", $pattern_rel);
         //Recuperation des types de relation
         $liste_type_relation_up = new marc_list("relationtypeup");
         $liste_type_relation_down = new marc_list("relationtypedown");
         $liste_type_relation_both = array();
         foreach ($liste_type_relation_up->table as $key_up => $val_up) {
             foreach ($liste_type_relation_down->table as $key_down => $val_down) {
                 if ($val_up == $val_down) {
                     $liste_type_relation_both[$key_down] = $val_down;
                     unset($liste_type_relation_down->table[$key_down]);
                     unset($liste_type_relation_up->table[$key_up]);
                 }
             }
         }
         $opts = '';
         foreach ($liste_type_relation_up->table as $key => $val) {
             if ($key . '-up' == $value_deflt_relation) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-up" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-up">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_up!!", $opts, $pattern_rel);
         $opts = '';
         foreach ($liste_type_relation_down->table as $key => $val) {
             if ($key . '-down' == $value_deflt_relation) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_down!!", $opts, $pattern_rel);
         $opts = '';
         foreach ($liste_type_relation_both as $key => $val) {
             if ($key . '-down' == $value_deflt_relation) {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down" selected="selected" >' . $val . '</option>';
             } else {
                 $opts .= '<option  style="color:#000000" value="' . $key . '-down">' . $val . '</option>';
             }
         }
         $pattern_rel = str_replace("!!f_notice_type_relations_both!!", $opts, $pattern_rel);
         $string_relations .= $pattern_rel;
         $n_rel++;
     }
     //Nombre de relations
     $ptab[13] = str_replace("!!max_rel!!", $n_rel, $ptab[13]);
     //Liens multiples
     $ptab[13] = str_replace("!!notice_relations!!", $string_relations, $ptab[13]);
     $form_notice = str_replace('!!tab11!!', $ptab[13], $form_notice);
     // champs de gestion
     $select_statut = gen_liste_multiple("select id_notice_statut, gestion_libelle from notice_statut order by 2", "id_notice_statut", "gestion_libelle", "id_notice_statut", "form_notice_statut", "", $this->statut, "", "", "", "", 0);
     $ptab[10] = str_replace('!!notice_statut!!', $select_statut, $ptab[10]);
     if ($this->is_new) {
         $ptab[10] = str_replace('!!checked_yes!!', "checked", $ptab[10]);
         $ptab[10] = str_replace('!!checked_no!!', "", $ptab[10]);
     } else {
         $ptab[10] = str_replace('!!checked_no!!', "checked", $ptab[10]);
         $ptab[10] = str_replace('!!checked_yes!!', "", $ptab[10]);
     }
     $ptab[10] = str_replace('!!commentaire_gestion!!', htmlentities($this->commentaire_gestion, ENT_QUOTES, $charset), $ptab[10]);
     $ptab[10] = str_replace('!!thumbnail_url!!', htmlentities($this->thumbnail_url, ENT_QUOTES, $charset), $ptab[10]);
     global $pmb_notice_img_folder_id;
     $message_folder = "";
     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);
         if (pmb_mysql_num_rows($res)) {
             $rep = pmb_mysql_fetch_object($res);
             if (!is_dir($rep->repertoire_path)) {
                 $notice_img_folder_error = 1;
             }
         } else {
             $notice_img_folder_error = 1;
         }
         if ($notice_img_folder_error) {
             if (SESSrights & ADMINISTRATION_AUTH) {
                 $requete = "select * from parametres where gestion=0 and type_param='pmb' and sstype_param='notice_img_folder_id' ";
                 $res = pmb_mysql_query($requete);
                 $i = 0;
                 if ($param = pmb_mysql_fetch_object($res)) {
                     $message_folder = " <a class='erreur' href='./admin.php?categ=param&action=modif&id_param=" . $param->id_param . "' >" . $msg['notice_img_folder_admin_no_access'] . "</a> ";
                 }
             } else {
                 $message_folder = $msg['notice_img_folder_no_access'];
             }
         }
     }
     $ptab[10] = str_replace('!!message_folder!!', $message_folder, $ptab[10]);
     if ($this->id && $pmb_notices_show_dates) {
         $create_date = new DateTime($this->create_date);
         $update_date = new DateTime($this->update_date);
         $dates_notices = "<br>\n\t\t\t\t\t<label for='notice_date_crea' class='etiquette'>" . $msg["noti_crea_date"] . "</label>&nbsp;" . $create_date->format('d/m/Y H:i:s') . "\n\t\t\t    \t<br>\n\t\t\t    \t <label for='notice_date_mod' class='etiquette'>" . $msg["noti_mod_date"] . "</label>&nbsp;" . $update_date->format('d/m/Y H:i:s');
         $ptab[10] = str_replace('!!dates_notice!!', $dates_notices, $ptab[10]);
     } else {
         $ptab[10] = str_replace('!!dates_notice!!', "", $ptab[10]);
     }
     //affichage des formulaires des droits d'acces
     $rights_form = $this->get_rights_form();
     $ptab[10] = str_replace('<!-- rights_form -->', $rights_form, $ptab[10]);
     // langue de la notice
     global $lang;
     $user_lang = $this->indexation_lang;
     if (!$user_lang) {
         $user_lang = $xmlta_indexation_lang;
     }
     //	if(!$user_lang) $user_lang="fr_FR";
     $langues = new XMLlist("{$include_path}/messages/languages.xml");
     $langues->analyser();
     $clang = $langues->table;
     $combo = "<select name='indexation_lang' id='indexation_lang' class='saisie-20em' >";
     if (!$user_lang) {
         $combo .= "<option value='' selected>--</option>";
     } else {
         $combo .= "<option value='' >--</option>";
     }
     while (list($cle, $value) = each($clang)) {
         // arabe seulement si on est en utf-8
         if ($charset != 'utf-8' and $user_lang != 'ar' or $charset == 'utf-8') {
             if (strcmp($cle, $user_lang) != 0) {
                 $combo .= "<option value='{$cle}'>{$value} ({$cle})</option>";
             } else {
                 $combo .= "<option value='{$cle}' selected>{$value} ({$cle})</option>";
             }
         }
     }
     $combo .= "</select>";
     $ptab[10] = str_replace('!!indexation_lang!!', $combo, $ptab[10]);
     $form_notice = str_replace('!!indexation_lang_sel!!', $user_lang, $form_notice);
     $form_notice = str_replace('!!tab10!!', $ptab[10], $form_notice);
     // autorité personnalisées
     $authperso = new authperso_notice($this->id);
     $authperso_tpl = $authperso->get_form();
     $form_notice = str_replace('!!authperso!!', $authperso_tpl, $form_notice);
     $form_notice = str_replace('!!tab10!!', $ptab[10], $form_notice);
     // map
     if ($pmb_map_activate) {
         if ($this->duplicate_from_id) {
             $map_edition = new map_edition_controler(TYPE_RECORD, $this->duplicate_from_id);
         } else {
             $map_edition = new map_edition_controler(TYPE_RECORD, $this->id);
         }
         $map_form = $map_edition->get_form();
         if ($this->duplicate_from_id) {
             $map_info = new map_info($this->duplicate_from_id);
         } else {
             $map_info = new map_info($this->id);
         }
         $map_form_info = $map_info->get_form();
         $map_notice_form = $ptab[14];
         $map_notice_form = str_replace('!!notice_map!!', $map_form . $map_form_info, $map_notice_form);
         $form_notice = str_replace('!!tab14!!', $map_notice_form, $form_notice);
     } else {
         $form_notice = str_replace('!!tab14!!', "", $form_notice);
     }
     // Nomenclature
     if ($pmb_nomenclature_activate) {
         $nomenclature = new nomenclature_record_ui($this->id);
         $nomenclature_notice_form = $ptab[15];
         $nomenclature_notice_form = str_replace('!!nomenclature_form!!', $nomenclature->get_form(), $nomenclature_notice_form);
         $form_notice = str_replace('!!tab15!!', $nomenclature_notice_form, $form_notice);
     } else {
         $form_notice = str_replace('!!tab15!!', "", $form_notice);
     }
     // definition de la page cible du form
     $form_notice = str_replace('!!action!!', $this->action, $form_notice);
     // ajout des selecteurs
     $select_doc = new marc_select('doctype', 'typdoc', $this->type_doc, "get_pos(); expandAll(); ajax_parse_dom(); if (inedit) move_parse_dom(relative); else initIt();");
     $form_notice = str_replace('!!doc_type!!', $select_doc->display, $form_notice);
     $form_notice = str_replace('!!notice_id_no_replace!!', $this->id, $form_notice);
     // Ajout des localisations pour edition
     $select_loc = "";
     if ($PMBuserid == 1) {
         $req_loc = "select idlocation,location_libelle from docs_location";
         $res_loc = pmb_mysql_query($req_loc);
         if (pmb_mysql_num_rows($res_loc) > 1) {
             $select_loc = "<select name='grille_location' id='grille_location' style='display:none' onChange=\"get_pos(); expandAll(); if (inedit) move_parse_dom(relative); else initIt();\">\n";
             $select_loc .= "<option value='0'>" . $msg['all_location'] . "</option>\n";
             while ($r = pmb_mysql_fetch_object($res_loc)) {
                 $select_loc .= "<option value='" . $r->idlocation . "'>" . $r->location_libelle . "</option>\n";
             }
             $select_loc .= "</select>\n";
         }
     }
     $form_notice = str_replace("!!location!!", $select_loc, $form_notice);
     // affichage du lien pour suppression et du lien d'annulation
     if ($this->id) {
         $link_supp = "\n\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\tfunction confirm_delete() {\n\t\t\t\t\t\tresult = confirm(\"{$msg[confirm_suppr_notice]}\");\n\t\t\t       \t\tif(result) {\n\t\t\t       \t\t\tunload_off();\n\t\t\t           \t\tdocument.location = './catalog.php?categ=delete&id=" . $this->id . "'\n\t\t\t\t\t\t} \n\t\t\t\t\t}\n\t\t\t\t</script>\n\t\t\t\t<input type='button' class='bouton' value=\"{$msg[63]}\" onClick=\"confirm_delete();\" />";
         $link_annul = "<input type='button' class='bouton' value=\"{$msg[76]}\" onClick=\"unload_off();history.go(-1);\" />";
         $link_remplace = "<input type='button' class='bouton' value='{$msg['158']}' onclick='unload_off();document.location=\"./catalog.php?categ=remplace&id=" . $this->id . "\"' />";
         $link_duplicate = "<input type='button' class='bouton' value='{$msg['notice_duplicate_bouton']}' onclick='unload_off();document.location=\"./catalog.php?categ=duplicate&id=" . $this->id . "\"' />";
         if ($z3950_accessible) {
             $link_z3950 = "<input type='button' class='bouton' value='{$msg['notice_z3950_update_bouton']}' onclick='unload_off();document.location=\"./catalog.php?categ=z3950&id_notice=" . $this->id . "&isbn=" . $this->code . "\"' />";
         } else {
             $link_z3950 = "";
         }
         if ($pmb_type_audit) {
             $link_audit = "<input class='bouton' type='button' onClick=\"openPopUp('./audit.php?type_obj=1&object_id={$this->id}', 'audit_popup', 700, 500, -2, -2, '{$select_categ_prop}')\" title='{$msg['audit_button']}' value='{$msg['audit_button']}' />";
         } else {
             $link_audit = "";
         }
     } else {
         $link_supp = "";
         $link_remplace = "";
         $link_duplicate = "";
         $link_z3950 = "";
         $link_audit = "";
         // 				if ($this->notice_mere_id || $this->duplicate_from_id) $link_annul = "<input type='button' class='bouton' value=\"{$msg[76]}\" onClick=\"unload_off();history.go(-1);\" />";
         if ($this->notice_link['up'][0]['id_notice'] || $this->duplicate_from_id) {
             $link_annul = "<input type='button' class='bouton' value=\"{$msg[76]}\" onClick=\"unload_off();history.go(-1);\" />";
         } else {
             $link_annul = "<input type='button' class='bouton' value=\"{$msg[76]}\" onClick=\"unload_off();document.location='" . $this->link_annul . "';\" />";
         }
     }
     $form_notice = str_replace('!!link_supp!!', $link_supp, $form_notice);
     $form_notice = str_replace('!!link_annul!!', $link_annul, $form_notice);
     $form_notice = str_replace('!!link_remplace!!', $link_remplace, $form_notice);
     $form_notice = str_replace('!!link_duplicate!!', $link_duplicate, $form_notice);
     $form_notice = str_replace('!!link_z3950!!', $link_z3950, $form_notice);
     $form_notice = str_replace('!!link_audit!!', $link_audit, $form_notice);
     return $form_notice;
 }
function show_preferences()
{
    global $uid;
    global $skin;
    global $PHP_SELF;
    $sth = mysql_query("select * from skins");
    while ($skins = mysql_fetch_array($sth)) {
        $options[$skins["name"]] = $skins["id"];
    }
    $sth = mysql_query("select admin from users where id={$uid}");
    if (!$sth) {
        show_error("Database failuer!");
        return 0;
    }
    $admin = mysql_fetch_array($sth);
    if ($admin["admin"] != "") {
        show_message("<a href='adminarea.php'>Enter Admin Area</a>");
    }
    $map_info = new map_info($uid);
    if ($map_info->has_map_anims() == 1) {
        $checked = "checked";
    }
    echo "<form method=POST action=\"" . $PHP_SELF . "\">";
    table_start("center", "400");
    table_head_text(array("Appearence"), "2");
    table_text(array("&nbsp;"), "", "", "2", "head");
    table_form_select("Skin", "skin_new", $options, $skin, "head", "text");
    table_form_submit("Change", "change_skin", "", "text");
    table_end();
    echo "</form>\n";
    //runelord: map_sizes
    $sth = mysql_query("select map_size from options where uid=" . $uid);
    if (!$sth || !mysql_num_rows($sth)) {
        show_error("oops, DB Failure");
        return 0;
    }
    list($current_map_size) = mysql_fetch_row($sth);
    $map_sizes_output = "<select name=\"map_size\" size=\"1\">";
    $sth = mysql_query("SELECT * FROM map_sizes ORDER BY width ASC");
    if (!$sth || !mysql_num_rows($sth)) {
        show_error("Database Failureeeeerrerererererere");
        return 0;
    }
    while ($map_sizes = mysql_fetch_array($sth)) {
        if ($current_map_size == $map_sizes["id"]) {
            $map_sizes_output .= "<option selected value=\"" . $map_sizes["id"] . "\">" . $map_sizes["width"] . " : " . $map_sizes["height"] . "</option>";
        } else {
            $map_sizes_output .= "<option value=\"" . $map_sizes["id"] . "\">" . $map_sizes["width"] . " : " . $map_sizes["height"] . "</option>";
        }
    }
    $map_sizes_output .= "</select>";
    echo "<form method=POST action=\"" . $PHP_SELF . "\">";
    table_start("center", "400");
    table_head_text(array("Map Settings"), "2");
    table_text(array("&nbsp;"), "", "", "2", "head");
    table_text(array("Map Size"), "", "", "2", "head");
    table_text(array($map_sizes_output), "", "", "2", "text");
    table_form_submit("Change", "change_map_size", "", "text");
    echo "</form>\n";
    echo "<form method=POST action=\"" . $PHP_SELF . "\">";
    table_text(array("&nbsp;"), "", "", "2", "head");
    table_text(array("Animations (KSVG needs disabled animations)", "<input type=\"checkbox\" name=\"animations\" value=\"1\" {$checked}>"), "", "", "", "head");
    table_form_submit("Change", "change_anims", "", "text");
    table_end();
    echo "</form>\n";
    table_start("center", "400");
    echo "<form method=POST action=\"" . $PHP_SELF . "\">";
    table_text(array("Change Password", "&nbsp;"), "", "", "", "head");
    table_text_open();
    table_text_design("Old Password", "300", "left", "", "text");
    table_text_design("<input type=\"password\" align=\"right\" name=\"old\">", "100", "right", "", "text");
    table_text_close();
    table_text_open();
    table_text_design("New Password", "300", "left", "", "text");
    table_text_design("<input type=\"password\" align=\"right\" name=\"new1\">", "100", "right", "", "text");
    table_text_close();
    table_text_open();
    table_text_design("Re-type new Password", "300", "left", "", "text");
    table_text_design("<input type=\"password\" align=\"right\" name=\"new2\">", "100", "right", "", "text");
    table_text_close();
    table_form_submit("Set", "change_pw", "", "text");
    table_end();
    echo "</form>";
}
            echo "<animateTransform attributeType=\"XML\" attributeName=\"transform\" type=\"rotate\" values=\"360;0\" dur=\"" . ($j + 2) * 100 . "\" repeatCount=\"indefinite\"/>";
        }
        echo "</g>";
        echo "</g>";
        if ($map_info->has_map_anims()) {
            echo "<animateTransform attributeType=\"XML\" attributeName=\"transform\" type=\"rotate\" values=\"0;360\" dur=\"" . ($j + 2) * 100 . "\" repeatCount=\"indefinite\"/>";
        }
        echo "</g>\n";
    }
}
/* ****************
 *
 * main
 *
 *****************/
$map_info = new map_info($uid);
$fog_of_war = $map_info->get_fog_of_war();
if (!in_array($sid, $map_info->get_scanned_systems()) && !$fog_of_war[$sid]) {
    return false;
}
if (!in_array($sid, $map_info->get_scanned_systems())) {
    $fog_mode = true;
} else {
    $fog_mode = false;
}
if ($fog_mode) {
    $planets = array_values($fog_of_war[$sid]);
} else {
    $planets = $map_info->get_systemplanets($sid);
}
$globalTransform = get_global_SVGTransform($uid, 1, $sid, $availHeight, $availWidth);