function __construct($notice_ids, $user = 0)
 {
     global $PMBuserid;
     $this->user = $user;
     if ($this->user = 0) {
         $this->user = $PMBuserid;
     }
     $this->notice_ids = $notice_ids;
     if ($this->notice_ids != '') {
         //filtrage sur statut ou droits d'accès..
         $query = $this->_get_filter_query();
         if ($query) {
             $res = pmb_mysql_query($query);
             $this->notice_ids = "";
             if (pmb_mysql_num_rows($res)) {
                 while ($row = pmb_mysql_fetch_assoc($res)) {
                     if ($this->notice_ids != "") {
                         $this->notice_ids .= ",";
                     }
                     $this->notice_ids .= $row['id_notice'];
                 }
             }
         }
     }
 }
 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));
     }
 }
 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 = '';
     }
 }
 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 $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) . "&noticecode=!!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);
 }
 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 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;
 }
 function show_form($param = '')
 {
     global $dbh, $charset;
     global $deflt_upload_repertoire;
     //On créer le sélecteur pour choisir le repertoire d'upload
     $query = "SELECT * FROM upload_repertoire";
     $result = pmb_mysql_query($query, $dbh);
     $select = "";
     if (pmb_mysql_num_rows($result)) {
         $select .= "<select name='upload_repertoire'>";
         $allready_selected = false;
         while ($upload_rep = pmb_mysql_fetch_object($result)) {
             if ($param['upload_repertoire'] == $upload_rep->repertoire_id && !$allready_selected) {
                 $select .= "\t<option selected='true' value='{$upload_rep->repertoire_id}'>{$upload_rep->repertoire_nom}</option>";
                 $allready_selected = true;
             } elseif ($deflt_upload_repertoire == $upload_rep->repertoire_id && !$allready_selected) {
                 $select .= "\t<option selected='true' value='{$upload_rep->repertoire_id}'>{$upload_rep->repertoire_nom}</option>";
                 $allready_selected = true;
             } else {
                 $select .= "\t<option value='{$upload_rep->repertoire_id}'>{$upload_rep->repertoire_nom}</option>";
             }
         }
         $select .= "</select>";
     } else {
         $select .= $this->msg['planificateur_scan_docnum_no_upload_repertoire'];
     }
     $form_task .= "\n\t\t<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for='upload_folder'>" . $this->msg["planificateur_scan_docnum_upload_repertoire"] . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne_suite'>\n\t\t\t\t{$select}\t\n\t\t\t</div>\n\t\t</div>\n\t\t<div class='row'>\n\t\t\t<div class='colonne3'>\n\t\t\t\t<label for='upload_folder'>" . $this->msg["planificateur_scan_docnum_upload_folder"] . "</label>\n\t\t\t</div>\n\t\t\t<div class='colonne_suite'>\n\t\t\t\t<input type='text' id='upload_folder' name='upload_folder' value='" . htmlentities($param['upload_folder'], ENT_QUOTES, $charset) . "'/>\n\t\t\t</div>\n\t\t</div>";
     return $form_task;
 }
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;
}
Example #12
0
 function explnum_doc($id_expl = 0)
 {
     global $dbh;
     $this->explnum_doc_id = $id_expl;
     if (!$this->explnum_doc_id) {
         $this->explnum_doc_nomfichier = '';
         $this->explnum_doc_contenu = '';
         $this->explnum_doc_mime = '';
         $this->explnum_doc_extfichier = '';
     } else {
         $req = "select * from explnum_doc where id_explnum_doc='" . $this->explnum_doc_id . "'";
         $res = pmb_mysql_query($req, $dbh);
         if (pmb_mysql_num_rows($res)) {
             $expl = pmb_mysql_fetch_object($res);
             $this->explnum_doc_nomfichier = $expl->explnum_doc_nomfichier;
             $this->explnum_doc_contenu = $expl->explnum_doc_data;
             $this->explnum_doc_mime = $expl->explnum_doc_mimetype;
             $this->explnum_doc_extfichier = $expl->explnum_doc_extfichier;
         } else {
             $this->explnum_doc_nomfichier = '';
             $this->explnum_doc_contenu = '';
             $this->explnum_doc_mime = '';
             $this->explnum_doc_extfichier = '';
         }
     }
 }
 protected function fetch_datas()
 {
     global $dbh;
     $this->name = "";
     $this->nature = 0;
     $this->order = 0;
     $this->types = array();
     if ($this->id) {
         $query = "select * from nomenclature_formations where id_formation = " . $this->id;
         $result = pmb_mysql_query($query, $dbh);
         if (pmb_mysql_num_rows($result)) {
             $row = pmb_mysql_fetch_object($result);
             $this->set_name($row->formation_name);
             $this->set_nature($row->formation_nature);
             $this->set_order($row->formation_order);
             //récupération des types
             $query = "select id_type from nomenclature_types where type_formation_num = " . $this->id . " order by type_order asc";
             $result = pmb_mysql_query($query, $dbh);
             if (pmb_mysql_num_rows($result)) {
                 while ($row = pmb_mysql_fetch_object($result)) {
                     $this->add_type(new nomenclature_type($row->id_type));
                 }
             }
         }
     }
 }
 function get_link_user()
 {
     global $dbh, $PMBuserid;
     $requete = "SELECT * FROM search_perso";
     if ($PMBuserid != 1) {
         $requete .= " WHERE (autorisations='{$PMBuserid}' or autorisations like '{$PMBuserid} %' or autorisations like '% {$PMBuserid} %' or autorisations like '% {$PMBuserid}') ";
     }
     $requete .= " order by search_name ";
     $myQuery = pmb_mysql_query($requete, $dbh);
     $this->search_perso_user = array();
     $link = "";
     if (pmb_mysql_num_rows($myQuery)) {
         $i = 0;
         while ($r = pmb_mysql_fetch_object($myQuery)) {
             if ($r->search_directlink) {
                 if ($r->search_shortname) {
                     $libelle = $r->search_shortname;
                 } else {
                     $libelle = $r->search_name;
                 }
                 $link .= "\n\t\t\t\t\t<span>\n\t\t\t\t\t\t<a href=\"javascript:document.forms['search_form" . $r->search_id . "'].submit();\">{$libelle}</a>\n\t\t\t\t\t</span>\n\t\t\t\t";
             }
             $this->search_perso_user[$i] = new stdClass();
             $this->search_perso_user[$i]->id = $r->search_id;
             $this->search_perso_user[$i]->name = $r->search_name;
             $this->search_perso_user[$i]->shortname = $r->search_shortname;
             $this->search_perso_user[$i]->query = $r->search_query;
             $this->search_perso_user[$i]->human = $r->search_human;
             $this->search_perso_user[$i]->directlink = $r->search_directlink;
             $i++;
         }
     }
     $this->directlink_user = $link;
     return true;
 }
 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 = "";
     }
 }
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'\" />";
}
Example #17
0
 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;
 }
 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;
 }
 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;
 }
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;
}
Example #21
0
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'\" />";
}
 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;
 }
 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;
 }
 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;
 }
