$w = $largeur_page - $marge_gauche - $marge_droite; $ourPDF = new $fpdf($orient_page, 'mm', $taille_doc); $ourPDF->Open(); $ourPDF->SetMargins($marge_gauche, $marge_haut, $marge_droite); $sug_map = new suggestions_map(); //On récupère les infos de la liste de suggestions if (!$statut) { $statut = -1; } $us = stripslashes($user_input); $mask = $sug_map->getMask_FILED(); if (!$user_input) { $q = suggestions::listSuggestions(0, $statut, $num_categ, $mask); } else { $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0); $q = suggestions::listSuggestions(0, $statut, $num_categ, $mask, 0, 0, $aq, $user_input); } $res = pmb_mysql_query($q, $dbh); $ourPDF->addPage(); $ourPDF->setFont($pmb_pdf_font); //Affichage date $date = formatdate(today()); $ourPDF->setFontSize($fs_date); $ourPDF->SetXY($x_date, $y_date); $ourPDF->Cell($l_date, $h_date, $date, 0, 0, 'L', 0); //Affichage titre $titre = $msg['acquisition_sug_list']; $ourPDF->setFontSize($fs_titre); $ourPDF->SetXY($x_titre, $y_titre); $ourPDF->Cell($l_titre, $h_titre, $titre, 0, 0, 'L', 0); if ($us != '') {
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net) // +-------------------------------------------------+ // $Id: make_sugg.inc.php,v 1.15 2010-02-23 16:27:22 kantin Exp $ if (stristr($_SERVER['REQUEST_URI'], ".inc.php")) { die("no access"); } require_once $base_path . '/classes/suggestions_categ.class.php'; require_once $base_path . '/classes/docs_location.class.php'; require_once $base_path . '/classes/suggestions.class.php'; $tooltip = str_replace("\\n", "<br />", $msg["empr_sugg_ko"]); $sug_form = "<div id='make_sugg'>\n<h3><span>" . htmlentities($msg['empr_make_sugg'], ENT_QUOTES, $charset) . "</span></h3>"; if ($opac_show_help) { $sug_form .= "\n<div class='row'>\n{$tooltip}</div>\n"; } if ($id_sug) { $sugg = new suggestions($id_sug); } $sug_form .= "\n<script >\n\tfunction confirm_suppr(){\n\t\tphrase = \"{$msg[empr_confirm_suppr_sugg]}\";\n\t\tresult = confirm(phrase);\n\t\tif(result)\n\t\t\treturn true;\n\t\t\n\t\treturn false;\n\t}\n</script>\n<div id='make_sugg-container'>\n<form action=\"empr.php\" method=\"post\" name=\"empr_sugg\" enctype='multipart/form-data'>\n\t<input type='hidden' name='id_sug' id='id_sug' value='{$sugg->id_suggestion}' />\n\t<table width='60%' cellpadding='5'>\n\t\t<tr>\t\n\t\t\t<td class='cell_header' align=right>" . htmlentities($msg["empr_sugg_tit"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"hidden\" name=\"lvl\" />\n\t\t\t\t<input type=\"text\"' id=\"tit\" name=\"tit\" size=\"50\" border=\"0\" value=\"" . htmlentities($sugg->titre, ENT_QUOTES, $charset) . "\"/>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class='cell_header' align=right>" . htmlentities($msg["empr_sugg_aut"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" id=\"aut\" name=\"aut\" size=\"50\" border=\"0\" value=\"" . htmlentities($sugg->auteur, ENT_QUOTES, $charset) . "\"/>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class='cell_header' align=right>" . htmlentities($msg["empr_sugg_edi"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" id=\"edi\" name=\"edi\" size=\"50\" border=\"0\" value=\"" . htmlentities($sugg->editeur, ENT_QUOTES, $charset) . "\"/>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class='cell_header' align=right>" . htmlentities($msg["empr_sugg_code"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" id=\"code\" name=\"code\" size=\"20\" border=\"0\" value=\"" . htmlentities($sugg->code, ENT_QUOTES, $charset) . "\"/>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class='cell_header' align=right>" . htmlentities($msg["empr_sugg_prix"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" id=\"prix\" name=\"prix\" size=\"20\" border=\"0\" value=\"" . htmlentities($sugg->prix, ENT_QUOTES, $charset) . "\"/>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class='cell_header' align=right>" . htmlentities($msg["empr_sugg_url"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>\n\t\t\t\t<input type='text' id=\"url_sug\" name=\"url_sug\" size=\"50\" border=\"0\" value=\"" . htmlentities($sugg->url_suggestion, ENT_QUOTES, $charset) . "\"/>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class='cell_header' align=right vertical-align=top>" . htmlentities($msg["empr_sugg_comment"], ENT_QUOTES, $charset) . "<br /><i>" . htmlentities($msg["empr_sugg_comment_jt"], ENT_QUOTES, $charset) . "</i></td>\n\t\t\t<td>\n\t\t\t\t<textarea id=\"comment\" name=\"comment\" cols=\"50\" rows='4' wrap='virtual'>" . htmlentities($sugg->commentaires, ENT_QUOTES, $charset) . "</textarea>\n\t\t\t</td>\n\t\t</tr>\n\t\t<tr>\n\t\t\t<td class='cell_header' align=right>" . htmlentities($msg["empr_sugg_datepubli"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>\n\t\t\t\t<input type='text' id='date_publi' name='date_publi' value='{$sugg->date_publi}'>\n\t\t\t\t<input type='button' class='bouton' id='date_publi_sug' name='date_publi_sug' value='...' onClick=\"window.open('./select.php?what=calendrier&caller=empr_sugg¶m1=date_publi¶m2=date_publi&auto_submit=NO&date_anterieure=YES', 'date_publi', 'toolbar=no, dependent=yes, width=250,height=250, resizable=yes')\"/>\n\t\t\t</td>\n\t\t</tr>\t"; if (!$_SESSION["id_empr_session"]) { $sug_form .= "\n\t\t<tr>\n\t\t\t<td class='cell_header' align=right>" . htmlentities($msg["empr_sugg_mail"], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td>\n\t\t\t\t<input type=\"text\" id=\"mail\" name=\"mail\" size=\"50\" border=\"0\" value=\"" . $empr_mail . "\"/>\n\t\t\t</td>\n\t\t</tr>"; } if ($opac_sugg_categ == '1') { if ($id_sug) { $default_categ = $sugg->num_categ; } else { if (suggestions_categ::exists($opac_sugg_categ_default)) { $default_categ = $opac_sugg_categ_default; } else { $default_categ = '1'; } }
function show_form_sug($update_action) { global $dbh, $msg, $charset; global $id_bibli, $id_sug; global $sug_map; global $sug_modif_form; global $acquisition_poids_sugg, $lk_url_sug; global $acquisition_sugg_categ, $acquisition_sugg_categ_default; global $orig_form_mod; global $orig_champ_modif; global $id_notice; global $acquisition_sugg_localises; global $deflt_docs_location; global $sugg_location_id; global $javascript_path; $form = $sug_modif_form; //Récupération des pondérations de suggestions $tab_poids = explode(",", $acquisition_poids_sugg); $tab_poids[0] = substr($tab_poids[0], 2); //utilisateur $tab_poids[1] = substr($tab_poids[1], 2); //abonné $tab_poids[2] = substr($tab_poids[2], 2); //visiteur if (!$id_sug) { //Création de suggestion $titre = htmlentities($msg['acquisition_sug_cre'], ENT_QUOTES, $charset); //Récupération de l'utilisateur $requete_user = "******" . SESSlogin . "' limit 1 "; $res_user = pmb_mysql_query($requete_user, $dbh); $row_user = pmb_mysql_fetch_row($res_user); $orig = $row_user[0]; $lib_orig = $row_user[1]; if ($row_user[2]) { $lib_orig .= $row_user[2] . ", " . $row_user[1]; } $form = str_replace('!!lib_orig!!', $orig_form_mod, $form); $form = str_replace('!!dat_cre!!', formatdate(today()), $form); $form = str_replace('!!orig!!', $orig, $form); $form = str_replace('!!lib_orig!!', htmlentities($lib_orig, ENT_QUOTES, $charset), $form); $form = str_replace('!!typ!!', '0', $form); $form = str_replace('!!poi!!', $tab_poids[0], $form); $form = str_replace('!!poi_tot!!', $tab_poids[0], $form); $statut = $sug_map->getFirstStateId(); $form = str_replace('!!statut!!', $statut, $form); $form = str_replace('!!lib_statut!!', $sug_map->getHtmlComment($statut), $form); $form = str_replace('!!list_user!!', '', $form); $form = str_replace('!!creator_ajout!!', '', $form); $form = str_replace('!!lien!!', '', $form); if ($acquisition_sugg_categ != '1') { $sel_categ = ""; } else { if (suggestions_categ::exists($acquisition_sugg_categ_default)) { $sugg_categ = new suggestions_categ($acquisition_sugg_categ_default); } else { $sugg_categ = new suggestions_categ('1'); } $tab_categ = suggestions_categ::getCategList(); $sel_categ = "<select class='saisie-25em' id='num_categ' name='num_categ'>"; foreach ($tab_categ as $id_categ => $lib_categ) { $sel_categ .= "<option value='" . $id_categ . "' "; if ($id_categ == $sugg_categ->id_categ) { $sel_categ .= "selected='selected' "; } $sel_categ .= ">"; $sel_categ .= htmlentities($lib_categ, ENT_QUOTES, $charset) . "</option>"; } $sel_categ .= "</select>"; } $form = str_replace('!!nombre_expl!!', '1', $form); $list_locs = ''; if ($acquisition_sugg_localises) { $sugg_location_id = (string) $sugg_location_id == "" ? $deflt_docs_location : $sugg_location_id; if ($sugg_location_id) { $temp_location = $sugg_location_id; } else { $temp_location = 0; } $locs = new docs_location(); $list_locs = $locs->gen_combo_box_sugg($temp_location, 1, ""); } $form = str_replace('<!-- sel_location -->', $list_locs, $form); // si suggestion concernant une notice avec $id_notice en parametre, on pre-rempli les champs if ($id_notice) { $notice = new notice($id_notice); $tit = htmlentities($notice->tit1, ENT_QUOTES, $charset); $edi = htmlentities($notice->ed1, ENT_QUOTES, $charset); $prix = $notice->prix; $cod = $notice->code; $url_sug = $notice->lien; $as = array_search("0", $notice->responsabilites["responsabilites"]); if ($as !== FALSE && $as !== NULL) { $auteur_0 = $notice->responsabilites["auteurs"][$as]; $auteur = new auteur($auteur_0["id"]); } $aut = htmlentities($auteur->display, ENT_QUOTES, $charset); $form = str_replace('!!id_notice!!', $id_notice, $form); } else { $form = str_replace('!!id_notice!!', 0, $form); } $form = str_replace('!!categ!!', $sel_categ, $form); $form = str_replace('!!tit!!', $tit, $form); $form = str_replace('!!edi!!', $edi, $form); $form = str_replace('!!aut!!', $aut, $form); $form = str_replace('!!cod!!', $cod, $form); $form = str_replace('!!pri!!', $prix, $form); $form = str_replace('!!com!!', '', $form); $form = str_replace('!!com_gestion!!', '', $form); $form = str_replace('!!url_sug!!', $url_sug, $form); //Affichage du selecteur de source $req = "select * from suggestions_source order by libelle_source"; $res = pmb_mysql_query($req, $dbh); $option = "<option value='0' selected>" . htmlentities($msg['acquisition_sugg_no_src'], ENT_QUOTES, $charset) . "</option>"; while ($src = pmb_mysql_fetch_object($res)) { $option .= "<option value='" . $src->id_source . "' {$selected} >" . htmlentities($src->libelle_source, ENT_QUOTES, $charset) . "</option>"; $selected = ""; } $selecteur = "<select id='sug_src' name='sug_src'>" . $option . "</select>"; $form = str_replace('!!liste_source!!', $selecteur, $form); $form = str_replace('!!date_publi!!', '', $form); $pj = "<div class='row'>\n\t\t\t\t\t<input type='file' id='piece_jointe_sug' name='piece_jointe_sug' class='saisie-80em' size='60' />\n\t\t\t </div>"; $form = str_replace('!!div_pj!!', $pj, $form); } else { //Modification de suggestion $titre = htmlentities($msg['acquisition_sug_mod'], ENT_QUOTES, $charset); $sug = new suggestions($id_sug); $q = suggestions_origine::listOccurences($id_sug); $list_orig = pmb_mysql_query($q, $dbh); $orig = 0; $poids_tot = 0; $users = array(); while ($row_orig = pmb_mysql_fetch_object($list_orig)) { if (!$orig) { $orig = $row_orig->origine; $typ = $row_orig->type_origine; $poids = $tab_poids[$row_orig->type_origine]; } array_push($users, $row_orig); $poids_tot = $poids_tot + $tab_poids[$row_orig->type_origine]; } //On parcourt tous les créateurs de suggestions for ($i = 0; $i < sizeof($users); $i++) { $orig = $users[$i]->origine; $typ = $users[$i]->type_origine; //Récupération du nom du créateur de la suggestion switch ($typ) { default: case '0': $requete_user = "******" . $orig . "'"; $res_user = pmb_mysql_query($requete_user, $dbh); $row_user = pmb_mysql_fetch_row($res_user); $lib_orig = $row_user[1]; if ($row_user[2]) { $lib_orig .= ", " . $row_user[2]; } if (empty($premier_user) || !isset($premier_user)) { $premier_user = $lib_orig; } else { $list_user .= $lib_orig . "<br />"; } break; case '1': $requete_empr = "SELECT id_empr, empr_nom, empr_prenom FROM empr where id_empr = '" . $orig . "'"; $res_empr = pmb_mysql_query($requete_empr, $dbh); $row_empr = pmb_mysql_fetch_row($res_empr); $lib_orig = $row_empr[1]; if ($row_empr[2]) { $lib_orig .= ", " . $row_empr[2]; } if (empty($premier_user) || !isset($premier_user)) { $premier_user = $lib_orig; } else { $list_user .= $lib_orig . "<br />"; } break; case '2': if ($orig) { $lib_orig = $orig; } else { $lib_orig = $msg['suggest_anonyme']; } if (empty($premier_user) || !isset($premier_user)) { $premier_user = $lib_orig; } else { $list_user .= $lib_orig . "<br />"; } break; } } //Récupération du statut de la suggestion $lib_statut = $sug_map->getHtmlComment($sug->statut); $form = str_replace('!!dat_cre!!', formatdate($sug->date_creation), $form); $form = str_replace('!!orig!!', $orig, $form); //Ajout du champ de saisie du nouveau créateur $ajout_create = "<input id='creator_orig_id' type='hidden' name='creator_orig_id'>\n\t\t<input type='text' id='creator_lib_orig' name='creator_lib_orig' class='saisie-10emr'/>\n\t\t<input type='button' class='bouton_small' value='...' onclick=\"openPopUp('./select.php?what=origine&caller=sug_modif_form¶m1=creator_orig_id¶m2=creator_lib_orig¶m3=typ¶m4=¶m5=¶m6=&deb_rech=', 'select_creator_orig', 400, 400, -2, -2, 'scrollbars=yes, toolbar=no, dependent=yes, resizable=yes')\" />"; if (sizeof($users) > 1) { //on ajoute le champ à la liste $list_user .= $ajout_create; $form = str_replace('!!creator_ajout!!', '', $form); } else { $form = str_replace('!!creator_ajout!!', "<br />" . $ajout_create, $form); } //Menu dépliant $deroul_user = gen_plus('ori', $msg['suggest_creator'] . " (" . (sizeof($users) - 1) . ")", $list_user, 0); if ($lib_orig) { $form = str_replace('!!lib_orig!!', htmlentities($premier_user, ENT_QUOTES, $charset), $form); if (sizeof($users) > 1) { $form = str_replace('!!list_user!!', $deroul_user, $form); } else { $form = str_replace('!!list_user!!', '', $form); } } else { $form = str_replace('!!lib_orig!!', ' ', $form); $form = str_replace('!!list_user!!', '', $form); } $form = str_replace('!!typ!!', $typ, $form); $form = str_replace('!!poi!!', $poids, $form); $form = str_replace('!!poi_tot!!', $poids_tot, $form); $form = str_replace('!!statut!!', $sug->statut, $form); $form = str_replace('!!lib_statut!!', $lib_statut, $form); if ($acquisition_sugg_categ != '1') { $sel_categ = ""; } else { $state_name = $sug_map->getStateNameFromId($sug->statut); $categ = $sug_map->getState_CATEG($state_name); $sugg_categ = new suggestions_categ($sug->num_categ); if ($categ == 'YES') { $tab_categ = suggestions_categ::getCategList(); $sel_categ = "<select class='saisie-25em' id='num_categ' name='num_categ'>"; foreach ($tab_categ as $id_categ => $lib_categ) { $sel_categ .= "<option value='" . $id_categ . "' "; if ($id_categ == $sug->num_categ) { $sel_categ .= "selected='selected' "; } $sel_categ .= ">"; $sel_categ .= htmlentities($lib_categ, ENT_QUOTES, $charset) . "</option>"; } $sel_categ .= "</select>"; } else { $sel_categ = htmlentities($sugg_categ->libelle_categ, ENT_QUOTES, $charset); } } //Nombre d'exemplaire $form = str_replace('!!nombre_expl!!', $sug->nb, $form); //Selecteur de localisation $list_locs = ''; if ($acquisition_sugg_localises) { $sugg_location_id = $sug->sugg_location; if ($sugg_location_id) { $temp_location = $sugg_location_id; } else { $temp_location = 0; } $locs = new docs_location(); $list_locs = $locs->gen_combo_box_sugg($temp_location, 1, ""); } $form = str_replace('<!-- sel_location -->', $list_locs, $form); if ($sug->num_notice && $sug->num_notice != 0) { $req_ana = "select analysis_bulletin as bull , analysis_notice as noti from analysis where analysis_notice ='" . $sug->num_notice . "'"; $res_ana = pmb_mysql_query($req_ana, $dbh); $num_rows_ana = pmb_mysql_num_rows($res_ana); if ($num_rows_ana) { $ana = pmb_mysql_fetch_object($res_ana); $url_view = "catalog.php?categ=serials&sub=bulletinage&action=view&bul_id={$ana->bull}&art_to_show=" . $ana->noti; } else { $url_view = "./catalog.php?categ=isbd&id=" . $sug->num_notice; } $lien = "<a href='{$url_view}'> " . $msg['acquisition_sug_view_not'] . "</a>"; $form = str_replace('!!lien!!', $lien, $form); } else { $form = str_replace('!!lien!!', '', $form); } $form = str_replace('!!categ!!', $sel_categ, $form); $form = str_replace('!!tit!!', htmlentities($sug->titre, ENT_QUOTES, $charset), $form); $form = str_replace('!!edi!!', htmlentities($sug->editeur, ENT_QUOTES, $charset), $form); $form = str_replace('!!aut!!', htmlentities($sug->auteur, ENT_QUOTES, $charset), $form); $form = str_replace('!!cod!!', htmlentities($sug->code, ENT_QUOTES, $charset), $form); $form = str_replace('!!pri!!', round($sug->prix, 2), $form); $form = str_replace('!!com!!', htmlentities($sug->commentaires, ENT_QUOTES, $charset), $form); $form = str_replace('!!com_gestion!!', htmlentities($sug->commentaires_gestion, ENT_QUOTES, $charset), $form); $req = "select * from suggestions_source order by libelle_source"; $res = pmb_mysql_query($req, $dbh); $selected = ""; $option = "<option value='0' selected>" . htmlentities($msg['acquisition_sugg_no_src'], ENT_QUOTES, $charset) . "</option>"; while ($src = pmb_mysql_fetch_object($res)) { $src->id_source == $sug->sugg_src ? $selected = " selected " : ($selected = ""); $option .= "<option value='" . $src->id_source . "' {$selected}>" . htmlentities($src->libelle_source, ENT_QUOTES, $charset) . "</option>"; } $selecteur = "<select id='sug_src' name='sug_src'>" . $option . "</select>"; $form = str_replace('!!liste_source!!', $selecteur, $form); $form = str_replace("!!date_publi!!", htmlentities($sug->date_publi, ENT_QUOTES, $charset), $form); if (!$sug->get_explnum('id')) { $pj = "<div class='row'>\n\t\t\t\t\t<input type='file' id='piece_jointe_sug' name='piece_jointe_sug' class='saisie-80em' size='60' />\n\t\t\t </div>"; } else { $pj = "\n\t\t\t<input type='hidden' name='id_pj' id='id_pj' value='" . $sug->get_explnum('id') . "' />\n\t\t\t<div class='row'>" . $sug->get_explnum('nom') . " <input type='submit' class='bouton' name='del_pj' id='del_pj' value='X' onclick='this.form.action=\"./acquisition.php?categ=sug&action=del_pj&id_bibli=" . $id_bibli . "&id_sug=" . $id_sug . "\"' /> \n\t\t\t</div>"; } $form = str_replace('!!div_pj!!', $pj, $form); if ($sug->url_suggestion) { $form = str_replace('<!-- url_sug -->', $lk_url_sug, $form); } $form = str_replace('!!url_sug!!', htmlentities($sug->url_suggestion, ENT_QUOTES, $charset), $form); $form = str_replace('!!id_notice!!', $sug->num_notice, $form); // Affichage du bouton supprimer $bt_sup = $sug_map->getButton_DELETED($sug->statut, $id_bibli, $id_sug); $form = str_replace('<!-- bouton_sup -->', $bt_sup, $form); if ($sug->num_notice) { //Eventuellement, lien vers la notice } else { // Affichage du bouton cataloguer $bt_cat = $sug_map->getButton_CATALOG($sug->statut, $id_bibli, $id_sug); $button = "<input type='radio' name='catal_type' id='not_type' value='0' checked /><label class='etiquette' for='not_type'>" . htmlentities($msg['acquisition_type_mono'], ENT_QUOTES, $charset) . "</label>\n\t\t\t<input type='radio' name='catal_type' value='1' id='art_type'/><label for='art_type' class='etiquette'>" . htmlentities($msg['acquisition_type_art'], ENT_QUOTES, $charset) . "</label>"; if ($sug->sugg_noti_unimarc) { $bt_cat = str_replace('!!type_catal!!', " <label style='color:red'>Notice externe existante</label>", $bt_cat); } else { $bt_cat = str_replace('!!type_catal!!', $button, $bt_cat); } $form = str_replace('<!-- bouton_cat -->', $bt_cat, $form); } } //$action ="./acquisition.php?categ=sug&action=update&id_bibli=".$id_bibli."&id_sug=".$id_sug; $form = str_replace('!!action!!', $update_action, $form); $form = str_replace('!!form_title!!', $titre, $form); print "<script type=\"text/javascript\" src=\"" . $javascript_path . "/tablist.js\"></script>"; print $form; }
//Traitement des changements de categories if ($acquisition_sugg_categ == '1' && $action == 'to_categ') { $sug_map->changeCateg($chk, $to_categ); } //Traitement des actions print "<h1>" . htmlentities($msg['acquisition_sug_ges'], ENT_QUOTES, $charset) . "</h1>"; switch ($action) { case 'list': if ($sug_map->has_unimarc) { catalog_notice_form(); } else { if ($catnoti) { $ids = explode(",", $chk); require_once $class_path . '/serials.class.php'; for ($i = 0; $i < count($ids); $i++) { $sug = new suggestions($ids[$i]); if ($sug->sugg_noti_unimarc) { $sug->catalog_notice(); } } } show_list_sug(); } break; case 'modif': $update_action = "./acquisition.php?categ=sug&action=update&id_bibli=" . $id_bibli . "&id_sug=" . $id_sug; show_form_sug($update_action); break; case 'update': update_sug(); show_list_sug();
$sug_form = "<h3>" . htmlentities($msg["empr_make_sugg"], ENT_QUOTES, $charset) . "</h3>\n"; // Contrôle des données saisies if ($tit != "" && ($aut != "" || $edi != "" || $code != "" || $_FILES['piece_jointe_sug']['name'] != "")) { //Les données minimun ont été saisies $userid = $_SESSION["id_empr_session"]; if (!$userid) { $type = '2'; //Visiteur non authentifié $userid = $mail; } else { $type = '1'; //Abonné } //On évite de saisir 2 fois la même suggestion if ($id_sug || !suggestions::exists($userid, $tit, $aut, $edi, $code)) { $su = new suggestions($id_sug); $su->titre = stripslashes($tit); $su->editeur = stripslashes($edi); $su->auteur = stripslashes($aut); $su->code = stripslashes($code); $prix = str_replace(',', '.', $prix); if (is_numeric($prix)) { $su->prix = $prix; } $su->nb = (int) $nb ? (int) $nb : "1"; $su->statut = $sug_map->getFirstStateId(); $su->url_suggestion = stripslashes($url_sug); $su->commentaires = stripslashes($comment); $su->date_creation = today(); $su->date_publi = stripslashes($date_publi); $su->sugg_src = $sug_src;
function sug_fusVal() { global $dbh; global $msg, $charset; global $chk, $sug; $fus = new suggestions($chk[0]); $q = suggestions_origine::listOccurences($chk[0], 1); $tab_orig = mysql_query($q, $dbh); $row_orig = mysql_fetch_object($tab_orig); $orig = $row_orig->origine; foreach ($sug as $key => $id_sug) { if ($id_sug != $chk[0]) { suggestions::delete($id_sug); suggestions_origine::fusionne($orig, $id_sug, $chk[0]); } } }
function save() { global $dbh, $max_nblignes, $msg, $id_empr, $empr_location, $num_categ; for ($i = 0; $i < $max_nblignes; $i++) { $tit = "sugg_tit_" . $i; $aut = "sugg_aut_" . $i; $edi = "sugg_edi_" . $i; $code = "sugg_code_" . $i; $prix = "sugg_prix_" . $i; $com = "sugg_com_" . $i; $url = "sugg_url_" . $i; $qte = "sugg_qte_" . $i; $src = "sugg_src_" . $i; $date = "sugg_date_" . $i; $unimarc = "id_unimarc_" . $i; $notice = "id_notice_" . $i; global $sug_tr, ${$tit}, ${$aut}, ${$edi}, ${$code}, ${$com}, ${$prix}, ${$url}, ${$qte}, ${$src}, ${$date}, ${$unimarc}, ${$notice}; if (isset(${$tit})) { if (!is_numeric(${$qte})) { print "<strong>" . $msg[empr_sugg_qte_error] . "<strong>"; return; } else { if (!${$tit} || !${$edi} && !${$aut} && !${$code}) { print "<strong>" . str_replace('\\n', '<br />', $msg['empr_sugg_ko']) . "<strong>"; return; } else { if (!suggestions::exists($id_empr, ${$tit}, ${$aut}, ${$edi}, ${$code})) { ${$prix} = str_replace(',', '.', ${$prix}); $req = "insert into suggestions set \n\t\t\t\t\t\t\ttitre='" . ${$tit} . "',\n\t\t\t\t\t\t\tauteur='" . ${$aut} . "',\n\t\t\t\t\t\t\tediteur='" . ${$edi} . "',\n\t\t\t\t\t\t\tcode='" . ${$code} . "',\n\t\t\t\t\t\t\tprix='" . ${$prix} . "',\n\t\t\t\t\t\t\tcommentaires='" . ${$com} . "',\n\t\t\t\t\t\t\turl_suggestion='" . ${$url} . "',\n\t\t\t\t\t\t\tnb='" . ${$qte} . "',\n\t\t\t\t\t\t\tsugg_source='" . ${$src} . "',\n\t\t\t\t\t\t\tstatut=1,\n\t\t\t\t\t\t\tdate_publication='" . ${$date} . "',\n\t\t\t\t\t\t\tdate_creation='" . date("Y-m-d") . "',\n\t\t\t\t\t\t\tsugg_location='" . $empr_location . "',\n\t\t\t\t\t\t\tnum_categ='" . $num_categ . "'\n\t\t\t\t\t\t\t"; if (${$unimarc}) { $uni = new suggestions_unimarc(${$unimarc}); $req .= ", notice_unimarc ='" . addslashes($uni->sugg_uni_notice) . "'"; } if (${$notice}) { $req .= ", num_notice ='" . ${$notice} . "'"; } pmb_mysql_query($req, $dbh); $idSugg = pmb_mysql_insert_id(); if (is_object($uni)) { $uni->delete(); } $sug_orig = new suggestions_origine($id_empr, $idSugg); $sug_orig->type_origine = 1; $sug_orig->save(); //Envoi mail $su = new suggestions($idSugg); suggestions::alert_mail_sugg_users_pmb(1, $id_empr, $su->get_table(), $su->sugg_location); print $msg['empr_sugg_ok']; } else { print $msg['empr_sugg_already_exist']; } } } } } }
if ($allow_sugg) { require_once $base_path . '/empr/valid_sugg.inc.php'; } else { print $msg[empr_no_allow_sugg]; } print "</div>"; break; case 'view_sugg': print "<div id='empr-sugg'>\n"; require_once $base_path . '/empr/view_sugg.inc.php'; print "</div>"; break; case 'suppr_sugg': print "<div id='empr-sugg'>\n"; if ($allow_sugg && $id_sug) { suggestions::delete($id_sug); } print "</div>"; break; case 'private_list': case 'public_list': case 'demande_list': print "<div id='empr-list'>\n"; require_once $base_path . '/empr/liste_lecture.inc.php'; print "</div>"; break; case 'do_dmde': print "<div id='empr-dema'>\n"; if ($allow_dema) { require_once $base_path . '/empr/make_demande.inc.php'; } else {
function changeCateg($chk, $to_categ) { foreach ($chk as $key => $id_sug) { $sug = new suggestions($id_sug); $state_name = $this->getStateNameFromId($sug->statut); if ($this->getState_CATEG($state_name) == 'YES' && suggestions_categ::exists($to_categ)) { $sug->num_categ = $to_categ; $sug->save(); } } }
function delete_suggestion($session_id, $suggestion_id) { global $dbh; if (!$session_id) { return FALSE; } $session_info = $this->retrieve_session_information($session_id); $empr_id = $session_info["empr_id"]; if (!$empr_id) { return FALSE; } $exists = suggestions_origine::exists($empr_id, $suggestion_id, 1); if (!$exists) { return FALSE; } $sugg = new suggestions($suggestion_id); if (!($sugg->sugg_origine_type == 1) && $sugg->sugg_origine == $empr_id) { return FALSE; } $sugg->delete($suggestion_id); return TRUE; }
$w = $largeur_page - $marge_gauche - $marge_droite; $ourPDF = new $fpdf($orient_page, 'mm', $taille_doc); $ourPDF->Open(); $ourPDF->SetMargins($marge_gauche, $marge_haut, $marge_droite); $sug_map = new suggestions_map(); //On récupère les infos de la liste de suggestions if (!$statut) { $statut = -1; } $us = stripslashes($user_input); $mask = $sug_map->getMask_FILED(); if (!$user_input) { $q = suggestions::listSuggestions(0, $statut, $num_categ, $mask, 0, 0, $aq, '', $sugg_location_id, '', 0, $origine_id, $type_origine); } else { $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0); $q = suggestions::listSuggestions(0, $statut, $num_categ, $mask, 0, 0, $aq, '', $sugg_location_id, $user_input, 0, $origine_id, $type_origine); } $res = pmb_mysql_query($q, $dbh); $ourPDF->addPage(); $ourPDF->setFont($pmb_pdf_font); //Affichage date $date = formatdate(today()); $ourPDF->setFontSize($fs_date); $ourPDF->SetXY($x_date, $y_date); $ourPDF->Cell($l_date, $h_date, $date, 0, 0, 'L', 0); //Affichage titre $titre = ""; if ($origine_id) { if (is_array($origine_id) && count($origine_id) && is_array($type_origine) && count($type_origine)) { $nom = ""; foreach ($origine_id as $k => $v) {
function do_sugg_form($id_suggestion) { global $dbh, $charset; global $recept_deliv_form_sugg, $deflt3receptsugstat; $sug = new suggestions($id_suggestion); $tab_orig = $sug->getOrigines(); $form = ''; //Récupération des noms des créateurs des suggestions $list_orig = ''; if (count($tab_orig)) { $form = $recept_deliv_form_sugg; foreach ($tab_orig as $orig) { switch ($orig['type_origine']) { default: case '0': $q_user = "******" . $orig['origine'] . "'"; $r_user = mysql_query($q_user, $dbh); $row_user = mysql_fetch_row($r_user); $list_orig = htmlentities($row_user[1], ENT_QUOTES, $charset); if ($row_user[2]) { $list_orig .= ", " . htmlentities($row_user[2], ENT_QUOTES, $charset); } $list_orig .= "<br />"; break; case '1': $q_empr = "SELECT id_empr, empr_nom, empr_prenom FROM empr where id_empr = '" . $orig['origine'] . "'"; $r_empr = mysql_query($q_empr, $dbh); $row_empr = mysql_fetch_row($r_empr); $list_orig .= htmlentities($row_empr[1], ENT_QUOTES, $charset); if ($row_empr[2]) { $list_orig .= ", " . htmlentities($row_empr[2], ENT_QUOTES, $charset); } $list_orig .= "<br />"; break; case '2': break; } } $form = str_replace('<!-- origines -->', $list_orig, $form); $form = str_replace('!!id_sug!!', $id_suggestion, $form); $sug_map = new suggestions_map(); if ($sug->statut == $sug_map->getState_ID('ORDERED')) { $sel_sugstat = $sug_map->getHtmlStateSelect('ORDERED', array(0 => $sug_map->getStateNameFromId($deflt3receptsugstat)), TRUE, array('name' => 'sel_sugstat')); } else { $sel_sugstat = $sug_map->getHtmlStateSelect('ORDERED', array(0 => $sug_map->getStateNameFromId($sug->statut)), TRUE, array('name' => 'sel_sugstat')); } $form = str_replace('<!-- sel_sugstat -->', $sel_sugstat, $form); } return $form; }
} else { $pair_impair = "odd"; } if ($row->statut == 1) { //Si la suggestion n'est pas validée on peut la modifier $modif_sugg = "onclick=\"document.location='" . $opac_url_base . "empr.php?lvl=make_sugg&id_sug={$row->id_suggestion}'\" "; $pointer = "style='cursor:pointer'"; } else { $modif_sugg = ""; $pointer = ""; } $sug_form .= "\n\t\t\t<tr class='{$pair_impair}' >\n\t\t\t\t<td {$modif_sugg} {$pointer}>" . formatdate($row->date_suggestion) . "</td>\n\t\t\t\t<td {$modif_sugg} {$pointer}>" . htmlentities($row->titre, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td {$modif_sugg} {$pointer}>" . htmlentities($row->editeur, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td {$modif_sugg} {$pointer}>" . htmlentities($row->auteur, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t<td {$modif_sugg} {$pointer}>" . $lib_statut . "</td>\n\t\t\t\t<td {$modif_sugg} {$pointer}>" . htmlentities($row->date_publication, ENT_QUOTES, $charset) . "</td>"; $source = new suggestion_source($row->sugg_source); $sug_form .= "<td {$pointer}>" . htmlentities($source->libelle_source, ENT_QUOTES, $charset) . "</td>"; if ($opac_sugg_categ == '1') { $categ = new suggestions_categ($row->num_categ); $sug_form .= "<td {$modif_sugg} {$pointer}>" . htmlentities($categ->libelle_categ, ENT_QUOTES, $charset) . "</td>"; } $sug = new suggestions($row->id_suggestion); if ($sug->get_explnum('id')) { $sug_form .= "<td align='center'><i>" . ($sug->get_explnum('id') ? "<a href=\"{$base_path}/explnum_doc.php?explnumdoc_id=" . $sug->get_explnum('id') . "\" target=\"_LINK_\"><img src='" . get_url_icon("globe_orange.png") . "' border='0' /></a>" : '') . "</i></td>"; } else { $sug_form .= "<td></td>"; } $sug_form .= "\n\t\t\t</tr>"; } $sug_form .= "</table></div></div>"; print $sug_form; } else { print "\n\t\t<h3>" . htmlentities($msg['empr_view_sugg'], ENT_QUOTES, $charset) . "</h3>\n\t\t<div class='row'>" . htmlentities($msg['empr_view_no_sugg'], ENT_QUOTES, $charset) . "\n\t\t</div>"; }
// permet de charger la bonne langue, mot vide... $info = notice::indexation_prepare($id); // Mise a jour des index de la notice notice::majNotices($id); // Mise a jour de la table notices_global_index notice::majNoticesGlobalIndex($id); // Mise a jour de la table notices_mots_global_index notice::majNoticesMotsGlobalIndex($id); // restaure l'environnement de langue notice::indexation_restaure($info); //synchro_rdf if ($pmb_synchro_rdf) { $synchro_rdf->addRdf($id, 0); } //Mise a jour de la suggestion $sug = new suggestions($id_sug); $sug->titre = stripslashes($t_notice['tit1']); $f_aut[] = array('id' => $f_aut0_id, 'fonction' => $f_f0_code, 'type' => '0'); if ($f_aut0_id) { $auteur = new auteur($f_aut0_id); $sug->auteur = $auteur->display; } if ($f_ed1_id) { $sug->editeur = stripslashes($f_ed1); } $sug->code = $t_notice['code']; $t_notice['prix'] = str_replace(',', '.', $t_notice['prix']); //float(8,2) $sug->prix = $t_notice['prix']; $sug->num_notice = $id; $sug->save();