function show_list_sug($id_bibli = 0) { global $dbh, $base_path; global $msg, $charset; global $sug_map; global $sug_search_form, $sug_list_form, $filtre_src, $user_txt, $user_id, $user_statut; global $nb_per_page; global $class_path; global $user_input, $statut, $num_categ, $page, $nbr_lignes, $last_param; global $script, $bt_chk, $bt_imp, $bt_exporter; global $acquisition_sugg_categ; global $acquisition_sugg_localises, $sugg_location_id; global $deflt_docs_location; if ($acquisition_sugg_localises) { $sugg_location_id = (string) $sugg_location_id == "" ? $deflt_docs_location : $sugg_location_id; } // nombre de références par pages if (!$nb_per_page) { $nb_per_page = 10; } //Affichage form de recherche $titre = htmlentities($msg['recherche'] . ' : ' . $msg['acquisition_sug'], ENT_QUOTES, $charset); $action = "./acquisition.php?categ=sug&action=list&id_bibli=" . $id_bibli . "&user_input=&nb_per_page=" . $nb_per_page; $bouton_add = "<input class='bouton' type='button' value='" . $msg['acquisition_ajout_sug'] . "' onClick=\"document.location='./acquisition.php?categ=sug&sub=todo&action=modif&id_bibli=" . $id_bibli . "&sugg_location_id={$sugg_location_id}';\" />"; $lien_last_sug = ""; $sug_search_form = str_replace('!!form_title!!', $titre, $sug_search_form); $sug_search_form = str_replace('!!action!!', $action, $sug_search_form); $sug_search_form = str_replace('<!-- sel_state -->', $sug_map->getStateSelector(), $sug_search_form); $sug_search_form = str_replace('<!-- bouton_add -->', $bouton_add, $sug_search_form); $sug_search_form = str_replace('<!-- lien_last -->', $lien_last_sug, $sug_search_form); //Selecteur de localisation $list_locs = ''; if ($acquisition_sugg_localises) { 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, "submit();"); } $sug_search_form = str_replace('<!-- sel_location -->', $list_locs, $sug_search_form); //Selecteur de categories if ($acquisition_sugg_categ != '1') { $sel_categ = ""; } else { $tab_categ = suggestions_categ::getCategList(); $sel_categ = "<select class='saisie-25em' id='num_categ' name='num_categ' onchange=\"submit();\">"; $sel_categ .= "<option value='-1'>" . htmlentities($msg['acquisition_sug_tous'], ENT_QUOTES, $charset) . "</option>"; foreach ($tab_categ as $id_categ => $lib_categ) { $sel_categ .= "<option value='" . $id_categ . "' > "; $sel_categ .= htmlentities($lib_categ, ENT_QUOTES, $charset) . "</option>"; } $sel_categ .= "</select>"; } $sug_search_form = str_replace('<!-- sel_categ -->', $sel_categ, $sug_search_form); //Affichage du filtre par source $req = "select * from suggestions_source order by libelle_source"; $res = pmb_mysql_query($req, $dbh); $selected = ""; $option = "<option value='0'>" . htmlentities($msg['acquisition_sugg_all_sources'], ENT_QUOTES, $charset) . "</option>"; while ($src = pmb_mysql_fetch_object($res)) { $src->id_source == $filtre_src ? $selected = "selected" : ($selected = ""); $option .= "<option value='" . $src->id_source . "' {$selected}>" . htmlentities($src->libelle_source, ENT_QUOTES, $charset) . "</option>"; } $selecteur = " <select id='filtre_src' name='filtre_src' onchange=\"this.form.submit();\">" . $option . "</select>"; $sug_search_form = str_replace('!!sug_filtre_src!!', $selecteur, $sug_search_form); $user_name = $user_txt; if (!$user_txt && $user_id) { $req = "select concat(empr_nom,', ',empr_prenom) as nom from empr where id_empr='" . $user_id . "'"; $res = pmb_mysql_query($req, $dbh); $empr = pmb_mysql_fetch_object($res); $user_name = $empr->nom; } $sug_search_form = str_replace('!!user_txt!!', htmlentities($user_name, ENT_QUOTES, $charset), $sug_search_form); $sug_search_form = str_replace('!!user_id!!', htmlentities($user_id, ENT_QUOTES, $charset), $sug_search_form); $sug_search_form = str_replace('!!user_statut!!', htmlentities($user_statut, ENT_QUOTES, $charset), $sug_search_form); $sug_search_form = str_replace('!!user_input!!', htmlentities($user_input, ENT_QUOTES, $charset), $sug_search_form); print $sug_search_form; //Affiche par defaut toutes les categories de suggestions if ($acquisition_sugg_categ != '1') { $num_categ = "-1"; } else { if (!$num_categ) { $num_categ = '-1'; } print "<script type='text/javascript' >document.forms['search'].elements['num_categ'].value = '" . $num_categ . "';</script>"; } if (!$statut) { $statut = getSessionSugState(); //Recuperation du statut courant } else { setSessionSugState($statut); } print "<script type='text/javascript' >document.forms['search'].elements['statut'].value = '" . $statut . "';document.forms['search'].elements['user_input'].focus();\n\tdocument.forms['search'].elements['user_input'].select();</script>"; //Prise en compte du formulaire de recherche $mask = $sug_map->getMask_FILED(); // traitement de la saisie utilisateur require_once $class_path . "/analyse_query.class.php"; //comptage if (!$nbr_lignes) { if (!$user_input) { $nbr_lignes = suggestions::getNbSuggestions($id_bibli, $statut, $num_categ, $mask, 0, $sugg_location_id, '', $filtre_src, $user_id, $user_statut); } else { $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0); if ($aq->error) { error_message($msg["searcher_syntax_error"], sprintf($msg["searcher_syntax_error_desc"], $aq->current_car, $aq->input_html, $aq->error_message)); exit; } $nbr_lignes = suggestions::getNbSuggestions($id_bibli, $statut, $num_categ, $mask, $aq, $sugg_location_id, $user_input, $filtre_src, $user_id, $user_statut); } } else { $aq = new analyse_query(stripslashes($user_input), 0, 0, 0, 0); } if (!$page) { $page = 1; } $debut = ($page - 1) * $nb_per_page; if ($nbr_lignes) { $url_base = "acquisition.php?categ=sug&action=list&id_bibli={$id_bibli}&user_input=" . rawurlencode(stripslashes($user_input)) . "&statut={$statut}&num_categ={$num_categ}&sugg_location_id={$sugg_location_id}&filtre_src={$filtre_src}&user_id={$user_id}&user_statut={$user_statut}"; //affichage if (!$user_input) { $q = suggestions::listSuggestions($id_bibli, $statut, $num_categ, $mask, $debut, $nb_per_page, 0, '', $sugg_location_id, '', $filtre_src, $user_id, $user_statut); } else { $q = suggestions::listSuggestions($id_bibli, $statut, $num_categ, $mask, $debut, $nb_per_page, $aq, '', $sugg_location_id, $user_input, $filtre_src, $user_id, $user_statut); } $res = pmb_mysql_query($q, $dbh); //Affichage liste des suggestions $nbr = pmb_mysql_num_rows($res); $aff_row = ""; $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = pmb_mysql_fetch_object($res); //recuperation origine $lib_orig = ""; $typ_orig = "0"; $q = suggestions_origine::listOccurences($row->id_suggestion, '1'); $list_orig = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($list_orig)) { $row_orig = pmb_mysql_fetch_object($list_orig); $orig = $row_orig->origine; $typ_orig = $row_orig->type_origine; } //Récupération du nom du créateur de la suggestion $idempr = 0; switch ($typ_orig) { default: case '0': $requete_user = "******" . $orig . "' limit 1 "; $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]; } break; case '1': $requete_empr = "SELECT id_empr, empr_nom, empr_prenom, empr_adr1 FROM empr where id_empr = '" . $orig . "' limit 1 "; $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]; } $idempr = $row_empr[0]; break; case '2': $lib_orig = $orig; break; } $lib_statut = $sug_map->getHtmlComment($row->statut); $col2 = ""; if (trim($row->code) != "") { $col2 = htmlentities(trim($row->code), ENT_QUOTES, $charset) . "<br />"; } $col2 .= htmlentities(trim($row->titre), ENT_QUOTES, $charset); $col3 = ""; $col30 = ""; $col31 = ""; if (trim($row->auteur) != "") { $col30 = htmlentities(trim($row->auteur), ENT_QUOTES, $charset); } if (trim($row->editeur) != "") { $col31 = "[" . htmlentities(trim($row->editeur), ENT_QUOTES, $charset) . "]"; } $col3 = $col30; if ($col3 != "" && $col31 != "") { $col3 .= "<br />"; } $col3 .= $col31; if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript_l1 = "onmouseover=\"this.className='surbrillance';this.parentNode.rows[this.rowIndex+1].className='surbrillance';\" onmouseout=\"this.className='" . $pair_impair . "';this.parentNode.rows[this.rowIndex+1].className='" . $pair_impair . "'\" "; $tr_javascript_l2 = "onmouseover=\"this.className='surbrillance';this.parentNode.rows[this.rowIndex-1].className='surbrillance';\" onmouseout=\"this.className='" . $pair_impair . "';this.parentNode.rows[this.rowIndex-1].className='" . $pair_impair . "'\" "; $dn_javascript = "onmousedown=\"document.location='./acquisition.php?categ=sug&action=modif&id_bibli=" . $id_bibli . "&id_sug=" . $row->id_suggestion . "' \" "; if ($idempr) { $link_empr = "<a href='circ.php?categ=pret&id_empr={$idempr}'>"; $link_empr_fin = "</a>"; } else { $link_empr = ""; $link_empr_fin = ""; } $aff_row .= "<tr class='" . $pair_impair . "' " . $tr_javascript_l1 . " style='cursor: pointer' >\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . formatdate($row->date_creation) . "<br />{$link_empr}" . htmlentities($lib_orig, ENT_QUOTES, $charset) . "{$link_empr_fin}</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . $col2 . "</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . $col3 . "</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . htmlentities($row->nb, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >" . htmlentities($row->prix, ENT_QUOTES, $charset) . "</td>\n\t\t\t\t\t\t<td " . $dn_javascript . " >{$lib_statut}</td>"; if (!$row->num_notice) { $aff_row .= "<td " . $dn_javascript . " ></td>"; } else { $req_ana = "select analysis_bulletin as bull , analysis_notice as noti from analysis where analysis_notice ='" . $row->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=" . $row->num_notice; } $aff_row .= "<td style='text-align:center;'><a href=\"" . $url_view . "\"><img border=\"0\" align=\"middle\" title=\"" . $msg['acquisition_sug_view_not'] . "\" alt=\"" . $msg['acquisition_sug_view_not'] . "\" src=\"./images/notice.gif\" /></a></td>"; } $sug_src = new suggestion_source($row->sugg_source); if ($acquisition_sugg_categ == '1') { $categ = new suggestions_categ($row->num_categ); $aff_row .= "<td " . $dn_javascript . " >" . htmlentities($categ->libelle_categ, ENT_QUOTES, $charset) . "<br />" . htmlentities($sug_src->libelle_source, ENT_QUOTES, $charset) . "</td>"; $colspan = '10'; } else { $aff_row .= "<td " . $dn_javascript . " >" . htmlentities($sug_src->libelle_source, ENT_QUOTES, $charset) . "</td>"; $colspan = '9'; } $sug = new suggestions($row->id_suggestion); $img_pj = "<a href=\"{$base_path}/explnum_doc.php?explnumdoc_id=" . $sug->get_explnum('id') . "\" target=\"_LINK_\"><img src='{$base_path}/images/globe_orange.png' /></a>"; $img_import = "<a href=\"{$base_path}/acquisition.php?categ=sug&sub=import&explnumdoc_id=" . $sug->get_explnum('id') . " \"><img src='{$base_path}/images/upload.gif' /></a>"; $aff_row .= "<td align='center'><i>" . ($sug->get_explnum('id') ? "{$img_pj} {$img_import}" : '') . "</i></td>"; $aff_row .= "<td ><input type='checkbox' id='chk[" . $row->id_suggestion . "]' name='chk[]' value='" . $row->id_suggestion . "' /></td>\n\t\t\t\t\t</tr>"; $aff_row .= "\t\t<tr class='" . $pair_impair . "' " . $tr_javascript_l2 . " style='cursor: pointer' >\n\t\t\t\t\t\t<td colspan='" . $colspan . "' " . $dn_javascript . " ><i>" . htmlentities($row->commentaires, ENT_QUOTES, $charset) . "</i></td>\n\t\t\t\t\t</tr>"; } $sug_list_form = str_replace('<!-- sug_list -->', $aff_row, $sug_list_form); //Affichage des boutons //Bouton Imprimer $imp = "openPopUp('./pdf.php?pdfdoc=listsug&user_input=" . urlencode(stripslashes($user_input)) . "&statut=" . $statut . "&num_categ=" . $num_categ . "&sugg_location_id=" . $sugg_location_id . "' ,'print_PDF', 600, 500, -2, -2, 'toolbar=no, dependent=yes, resizable=yes');"; $bt_imp = str_replace('!!imp!!', $imp, $bt_imp); $sug_list_form = str_replace('<!-- bt_imp -->', $bt_imp, $sug_list_form); //Génération de la liste des conversions possibles $catalog = _parser_text_no_function_(file_get_contents($base_path . "/admin/convert/imports/catalog.xml"), "CATALOG"); $list_export = "<select name='export_list'>"; for ($i = 0; $i < count($catalog["ITEM"]); $i++) { $item = $catalog["ITEM"][$i]; if ($item["EXPORT"] == "yes") { $list_export .= "<option value='" . $i . "'>" . htmlentities($item["EXPORTNAME"], ENT_QUOTES, $charset) . "</option>\n"; } } $list_export .= "</select>"; $bt_exporter = str_replace("<!-- list_export -->", $list_export, $bt_exporter); //Lien vers la page suivante $link_export = "document.sug_list_form.action='acquisition.php?categ=sug&sub=export'; document.sug_list_form.submit();"; $bt_exporter = str_replace("!!exp!!", $link_export, $bt_exporter); $sug_list_form = str_replace('<!-- bt_exporter -->', $bt_exporter, $sug_list_form); //Bouton Sélectionner $sug_list_form = str_replace('<!-- bt_chk -->', $bt_chk, $sug_list_form); //Liste Boutons $button_list = $sug_map->getButtonList($statut); $sug_list_form = str_replace('<!-- bt_list -->', $button_list, $sug_list_form); //Bouton Reprendre $bt_todo = $sug_map->getButtonList_TODO($statut); $sug_list_form = str_replace('<!-- bt_todo -->', $bt_todo, $sug_list_form); if ($acquisition_sugg_categ == '1') { //Selecteur Affecter a une categorie $to_categ = $sug_map->getCategModifier($statut, $num_categ, $nb_per_page); } else { $to_categ = ""; } $sug_list_form = str_replace('<!-- to_categ -->', $to_categ, $sug_list_form); //Bouton Supprimer $button_sup = $sug_map->getButtonList_DELETED($statut); $sug_list_form = str_replace('<!-- bt_sup -->', $button_sup, $sug_list_form); //JavaScript $script_list = $sug_map->getScriptList($statut, $num_categ, $nb_per_page); $script = str_replace('<!-- script_list -->', $script_list, $script); $sug_list_form = str_replace('<!-- script -->', $script, $sug_list_form); //Barre de navigation if (!$last_param) { $nav_bar = aff_pagination($url_base, $nbr_lignes, $nb_per_page, $page, 10, true, true); } else { $nav_bar = ""; } $sug_list_form = str_replace('<!-- nav_bar -->', $nav_bar, $sug_list_form); print $sug_list_form; } else { // la requête n'a produit aucun résultat error_message($msg['acquisition_sug_rech'], str_replace('!!sug_cle!!', stripslashes($user_input), $msg['acquisition_sug_rech_error']), 0, './categ=sug&sub=todo&action=list&id_bibli=' . $id_bibli); } }
$statut_clause = ""; } else { $statut_clause = "and statut='" . $statut . "'"; } $req = "select count(id_suggestion) as nb, concat(empr_nom,' ',empr_prenom) as nom, id_empr as id, empr_location from suggestions, suggestions_origine, empr\n where origine=id_empr and num_suggestion=id_suggestion and type_origine=1 {$statut_clause} group by nom"; $res = pmb_mysql_query($req, $dbh); $aff = "\n\t<h1>" . $msg['acquisition_sug_ges'] . "</h1>\n\t<form name='list_lecteur_sug' method='post' action='./acquisition.php?categ=sug&sub=empr_sug'>\n\t<h3>" . $msg['acquisition_sugg_list_lecteur'] . "</h3>\n\t<div class='form-contenu'>\n\t\t<div class='row'>\n\t\t\t<label class='etiquette'>" . $msg['acquisition_sugg_filtre_by_etat'] . "\n\t\t\t</label>\t\n\t\t</div>\n\t\t<div class='row'> " . $sug_map->getStateSelector() . "\n\t\t</div>\n\t\t<table>\n\t\t\t<tr>\n\t\t\t\t<th>" . $msg['acquisition_sugg_lecteur'] . "</th>\n\t\t\t\t<th>" . $msg['acquisition_sugg_nb'] . "</th>\n\t\t\t</tr>"; if (!pmb_mysql_num_rows($res)) { $aff .= "<tr><td>" . htmlentities($msg['acquisition_sugg_no_state_lecteur'], ENT_QUOTES, $charset) . "</td></tr>"; } else { $parity = 1; while ($empr = pmb_mysql_fetch_object($res)) { if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = "onclick=\"document.location='./acquisition.php?categ=sug&action=list&user_id[]=" . $empr->id . "&user_statut[]=1&sugg_location_id=" . $empr->empr_location . "' \" "; $aff .= "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td>" . $empr->nom . "</td><td>" . $empr->nb . "</td></tr>"; } } $aff .= "</table>\n\t</div>\n\t</form>"; if (!$statut) { $statut = getSessionSugState(); //Recuperation du statut courant } else { setSessionSugState($statut); } $aff .= "<script type='text/javascript' >this.document.forms['list_lecteur_sug'].elements['statut'].value = '" . $statut . "' </script>"; print $aff;