function genere_page_rss($id = 0) { global $dbh, $opac_url_base, $charset, $msg; global $opac_view_filter_class; if ($id) { $clause = " where id_rss_flux='{$id}' "; } $rqt = "select id_rss_flux, nom_rss_flux, img_url_rss_flux from rss_flux {$clause} order by 2 "; $res = pmb_mysql_query($rqt, $dbh); while ($obj = pmb_mysql_fetch_object($res)) { if ($opac_view_filter_class) { if (!$opac_view_filter_class->is_selected("flux_rss", $obj->id_rss_flux)) { continue; } } $liens .= "\n\t\t<tr>\n\t\t\t<td width=10%>"; if ($obj->img_url_rss_flux) { $liens .= "<a href=\"index.php?lvl=rss_see&id=" . $obj->id_rss_flux . "\"><img src='" . $obj->img_url_rss_flux . "' border=none /></a>"; } $liens .= "</td><td width=50%><a href=\"index.php?lvl=rss_see&id=" . $obj->id_rss_flux . "\">" . htmlentities($obj->nom_rss_flux, ENT_QUOTES, $charset) . "</a>\n\t\t\t</td><td><a href=\"" . $opac_url_base . "rss.php?id=" . $obj->id_rss_flux . "\" alt=\"" . $msg[abonne_rss_dispo] . "\" title=\"" . $msg[abonne_rss_dispo] . "\"><img id=\"rss_logo\" src='" . $opac_url_base . "images/rss.png' border=none /></a>\n\t\t\t" . htmlentities($opac_url_base . "rss.php?id=" . $obj->id_rss_flux, ENT_QUOTES, $charset) . "\n\t\t\t\t</td></tr>"; } if ($liens) { $liens = "<table> {$liens} </table>"; } return $liens; }
function get_rights($group, $method) { global $msg; $this->clear_error(); //Vérification que le groupe / méthode existe if (!$method && $this->es->group_exists($group) || $this->es->method_exists($group, $method)) { $es_r = new es_rights($group, $method); $requete = "select available, num_user, anonymous from es_methods, es_methods_users where groupe='" . addslashes($group) . "' and method='" . addslashes($method) . "' and id_method=num_method"; $resultat = pmb_mysql_query($requete); if ($resultat) { $first = true; while ($r = pmb_mysql_fetch_object($resultat)) { if ($first) { $es_r->available = $r->available; } if ($r->anonymous) { $es_r->anonymous_user = $r->num_user; } else { $es_r->users[] = $r->num_user; } } } return $es_r; } else { $this->set_error(ES_RIGHTS_UNKNOWN_GROUP_OR_METHOD, $msg["es_rights_error_unknown_group"]); return false; } }
public function fetch_datas() { global $dbh; $this->instruments = array(); $this->instruments_data = array(); $this->label = ""; $this->num_nomenclature = 0; $this->order = 0; if ($this->id) { //le nom de l'atelier $query = "select * from nomenclature_workshops where id_workshop = " . $this->id . " order by workshop_order asc, workshop_label"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { if ($row = pmb_mysql_fetch_object($result)) { $this->label = $row->workshop_label; $this->num_nomenclature = $row->workshop_num_nomenclature; $this->order = $row->workshop_order; //récupération des instruments $query = "select workshop_instrument_num_instrument, workshop_instrument_number,workshop_instrument_order from nomenclature_workshops_instruments where workshop_instrument_num_workshop = " . $this->id . " order by workshop_instrument_order asc"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $this->add_instrument(new nomenclature_instrument($row->workshop_instrument_num_instrument)); $this->instruments_data[$row->workshop_instrument_num_instrument]['effective'] = $row->workshop_instrument_number; $this->instruments_data[$row->workshop_instrument_num_instrument]['order'] = $row->workshop_instrument_order; } } } } } }
function param_perso_form(&$p_perso) { global $dbh; global $param_perso_900; for ($i = 0; $i < count($param_perso_900); $i++) { $req = " select idchamp, type, datatype from notices_custom where name='" . $param_perso_900[$i]['n'] . "'"; $res = pmb_mysql_query($req, $dbh); if (pmb_mysql_num_rows($res)) { $perso = pmb_mysql_fetch_object($res); if ($perso->idchamp) { if ($perso->type == 'list') { $requete = "select notices_custom_list_value from notices_custom_lists where notices_custom_list_lib='" . addslashes($param_perso_900[$i]['a']) . "' and notices_custom_champ={$perso->idchamp}"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat)) { $value = pmb_mysql_result($resultat, 0, 0); } else { $requete = "select max(notices_custom_list_value*1) from notices_custom_lists where notices_custom_champ={$perso->idchamp}"; $resultat = pmb_mysql_query($requete); $max = @pmb_mysql_result($resultat, 0, 0); $n = $max + 1; $requete = "insert into notices_custom_lists (notices_custom_champ,notices_custom_list_value,notices_custom_list_lib) values({$perso->idchamp},{$n},'" . addslashes($param_perso_900[$i]['a']) . "')"; pmb_mysql_query($requete); $value = $n; } $p_perso->values[$perso->idchamp][] = $value; } else { $p_perso->values[$perso->idchamp][] = $param_perso_900[$i]['a']; } } } } }
function get_primaldata() { global $dbh; $requete = "SELECT * FROM sub_collections WHERE sub_coll_id='" . addslashes($this->id) . "' "; $result = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($result)) { $obj = pmb_mysql_fetch_object($result); pmb_mysql_free_result($result); $this->get_primaldatafrom($obj); } else { // pas de sous-collection avec cette clé $this->id = 0; $this->name = ''; $this->parent = ''; $this->parent_libelle = ''; $this->parent_isbd = ''; $this->publisher = ''; $this->publisher_libelle = ''; $this->publisher_isbd = ''; $this->display = ''; $this->issn = ''; $this->isbd_entry = ''; $this->comment = ''; } }
protected function build_tree_sections($id_parent, $depth = 0) { global $dbh; if ($this->parameters['max_depth'] == 0 || $depth < $this->parameters['max_depth']) { $items = $ids = $rows = array(); $query = "select id_section,section_title from cms_sections where section_num_parent = " . $id_parent . " order by section_order asc"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $ids[] = $row->id_section; $rows[] = $row; } $ids = $this->filter_datas("sections", $ids); foreach ($rows as $row) { if (in_array($row->id_section, $ids)) { $section = cms_provider::get_instance("section", $row->id_section); $item = array('id' => $row->id_section, 'title' => $row->section_title, 'link' => $this->get_constructed_link("section", $row->id_section), 'details' => $section->format_datas(false, false)); $sub_query = "select count(id_section) from cms_sections where section_num_parent = " . $row->id_section; $sub_result = pmb_mysql_query($sub_query, $dbh); if (pmb_mysql_num_rows($result) && pmb_mysql_result($sub_result, 0, 0) > 0) { $item['children'] = $this->build_tree_sections($row->id_section, $depth + 1); } $items[] = $item; } } } } return $items; }
public function get_datas() { global $opac_url_base; global $opac_show_book_pics; global $opac_book_pics_url; $datas = parent::get_datas(); $notices = $datas['records']; $query = "select notice_id,tit1,thumbnail_url,code from notices where notice_id in(" . implode(",", $notices) . ")"; $result = pmb_mysql_query($query); $notices = array(); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { if ($opac_show_book_pics == '1' && ($opac_book_pics_url || $row->thumbnail_url)) { $code_chiffre = pmb_preg_replace('/-|\\.| /', '', $row->code); $url_image = $opac_book_pics_url; $url_image = $opac_url_base . "getimage.php?url_image=" . urlencode($url_image) . "¬icecode=!!noticecode!!&vigurl=" . urlencode($row->thumbnail_url); if ($row->thumbnail_url) { $url_vign = $row->thumbnail_url; } else { if ($code_chiffre) { $url_vign = str_replace("!!noticecode!!", $code_chiffre, $url_image); } else { $url_vign = $opac_url_base . "images/vide.png"; } } } $notices[] = array('title' => $row->tit1, 'link' => $opac_url_base . "?lvl=notice_display&id=" . $row->notice_id, 'vign' => $url_vign); } } return array('records' => $notices); }
function list_author_notices($author_id, $OPACUserId = -1) { global $dbh; global $msg; $result = array(); $author_id += 0; if (!$author_id) { throw new Exception("Missing parameter: author_id"); } $rqt_auteurs = "select author_id as aut from authors where author_see='{$author_id}' and author_id!=0 "; $rqt_auteurs .= "union select author_see as aut from authors where author_id='{$author_id}' and author_see!=0 "; $res_auteurs = pmb_mysql_query($rqt_auteurs, $dbh); $clause_auteurs = " in ('{$author_id}' "; while ($id_aut = pmb_mysql_fetch_object($res_auteurs)) { $clause_auteurs .= ", '" . $id_aut->aut . "' "; $rqt_auteursuite = "select author_id as aut from authors where author_see='{$id_aut->aut}' and author_id!=0 "; $res_auteursuite = pmb_mysql_query($rqt_auteursuite, $dbh); while ($id_autsuite = pmb_mysql_fetch_object($res_auteursuite)) { $clause_auteurs .= ", '" . $id_autsuite->aut . "' "; } } $clause_auteurs .= " ) "; $requete = "SELECT distinct notices.notice_id FROM notices, responsability "; $requete .= "where responsability_author {$clause_auteurs} and notice_id=responsability_notice "; $requete .= "ORDER BY index_serie,tnvol,index_sew"; $res = pmb_mysql_query($requete, $dbh); if ($res) { while ($row = pmb_mysql_fetch_assoc($res)) { $result[] = $row["notice_id"]; } } //Je filtre les notices en fonction des droits $result = $this->filter_tabl_notices($result); return $result; }
public function get_datas() { $selector = $this->get_selected_selector(); if ($selector) { $return = array(); if (count($selector->get_value()) > 0) { foreach ($selector->get_value() as $value) { $return[] = $value; } } $return = $this->filter_datas("articles", $return); if (count($return)) { $query = "select id_article,if(article_start_date != '0000-00-00 00:00:00',article_start_date,article_creation_date) as publication_date from cms_articles where id_article in (" . implode(",", $return) . ")"; if ($this->parameters["sort_by"] != "") { $query .= " order by " . $this->parameters["sort_by"]; if ($this->parameters["sort_order"] != "") { $query .= " " . $this->parameters["sort_order"]; } } $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $return = array(); while ($row = pmb_mysql_fetch_object($result)) { $return[] = $row->id_article; } } } return $return; } return false; }
function show_orinot($dbh) { global $msg; global $charset; print "<table>\n\t<tr>\n\t\t<th>{$msg['orinot_nom']}</th>\n\t\t<th>{$msg['orinot_pays']}</th>\n\t\t<th>{$msg['orinot_diffusable']}</th>\n\t</tr>"; // affichage du tableau des statuts $requete = "SELECT orinot_id, orinot_nom, orinot_pays, orinot_diffusion FROM origine_notice ORDER BY orinot_nom "; $res = pmb_mysql_query($requete, $dbh); $nbr = pmb_mysql_num_rows($res); $parity = 1; for ($i = 0; $i < $nbr; $i++) { $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=notices&sub=orinot&action=modif&id={$row->orinot_id}';\" "; print pmb_bidi("<tr class='{$pair_impair}' {$tr_javascript} style='cursor: pointer'><td>" . htmlentities($row->orinot_nom, ENT_QUOTES, $charset) . "</td><td>" . htmlentities($row->orinot_pays, ENT_QUOTES, $charset) . "</td>"); if ($row->orinot_diffusion) { print "<td>{$msg['orinot_diffusable_oui']}</td>"; } else { print "<td>{$msg['orinot_diffusable_non']}</td>"; } print "</tr>"; } print "</table>\n\t\t<input class='bouton' type='button' value=' {$msg['orinot_ajout']} ' onClick=\"document.location='./admin.php?categ=notices&sub=orinot&action=add'\" />"; }
function update_avis($id) { global $dbh, $desc, $sujet, $msg, $charset; header('Content-Type: text/html;charset=' . $charset); $req = "update avis set sujet='" . $sujet . "', commentaire='" . $desc . "' where id_avis='" . $id . "'"; pmb_mysql_query($req, $dbh); $requete = "select avis.note, avis.sujet, avis.commentaire, avis.id_avis, DATE_FORMAT(avis.dateAjout,'" . $msg[format_date] . "') as ladate, "; $requete .= "empr_login, empr_nom, empr_prenom, "; $requete .= "niveau_biblio, niveau_biblio, valide, notice_id "; $requete .= "from avis "; $requete .= "left join empr on empr.id_empr=avis.num_empr "; $requete .= "left join notices on notices.notice_id=avis.num_notice "; $requete .= "where id_avis='" . $id . "'"; $requete .= "order by index_serie, tnvol, index_sew ,dateAjout desc "; $res = pmb_mysql_query($requete, $dbh); while ($loc = pmb_mysql_fetch_object($res)) { $display = "\n\t\t\t<div class='left'>\n\t\t\t\t<input type='checkbox' name='valid_id_avis[]' id='valid_id_avis[]' value='{$loc->id_avis}' onClick=\"stop_evenement(event);\" />"; if (!$loc->valide) { $display .= "<font color='#CC0000'>" . $msg[gestion_avis_note] . " <span >" . htmlentities($loc->note, ENT_QUOTES, $charset) . " <b>" . htmlentities($loc->sujet, ENT_QUOTES, $charset) . "</b></span></font>"; } else { $display .= "<font color='#00BB00'>" . $msg[gestion_avis_note] . " <span >" . htmlentities($loc->note, ENT_QUOTES, $charset) . " <b>" . htmlentities($loc->sujet, ENT_QUOTES, $charset) . "</b></span></font>"; } if ($charset != "utf-8") { $loc->commentaire = cp1252Toiso88591($loc->commentaire); } $display .= ", " . htmlentities($loc->ladate, ENT_QUOTES, $charset) . " " . htmlentities($loc->empr_prenom . " " . $loc->empr_nom, ENT_QUOTES, $charset) . "\n\t\t\t</div>\n\t\t\t<div class='row'>" . do_bbcode($loc->commentaire) . "\t</div>\n\t\t"; } print $display; }
function fetch_data() { global $dbh; $this->selected_list = array(); $req = "SELECT * FROM opac_filters where opac_filter_view_num=" . $this->id_vue . " and opac_filter_path='" . $this->path . "' "; $myQuery = pmb_mysql_query($req, $dbh); if (pmb_mysql_num_rows($myQuery)) { $r = pmb_mysql_fetch_object($myQuery); $param = unserialize($r->opac_filter_param); $this->selected_list = $param["selected"]; } $myQuery = pmb_mysql_query("SELECT * FROM docs_location order by location_libelle ", $dbh); $this->liste_item = array(); $link = ""; $i = 0; if (pmb_mysql_num_rows($myQuery)) { while ($r = pmb_mysql_fetch_object($myQuery)) { $this->liste_item[$i] = new stdClass(); $this->liste_item[$i]->id = $r->idlocation; $this->liste_item[$i]->name = $r->location_libelle; if (in_array($r->idlocation, $this->selected_list)) { $this->liste_item[$i]->selected = 1; } else { $this->liste_item[$i]->selected = 0; } $i++; } } return true; }
public function get_value() { global $dbh; if ($this->parameters['sub_selector']) { $sub_selector = new $this->parameters['sub_selector']($this->get_sub_selector_id($this->parameters['sub_selector'])); $values = $sub_selector->get_value(); if (!is_array($values)) { if ($values != "") { $values = array($values); } else { $values = array(); } } if (count($values)) { $tagslist = array(); switch ($this->parameters['sub_selector']) { case "cms_module_item_selector_item_generic": $query = "select id_tag from docwatch_tags left join docwatch_items_tags on num_tag=id_tag where num_item in (" . implode(",", $values) . ")"; $result = pmb_mysql_query($query, $dbh); if ($result) { while ($row = pmb_mysql_fetch_object($result)) { $tagslist[] = $row->id_tag; } } return $tagslist; break; case "cms_module_common_selector_env_var": return $values; break; } } } return array(); }
public function get_value() { if (!$this->value) { $parent = new cms_module_common_selector_sections($this->get_sub_selector_id("cms_module_common_selector_sections")); $cp = new cms_module_common_selector_type_section_filter($this->get_sub_selector_id("cms_module_common_selector_type_section_filter")); $parents = $parent->get_value(); $field = $cp->get_value(); $var = new cms_module_common_selector_env_var($this->get_sub_selector_id("cms_module_common_selector_env_var")); $this->value = array(); if (is_array($parents) && count($parents)) { $query = "select id_section from cms_sections where section_num_parent in (" . implode(",", $parents) . ")"; $result = pmb_mysql_query($query); $fields = new cms_editorial_parametres_perso($field['type']); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $fields->get_values($row->id_section); if (in_array($var->get_value(), $fields->values[$field['field']])) { $this->value[] = $row->id_section; } } } } } return $this->value; }
function parametres_perso($prefix) { global $_custom_prefixe_; $this->prefix = $prefix; $this->base_url = $base_url; $_custom_prefixe_ = $prefix; //Lecture des champs $this->no_special_fields = 0; $this->t_fields = array(); $requete = "select idchamp, name, titre, type, datatype, obligatoire, options, multiple, export, search, opac_sort from " . $this->prefix . "_custom order by ordre"; $resultat = pmb_mysql_query($requete); if (pmb_mysql_num_rows($resultat) == 0) { $this->no_special_fields = 1; } else { while ($r = pmb_mysql_fetch_object($resultat)) { $this->t_fields[$r->idchamp]["DATATYPE"] = $r->datatype; $this->t_fields[$r->idchamp]["NAME"] = $r->name; $this->t_fields[$r->idchamp]["TITRE"] = $r->titre; $this->t_fields[$r->idchamp]["TYPE"] = $r->type; $this->t_fields[$r->idchamp]["OPTIONS"] = $r->options; $this->t_fields[$r->idchamp]["MANDATORY"] = $r->obligatoire; $this->t_fields[$r->idchamp]["OPAC_SHOW"] = $r->multiple; $this->t_fields[$r->idchamp]["EXPORT"] = $r->export; $this->t_fields[$r->idchamp]["SEARCH"] = $r->search; $this->t_fields[$r->idchamp]["OPAC_SORT"] = $r->opac_sort; } } }
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 load() { global $dbh; $q = "select * from suggestions left join explnum_doc_sugg on num_suggestion=id_suggestion where id_suggestion = '" . $this->id_suggestion . "' "; $r = pmb_mysql_query($q, $dbh); $obj = pmb_mysql_fetch_object($r); $this->titre = $obj->titre; $this->editeur = $obj->editeur; $this->auteur = $obj->auteur; $this->code = $obj->code; $this->prix = $obj->prix; $this->nb = $obj->nb; $this->commentaires = $obj->commentaires; $this->commentaires_gestion = $obj->commentaires_gestion; $this->date_creation = $obj->date_creation; $this->date_decision = $obj->date_decision; $this->statut = $obj->statut; $this->num_produit = $obj->num_produit; $this->num_entite = $obj->num_entite; $this->num_rubrique = $obj->num_rubrique; $this->num_fournisseur = $obj->num_fournisseur; $this->num_notice = $obj->num_notice; $this->index_suggestion = $obj->index_suggestion; $this->url_suggestion = $obj->url_suggestion; $this->num_categ = $obj->num_categ; $this->sugg_location = $obj->sugg_location; $this->date_publi = $obj->date_publication; $this->sugg_src = $obj->sugg_source; $this->sugg_explnum = $obj->num_explnum_doc; $this->sugg_noti_unimarc = $obj->notice_unimarc; }
public function get_datas() { global $dbh; $return = array(); $selector = $this->get_selected_selector(); if ($selector) { $value = $selector->get_value(); if ($value['publisher'] != 0) { $query = "select notice_id from notices where ed1_id = " . $value['publisher'] . ' and notice_id != ' . $value['record']; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result) > 0) { $return["title"] = "Du même éditeur"; $records = array(); while ($row = pmb_mysql_fetch_object($result)) { $records[] = $row->notice_id; } } $return['records'] = $this->filter_datas("notices", $records); if ($this->parameters['nb_max_elements'] > 0) { $return['records'] = array_slice($return['records'], 0, $this->parameters['nb_max_elements']); } } return $return; } return false; }
function search_other_function_filters() { global $code_langue_restrict; global $charset, $msg, $marc_liste_langues; if (!$marc_liste_langues) { $marc_liste_langues = new marc_list('lang'); } $r = "<select name='code_langue_restrict'>"; $r .= "<option value=''>" . $msg[all_languages] . "</option>"; $requete = "select distinct code_langue from notices_langues where code_langue is not null and code_langue!='' order by ordre_langue"; $resultat = pmb_mysql_query($requete); // on met les balises <option> dans un tableau, indexé par le nom traduit de la langue $t = array(); while ($res = pmb_mysql_fetch_object($resultat)) { if ($marc_liste_langues->table[$res->code_langue]) { $s = "<option value='" . htmlentities($res->code_langue, ENT_QUOTES, $charset) . "' "; if ($res->code_langue == $code_langue_restrict) { $s .= "selected"; } $s .= ">" . $marc_liste_langues->table[$res->code_langue]; $s .= "</option>"; $t[$marc_liste_langues->table[$res->code_langue]] = $s; } } // tri le tableau selon les clés (ici les noms des langues, pas les codes) ksort($t); // recopie des balises triées dans la liste <select> foreach ($t as $k => $v) { $r .= $v; } $r .= "</select>"; return $r; }
public function get_datas() { //on commence par récupérer l'identifiant retourné par le sélecteur... $selector = $this->get_selected_selector(); if ($selector) { $section_id = $selector->get_value(); $section_ids = $this->filter_datas("sections", array($section_id)); if ($section_ids[0]) { $sections = array(); $section_id = $section_ids[0]; $datas = array(); $i = 0; do { $i++; $query = "select id_section,section_num_parent from cms_sections where id_section = " . $section_id; $result = pmb_mysql_query($query); if (pmb_mysql_num_rows($result)) { $row = pmb_mysql_fetch_object($result); $section_id = $row->section_num_parent; $datas[] = $row->id_section; } else { break; } //en théorie on sort toujours, mais comme c'est un pays formidable, on lock à 100 itérations... } while ($row->section_num_parent != 0 || $i > 100); return array_reverse($datas); } } return false; }
public function get_datas() { $selector = $this->get_selected_selector(); if ($selector) { $tab_values = $selector->get_value(); if (!is_array($tab_values)) { $tab_values = array($tab_values); } if (count($tab_values) > 0) { $list_values = implode(",", $tab_values); $query = "select id_article,if(article_start_date != '0000-00-00 00:00:00',article_start_date,article_creation_date) as publication_date from cms_articles where num_section in (" . $list_values . ")"; if ($this->parameters["sort_by"] != "") { $query .= " order by " . $this->parameters["sort_by"]; if ($this->parameters["sort_order"] != "") { $query .= " " . $this->parameters["sort_order"]; } } $result = pmb_mysql_query($query); $return = array(); if ($result) { while ($row = pmb_mysql_fetch_object($result)) { $return[] = $row->id_article; } } $return = $this->filter_datas("articles", $return); if ($this->parameters["nb_max_elements"] > 0) { $return = array_slice($return, 0, $this->parameters["nb_max_elements"]); } return $return; } } return false; }
public function fetch_datas() { global $dbh; if ($this->id) { //le nom de la famille $query = "select family_name from nomenclature_families where id_family = " . $this->id; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $this->set_name($row->family_name); } //récupération des pupitres $query = "select id_musicstand from nomenclature_musicstands where musicstand_famille_num = " . $this->id . " order by musicstand_order asc"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $this->add_musicstand(new nomenclature_musicstand($row->id_musicstand)); } } } } else { $this->musicstands = array(); $this->name = ""; } }
public function get_datas() { global $dbh; $selector = $this->get_selected_selector(); if ($selector) { $query = "select distinct notice_id \n\t\t\t\tfrom notices join notices_categories on notice_id=notcateg_notice \n\t\t\t\tjoin cms_articles_descriptors on cms_articles_descriptors.num_noeud=notices_categories.num_noeud \n\t\t\t\tand num_article=" . $selector->get_value(); $result = pmb_mysql_query($query, $dbh); $return = array(); if ($result && pmb_mysql_num_rows($result) > 0) { $return["title"] = "Liste de notices"; while ($row = pmb_mysql_fetch_object($result)) { $return["records"][] = $row->notice_id; } } $return['records'] = $this->filter_datas("notices", $return['records']); $return['records'] = array_slice($return['records'], 0, $this->parameters['nb_max_elements']); if (!count($return['records'])) { return false; } // on tri par pertinence $query = "SELECT notice_id\n\t\t\tFROM notices\n\t\t\tJOIN notices_categories ON notice_id = notcateg_notice\n\t\t\tJOIN cms_articles_descriptors ON cms_articles_descriptors.num_noeud = notices_categories.num_noeud\n\t\t\tAND num_article =" . $selector->get_value() . " where notice_id in(" . implode(',', $return['records']) . ")group by notice_id order by count(*) desc, create_date desc"; $result = pmb_mysql_query($query, $dbh); $return = array(); if ($result && pmb_mysql_num_rows($result) > 0) { $return["title"] = "Liste de notices"; while ($row = pmb_mysql_fetch_object($result)) { $return["records"][] = $row->notice_id; } } return $return; } return false; }
function show_form($param = '') { //paramètres pré-enregistré $value_param = array(); if ($param['form_jeu_sauv']) { foreach ($param['form_jeu_sauv'] as $jeu_sauvegarde) { $value_param[$jeu_sauvegarde] = $jeu_sauvegarde; } } $requete = "select sauv_sauvegarde_id, sauv_sauvegarde_nom from sauv_sauvegardes"; $result = pmb_mysql_query($requete); $nb_rows = pmb_mysql_num_rows($result); //taille du selecteur if ($nb_rows < 3) { $nb = 3; } else { if ($nb_rows > 10) { $nb = 10; } else { $nb = $nb_rows; } } //Choix du ou des jeux de sauvegardes $form_task .= "\n\t\t<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for='jeu_sauv'>" . $this->msg["planificateur_backup_choice"] . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne_suite'>\n\t\t\t\t<select id='form_jeu_sauv' class='saisie-50em' name='form_jeu_sauv[]' size='" . $size_select . "' multiple>"; while ($row = pmb_mysql_fetch_object($result)) { $form_task .= "<option value='" . $row->sauv_sauvegarde_id . "' " . ($value_param[$row->sauv_sauvegarde_id] == $row->sauv_sauvegarde_id ? 'selected=\'selected\'' : '') . ">" . $row->sauv_sauvegarde_nom . "</option>"; } $form_task .= "</select>"; $form_task .= "</div></div>"; return $form_task; }
function fetch_data() { global $dbh; $req = "SELECT surloc_num, location_id,location_libelle, rel_date_parution,rel_libelle_numero, rel_comment_opac \n\t\tfrom perio_relance, abts_abts, docs_location\n\t\twhere location_id=idlocation and rel_abt_num=abt_id and num_notice=" . $this->serial_id . " and rel_comment_opac!='' group by rel_abt_num,rel_date_parution,rel_libelle_numero order by rel_nb desc"; $result = pmb_mysql_query($req); if (pmb_mysql_num_rows($result)) { $tr_class = ""; while ($r = pmb_mysql_fetch_object($result)) { $surloc_libelle = ""; if ($opac_sur_location_activate && $r->surloc_num) { $req = "select surloc_libelle from sur_location where surloc_id = " . $r->surloc_num; $res_surloc = pmb_mysql_query($req); if (pmb_mysql_num_rows($res_surloc)) { $surloc = pmb_mysql_fetch_object($res_surloc); $surloc_libelle = $surloc->surloc_libelle . " / "; } } $line = $bulletin_retard_line; $line = str_replace("!!location_libelle!!", $surloc_libelle . $r->location_libelle, $line); $line = str_replace("!!date_parution!!", $r->rel_date_parution, $line); $line = str_replace("!!libelle_numero!!", $r->rel_libelle_numero, $line); $line = str_replace("!!comment_opac!!", $r->rel_comment_opac, $line); if ($tr_class == 'even') { $tr_class = "odd"; } else { $tr_class = 'even'; } $line = str_replace("!!tr_class!!", $tr_class, $line); $lines .= $line; } $tpl = $bulletin_retard_form; $tpl = gen_plus("bulletin_retard", $msg["bulletin_retard_title"], str_replace("!!bulletin_retard_list!!", $lines, $tpl)); } }
function source_get_property_form($source_id) { global $charset, $dbh; $params = $this->get_source_params($source_id); if ($params["PARAMETERS"]) { //Affichage du formulaire avec $params["PARAMETERS"] $vars = unserialize($params["PARAMETERS"]); foreach ($vars as $key => $val) { global ${$key}; ${$key} = $val; } } $form = "\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'><label for='libelle'>" . $this->msg["urlslist_libelle"] . "</label></div>\n\t\t\t\t<div class='colonne-suite'><input type='text' name='libelle' value='" . htmlentities($libelle, ENT_QUOTES, $charset) . "'/></div>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'><label for='infobulle'>" . $this->msg["urlslist_infobulle"] . "</label></div>\n\t\t\t\t<div class='colonne-suite'><input type='text' name='infobulle' value='" . htmlentities($infobulle, ENT_QUOTES, $charset) . "'/></div>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'><label for='source_name'>" . $this->msg["urlslist_source_name"] . "</label></div>\n\t\t\t\t<div class='colonne-suite'><input type='text' name='source_name' value='" . htmlentities($source_name, ENT_QUOTES, $charset) . "'/></div>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'><label for='width'>" . $this->msg["urlslist_width"] . "</label></div>\n\t\t\t\t<div class='colonne-suite'><input type='text' name='width' value='" . htmlentities($width, ENT_QUOTES, $charset) . "'/></div>\n\t\t\t</div>\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'><label for='height'>" . $this->msg["urlslist_height"] . "</label></div>\n\t\t\t\t<div class='colonne-suite'><input type='text' name='height' value='" . htmlentities($height, ENT_QUOTES, $charset) . "'/></div>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>\n\t\t\t<div class='row'>\n\t\t\t\t<div class='colonne3'><label for='source_name'>" . $this->msg["urlslist_source_field"] . "</label></div>\n\t\t\t\t<div class='colonne-suite'>\n\t\t\t\t\t<select name='cp_field'>"; $query = "select idchamp, titre from notices_custom where type='url'"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result)) { while ($row = pmb_mysql_fetch_object($result)) { $form .= "\n \t\t\t\t\t<option value='" . $row->idchamp . "' " . ($row->idchamp == $cp_field ? "selected='selected'" : "") . ">" . htmlentities($row->titre, ENT_QUOTES, $charset) . "</option>"; } } else { $form .= "\n \t\t\t\t\t<option value='0'>" . $this->msg["urlslist_no_field"] . "</option>"; } $form .= "\n \t\t\t\t</select>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class='row'> </div>"; return $form; }
public function get_datas() { $selector = $this->get_selected_selector(); if ($selector) { $query = "select distinct id_article,if(article_start_date != '0000-00-00 00:00:00',article_start_date,article_creation_date) as publication_date from cms_articles join cms_articles_descriptors on id_article=num_article where num_article != '" . $selector->get_value() . "' and num_noeud in (select num_noeud from cms_articles_descriptors where num_article = '" . $selector->get_value() . "')"; if ($this->parameters["sort_by"] != "") { $query .= " order by " . $this->parameters["sort_by"]; if ($this->parameters["sort_order"] != "") { $query .= " " . $this->parameters["sort_order"]; } } $result = pmb_mysql_query($query); $return = array(); if (pmb_mysql_num_rows($result) > 0) { while ($row = pmb_mysql_fetch_object($result)) { $return[] = $row->id_article; } } $return = $this->filter_datas("articles", $return); if ($this->parameters["nb_max_elements"] > 0) { $return = array_slice($return, 0, $this->parameters["nb_max_elements"]); } return $return; } return false; }
public function get_datas() { global $dbh; $return = array(); $selector = $this->get_selected_selector(); if ($selector) { $value = $selector->get_value(); if ($value != 0) { //on part du premier exemplaire... $query = "select expl_cote from exemplaires where expl_notice = " . $value . " order by expl_cote limit 1 "; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result) > 0) { $row = pmb_mysql_fetch_object($result); $cote = $row->expl_cote; $query = "\n\t\t\t\t\t(select distinct expl_notice,expl_cote from exemplaires where expl_notice!=0 and expl_bulletin = 0 and expl_cote >= '" . $cote . "' and expl_notice = " . $value . " order by expl_cote asc limit 5)\n\t\t\t\t\t\tunion \n\t\t\t\t\t(select distinct expl_notice,expl_cote from exemplaires where expl_notice!=0 and expl_bulletin = 0 and expl_cote < '" . $cote . "' and expl_notice = " . $value . " order by expl_cote desc limit 5)"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result) > 0) { $return["title"] = ""; while ($row = pmb_mysql_fetch_object($result)) { $return["records"][] = $row->expl_notice; } } $return['records'] = $this->filter_datas("notices", $return['records']); if ($this->parameters['nb_max_elements'] > 0) { $return['records'] = array_slice($return['records'], 0, $this->parameters['nb_max_elements']); } } } return $return; } return false; }
public function get_datas() { global $dbh; $return = array(); $selector = $this->get_selected_selector(); if ($selector) { $value = $selector->get_value(); $records = array(); if (is_array($value) && count($value)) { for ($i = 0; $i < count($value); $i++) { $query = "select notice_id from notices where notice_id='" . $value[$i] . "'"; $result = pmb_mysql_query($query, $dbh); if (pmb_mysql_num_rows($result) > 0) { $row = pmb_mysql_fetch_object($result); $records[] = $row->notice_id; } } $records = array_reverse($records); $return['records'] = $this->filter_datas("notices", $records); if ($this->parameters['nb_max_elements'] > 0) { $return['records'] = array_slice($return['records'], 0, $this->parameters['nb_max_elements']); } } return $return; } return false; }
function search_other_function_filters() { global $recherche_loc; global $charset; global $msg, $dbh; // mettre par défaut la localisation du lecteur if (!isset($recherche_loc) && $_SESSION["empr_location"]) { $recherche_loc = $_SESSION["empr_location"]; } $r .= "<select name='recherche_loc'>"; $r .= "<option value='0'>" . htmlentities($msg["search_loc_all_site"], ENT_QUOTES, $charset) . "</option>"; $requete = "select location_libelle,idlocation from docs_location where location_visible_opac=1"; $result = pmb_mysql_query($requete, $dbh); if (pmb_mysql_num_rows($result)) { while ($loc = pmb_mysql_fetch_object($result)) { $selected = ""; if ($recherche_loc == $loc->idlocation) { $selected = "selected"; } $r .= "<option value='{$loc->idlocation}' {$selected}>{$loc->location_libelle}</option>"; } } $r .= "</select>"; return $r; }