Example #25
0
 function getData()
 {
     global $dbh, $msg;
     $this->ntu_data = array();
     if ($this->id) {
         $requete = "SELECT * FROM notices_titres_uniformes WHERE ntu_num_notice={$this->id} order by ntu_ordre";
         $result = pmb_mysql_query($requete, $dbh);
         $nb_result = 0;
         if (pmb_mysql_num_rows($result)) {
             while ($res_tu = pmb_mysql_fetch_object($result)) {
                 $this->ntu_data[$nb_result] = new stdClass();
                 $this->ntu_data[$nb_result]->num_tu = $res_tu->ntu_num_tu;
                 $this->ntu_data[$nb_result]->titre = $res_tu->ntu_titre;
                 $this->ntu_data[$nb_result]->date = $res_tu->ntu_date;
                 $this->ntu_data[$nb_result]->sous_vedette = $res_tu->ntu_sous_vedette;
                 $this->ntu_data[$nb_result]->langue = $res_tu->ntu_langue;
                 $this->ntu_data[$nb_result]->version = $res_tu->ntu_version;
                 $this->ntu_data[$nb_result]->mention = $res_tu->ntu_mention;
                 $this->ntu_data[$nb_result]->tu = new titre_uniforme($this->ntu_data[$nb_result]->num_tu);
                 /*  Champs récupérés du titre uniforme:
                 				 	name 			
                 					tonalite
                 					comment
                 					distrib (array)
                 					ref (array)
                 					subdiv (array)
                 				*/
                 $nb_result++;
             }
         } else {
             // pas trouvé avec cette clé
         }
     }
 }
