function gerer_abon_bannette($priv_pub = "PUB", $link_to_bannette = "", $htmldiv_id = "bannette-container", $htmldiv_class = "bannette-container", $htmldiv_zindex = "")
{
    global $dbh;
    global $charset;
    global $msg;
    global $opac_allow_resiliation;
    // récupération des bannettes
    $tableau_bannettes = tableau_gerer_bannette($priv_pub);
    if (!sizeof($tableau_bannettes)) {
        return "";
    }
    // préparation du tableau
    $retour_aff = "<div id='{$htmldiv_id}' class='{$htmldiv_class}'";
    if ($htmldiv_zindex) {
        $retour_aff .= " zindex='{$htmldiv_zindex}' ";
    }
    $retour_aff .= " >";
    $retour_aff .= "<form name='bannette_abonn' method='post' >";
    $retour_aff .= "<input type='hidden' name='lvl' value='bannette_gerer' />";
    $retour_aff .= "<input type='hidden' name='enregistrer' value='{$priv_pub}' />";
    $retour_aff .= "<table cellpadding='3px' cellspacing='5px'><tr>\n\t\t\t\t\t\t\t<th align='right' valign='bottom'>" . $msg[dsi_bannette_gerer_abonn] . "</th>\n\t\t\t\t\t\t\t<th align='left' valign='bottom'>" . $msg[dsi_bannette_gerer_nom_liste] . "</th>\n\t\t\t\t\t\t\t<th align='center' valign='bottom'>" . $msg[dsi_bannette_gerer_date] . "</th>\n\t\t\t\t\t\t\t<th align='center' valign='bottom'>" . $msg[dsi_bannette_gerer_nb_notices] . "</th>\n\t\t\t\t\t\t\t<th align='center' valign='bottom'>" . $msg[dsi_bannette_gerer_periodicite] . "</th>\n\t\t\t\t\t\t\t</tr>";
    for ($i = 0; $i < sizeof($tableau_bannettes); $i++) {
        $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'];
        $retour_aff .= "\n<tr><td align='right' valign='top'>";
        if (!$opac_allow_resiliation && $tableau_bannettes[$i]['categorie_lecteurs']) {
            $retour_aff .= "\n<input type='checkbox' name='dummy[]' value='' " . $tableau_bannettes[$i]['abonn'] . " disabled />";
            $retour_aff .= "<input type='hidden' name='bannette_abon[{$id_bannette}]' value='1' " . $tableau_bannettes[$i]['abonn'] . " style='display:none'/>";
        } else {
            $retour_aff .= "\n<input type='checkbox' name='bannette_abon[{$id_bannette}]' value='1' " . $tableau_bannettes[$i]['abonn'] . " />";
        }
        $retour_aff .= "\n</td><td align='left' valign='top'>";
        if ($link_to_bannette) {
            // Construction de l'affichage de l'info bulle de la requette
            $requete = "select * from bannette_equation, equations where num_equation=id_equation and num_bannette={$id_bannette}";
            $resultat = pmb_mysql_query($requete);
            if ($r = pmb_mysql_fetch_object($resultat)) {
                $recherche = $r->requete;
                $equ = new equation($r->num_equation);
                if (!is_object($search)) {
                    $search = new search();
                }
                $search->unserialize_search($equ->requete);
                $recherche = $search->make_human_query();
                $zoom_comment = "<div id='zoom_comment" . $id_bannette . "' style='border: solid 2px #555555; background-color: #FFFFFF; position: absolute; display:none; z-index: 2000;'>";
                $zoom_comment .= $recherche;
                $zoom_comment .= "</div>";
                $java_comment = " onmouseover=\"z=document.getElementById('zoom_comment" . $id_bannette . "'); z.style.display=''; \" onmouseout=\"z=document.getElementById('zoom_comment" . $id_bannette . "'); z.style.display='none'; \"";
            }
            $retour_aff .= "<a href=\"" . str_replace("!!id_bannette!!", $id_bannette, $link_to_bannette) . "\" {$java_comment} >";
        }
        $retour_aff .= htmlentities($comment_public, ENT_QUOTES, $charset);
        if ($link_to_bannette) {
            $retour_aff .= "</a>";
            $retour_aff .= $zoom_comment;
        }
        $retour_aff .= "\n</td><td align='center' valign='top'>";
        $retour_aff .= htmlentities($aff_date_last_envoi, ENT_QUOTES, $charset);
        $retour_aff .= "\n</td><td align='center' valign='top'>";
        $retour_aff .= htmlentities($tableau_bannettes[$i]['nb_contenu'], ENT_QUOTES, $charset);
        $retour_aff .= "\n</td><td align='center' valign='top'>";
        $retour_aff .= htmlentities($tableau_bannettes[$i]['periodicite'], ENT_QUOTES, $charset);
        $retour_aff .= "</td></tr>";
    }
    // fermeture du tableau
    $retour_aff .= "</table>\n\t\t\t\t\t<INPUT type='submit' class='bouton' value=\"";
    if ($priv_pub == "PUB") {
        $retour_aff .= $msg[dsi_bannette_gerer_sauver];
    } else {
        $retour_aff .= $msg[dsi_bannette_gerer_supprimer];
    }
    $retour_aff .= "\" />\n\t\t\t\t\t</form></div><!-- fin id='{$htmldiv_id}' class='{$htmldiv_class}' -->";
    return $retour_aff;
}
Esempio n. 2
0
    $id_empr = $_SESSION["id_empr_session"];
}
if ($enregistrer == 'PUB') {
    $tableau_bannettes = tableau_gerer_bannette("PUB");
    for ($i = 0; $i < sizeof($tableau_bannettes); $i++) {
        $id_bannette = $tableau_bannettes[$i]['id_bannette'];
        if ($opac_allow_resiliation && !$new_connexion) {
            pmb_mysql_query("delete from bannette_abon where num_empr='{$id_empr}' and num_bannette='{$id_bannette}' ");
        }
        if ($bannette_abon[$id_bannette]) {
            pmb_mysql_query("replace into bannette_abon (num_empr, num_bannette) values('{$id_empr}', '" . $id_bannette . "')", $dbh);
        }
    }
}
if ($enregistrer == 'PRI') {
    $tableau_bannettes = tableau_gerer_bannette("PRI");
    for ($i = 0; $i < sizeof($tableau_bannettes); $i++) {
        $id_bannette = $tableau_bannettes[$i]['id_bannette'];
        if ($bannette_abon[$id_bannette]) {
            pmb_mysql_query("delete from bannette_abon where num_empr='{$id_empr}' and num_bannette='{$id_bannette}' ");
            pmb_mysql_query("delete from bannette_contenu where num_bannette='{$id_bannette}' ");
            $req_eq = pmb_mysql_query("select num_equation from bannette_equation where num_bannette='{$id_bannette}' ");
            $eq = pmb_mysql_fetch_object($req_eq);
            pmb_mysql_query("delete from equations where id_equation='" . $eq->num_equation . "' ");
            pmb_mysql_query("delete from bannette_equation where num_bannette='{$id_bannette}' ");
            pmb_mysql_query("delete from bannettes where id_bannette='{$id_bannette}' ");
        }
    }
}
print "<div id='aut_details' class='aut_details_bannette'>\n";
if ($opac_allow_resiliation) {
Esempio n. 3
0
 function list_abonnements($session_id)
 {
     global $dbh, $msg;
     if (!$session_id) {
         return array();
     }
     $session_info = $this->retrieve_session_information($session_id);
     $empr_id = $session_info["empr_id"];
     if (!$empr_id) {
         return array();
     }
     $empr = new emprunteur($empr_id);
     global $opac_allow_resiliation, $opac_allow_bannette_priv;
     $results = array();
     $tableau_bannette_pub = tableau_gerer_bannette($empr_id, $empr->categ, "PUB");
     $tableau_bannette_priv = tableau_gerer_bannette($empr_id, $empr->categ, "PRI");
     $tableau_bannettes = array_merge($tableau_bannette_pub, $tableau_bannette_priv);
     $search = new search();
     foreach ($tableau_bannettes as $abanette) {
         // Construction de l'affichage de l'info bulle de la requette
         $requete = "select * from bannette_equation, equations where num_equation=id_equation and num_bannette=" . $abanette["id_bannette"];
         $resultat = mysql_query($requete);
         if ($r = mysql_fetch_object($resultat)) {
             $equ = new equation($r->num_equation);
             $search->unserialize_search($equ->requete);
             $recherche = $search->make_human_query();
         }
         $a_abonnement = array('abonnement_id' => $abanette["id_bannette"], 'abonnement_type' => $abanette["priv_pub"] == 'PUB' ? "PUBLIC" : 'PRIVATE', 'abonnement_title' => utf8_normalize($abanette["comment_public"]), 'abonnement_lastsentdate' => utf8_normalize($abanette["aff_date_last_envoi"]), 'abonnement_notice_count' => $abanette["nb_contenu"], 'abonnement_equation_human' => utf8_normalize($recherche), 'empr_subscriber' => $abanette["priv_pub"] == 'PUB' ? $abanette["abonn"] == 'checked' : true);
         $results[] = $a_abonnement;
     }
     return $results;
 }