function show_abts($dbh) { global $msg; global $charset; print "<table>\n\t\t<tr>\n\t\t<th>" . $msg[103] . "</th>\n\t\t<th style='display:none'>" . $msg["type_abts_prepay"] . "</th>\n\t\t<th style='display:none'>" . $msg["type_abts_prepay_dflt"] . "</th>\n\t\t<th>" . $msg["type_abts_tarif"] . "</th>\n\t\t<th>" . $msg["type_abts_caution"] . "</th>\n\t\t</tr>"; // affichage du tableau des utilisateurs $requete = "SELECT id_type_abt, type_abt_libelle, prepay, prepay_deflt_mnt,tarif,caution FROM type_abts ORDER BY type_abt_libelle,id_type_abt"; $res = pmb_mysql_query($requete, $dbh); $nbr = pmb_mysql_num_rows($res); $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = pmb_mysql_fetch_row($res); if ($row[2]) { $prepay = "x"; } if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=finance&sub=abts&action=modif&id={$row['0']}';\" "; print pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td>" . htmlentities($row[1], ENT_QUOTES, $charset) . "</td>\n\t\t\t<td style='text-align:center;display:none'>{$prepay}</td><td style='display:none'>" . $row[3] . "</td><td>" . $row[4] . "</td><td>" . $row[5] . "</td>\n\t\t\t\t\t\t</tr>"); } print "</table>\n\t\t<input class='bouton' type='button' value=\" " . $msg["type_abts_add"] . " \" onClick=\"document.location='./admin.php?categ=finance&sub=abts&action=add'\" />"; }
function retrieve_shelf_content($shelf_id, $OPACUserId) { global $dbh; $shelf_id += 0; if (!$shelf_id) { return array(); } //droits d'acces emprunteur/notice $acces_j = ''; global $gestion_acces_active, $gestion_acces_empr_notice; if ($OPACUserId != -1 && $gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { $ac = new acces(); $dom_2 = $ac->setDomain(2); $acces_j = $dom_2->getJoin($empr_id, 4, 'notice_id'); } if ($acces_j) { $statut_j = ''; $statut_r = ''; } else { $statut_j = ',notice_statut'; $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0) or (notice_visible_opac_abon=1 and notice_visible_opac=1)) "; } $sql = "SELECT object_id FROM etagere LEFT JOIN etagere_caddie ON (etagere_id = idetagere) LEFT JOIN caddie_content ON (caddie_content.caddie_id = etagere_caddie.caddie_id) LEFT JOIN notices ON (object_id = notice_id) {$acces_j} {$statut_j} WHERE etagere_id = " . $shelf_id . " AND object_id {$statut_r} GROUP BY object_id"; $res = pmb_mysql_query($sql, $dbh); $results = array(); while ($row = pmb_mysql_fetch_row($res)) { $results[] = $row[0]; } return $results; }
function fetch_data() { global $include_path; global $PMBuserid; $this->info = array(); $this->users = array(); $requete_users = "SELECT userid, username FROM users order by username "; $res_users = pmb_mysql_query($requete_users); $this->all_users = array(); while (list($this->all_userid, $all_username) = pmb_mysql_fetch_row($res_users)) { $this->all_users[] = array($this->all_userid, $all_username); } if (!$this->id) { $this->users[] = $PMBuserid; return; } $req = "select * from mailtpl where id_mailtpl=" . $this->id; $resultat = pmb_mysql_query($req); if (pmb_mysql_num_rows($resultat)) { $r = pmb_mysql_fetch_object($resultat); $this->info['id'] = $r->id_mailtpl; $this->info['name'] = $r->mailtpl_name; $this->info['objet'] = $r->mailtpl_objet; $this->info['tpl'] = $r->mailtpl_tpl; $this->info['users'] = $r->mailtpl_users; } $this->users = explode(" ", $this->info['users']); // printr($this->info[28]); }
function show_procs($idcaddie) { global $msg; global $PMBuserid; global $dbh; print "<table>"; // affichage du tableau des procédures if ($PMBuserid != 1) { $where = " and (autorisations='{$PMBuserid}' or autorisations like '{$PMBuserid} %' or autorisations like '% {$PMBuserid} %' or autorisations like '% {$PMBuserid}') "; } $requete = "SELECT idproc, type, name, requete, comment, autorisations, parameters FROM caddie_procs WHERE type='SELECT' {$where} ORDER BY name "; $res = pmb_mysql_query($requete, $dbh); $nbr = pmb_mysql_num_rows($res); $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = pmb_mysql_fetch_row($res); $rqt_autorisation = explode(" ", $row[5]); if (array_search($PMBuserid, $rqt_autorisation) !== FALSE || $PMBuserid == 1) { if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; if (preg_match_all("|!!(.*)!!|U", $row[3], $query_parameters)) { $action = "form_proc"; } else { $action = "pointe_item"; } $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./catalog.php?categ=caddie&sub=pointage&moyen=selection&action={$action}&id={$row['0']}&idcaddie={$idcaddie}';\" "; print pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n\t\t\t\t\t<td>\n\t\t\t\t\t\t<strong>{$row['2']}</strong><br />\n\t\t\t\t\t\t<small>{$row['4']} </small>\n\t\t\t\t\t\t</td>\n\t\t\t\t</tr>"); } } print "</table>"; }
function do_selector_bul_section($section_id, $location_id) { global $dbh; global $charset; global $deflt_section; global $deflt_location; if (!$section_id) { $section_id = $deflt_section; } if (!$location_id) { $location_id = $deflt_location; } $rqtloc = "SELECT idlocation FROM docs_location order by location_libelle"; $resloc = pmb_mysql_query($rqtloc, $dbh); while ($loc = pmb_mysql_fetch_object($resloc)) { $requete = "SELECT idsection, section_libelle FROM docs_section, docsloc_section where idsection=num_section and num_location='{$loc->idlocation}' order by section_libelle"; $result = pmb_mysql_query($requete, $dbh); $nbr_lignes = pmb_mysql_num_rows($result); if ($nbr_lignes) { if ($loc->idlocation == $location_id) { $selector .= "<div id=\"docloc_section" . $loc->idlocation . "\" style=\"display:block\">"; } else { $selector .= "<div id=\"docloc_section" . $loc->idlocation . "\" style=\"display:none\">"; } $selector .= "<select name='f_ex_section" . $loc->idlocation . "' id='f_ex_section" . $loc->idlocation . "'>"; while ($line = pmb_mysql_fetch_row($result)) { $selector .= "<option value='{$line['0']}'"; $line[0] == $section_id ? $selector .= ' SELECTED>' : ($selector .= '>'); $selector .= htmlentities($line[1], ENT_QUOTES, $charset) . '</option>'; } $selector .= '</select></div>'; } } return $selector; }
function ajax_verif_date() { global $msg, $p1; $mysql_date = extraitdate($p1); $rqt = "SELECT DATE_ADD('" . $mysql_date . "', INTERVAL 0 DAY)"; if ($result = pmb_mysql_query($rqt)) { if ($row = pmb_mysql_fetch_row($result)) { if ($row[0]) { ajax_http_send_response($row[0]); return; } } } ajax_http_send_error('400', $msg['error_message_invalid_date']); }
function show_procs($dbh) { global $msg; global $charset; global $PMBuserid, $javascript_path, $form_notice_tpl; print "\n\t\t<script type=\"text/javascript\" src=\"" . $javascript_path . "/tablist.js\"></script>\n\t\t<a href=\"javascript:expandAll()\"><img src='./images/expand_all.gif' border='0' id=\"expandall\"></a>\n\t\t<a href=\"javascript:collapseAll()\"><img src='./images/collapse_all.gif' border='0' id=\"collapseall\"></a>\n\t\t"; // affichage du tableau des procédures $requete = "SELECT idproc, name, requete, comment, autorisations, libproc_classement, num_classement FROM procs left join procs_classements on idproc_classement=num_classement ORDER BY libproc_classement,name "; $res = pmb_mysql_query($requete, $dbh); $nbr = pmb_mysql_num_rows($res); $class_prec = $msg[proc_clas_aucun]; $buf_tit = ""; $buf_class = 0; $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = pmb_mysql_fetch_row($res); $rqt_autorisation = explode(" ", $row[4]); if (($PMBuserid == 1 || array_search($PMBuserid, $rqt_autorisation) !== FALSE) && pmb_strtolower(pmb_substr(trim($row[2]), 0, 6)) == 'select') { $classement = $row[5]; if ($class_prec != $classement) { if (!$row[5]) { $row[5] = $msg[proc_clas_aucun]; } if ($buf_tit) { $buf_contenu = "<table><tr><th colspan=4>" . $buf_tit . "</th></tr>" . $buf_contenu . "</table>"; print gen_plus("procclass" . $buf_class, $buf_tit, $buf_contenu); $buf_contenu = ""; } $buf_tit = $row[5]; $buf_class = $row[6]; $class_prec = $classement; } if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity++; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./edit.php?categ=procs&sub=&action=execute&id_proc={$row['0']}';\" "; $buf_contenu .= "\n<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>\n\t\t\t\t\t<td><strong>{$row['1']}</strong><br />\n\t\t\t\t\t\t<small>{$row['3']}</small></td>\n\t\t\t\t</tr>"; } } $buf_contenu = "<table><tr><th colspan=4>" . $buf_tit . "</th></tr>" . $buf_contenu . "</table>"; print gen_plus("procclass" . $buf_class, $buf_tit, $buf_contenu); }
function show_procs($dbh) { global $msg; global $PMBuserid; print "<hr /><table>"; // affichage du tableau des procédures if ($PMBuserid != 1) { $where = " where (autorisations='{$PMBuserid}' or autorisations like '{$PMBuserid} %' or autorisations like '% {$PMBuserid} %' or autorisations like '% {$PMBuserid}') "; } $requete = "SELECT idproc, type, name, requete, comment, autorisations FROM caddie_procs {$where} ORDER BY type, name "; $res = pmb_mysql_query($requete, $dbh); $nbr = pmb_mysql_num_rows($res); $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = pmb_mysql_fetch_row($res); $rqt_autorisation = explode(" ", $row[5]); if (array_search($PMBuserid, $rqt_autorisation) !== FALSE || $PMBuserid == 1) { if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $action = " onmousedown=\"document.location='./catalog.php?categ=caddie&sub=gestion&quoi=procs&action=modif&id={$row['0']}';\""; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" "; print "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'>"; if ($row[1] != "ACTION") { print "\t<td width='10'><input class='bouton' type='button' value=' {$msg['procs_options_tester_requete']} ' onClick=\"document.location='./catalog.php?categ=caddie&sub=gestion&quoi=procs&action=execute&id={$row['0']}'\" />"; } else { print "\t<td width='10' {$action}> "; } print pmb_bidi("\n\t\t\t\t\t</td>\n\t\t\t\t\t<td width='80' {$action}>\n\t\t\t\t\t\t{$row['1']}\n\t\t\t\t\t\t</td>\n\t\t\t\t\t<td {$action}>\n\t\t\t\t\t\t<strong>{$row['2']}</strong><br />\n\t\t\t\t\t\t<small>{$row['4']} </small>\n\t\t\t\t\t\t</td>"); if (preg_match_all("|!!(.*)!!|U", $row[3], $query_parameters)) { print "<td><a href='catalog.php?categ=caddie&sub=gestion&quoi=procs&action=configure&id_query=" . $row[0] . "'>{$msg['procs_options_config_param']}</a>"; } else { print "<td {$action}> "; } print "</td>"; print "<td><input class='bouton' type='button' value=\"" . $msg[procs_bt_export] . "\" onClick=\"document.location='./export.php?quoi=procs&sub=caddie&id={$row['0']}'\" /></td>\n\t\t\t\t\t\t</tr>"; } } print "</table><hr />\n\t\t<input class='bouton' type='button' value=' {$msg['704']} ' onClick=\"document.location='./catalog.php?categ=caddie&sub=gestion&quoi=procs&action=add'\" />\n\t\t<input class='bouton' type='button' value=' {$msg['procs_bt_import']} ' onClick=\"document.location='./catalog.php?categ=caddie&sub=gestion&quoi=procs&action=import'\" />"; }
function show_section($dbh) { global $msg; global $pmb_gestion_financiere, $pmb_gestion_abonnement; if ($pmb_gestion_financiere) { $gestion_abts = $pmb_gestion_abonnement; } else { $gestion_abts = 0; } print "<table>\n\t<tr>\n\t\t<th>" . $msg[103] . "</th>\n\t\t<th>" . $msg[1400] . "</th>"; if ($gestion_abts) { print "<th>" . $msg["empr_categ_tarif"] . "</th>"; } print "<th>" . $msg["empr_categ_age_min"] . "</th>\n\t\t<th>" . $msg["empr_categ_age_max"] . "</th>\n\t</tr>"; // affichage du tableau des utilisateurs $requete = "SELECT id_categ_empr, libelle, duree_adhesion, tarif_abt, age_min, age_max FROM empr_categ ORDER BY libelle, id_categ_empr"; $res = pmb_mysql_query($requete, $dbh); $nbr = pmb_mysql_num_rows($res); $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = pmb_mysql_fetch_row($res); if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=empr&sub=categ&action=modif&id={$row['0']}';\" "; print pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td>{$row['1']}</td>\n\t\t\t\t\t\t<td>{$row['2']}</td>"); if ($gestion_abts == 1) { $tarif = $row[3]; } else { if ($gestion_abts == 2) { $tarif = $msg["finance_see_finance"]; } } if ($gestion_abts) { print "<td>" . $tarif . "</td>"; } print "<td>" . $row[4] . "</td>\n\t\t\t\t<td>" . $row[5] . "</td>\n\t\t\t\t\t</tr>"; } print "</table>\n\t\t<input class='bouton' type='button' value=' {$msg['524']} ' onClick=\"document.location='./admin.php?categ=empr&sub=categ&action=add'\" />"; }
function show_list_biblio() { global $dbh; global $msg; global $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); $user_userid = $row_user[0]; //Affichage de la liste des etablissements auxquels a acces l'utilisateur $aff = "<table>"; $q = entites::list_biblio($user_userid); $res = pmb_mysql_query($q, $dbh); $nbr = pmb_mysql_num_rows($res); if (!$nbr) { //Pas d'etablissements définis pour l'utilisateur $error = true; $error_msg .= htmlentities($msg["acquisition_err_coord"], ENT_QUOTES, $charset) . "<div class='row'></div>"; } if ($error) { error_message($msg[321], $error_msg . htmlentities($msg["acquisition_err_par"], ENT_QUOTES, $charset), '1', './admin.php?categ=acquisition'); die; } if ($nbr == '1') { $row = pmb_mysql_fetch_object($res); show_list_exer($row->id_entite); } else { $parity = 1; while ($row = pmb_mysql_fetch_object($res)) { if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=acquisition&sub=compta&action=list&ent={$row->id_entite}';\" "; $aff .= "<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td><i>{$row->raison_sociale}</i></td></tr>"; } $aff .= "</table>"; print $aff; } }
function aff_form_autorisations_etagere($param_autorisations = "1", $creation_etagere = "1") { global $dbh; global $msg; global $PMBuserid; $requete_users = "SELECT userid, username FROM users order by username "; $res_users = pmb_mysql_query($requete_users, $dbh); $all_users = array(); while (list($all_userid, $all_username) = pmb_mysql_fetch_row($res_users)) { $all_users[] = array($all_userid, $all_username); } if ($creation_etagere) { $param_autorisations .= " " . $PMBuserid; } $autorisations_donnees = explode(" ", $param_autorisations); for ($i = 0; $i < count($all_users); $i++) { if (array_search($all_users[$i][0], $autorisations_donnees) !== FALSE) { $autorisation[$i][0] = 1; } else { $autorisation[$i][0] = 0; } $autorisation[$i][1] = $all_users[$i][0]; $autorisation[$i][2] = $all_users[$i][1]; } $autorisations_users = ""; $id_check_list = ''; while (list($row_number, $row_data) = each($autorisation)) { $id_check = "auto_" . $row_data[1]; if ($id_check_list) { $id_check_list .= '|'; } $id_check_list .= $id_check; if ($row_data[1] == 1) { $autorisations_users .= "<span class='usercheckbox'><input type='checkbox' name='etagere_autorisations[]' value='" . $row_data[1] . "' id='{$id_check}' checked class='checkbox' readonly /><label for='{$id_check}' class='normlabel'> " . $row_data[2] . "</label></span> "; } elseif ($row_data[0]) { $autorisations_users .= "<span class='usercheckbox'><input type='checkbox' name='etagere_autorisations[]' value='" . $row_data[1] . "' id='{$id_check}' checked class='checkbox' /><label for='{$id_check}' class='normlabel'> " . $row_data[2] . "</label></span> "; } else { $autorisations_users .= "<span class='usercheckbox'><input type='checkbox' name='etagere_autorisations[]' value='" . $row_data[1] . "' id='{$id_check}' class='checkbox' /><label for='{$id_check}' class='normlabel'> " . $row_data[2] . "</label></span> "; } } $autorisations_users .= "<input type='hidden' id='auto_id_list' name='auto_id_list' value='{$id_check_list}' >"; return $autorisations_users; }
function show_codstat($dbh) { global $msg; print "<table>\n\t\t<tr>\n\t\t<th>" . $msg[103] . "</th>\n\t\t</tr>"; // affichage du tableau des utilisateurs $requete = "SELECT idcode, libelle FROM empr_codestat ORDER BY libelle, idcode "; $res = pmb_mysql_query($requete, $dbh); $nbr = pmb_mysql_num_rows($res); $parity = 1; for ($i = 0; $i < $nbr; $i++) { $row = pmb_mysql_fetch_row($res); if ($parity % 2) { $pair_impair = "even"; } else { $pair_impair = "odd"; } $parity += 1; $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./admin.php?categ=empr&sub=codstat&action=modif&id={$row['0']}';\" "; print pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td>{$row['1']}</td>\n\t\t\t\t\t\t</tr>"); } print "</table>\n\t\t<input class='bouton' type='button' value=' {$msg['99']} ' onClick=\"document.location='./admin.php?categ=empr&sub=codstat&action=add'\" />"; }
function mysqlTable($action) { global $pmb_set_time_limit, $dbh; if (SESSrights & ADMINISTRATION_AUTH) { $result = array(); if ($action) { @set_time_limit($pmb_set_time_limit); $db = DATA_BASE; $tables = pmb_mysql_list_tables($db); $num_tables = @pmb_mysql_num_rows($tables); $i = 0; while ($i < $num_tables) { $table[$i] = pmb_mysql_tablename($tables, $i); $i++; } while (list($cle, $valeur) = each($table)) { $requete = $action . " TABLE " . $valeur . " "; $res = @pmb_mysql_query($requete, $dbh); $nbr_lignes = @pmb_mysql_num_rows($res); if ($nbr_lignes) { for ($i = 0; $i < $nbr_lignes; $i++) { $row = pmb_mysql_fetch_row($res); $tab = array(); foreach ($row as $dummykey => $col) { if (!$col) { $col = " "; } $tab[$dummykey] = $col; } $result[] = $tab; } } } } return $result; } else { return array(); } }
$rqt = "ALTER TABLE users ADD deflt3liv_statut int(3) not null default '-1' "; echo traite_rqt($rqt, "ALTER TABLE users ADD default liv state"); $rqt = "ALTER TABLE users ADD deflt3fac_statut int(3) not null default '-1' "; echo traite_rqt($rqt, "ALTER TABLE users ADD default fac state"); $rqt = "ALTER TABLE users ADD deflt3sug_statut int(3) not null default '-1' "; echo traite_rqt($rqt, "ALTER TABLE users ADD default sug state"); //Modification de la table external_count $sql_alter_external_count = "ALTER TABLE external_count ADD source_id INT NOT NULL "; echo traite_rqt($sql_alter_external_count, "Modification de la table external_count 1"); $sql_alter_external_count = "UPDATE external_count, entrepots SET external_count.source_id = entrepots.source_id WHERE entrepots.recid = external_count.rid "; echo traite_rqt($sql_alter_external_count, "Modification de la table external_count 2"); //Récupération de la liste des sources $sql_liste_sources = "SELECT source_id FROM connectors_sources "; $res_liste_sources = pmb_mysql_query($sql_liste_sources, $dbh) or die(pmb_mysql_error()); //Pour chaque source while ($row = pmb_mysql_fetch_row($res_liste_sources)) { //On créer la table $sql_create_table = "CREATE TABLE entrepot_source_" . $row[0] . " (\n\t\t\t\t\t\t\t connector_id varchar(20) NOT NULL default '',\n\t\t\t\t\t\t\t source_id int(11) unsigned NOT NULL default 0,\n\t\t\t\t\t\t\t ref varchar(220) NOT NULL default '',\n\t\t\t\t\t\t\t date_import datetime NOT NULL default '0000-00-00 00:00:00',\n\t\t\t\t\t\t\t ufield char(3) NOT NULL default '',\n\t\t\t\t\t\t\t usubfield char(1) NOT NULL default '',\n\t\t\t\t\t\t\t field_order int(10) unsigned NOT NULL default 0,\n\t\t\t\t\t\t\t subfield_order int(10) unsigned NOT NULL default 0,\n\t\t\t\t\t\t\t value text NOT NULL,\n\t\t\t\t\t\t\t i_value text NOT NULL,\n\t\t\t\t\t\t\t recid bigint(20) unsigned NOT NULL default 0,\n\t\t\t\t\t\t\t search_id varchar(32) NOT NULL default '',\n\t\t\t\t\t\t\t PRIMARY KEY (connector_id,source_id,ref,ufield,usubfield,field_order,subfield_order,search_id),\n\t\t\t\t\t\t\t KEY usubfield (usubfield),\n\t\t\t\t\t\t\t KEY ufield_2 (ufield,usubfield),\n\t\t\t\t\t\t\t KEY recid_2 (recid,ufield,usubfield),\n\t\t\t\t\t\t\t KEY source_id (source_id),\n\t\t\t\t\t\t\t KEY i_recid_source_id (recid,source_id)\n\t\t\t\t\t\t\t) "; echo traite_rqt($sql_create_table, "CREATE TABLE entrepot_source_" . $row[0]); //On copie les éléments de la source dans sa nouvelle table $sql_transfer = "INSERT INTO entrepot_source_" . $row[0] . " (SELECT * FROM entrepots WHERE source_id = " . $row[0] . ")"; echo traite_rqt($sql_transfer, "INSERT INTO entrepot_source_" . $row[0]); } // +-------------------------------------------------+ echo "</table>"; $rqt = "update parametres set valeur_param='" . $action . "' where type_param='pmb' and sstype_param='bdd_version' "; $res = pmb_mysql_query($rqt, $dbh); echo "<strong><font color='#FF0000'>" . $msg[1807] . $action . " !</font></strong><br />"; echo form_relance("v4.66"); break; case "v4.66":
function show_form() { global $msg; global $dbh; global $charset, $lang; global $search_form_map; global $all_query, $typdoc_query, $statut_query, $docnum_query, $pmb_indexation_docnum_allfields, $pmb_indexation_docnum; global $categ_query, $thesaurus_auto_postage_search, $auto_postage_query; global $thesaurus_concepts_active, $concept_query; global $map_echelle_query, $map_projection_query, $map_ref_query, $map_equinoxe_query; global $pmb_map_size_search_edition; global $pmb_map_base_layer_type; global $pmb_map_base_layer_params; global $map_emprises_query; // on commence par créer le champ de sélection de document // récupération des types de documents utilisés. $query = "SELECT count(typdoc), typdoc "; $query .= "FROM notices where typdoc!='' GROUP BY typdoc"; $result = @pmb_mysql_query($query, $dbh); $toprint_typdocfield .= " <option value=''>{$msg['tous_types_docs']}</option>\n"; $doctype = new marc_list('doctype'); while ($rt = pmb_mysql_fetch_row($result)) { $obj[$rt[1]] = 1; $qte[$rt[1]] = $rt[0]; } foreach ($doctype->table as $key => $libelle) { if ($obj[$key] == 1) { $toprint_typdocfield .= " <option "; $toprint_typdocfield .= " value='{$key}'"; if ($typdoc == $key) { $toprint_typdocfield .= " selected='selected' "; } $toprint_typdocfield .= ">" . htmlentities($libelle . " (" . $qte[$key] . ")", ENT_QUOTES, $charset) . "</option>\n"; } } // récupération des statuts de documents utilisés. $query = "SELECT count(statut), id_notice_statut, gestion_libelle "; $query .= "FROM notices, notice_statut where id_notice_statut=statut GROUP BY id_notice_statut order by gestion_libelle"; $result = pmb_mysql_query($query, $dbh); $toprint_statutfield .= " <option value=''>{$msg['tous_statuts_notice']}</option>\n"; while ($obj = @pmb_mysql_fetch_row($result)) { $toprint_statutfield .= " <option value='{$obj['1']}'"; if ($statut_query == $obj[1]) { $toprint_statutfield .= " selected"; } $toprint_statutfield .= ">" . htmlentities($obj[2] . " (" . $obj[0] . ")", ENT_QUOTES, $charset) . "</OPTION>\n"; } $search_form_map = str_replace("!!typdocfield!!", $toprint_typdocfield, $search_form_map); $search_form_map = str_replace("!!statutfield!!", $toprint_statutfield, $search_form_map); $search_form_map = str_replace("!!all_query!!", htmlentities(stripslashes($all_query), ENT_QUOTES, $charset), $search_form_map); $search_form_map = str_replace("!!categ_query!!", htmlentities(stripslashes($categ_query), ENT_QUOTES, $charset), $search_form_map); if ($thesaurus_concepts_active) { $search_form_map = str_replace("!!concept_query!!", htmlentities(stripslashes($concept_query), ENT_QUOTES, $charset), $search_form_map); } // map $layer_params = json_decode($pmb_map_base_layer_params, true); $baselayer = "baseLayerType: dojox.geo.openlayers.BaseLayerType." . $pmb_map_base_layer_type; if (count($layer_params)) { if ($layer_params['name']) { $baselayer .= ",baseLayerName:\"" . $layer_params['name'] . "\""; } if ($layer_params['url']) { $baselayer .= ",baseLayerUrl:\"" . $layer_params['url'] . "\""; } if ($layer_params['options']) { $baselayer .= ",baseLayerOptions:" . json_encode($layer_params['options']); } } $size = explode("*", $pmb_map_size_search_edition); if (count($size) != 2) { $map_size = "width:800px; height:480px;"; } $map_size = "width:" . $size[0] . "px; height:" . $size[1] . "px;"; if (!$map_emprises_query) { $map_emprises_query = array(); } $map_holds = array(); foreach ($map_emprises_query as $map_hold) { $map_holds[] = array("wkt" => $map_hold, "type" => "search", "color" => null, "objects" => array()); } $r = "<div id='map_search' data-dojo-type='apps/map/map_controler' style='{$map_size}' data-dojo-props='" . $baselayer . ",mode:\"search_criteria\",hiddenField:\"map_emprises_query\",searchHolds:" . json_encode($map_holds, true) . "'></div>"; $search_form_map = str_replace("!!map!!", $r, $search_form_map); //champs maps $requete = "SELECT map_echelle_id, map_echelle_name FROM map_echelles ORDER BY map_echelle_name "; $projections = gen_liste($requete, "map_echelle_id", "map_echelle_name", "map_echelle_query", "", $map_echelle_query, 0, "", 0, $msg['map_echelle_vide']); $search_form_map = str_replace("!!map_echelle_list!!", $projections, $search_form_map); $requete = "SELECT map_projection_id, map_projection_name FROM map_projections ORDER BY map_projection_name "; $projections = gen_liste($requete, "map_projection_id", "map_projection_name", "map_projection_query", "", $map_projection_query, 0, "", 0, $msg['map_projection_vide']); $search_form_map = str_replace("!!map_projection_list!!", $projections, $search_form_map); $requete = "SELECT map_ref_id, map_ref_name FROM map_refs ORDER BY map_ref_name "; $refs = gen_liste($requete, "map_ref_id", "map_ref_name", "map_ref_query", "", $map_ref_query, 0, "", 0, $msg['map_ref_vide']); $search_form_map = str_replace("!!map_ref_list!!", $refs, $search_form_map); $search_form_map = str_replace("!!map_equinoxe_value!!", $map_equinoxe_query, $search_form_map); $checkbox = ""; if ($thesaurus_auto_postage_search) { $checkbox = "\n\t\t\t<div class='colonne'>\n\t\t\t\t<div class='row'>\n\t\t\t\t\t<input type='checkbox' !!auto_postage_checked!! id='auto_postage_query' name='auto_postage_query'/><label for='auto_postage_query'>" . $msg["search_autopostage_check"] . "</label>\n\t\t\t\t</div>\n\t\t\t</div>"; $checkbox = str_replace("!!auto_postage_checked!!", $auto_postage_query ? 'checked' : '', $checkbox); } $search_form_map = str_replace("!!auto_postage!!", $checkbox, $search_form_map); if ($pmb_indexation_docnum) { $checkbox = "<div class='colonne'>\n\t\t\t<div class='row'>\n\t\t\t<input type='checkbox' !!docnum_query_checked!! id='docnum_query' name='docnum_query'/><label for='docnum_query'>{$msg['docnum_indexation']}</label>\n\t\t\t</div>\n\t\t\t</div>"; $checkbox = str_replace("!!docnum_query_checked!!", $pmb_indexation_docnum_allfields || $docnum_query ? 'checked' : '', $checkbox); $search_form_map = str_replace("!!docnum_query!!", $checkbox, $search_form_map); } else { $search_form_map = str_replace("!!docnum_query!!", '', $search_form_map); } $search_form_map = str_replace("!!base_url!!", $this->base_url, $search_form_map); print pmb_bidi($search_form_map); }
function gen_date($bul_date, $ed_date) { $d_field = explode(' ', trim($bul_date)); $nb = count($d_field); $mysql_date = ''; if ($nb == 0) { if (is_numeric($ed_date)) { $year = $ed_date; $month = '01'; $day = '01'; $mysql_date = $year . '-' . $month . '-' . $day; } else { $rqt = "SELECT curdate()"; if ($result = pmb_mysql_query($rqt)) { if ($row = pmb_mysql_fetch_row($result)) { $mysql_date = $row[0]; } } } return $mysql_date; } if ($nb > 0) { $year = $d_field[count($d_field) - 1]; } if ($nb > 1) { $str_month = strtolower($d_field[count($d_field) - 2]); switch ($str_month) { case "janvier": $month = '01'; break; case "février": case "fevrier": $month = '02'; break; case "mars": $month = '03'; break; case "avril": $month = '04'; break; case "mai": $month = '05'; break; case "juin": $month = '06'; break; case "juillet": $month = '07'; break; case "aout": case "août": $month = '08'; break; case "septembre": $month = '09'; break; case "octobre": $month = '10'; break; case "novembre": $month = '11'; break; case "décembre": case "decembre": $month = '12'; break; default: $month = '01'; break; } } if ($nb > 2) { $day = $d_field[count($d_field) - 3]; } else { $day = '01'; } $date = $year . '-' . $month . '-' . $day; $rqt = "SELECT DATE_ADD('" . $date . "', INTERVAL 0 YEAR)"; if ($result = pmb_mysql_query($rqt)) { if ($row = pmb_mysql_fetch_row($result)) { $mysql_date = $row[0]; } } if (!$mysql_date) { $rqt = "SELECT curdate()"; if ($result = pmb_mysql_query($rqt)) { if ($row = pmb_mysql_fetch_row($result)) { $mysql_date = $row[0]; } } } return $mysql_date; }
die("<br /><br />" . $valeur . "<br /><br />" . $msg["proc_param_explain_failed"] . "<br /><br />" . $erreur_explain_rqt); } $res = @pmb_mysql_query($valeur, $dbh); $nbr_lignes = @pmb_mysql_num_rows($res); $nbr_champs = @pmb_mysql_num_fields($res); if ($nbr_lignes) { echo "<table >"; for ($i = 0; $i < $nbr_champs; $i++) { // ajout de liens pour trier les pages $fieldname = pmb_mysql_field_name($res, $i); $sortasc = "<a href='{$urlbase}&sortfield=" . ($i + 1) . "&desc=0'>asc</a>"; $sortdesc = "<a href='{$urlbase}&sortfield=" . ($i + 1) . "&desc=1'>desc</a>"; print "<th>{$fieldname}</th>"; } for ($i = 0; $i < $nbr_lignes; $i++) { $row = pmb_mysql_fetch_row($res); echo "<tr>"; foreach ($row as $dummykey => $col) { if (!$col) { $col = " "; } print pmb_bidi("<td>{$col}</td>"); } echo "</tr>"; } echo "</table><hr />"; } else { print "<br /><font color='#ff0000'>" . $msg['admin_misc_lignes'] . " " . pmb_mysql_affected_rows($dbh); $err = pmb_mysql_error($dbh); if ($err) { print "<br />{$err}";
function sql_value($rqt) { $result = pmb_mysql_query($rqt); $row = pmb_mysql_fetch_row($result); return $row[0]; }
function gen_signature($id = 0) { global $dbh; global $msg; global $pmb_notice_controle_doublons; $field_list = explode(',', str_replace(' ', '', $pmb_notice_controle_doublons)); // Pas de control activé en paramétrage: Sortir. if (($metod = $field_list[0]) < 1) { return 0; } foreach ($field_list as $i => $field) { if ($i > 0) { if (!$id) { // le formulaire à lire $chaine .= $this->read_field_form($field); } else { // la base à lire $chaine .= $this->read_field_database($field, $id); } } } // encodage signature par SOUNDEX (option 2) et par md5 (32 caractères) if ($metod == 2) { $rqt = "SELECT SOUNDEX('" . addslashes($chaine) . "')"; $result = pmb_mysql_query($rqt, $dbh); if ($row = pmb_mysql_fetch_row($result)) { $chaine = $row[0]; } } $this->signature = md5($chaine); return $this->signature; }
function make_serialized_human_query($serialized) { //global $search; global $msg; global $charset; global $include_path; $to_unserialize = unserialize($serialized); $search = $to_unserialize["SEARCH"]; for ($i = 0; $i < count($search); $i++) { $op = "op_" . $i . "_" . $search[$i]; $field_ = "field_" . $i . "_" . $search[$i]; $inter = "inter_" . $i . "_" . $search[$i]; $fieldvar = "fieldvar_" . $i . "_" . $search[$i]; if (!isset($GLOBALS[${$op}])) { global ${$op}; } if (!isset($GLOBALS[${$field_}])) { global ${$field_}; } if (!isset($GLOBALS[${$inter}])) { global ${$inter}; } if (!isset($GLOBALS[${$fieldvar}])) { global ${$fieldvar}; } ${$op} = $to_unserialize[$i]["OP"]; ${$field_} = $to_unserialize[$i]["FIELD"]; ${$inter} = $to_unserialize[$i]["INTER"]; ${$fieldvar} = $to_unserialize[$i]["FIELDVAR"]; } $r = ""; for ($i = 0; $i < count($search); $i++) { $s = explode("_", $search[$i]); if ($s[0] == "f") { $title = $this->fixedfields[$s[1]]["TITLE"]; } elseif (array_key_exists($s[0], $this->pp)) { $title = $this->pp[$s[0]]->t_fields[$s[1]]["TITRE"]; } elseif ($s[0] == "s") { $title = $this->specialfields[$s[1]]["TITLE"]; } $op = "op_" . $i . "_" . $search[$i]; $operator = $this->operators[${$op}]; $field_ = "field_" . $i . "_" . $search[$i]; $field = ${$field_}; //Recuperation des variables auxiliaires $fieldvar_ = "fieldvar_" . $i . "_" . $search[$i]; $fieldvar = ${$fieldvar_}; if (!is_array($fieldvar)) { $fieldvar = array(); } $field_aff = array(); if (array_key_exists($s[0], $this->pp)) { $datatype = $this->pp[$s[0]]->t_fields[$s[1]]["DATATYPE"]; $df = $this->dynamicfields[$s[0]]["FIELD"][$this->get_id_from_datatype($datatype, $s[0])]; $q_index = $df["QUERIES_INDEX"]; $q = $df["QUERIES"][$q_index[${$op}]]; if ($q["DEFAULT_OPERATOR"]) { $operator_multi = $q["DEFAULT_OPERATOR"]; } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $this->pp[$s[0]]->get_formatted_output(array(0 => $field[$j]), $s[1]); } } elseif ($s[0] == "f") { $ff = $this->fixedfields[$s[1]]; $q_index = $ff["QUERIES_INDEX"]; $q = $ff["QUERIES"][$q_index[${$op}]]; if ($fieldvar["operator_between_multiple_authorities"]) { $operator_multi = $fieldvar["operator_between_multiple_authorities"][0]; } else { if ($q["DEFAULT_OPERATOR"]) { $operator_multi = $q["DEFAULT_OPERATOR"]; } } switch ($this->fixedfields[$s[1]]["INPUT_TYPE"]) { case "list": $options = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["OPTIONS"][0]; $opt = array(); for ($j = 0; $j < count($options["OPTION"]); $j++) { if (substr($options["OPTION"][$j]["value"], 0, 4) == "msg:") { $opt[$options["OPTION"][$j]["VALUE"]] = $msg[substr($options["OPTION"][$j]["value"], 4, strlen($options["OPTION"][$j]["value"]) - 4)]; } else { $opt[$options["OPTION"][$j]["VALUE"]] = $options["OPTION"][$j]["value"]; } } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt[$field[$j]]; } break; case "query_list": $requete = $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["value"]; if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["FILTERING"] == "yes") { $requete = str_replace("!!acces_j!!", "", $requete); $requete = str_replace("!!statut_j!!", "", $requete); $requete = str_replace("!!statut_r!!", "", $requete); } if ($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]) { $use_global = explode(",", $this->fixedfields[$s[1]]["INPUT_OPTIONS"]["QUERY"][0]["USE_GLOBAL"]); for ($j = 0; $j < count($use_global); $j++) { $var_global = $use_global[$j]; global ${$var_global}; $requete = str_replace("!!" . $var_global . "!!", ${$var_global}, $requete); } } $resultat = pmb_mysql_query($requete); $opt = array(); while ($r_ = @pmb_mysql_fetch_row($resultat)) { $opt[$r_[0]] = $r_[1]; } for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt[$field[$j]]; } break; case "marc_list": $opt = new marc_list($this->fixedfields[$s[1]]["INPUT_OPTIONS"]["NAME"][0]["value"]); for ($j = 0; $j < count($field); $j++) { $field_aff[$j] = $opt->table[$field[$j]]; } break; case "date": $field_aff[0] = format_date($field[0]); break; case "authoritie": for ($j = 0; $j < sizeof($field); $j++) { if (is_numeric($field[$j]) && ${$op} == "AUTHORITY") { switch ($ff['INPUT_OPTIONS']['SELECTOR']) { case "categorie": $field[$j] = categories::getlibelle($field[$j], $lang); break; case "auteur": $aut = new auteur($field[$j]); if ($aut->rejete) { $field[$j] = $aut->name . ', ' . $aut->rejete; } else { $field[$j] = $aut->name; } if ($aut->date) { $field[$j] .= " ({$aut->date})"; } break; case "editeur": $ed = new editeur($field[$j]); $field[$j] = $ed->name; if ($ed->ville) { if ($ed->pays) { $field[$j] .= " ({$ed->ville} - {$ed->pays})"; } else { $field[$j] .= " ({$ed->ville})"; } } break; case "collection": $coll = new collection($field[$j]); $field[$j] = $coll->name; break; case "subcollection": $coll = new subcollection($field[$j]); $field[$j] = $coll->name; break; case "serie": $serie = new serie($field[$j]); $field[$j] = $serie->name; break; case "indexint": $indexint = new indexint($field[$j]); if ($indexint->comment) { $field[$j] = $indexint->name . " - " . $indexint->comment; } else { $field[$j] = $indexint->name; } if ($thesaurus_classement_mode_pmb != 0) { $field[$j] = "[" . $indexint->name_pclass . "] " . $field[$j]; } break; case "titre_uniforme": $tu = new titre_uniforme($field[$j]); $field[$j] = $tu->name; break; case "notice": $requete = "select if(serie_name is not null,if(tnvol is not null,concat(serie_name,', ',tnvol,'. ',tit1),concat(serie_name,'. ',tit1)),tit1) AS tit from notices left join series on serie_id=tparent_id where notice_id='" . $field[$j] . "' "; $res = pmb_mysql_query($requete); if ($res && pmb_mysql_num_rows($res)) { $field[$j] = pmb_mysql_result($res, 0, 0); } break; } } } $field_aff = $field; break; default: $field_aff = $field; break; } } elseif ($s[0] == "s") { //appel de la fonction make_human_query de la classe du champ special //Recherche du type $type = $this->specialfields[$s[1]]["TYPE"]; for ($is = 0; $is < count($this->tableau_speciaux["TYPE"]); $is++) { if ($this->tableau_speciaux["TYPE"][$is]["NAME"] == $type) { $sf = $this->specialfields[$s[1]]; require_once $include_path . "/search_queries/specials/" . $this->tableau_speciaux["TYPE"][$is]["PATH"] . "/search.class.php"; $specialclass = new $this->tableau_speciaux["TYPE"][$is]["CLASS"]($s[1], $i, $sf, $this); $field_aff = $specialclass->make_human_query(); $field_aff[0] = html_entity_decode(strip_tags($field_aff[0]), ENT_QUOTES, $charset); break; } } } //Ajout des variables si necessaire reset($fieldvar); $fieldvar_aff = array(); while (list($var_name, $var_value) = each($fieldvar)) { //Recherche de la variable par son nom $vvar = $this->fixedfields[$s[1]]["VAR"]; for ($j = 0; $j < count($vvar); $j++) { if ($vvar[$j]["TYPE"] == "input" && $vvar[$j]["NAME"] == $var_name) { //Calcul de la visibilite $varname = $vvar[$j]["NAME"]; $visibility = 1; $vis = $vvar[$j]["OPTIONS"]["VAR"][0]; if ($vis["NAME"]) { $vis_name = $vis["NAME"]; global ${$vis_name}; if ($vis["VISIBILITY"] == "no") { $visibility = 0; } for ($k = 0; $k < count($vis["VALUE"]); $k++) { if ($vis["VALUE"][$k]["value"] == ${$vis_name}) { if ($vis["VALUE"][$k]["VISIBILITY"] == "no") { $sub_vis = 0; } else { $sub_vis = 1; } if ($vis["VISIBILITY"] == "no") { $visibility |= $sub_vis; } else { $visibility &= $sub_vis; } break; } } } $var_list_aff = array(); $flag_aff = false; if ($visibility) { switch ($vvar[$j]["OPTIONS"]["INPUT"][0]["TYPE"]) { case "query_list": $query_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["value"]; $r_list = pmb_mysql_query($query_list); while ($line = pmb_mysql_fetch_array($r_list)) { $as = array_search($line[0], $var_value); if ($as !== false && $as !== NULL) { $var_list_aff[] = $line[1]; } } if ($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["ALLCHOICE"] == "yes" && count($var_list_aff) == 0) { $var_list_aff[] = $msg[substr($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"], 4, strlen($vvar[$j]["OPTIONS"]["INPUT"][0]["QUERY"][0]["TITLEALLCHOICE"]) - 4)]; } $fieldvar_aff[] = implode(" " . $msg["search_or"] . " ", $var_list_aff); $flag_aff = true; break; case "checkbox": $value = $var_value[0]; $label_list = $vvar[$j]["OPTIONS"]["INPUT"][0]["COMMENTS"][0]["LABEL"]; for ($indice = 0; $indice < count($label_list); $indice++) { if ($value == $label_list[$indice]["VALUE"]) { $libelle = $label_list[$indice]["value"]; break; } } $fieldvar_aff[] = $libelle; $flag_aff = true; break; } if ($flag_aff) { $fieldvar_aff[count($fieldvar_aff) - 1] = $vvar[$j]["COMMENT"] . " : " . $fieldvar_aff[count($fieldvar_aff) - 1]; } } } } } switch ($operator_multi) { case "and": $op_list = $msg["search_and"]; break; case "or": $op_list = $msg["search_or"]; break; default: $op_list = $msg["search_or"]; break; } $texte = implode(" " . $op_list . " ", $field_aff); //$texte=implode(" ".$msg["search_or"]." ",$field_aff); if (count($fieldvar_aff)) { $texte .= " [" . implode(" ; ", $fieldvar_aff) . "]"; } $inter = "inter_" . $i . "_" . $search[$i]; switch (${$inter}) { case "and": $inter_op = $msg["search_and"]; break; case "or": $inter_op = $msg["search_or"]; break; case "ex": $inter_op = $msg["search_exept"]; break; default: $inter_op = ""; break; } if ($inter_op) { $inter_op = "<strong>" . htmlentities($inter_op, ENT_QUOTES, $charset) . "</strong>"; } $r .= $inter_op . " <i><strong>" . htmlentities($title, ENT_QUOTES, $charset) . "</strong> " . htmlentities($operator, ENT_QUOTES, $charset) . " (" . htmlentities($texte, ENT_QUOTES, $charset) . ")</i> "; } return $r; }
function make_search() { global $gestion_acces_active, $gestion_acces_empr_notice, $class_path; // var_dump($_SESSION); $id = $_SESSION['last_module_search']['search_id']; $location = $_SESSION['last_module_search']['search_location']; $plettreaut = $_SESSION["last_module_search"]["search_plettreaut"]; $dcote = $_SESSION["last_module_search"]["search_dcote"]; $lcote = $_SESSION["last_module_search"]["search_lcote"]; $nc = $_SESSION["last_module_search"]["search_nc"]; $ssub = $_SESSION["last_module_search"]["search_ssub"]; /* * récupérer les infos de session */ $requete = "SELECT num_pclass FROM docsloc_section WHERE num_location='" . $location . "' AND num_section='" . $id . "' "; $res = pmb_mysql_query($requete); $type_aff_navigopac = 0; if (pmb_mysql_num_rows($res)) { $type_aff_navigopac = pmb_mysql_result($res, 0, 0); } //droits d'acces emprunteur/notice $acces_j = ''; if ($gestion_acces_active == 1 && $gestion_acces_empr_notice == 1) { require_once "{$class_path}/acces.class.php"; $ac = new acces(); $dom_2 = $ac->setDomain(2); $acces_j = $dom_2->getJoin($_SESSION['id_empr_session'], 4, 'notice_id'); } if ($acces_j) { $statut_j = ''; $statut_r = ''; } else { $statut_j = ',notice_statut'; $statut_r = "and statut=id_notice_statut and ((notice_visible_opac=1 and notice_visible_opac_abon=0)" . ($_SESSION["user_code"] ? " or (notice_visible_opac_abon=1 and notice_visible_opac=1)" : "") . ")"; } if ($_SESSION["opac_view"] && $_SESSION["opac_view_query"]) { $opac_view_restrict = " notice_id in (select opac_view_num_notice from opac_view_notices_" . $_SESSION["opac_view"] . ") "; $statut_r .= " and " . $opac_view_restrict; } if ($type_aff_navigopac == 0) { //Pas de navigation //on ne peut pas arriver ici... } elseif ($type_aff_navigopac == -1) { //Navigation par auteurs $requete = "create temporary table temp_n_id ENGINE=MyISAM ( SELECT notice_id FROM notices " . $acces_j . " JOIN exemplaires ON expl_section='" . $id . "' and expl_location='" . $location . "' and expl_notice=notice_id " . $statut_j . " WHERE 1 " . $statut_r . " GROUP BY notice_id)"; pmb_mysql_query($requete); //On récupère les notices de périodique avec au moins un exemplaire d'un bulletin dans la localisation et la section $requete = "INSERT INTO temp_n_id (SELECT notice_id FROM exemplaires JOIN bulletins ON expl_section='" . $id . "' and expl_location='" . $location . "' and expl_bulletin=bulletin_id JOIN notices ON notice_id=bulletin_notice " . $acces_j . " " . $statut_j . " WHERE 1 " . $statut_r . " GROUP BY notice_id)"; pmb_mysql_query($requete); @pmb_mysql_query("alter table temp_n_id add index(notice_id)"); //On sait par quoi doit commencer le nom de l'auteur if ($plettreaut == "num") { $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN responsability ON responsability_notice=temp_n_id.notice_id JOIN authors ON author_id=responsability_author and trim(index_author) REGEXP '^[0-9]' JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id"; } elseif ($plettreaut == "vide") { $requeteSource = "SELECT notices.notice_id FROM temp_n_id LEFT JOIN responsability ON responsability_notice=temp_n_id.notice_id LEFT JOIN notices ON notices.notice_id=temp_n_id.notice_id WHERE responsability_author IS NULL GROUP BY notices.notice_id"; } elseif ($plettreaut) { $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN responsability ON responsability_notice=temp_n_id.notice_id JOIN authors ON author_id=responsability_author and trim(index_author) REGEXP '^[" . $plettreaut . "]' JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id"; } else { $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id GROUP BY notices.notice_id"; } } else { //Navigation par un plan de classement if ($ssub) { $t_expl_cote_cond = array(); for ($i = 0; $i < count($t_dcote); $i++) { $t_expl_cote_cond[] = "expl_cote regexp '(^" . $t_dcote[$i] . " )|(^" . $t_dcote[$i] . "[0-9])|(^" . $t_dcote[$i] . "\$)|(^" . $t_dcote[$i] . ".)'"; } $expl_cote_cond = "(" . implode(" or ", $t_expl_cote_cond) . ")"; } if (!$ssub) { $requete = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires {$statut_j} "; $requete .= "where expl_location={$location} and expl_section={$id} and notice_id=expl_notice "; if (strlen($dcote)) { $requete .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' "; } $requete .= $statut_r; $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = @pmb_mysql_result($res, 0, 0); $requete2 = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} "; $requete2 .= "where expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id "; if (strlen($dcote)) { $requete2 .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' "; } $requete2 .= $statut_r; $res = pmb_mysql_query($requete2, $dbh); $nbr_lignes += @pmb_mysql_result($res, 0, 0); } else { $requete = "select COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires {$statut_j} "; $requete .= "where expl_location={$location} and expl_section={$id} and notice_id=expl_notice "; if (strlen($dcote)) { $requete .= " and {$expl_cote_cond} "; } $requete .= $statut_r; $res = pmb_mysql_query($requete, $dbh); $nbr_lignes = @pmb_mysql_result($res, 0, 0); $requete2 = "SELECT COUNT(distinct notice_id) FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} "; $requete2 .= "where expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id "; if (strlen($dcote)) { $requete2 .= "and {$expl_cote_cond} "; } $requete2 .= $statut_r; $res = pmb_mysql_query($requete2, $dbh); $nbr_lignes += @pmb_mysql_result($res, 0, 0); } if ($nbr_lignes) { //Table temporaire de tous les id $requete = "create temporary table temp_n_id ENGINE=MyISAM (select notice_id FROM notices {$acces_j} ,exemplaires {$statut_j} "; $requete .= "WHERE expl_location={$location} and expl_section={$id} and notice_id=expl_notice "; if (strlen($dcote)) { if (!$ssub) { $requete .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' "; $level_ref = strlen($dcote) + 1; } else { $requete .= "and {$expl_cote_cond} "; } } $requete .= "{$statut_r} "; $requete .= "group by notice_id) "; pmb_mysql_query($requete); $requete2 = "insert into temp_n_id (SELECT notice_id FROM notices {$acces_j} ,exemplaires, bulletins {$statut_j} "; $requete2 .= "where expl_location={$location} and expl_section={$id} and notice_id=bulletin_notice and expl_bulletin=bulletin_id "; if (strlen($dcote)) { if (!$ssub) { $requete2 .= "and expl_cote regexp '" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . "' and expl_cote not regexp '(\\\\.[0-9]*" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")|([^0-9]*[0-9]+\\\\.?[0-9]*.+" . $dcote . str_repeat("[0-9]", $lcote - strlen($dcote)) . ")' "; } else { $requete2 .= "and {$expl_cote_cond} "; } } $requete2 .= "{$statut_r} "; $requete2 .= "group by notice_id) "; @pmb_mysql_query($requete2); @pmb_mysql_query("alter table temp_n_id add index(notice_id)"); //Calcul du classement if (!$ssub) { $rq1_index = "create temporary table union1 ENGINE=MyISAM (select distinct expl_cote from exemplaires, temp_n_id where expl_location={$location} and expl_section={$id} and expl_notice=temp_n_id.notice_id) "; $res1_index = pmb_mysql_query($rq1_index); $rq2_index = "create temporary table union2 ENGINE=MyISAM (select distinct expl_cote from exemplaires, temp_n_id, bulletins where expl_location={$location} and expl_section={$id} and bulletin_notice=temp_n_id.notice_id and expl_bulletin=bulletin_id) "; $res2_index = pmb_mysql_query($rq2_index); $req_index = "select distinct expl_cote from union1 union select distinct expl_cote from union2"; $res_index = pmb_mysql_query($req_index); if ($level_ref == 0) { $level_ref = 1; } // Prepare indexint pre selection - Zend $zendIndexInt = array(); //$zendIndexIntCache = array(); $zendQ1 = "SELECT indexint_name, indexint_comment FROM indexint WHERE indexint_name NOT REGEXP '^[0-9][0-9][0-9]' AND indexint_comment != '' AND num_pclass='" . $type_aff_navigopac . "'"; $zendRes = pmb_mysql_query($zendQ1); while ($zendRow = pmb_mysql_fetch_assoc($zendRes)) { $zendIndexInt[$zendRow['indexint_name']] = $zendRow['indexint_comment']; } // Zend while ($ct = pmb_mysql_fetch_object($res_index)) { //Je regarde si le début existe dans indexint $lf = 5; $t = array(); while ($lf > 0) { $zendKey = substr($ct->expl_cote, 0, $lf); if ($zendIndexInt[$zendKey]) { if (!$nc) { $t["comment"] = $zendIndexInt[$zendKey]; $t["dcote"] = $zendKey; $t["ssub"] = 1; $index[$t["dcote"]] = $t; break; } else { $rq_del = "select distinct notice_id from notices, exemplaires where expl_cote='" . $ct->expl_cote . "' and expl_notice=notice_id "; $rq_del .= " union select distinct notice_id from notices, exemplaires, bulletins where expl_cote='" . $ct->expl_cote . "' and expl_bulletin=bulletin_id and bulletin_notice=notice_id "; $res_del = pmb_mysql_query($rq_del); while (list($n_id) = pmb_mysql_fetch_row($res_del)) { pmb_mysql_query("delete from temp_n_id where notice_id=" . $n_id); } } } $lf--; } if ($lf == 0) { if (preg_match("/[0-9][0-9][0-9]/", $ct->expl_cote, $c)) { $found = false; $lcote = 3; $level = $level_ref; while (!$found && $level <= $lcote) { $cote = substr($c[0], 0, $level); $compl = str_repeat("0", $lcote - $level); $rq_index = "select indexint_name,indexint_comment from indexint where indexint_name='" . $cote . $compl . "' and length(indexint_name)>={$lcote} and indexint_comment!='' and num_pclass='" . $type_aff_navigopac . "' order by indexint_name limit 1 "; $res_index_1 = pmb_mysql_query($rq_index); if (pmb_mysql_num_rows($res_index_1)) { $name = pmb_mysql_result($res_index_1, 0, 0); if (!$nc) { if (substr($name, 0, $level - 1) == $dcote) { $t["comment"] = pmb_mysql_result($res_index_1, 0, 1); if ($level > 1) { $cote_n_1 = substr($c[0], 0, $level - 1); $compl_n_1 = str_repeat("0", $lcote - $level + 1); if ($cote . $compl == $cote_n_1 . $compl_n_1) { $t["comment"] = "Généralités"; } } $t["lcote"] = $lcote; $t["dcote"] = $cote; $index[$name] = $t; $found = true; } else { $level++; } } else { if (substr($name, 0, $level - 1) == $dcote) { $rq_del = "select distinct notice_id from notices, exemplaires where expl_cote='" . $ct->expl_cote . "' and expl_notice=notice_id "; $rq_del .= " union select distinct notice_id from notices, exemplaires, bulletins where expl_cote='" . $ct->expl_cote . "' and expl_bulletin=bulletin_id and bulletin_notice=notice_id "; $res_del = pmb_mysql_query($rq_del); while (list($n_id) = pmb_mysql_fetch_row($res_del)) { pmb_mysql_query("delete from temp_n_id where notice_id=" . $n_id); } $found = true; } else { $level++; } } } else { $level++; } } if ($level > $lcote && $lf == 0) { $t["comment"] = $msg["l_unclassified"]; $t["lcote"] = $lcote; $t["dcote"] = $dcote; $index["NC"] = $t; } } else { $t["comment"] = $msg["l_unclassified"]; $t["lcote"] = $lcote; $t["dcote"] = $dcote; $index["NC"] = $t; } } } } if ($nc) { $nbr_lignes = pmb_mysql_result(pmb_mysql_query("select count(1) from temp_n_id"), 0, 0); } if ($nbr_lignes) { $requeteSource = "SELECT notices.notice_id FROM temp_n_id JOIN notices ON notices.notice_id=temp_n_id.notice_id "; } } } pmb_mysql_query("create temporary table t_s_navigation_section (notice_id integer unsigned not null)"); $requete = "insert into t_s_navigation_section " . $requeteSource; pmb_mysql_query($requete); pmb_mysql_query("alter table t_s_navigation_section add primary key(notice_id)"); return "t_s_navigation_section"; }
function get_ajax_list($name, $start) { global $charset, $dbh; $values = array(); reset($this->t_fields); while (list($key, $val) = each($this->t_fields)) { if ($val['NAME'] == $name) { switch ($val['TYPE']) { case 'list': $q = "select " . $this->prefix . "_custom_list_value, " . $this->prefix . "_custom_list_lib from " . $this->prefix . "_custom_lists where " . $this->prefix . "_custom_champ=" . $key . " order by ordre"; $r = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($r)) { while ($row = pmb_mysql_fetch_row($r)) { $values[$row[0]] = $row[1]; } } break; case 'query_list': $field['OPTIONS'][0] = _parser_text_no_function_("<?xml version='1.0' encoding='" . $charset . "'?>\n" . $val['OPTIONS'], 'OPTIONS'); $q = $field['OPTIONS'][0]['QUERY'][0]['value']; $r = pmb_mysql_query($q, $dbh); if (pmb_mysql_num_rows($r)) { while ($row = pmb_mysql_fetch_row($r)) { $values[$row[0]] = $row[1]; } } break; } break; } } if (count($values) && $start && $start != '%') { $filtered_values = array(); foreach ($values as $k => $v) { if (strtolower(substr($v, 0, strlen($start))) == strtolower($start)) { $filtered_values[$k] = $v; } } return $filtered_values; } return $values; }
function choix_info() { global $msg; global $current_module; global $base_path; // on n'utilse pas le template prévu pour cette étape $create_proc_form = "\n<form class='form-{$current_module}' name='search_form' action='!!url!!' method='post'>\n\t<h3>" . $msg["create_proc"] . " (!!etape!!/5)</h3>\n\t<div class='form-contenu'>\n\t\t<div class='erreur' align='justify'><img src='" . $base_path . "/images/alert.gif'>" . $msg["warn_create_proc"] . "</div>\n\t\t<br />\n\t\t<div class='row'>\n\t\t\t<label class='etiquette' for='form_name'>{$msg['705']}</label>\n\t\t</div>\n\t\t<div class='row'>\n\t\t\t<input type='text' name='nom_proc' value='' maxlength='255' class='saisie-50em' />\n\t\t</div>\n\t\t<div class='row'>\n\t\t\t<label class='etiquette' for='form_comment'>{$msg['707']}</label>\n\t\t</div>\n\t\t<div class='row'>\n\t\t\t<input type='text' name='comment' value='' maxlength='255' class='saisie-50em' />\n\t\t</div>\n\t\t<div class='row'>\n\t\t\t<label class='etiquette' for='form_comment'>{$msg['procs_autorisations']}</label>\n\t\t\t<input type='button' class='bouton_small' value='" . $msg['tout_cocher_checkbox'] . "' onclick='check_checkbox(document.getElementById(\"auto_id_list\").value,1);' align='middle'>\n\t\t\t<input type='button' class='bouton_small' value='" . $msg['tout_decocher_checkbox'] . "' onclick='check_checkbox(document.getElementById(\"auto_id_list\").value,0);' align='middle'>\n\t\t</div>\n\t\t<div class='row'>\n\t\t\t!!autorisations_users!!\n\t\t</div>\n\t</div>\n\t<div class='row'>\n\t\t<input type='submit' class='bouton' value='" . $msg["502"] . "' onClick=\"this.form.etape.value=!!etape_next!!; this.form.action='!!url_next!!'; this.form.page.value=''; \"/>\n\t</div>\n\t<input type='hidden' name='etape' value='!!etape!!'/>\n</form>"; // récupération des utilisateurs $dbh = connection_mysql(); $requete_users = "SELECT userid, username FROM users order by username "; $res_users = pmb_mysql_query($requete_users, $dbh); $autorisation = array(); while (list($all_userid, $all_username) = pmb_mysql_fetch_row($res_users)) { $autorisation[] = array(0, $all_userid, $all_username); } $autorisations_users = ""; while (list($row_number, $row_data) = each($autorisation)) { if ($row_data[0]) { $autorisations_users .= "<input type='checkbox' name='userautorisation[]' value='" . $row_data[1] . "' checked class='checkbox'> " . $row_data[2] . " "; } else { $autorisations_users .= "<input type='checkbox' name='userautorisation[]' value='" . $row_data[1] . "' class='checkbox'> " . $row_data[2] . " "; } } $create_proc_form = str_replace('!!autorisations_users!!', $autorisations_users, $create_proc_form); return $create_proc_form; }
//Recherche du no_notice le plus grand $requete_max = "select max(no_notice) from import_marc where origine='{$origine}'"; $resultat_max = pmb_mysql_query($requete_max); $no_notice = pmb_mysql_result($resultat_max, 0, 0) * 1 + 1; $z = 0; if ($_SESSION["param_export"]["notice_exporte"]) { $notice_exporte = $_SESSION["param_export"]["notice_exporte"]; } else { $notice_exporte = array(); } if ($_SESSION["param_export"]["bulletin_exporte"]) { $bulletin_exporte = $_SESSION["param_export"]["bulletin_exporte"]; } else { $bulletin_exporte = array(); } while (list($id) = pmb_mysql_fetch_row($resultat)) { if (!$specialexport) { $e_notice = array(); $param = new export_param(EXP_SESSION_CONTEXT); $e = new export(array($id), $notice_exporte, $bulletin_exporte); do { $nn = $e->get_next_notice($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context)); if ($e->notice) { $e_notice[] = $e->notice; } } while ($nn); $notice_exporte = $e->notice_exporte; //Pour les exemplaires de bulletin do { $nn = $e->get_next_bulletin($lender, $td, $sd, $keep_expl, $param->get_parametres($param->context)); if ($e->notice) {
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; }
$m = new suggestions_map(); $t = $m->getStateList(); break; case 'deflt3lgstatcde': case 'deflt3lgstatdev': $q = lgstat::getList('QUERY'); break; case 'deflt3receptsugstat': $m = new suggestions_map(); $t = $m->getStateList('ORDERED', TRUE); break; } if ($q) { $r = pmb_mysql_query($q, $dbh); $nb = pmb_mysql_num_rows($r); while ($row = pmb_mysql_fetch_row($r)) { $t[$row[0]] = $row[1]; } } if (count($t)) { $deflt3user .= "<div class='row'><div class='colonne60'>" . $msg[$field] . " : </div>\n"; $deflt3user .= "<div class='colonne_suite'><select class='saisie-30em' name=\"form_" . $field . "\">"; foreach ($t as $k => $v) { $deflt3user .= "<option value=\"" . $k . "\" "; if ($field_values[$i] == $k) { $deflt3user .= "selected='selected' "; } $deflt3user .= ">" . htmlentities($v, ENT_QUOTES, $charset) . "</option>\n"; } $deflt3user .= "</select></div></div><br />\n"; }
//Récupération du nom du créateur de la suggestion 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]; } break; case '2': $lib_orig = $orig; break; } $lib_orig = trim($lib_orig); $col1 = ""; $col1 = formatdate($row->date_creation) . "\n" . $lib_orig; $col2 = ""; if ($row->code != "") { $col2 = $row->code;
function _export_($id, $keep_expl) { global $charset; $notice = "<?xml version='1.0' encoding='" . $charset . "'?>\n"; $notice .= "<notice>\n"; $requete = "select * from notices where notice_id={$id}"; $resultat = pmb_mysql_query($requete); $rn = pmb_mysql_fetch_object($resultat); //Référence //$notice.=" <REF>".htmlspecialchars($id)."</REF>\n"; //Organisme (OP) $requete = "select notices_custom_list_lib from notices_custom_lists, notices_custom_values where notices_custom_lists.notices_custom_champ=1 and notices_custom_values.notices_custom_champ=1 and notices_custom_integer=notices_custom_list_value and notices_custom_origine={$id}"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $op = pmb_mysql_result($resultat, 0, 0); $notice .= " <OP>" . htmlspecialchars(strtoupper($op), ENT_QUOTES, $charset) . "</OP>\n"; } //Date saisie (DS) $requete = "select notices_custom_date from notices_custom_values where notices_custom_champ=3 and notices_custom_origine={$id}"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $date = pmb_mysql_result($resultat, 0, 0); } else { $date = date("Y") . "-" . date("m") . "-" . date("d"); } $notice .= "<DS>" . $date . "</DS>\n"; //NOM $serie = ""; if ($rn->tparent_id) { $requete = "select serie_name from series where serie_id=" . $rn->tparent_id; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $serie = pmb_mysql_result($resultat, 0, 0); } } if ($rn->tnvol) { $serie .= ($serie ? " " : "") . $rn->tnvol; } if ($serie) { $serie .= ". "; } // ajout GM 15/12/2006 pour export sous-titre dans TI if ($rn->tit4 != "") { $soustitre = " : " . $rn->tit4; } // fin ajout GM // modif GM 15/12/2006 ajout du sous-titre pour l'export // $notice.=" <TI>".htmlspecialchars(strtoupper($serie.$rn->tit1))."</TI>\n"; $notice .= " <NOM>" . htmlspecialchars(strtoupper($serie . $rn->tit1 . $soustitre), ENT_QUOTES, $charset) . "</NOM>\n"; //MEL $no = $rn->n_gen; if ($no) { $notice .= "<MEL>" . htmlspecialchars($no, ENT_QUOTES, $charset) . "</MEL>\n"; } $requete = "select num_noeud from notices_categories where notcateg_notice={$id}"; $resultat = pmb_mysql_query($requete); $doc = array(); $de = array(); while (list($categ_id) = pmb_mysql_fetch_row($resultat)) { $categ = new category($categ_id); switch ($categ->thes->id_thesaurus) { case 1: $de[] = $categ->libelle; break; case 12: $doc[] = $categ->libelle; break; } } //Descripteurs (DE) if (count($de)) { sort($de); $notice .= "<DE>" . htmlspecialchars(strtoupper(implode(",", $de)), ENT_QUOTES, $charset) . "</DE>\n"; } //Descripteurs Web if (count($doc)) { sort($doc); $notice .= "<DOC>" . htmlspecialchars(strtoupper(implode(",", $doc)), ENT_QUOTES, $charset) . "</DOC>\n"; } //Resumé (COMMENT) if ($rn->n_resume) { $notice .= "<COMMENT>" . htmlspecialchars($rn->n_resume, ENT_QUOTES, $charset) . "</COMMENT>\n"; } //Site (SITE) if ($rn->lien) { $notice .= "<SITE>" . htmlspecialchars($rn->lien, ENT_QUOTES, $charset) . "</SITE>\n"; } //LI if ($rn->n_contenu) { $notice .= "<LI>" . htmlspecialchars($rn->n_contenu, ENT_QUOTES, $charset) . "</LI>\n"; } //DO if ($rn->indexint) { $requete = "select indexint_name from indexint where indexint_id=" . $rn->indexint; $resultat = pmb_mysql_query($requete); $do = pmb_mysql_result($resultat, 0, 0); $notice .= "<DO>" . htmlspecialchars($do, ENT_QUOTES, $charset) . "</DO>\n"; } $notice .= "</notice>"; return $notice; }
require_once "{$include_path}/mysql_connect.inc.php"; $dbh = connection_mysql(); // on checke si l'utilisateur existe et si le mot de passe est OK $query = "SELECT count(1) FROM users WHERE username='******' AND pwd=password('{$password}') "; $result = pmb_mysql_query($query, $dbh); $valid_user = pmb_mysql_result($result, 0, 0); if (!$valid_user) { die("Interdit : utilisateur invalide "); } if (!$dsi_auto) { die("DSI Auto pas activée sur base {$database} (user={$user}) Version noyau: {$pmb_bdd_version} "); } /* param par défaut */ $requete_param = "SELECT * FROM users WHERE username='******' LIMIT 1 "; $res_param = pmb_mysql_query($requete_param, $dbh); $field_values = pmb_mysql_fetch_row($res_param); $array_values = pmb_mysql_fetch_array($res_param); $i = 0; while ($i < pmb_mysql_num_fields($res_param)) { $field = pmb_mysql_field_name($res_param, $i); $field_deb = substr($field, 0, 6); switch ($field_deb) { case "deflt_": global ${$field}; ${$field} = $field_values[$i]; break; case "deflt2": global ${$field}; ${$field} = $field_values[$i]; break; case "param_":
$browser_header ? $browser_header .= '><strong>' : ($browser_header = '<strong>'); $browser_header .= $tcateg->path_table[sizeof($tcateg->path_table) - 1]['libelle']; $browser_header .= '</strong>'; } } $browser_content .= "<tr>\n\t\t\t<th></th>\n\t\t\t<th>" . $msg[103] . "</th>\n\t\t\t<!--!!col_num_autorite!!-->\n\t\t\t<th>" . $msg["count_notices_assoc"] . "</th>\n\t\t\t</tr>"; $num_auth_present = false; $req = "SELECT id_authority_source FROM authorities_sources WHERE authority_type='category' AND TRIM(authority_number) !='' LIMIT 1"; $res_aut = pmb_mysql_query($req, $dbh); if ($res_aut && pmb_mysql_num_rows($res_aut)) { $browser_content = str_replace("<!--!!col_num_autorite!!-->", "<th>" . $msg["authorities_number"] . "</th>", $browser_content); $num_auth_present = true; } $odd_even = 0; pmb_mysql_data_seek($result, 0); while ($cat = pmb_mysql_fetch_row($result)) { $tcateg = new category($cat[0]); if ($odd_even == 0) { $browser_content .= "\t<tr class='odd'>"; $odd_even = 1; } else { if ($odd_even == 1) { $browser_content .= "\t<tr class='even'>"; $odd_even = 0; } } $notice_count = $tcateg->notice_count(false); $browser_content .= "<td style='text-align:center; width:25px;'>\n \t\t\t\t\t\t\t<a title='" . $msg['authority_list_see_label'] . "' href='./autorites.php?categ=see&sub=category&id=" . $tcateg->id . "'>\n \t\t\t\t\t\t\t\t<i class='fa fa-eye'></i>\n \t\t\t\t\t\t\t</a>\n \t\t \t \t\t</td>"; $browser_content .= "<td>"; if ($tcateg->has_child) { $browser_content .= "<a href='{$base_url}" . $tcateg->id . "'>";