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;
             }
         }
         $bannettes = $selector->get_value();
         if (is_array($bannettes) && count($bannettes)) {
             foreach ($bannettes as $bannette_id) {
                 $records = $notices = array();
                 notices_bannette($bannette_id, $notices);
                 foreach ($notices as $id => $niv) {
                     $records[] = $id;
                 }
             }
         }
         $records = $this->filter_datas("notices", $records);
         $records = array_slice($records, 0, $this->parameters['nb_max_elements']);
         $return = array('title' => 'Liste de Notices', 'records' => $records);
         return $return;
     }
     return false;
 }
function affiche_public_bannette($bannettes = "", $aff_notices_nb = 0, $mode_aff_notice = AFF_BAN_NOTICES_BOTH, $depliable = AFF_BAN_NOTICES_DEPLIABLES_OUI, $link_to_bannette = "", $liens_opac = array(), $date_diff = '', $htmldiv_id = "bannette-container", $htmldiv_class = "bannette-container", $htmldiv_zindex = "")
{
    global $dbh;
    global $msg, $charset;
    global $opac_notice_affichage_class;
    global $affiche_bannette_tpl;
    // récupération des bannettes
    global $id_empr;
    global $opac_websubscribe_show;
    global $id_empr;
    if ($bannettes) {
        $clause = " and id_bannette in ({$bannettes}) ";
    }
    //Récupération des infos des bannettes
    $requete = "select distinct id_bannette,comment_public, date_format(date_last_envoi, '" . $msg["format_date"] . "') as aff_date_last_envoi from bannettes where proprio_bannette = 0 {$clause} order by date_last_envoi DESC ";
    $resultat = pmb_mysql_query($requete);
    $tableau_bannettes = array();
    while ($r = pmb_mysql_fetch_object($resultat)) {
        $requete = "select count(1) as compte from bannette_contenu where num_bannette='{$r->id_bannette}'";
        $resnb = pmb_mysql_query($requete);
        $nb = pmb_mysql_fetch_object($resnb);
        if ($nb->compte) {
            $tableau_bannettes[] = array('id_bannette' => $r->id_bannette, 'comment_public' => $r->comment_public, 'aff_date_last_envoi' => $r->aff_date_last_envoi, 'nb_contenu' => $nb->compte);
        }
    }
    if (!sizeof($tableau_bannettes)) {
        return "";
    }
    // préparation du div comme il faut
    $retour_aff = "<div id='{$htmldiv_id}' class='{$htmldiv_class}'";
    if ($htmldiv_zindex) {
        $retour_aff .= " zindex='{$htmldiv_zindex}' ";
    }
    $retour_aff .= " >";
    for ($i = 0; $i < sizeof($tableau_bannettes); $i++) {
        $aff_banette = "";
        $id_bannette = $tableau_bannettes[$i]['id_bannette'];
        $comment_public = $tableau_bannettes[$i]['comment_public'];
        $aff_date_last_envoi = $tableau_bannettes[$i]['aff_date_last_envoi'];
        $aff_banette .= "\n<div class='bannette-titre'><h1>";
        $aff_banette .= "<a href='cart_info.php?lvl=dsi&id={$id_bannette}' target='cart_info' title=\"" . $msg[notice_title_basket] . "\"><img src='" . get_url_icon("basket_small_20x20.png") . "' border='0' alt=\"" . $msg[notice_title_basket] . "\"></a>";
        if ($link_to_bannette) {
            $aff_banette .= "<a href=\"" . str_replace("!!id_bannette!!", $id_bannette, $link_to_bannette) . "\">";
        }
        if ($date_diff) {
            $aff_banette .= htmlentities($comment_public . " - " . formatdate($date_diff), ENT_QUOTES, $charset);
        } else {
            $aff_banette .= htmlentities($comment_public . " - " . $aff_date_last_envoi, ENT_QUOTES, $charset);
        }
        if ($link_to_bannette) {
            $aff_banette .= "</a>";
        }
        //TODO
        if ($_SESSION['user_code']) {
            $aff_banette .= "\n\t\t\t<form name='bannette_subscription' method='post' action='./empr.php?tab=dsi&lvl=bannette_gerer'>\n\t\t\t\t<input type='hidden' name='enregistrer' value='PUB'/>\n\t\t\t\t<input type='hidden' name='lvl' value='bannette_gerer'/>\n\t\t\t\t<input type='hidden' name='bannette_abon[" . $id_bannette . "]' value='1' />";
            $query = "select num_bannette from bannette_abon where num_empr = " . $id_empr;
            $result = pmb_mysql_query($query);
            if (pmb_mysql_num_rows($result)) {
                while ($row = pmb_mysql_fetch_object($result)) {
                    $aff_banette .= "\n\t\t\t\t<input type='hidden' name='bannette_abon[" . $row->num_bannette . "]' value='1' />";
                }
            }
            $aff_banette .= "\n\t\t\t\t<input type='submit' class='bouton' value=\"" . $msg['bannette_abonn'] . "\"/>\n\t\t\t</form>";
        } else {
            if ($opac_websubscribe_show == 2) {
                $aff_banette .= "\n\t\t\t<form name='bannette_subscription' method='post' action='./do_resa.php'>\n\t\t\t\t<input type='hidden' name='enregistrer' value='PUB'/>\n\t\t\t\t<input type='hidden' name='lvl' value='bannette_gerer'/>\n\t\t\t\t<input type='hidden' name='new_connexion' value='1' /> \n\t\t\t\t<input type='hidden' name='tab' value='dsi'/>\n\t\t\t\t<input type='hidden' name='bannette_abon[" . $id_bannette . "]' value='1' />";
                $aff_banette .= "\n\t\t\t\t<input type='submit' class='bouton' value=\"" . $msg['bannette_abonn'] . "\"/>\n\t\t\t</form>";
            }
        }
        $aff_banette .= "</h1></div><hr/>";
        $notices = array();
        notices_bannette($id_bannette, $notices, $date_diff);
        if ($aff_notices_nb > 0) {
            $limite_notices = min($aff_notices_nb, count($notices));
        } elseif ($aff_notices_nb < 0) {
            $limite_notices = min($aff_notices_nb, count($notices));
        } else {
            $limite_notices = count($notices);
        }
        reset($notices);
        $limit = 0;
        if ($limite_notices) {
            $aff_banette .= "<div id='etagere-notice-list_!!id_bannette!!'>";
        }
        while ((list($idnotice, $niveau_biblio) = each($notices)) && $limit < $limite_notices) {
            $limit++;
            $notice = new $opac_notice_affichage_class($idnotice, $liens_opac, 1);
            // si notice visible
            if ($notice->visu_notice) {
                $notice->do_header();
                switch ($mode_aff_notice) {
                    case AFF_BAN_NOTICES_REDUIT:
                        $aff_banette .= "<div class='etagere-titre-reduit'>" . $notice->notice_header_with_link . "</div>";
                        break;
                    case AFF_BAN_NOTICES_ISBD:
                        $notice->do_isbd();
                        $notice->genere_simple($depliable, 'ISBD');
                        $aff_banette .= $notice->result;
                        break;
                    case AFF_BAN_NOTICES_PUBLIC:
                        $notice->do_public();
                        $notice->genere_simple($depliable, 'PUBLIC');
                        $aff_banette .= $notice->result;
                        break;
                    case AFF_BAN_NOTICES_BOTH:
                        $notice->do_isbd();
                        $notice->do_public();
                        $notice->genere_double($depliable, 'PUBLIC');
                        $aff_banette .= $notice->result;
                        break;
                    default:
                        $notice->do_isbd();
                        $notice->do_public();
                        $notice->genere_double($depliable, 'autre');
                        $aff_banette .= $notice->result;
                        break;
                }
            }
        }
        if ($limite_notices && $limite_notices < count($notices)) {
            $aff_banette .= "<br />...";
        }
        if ($limite_notices) {
            $aff_banette .= "</div>";
        }
        $req = "select distinct date_diff_arc from dsi_archive where num_banette_arc='" . $id_bannette . "' order by date_diff_arc desc";
        $res_arc = pmb_mysql_query($req, $dbh);
        $first = 0;
        $diff_list = "";
        while ($r = pmb_mysql_fetch_object($res_arc)) {
            if (!$first) {
                $libelle = $msg["dsi_archive_last"];
            } else {
                $libelle = sprintf($msg["dsi_archive_other"], formatdate($r->date_diff_arc));
            }
            if ($pair_impair == 'even') {
                $pair_impair = 'odd';
            } else {
                $pair_impair = 'even';
            }
            $tr_javascript = " onmouseover=\"this.className='surbrillance'\" onmouseout=\"this.className='{$pair_impair}'\" onmousedown=\"document.location='{$link_to_bannette}&date_diff=" . $r->date_diff_arc . "';\" ";
            $diff = "<tr style='cursor: pointer' class='{$pair_impair}' {$tr_javascript}><td>" . $libelle . "</td></tr>";
            $first = 1;
            $diff_list .= $diff;
        }
        $tpl = $affiche_bannette_tpl;
        $tpl = str_replace("!!historique!!", $diff_list, $tpl);
        $tpl = str_replace("!!diffusion!!", $aff_banette, $tpl);
        $tpl = str_replace("!!id_bannette!!", $id_bannette, $tpl);
        $retour_aff .= $tpl;
    }
    // fermeture du DIV
    $retour_aff .= "</div><!-- fin id='{$htmldiv_id}' class='{$htmldiv_class}' -->";
    return $retour_aff;
}