Example #26
0
function show_procs($idcaddie)
{
    global $msg;
    global $PMBuserid;
    global $dbh;
    print "<hr />{$msg['caddie_select_proc']}<br /><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 = "add_item";
            }
            $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='./catalog.php?categ=caddie&sub=collecte&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']}&nbsp;</small>\n\t\t\t\t\t\t</td>\n\t\t\t\t</tr>");
        }
    }
    print "</table>";
}
 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;
 }
Example #28
0
 function check_write_permission()
 {
     global $webdav_current_user_id;
     if ($this->config['write_permission']) {
         $tab = array();
         $query = "";
         switch ($this->config['authentication']) {
             case "gestion":
                 $tab = $this->config['restrcited_user_write_permission'];
                 $query = "select grp_num from users where userid = " . $webdav_current_user_id;
                 break;
             case "opac":
                 $query = "select empr_categ from empr where id_empr = " . $webdav_current_user_id;
             case "anonymous":
             default:
                 $tab = $this->config['restrcited_empr_write_permission'];
                 break;
         }
         //pas de restriction, on est bon
         if (!count($tab)) {
             return true;
         } elseif ($query != "") {
             //on doit s'assurer que la personne connectée est dispose des droits...
             $result = pmb_mysql_query($query);
             if (pmb_mysql_num_rows($result)) {
                 if (in_array(pmb_mysql_result($result, 0, 0), $tab)) {
                     return true;
                 }
             }
         }
     }
     //si on est encore dans la fonction, c'est qu'on correspond à aucun critère !
     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;
 }
 public function get_datas()
 {
     //on commence par récupérer l'identifiant retourné par le sélecteur...
     if ($this->parameters['selector'] != "") {
         for ($i = 0; $i < count($this->selectors); $i++) {
             if ($this->selectors[$i]['name'] == $this->parameters['selector']) {
                 $selector = new $this->parameters['selector']($this->selectors[$i]['id']);
                 break;
             }
         }
         $shelves = $selector->get_value();
         if (is_array($shelves) && count($shelves)) {
             foreach ($shelves as $shelve_id) {
                 $query = "select id_tri from etagere where idetagere =" . $shelve_id;
                 $result = pmb_mysql_query($query);
                 $records = $notices = array();
                 if ($result && pmb_mysql_num_rows($result)) {
                     while ($row = pmb_mysql_fetch_object($result)) {
                         notices_caddie($shelve_id, $notices, '', '', '', 0, $row->id_tri);
                     }
                 }
                 foreach ($notices as $id => $niv) {
                     $records[] = $id;
                 }
             }
         }
         $records = $this->filter_datas("notices", $records);
         if ($this->parameters['nb_max_elements'] > 0) {
             $records = array_slice($records, 0, $this->parameters['nb_max_elements']);
         }
         $return = array('title' => 'Liste de Notices', 'records' => $records);
         return $return;
     }
     return false;
 }