Example #1
0
function show_list_biblio_from_sug($sugchk)
{
    global $dbh;
    global $msg, $charset;
    global $tab_bib;
    global $current_module;
    $sugchk = rawurlencode(serialize($sugchk));
    //Affichage de la liste des etablissements et exercices auxquels a acces l'utilisateur
    $te = array();
    foreach ($tab_bib[0] as $k => $v) {
        $qe = entites::getCurrentExercices($v);
        $re = pmb_mysql_query($qe, $dbh);
        while ($rowe = pmb_mysql_fetch_object($re)) {
            $te[$rowe->id_exercice][0] = $v;
            $te[$rowe->id_exercice][1] = $tab_bib[1][$k];
            $te[$rowe->id_exercice][2] = $rowe->libelle;
        }
    }
    switch (count($te)) {
        case 0:
            //Pas d'exercice actif
            $error_msg .= htmlentities($msg["acquisition_err_exer"], ENT_QUOTES, $charset) . "<div class='row'></div>";
            error_message($msg[321], $error_msg . htmlentities($msg["acquisition_err_par"], ENT_QUOTES, $charset), '1', './admin.php?categ=acquisition');
            die;
            break;
        default:
            $aff = "<form class='form-" . $current_module . "' id='list_biblio_form' name='list_biblio_form' method='post' action=\"\" >";
            $aff .= "<input type='hidden' id='sugchk' name='sugchk' value='" . $sugchk . "' />";
            $aff .= "<h3>" . htmlentities($msg['acquisition_menu_chx_ent_exe'], ENT_QUOTES, $charset) . "</h3><div class='row'></div>";
            $aff .= "<table>";
            $parity = 1;
            $tb = array();
            foreach ($te as $key => $value) {
                if (in_array($value[0], $tb) === false) {
                    $tb[] = $value[0];
                    if ($parity % 2) {
                        $pair_impair = "even";
                    } else {
                        $pair_impair = "odd";
                    }
                    $parity += 1;
                    $aff .= "<tr class='" . $pair_impair . "' ><th>" . htmlentities($value[1], ENT_QUOTES, $charset) . "</th></tr>";
                }
                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.forms['list_biblio_form'].setAttribute('action','./acquisition.php?categ=ach&sub=cmde&action=from_sug_next&id_bibli=" . $value[0] . "&id_exer=" . $key . "');document.forms['list_biblio_form'].submit(); \" ";
                $aff .= "<tr class='" . $pair_impair . "' " . $tr_javascript . " style='cursor: pointer' ><td><i>" . htmlentities($value[2], ENT_QUOTES, $charset) . "</i></td></tr>";
            }
            $aff .= " </table></form>";
            if (count($te) == '1') {
                $aff .= "<script type='text/javascript'>document.forms['list_biblio_form'].setAttribute('action','./acquisition.php?categ=ach&sub=cmde&action=from_sug_next&id_bibli=" . $value[0] . "&id_exer=" . $key . "');document.forms['list_biblio_form'].submit();</script>";
            }
            print $aff;
            break;
    }
}
Example #2
0
function verif_exercice($id_bibli)
{
    global $charset;
    global $msg;
    global $dbh;
    $q = entites::getCurrentExercices($id_bibli);
    $r = mysql_query($q, $dbh);
    if (mysql_num_rows($r)) {
        return;
    }
    //Pas d'exercice actif pour la bibliothèque
    $error_msg .= htmlentities($msg["acquisition_err_exer"], ENT_QUOTES, $charset) . "<div class='row'></div>";
    error_message($msg[321], $error_msg . htmlentities($msg["acquisition_err_par"], ENT_QUOTES, $charset), '1', './admin.php?categ=acquisition');
    die;
}