function show_form()
    {
        global $modele_form;
        global $serial_header;
        global $msg;
        global $charset;
        global $tpl_del_bouton, $tpl_copy_bouton;
        $r = $serial_header . $modele_form;
        if (!$this->modele_id) {
            $r = str_replace('!!page_title!!', $msg[4000] . $msg[1003] . $msg["abts_modeles_add_title"], $r);
            $r = str_replace('!!libelle_form!!', $msg["abts_modeles_add_title"], $r);
            // Valeur par défaut
            $this->duree_abonnement = 12;
            $this->num_cycle = 0;
            $this->num_combien = 12;
            $this->num_increment = 0;
            $this->num_date_unite = 1;
            $this->num_increment_date = 12;
            $this->num_depart = 1;
            $this->vol_actif = 0;
            $this->vol_increment = 0;
            $this->vol_date_unite = 1;
            //mois
            $this->vol_increment_numero = 12;
            $this->vol_increment_date = 12;
            $this->vol_cycle = 0;
            $this->vol_combien = 1;
            $this->vol_depart = 1;
            $this->tom_actif = 0;
            $this->tom_increment = 10;
            $this->tom_date_unite = 2;
            $this->tom_increment_numero = 1;
            $this->tom_increment_date = 1;
            $this->tom_cycle = 0;
            $this->tom_combien = 1;
            $this->tom_depart = 1;
            $this->format_aff = sprintf($msg['abts_no'], "\$NUM;");
            $this->format_periode = "#date(\$DATE;);";
        } else {
            $r = str_replace('!!page_title!!', $msg[4000] . $msg[1003] . $msg["abts_modeles_modify_title"], $r);
            $r = str_replace('!!libelle_form!!', $msg["abts_modeles_modify_title"], $r);
        }
        //Construction du formulaire
        if ($this->modele_id) {
            $del_bouton = $tpl_del_bouton;
            $copy_bouton = $tpl_copy_bouton;
        } else {
            $copy_bouton = $del_bouton = "";
        }
        $this->getData();
        $r = str_replace("!!del_button!!", $del_bouton, $r);
        $r = str_replace("!!copy_bouton!!", $copy_bouton, $r);
        //Remplacement des valeurs
        $r = str_replace("!!modele_id!!", htmlentities($this->modele_id, ENT_QUOTES, $charset), $r);
        $r = str_replace("!!modele_name!!", htmlentities($this->modele_name, ENT_QUOTES, $charset), $r);
        //Notice mère
        $perio = new serial_display($this->num_notice, 1);
        $r = str_replace("!!num_notice_libelle!!", $perio->header, $r);
        $r = str_replace("!!num_notice!!", $this->num_notice, $r);
        //Périodicité
        $requete = "select periodicite_id,libelle from abts_periodicites";
        $resultat = pmb_mysql_query($requete);
        $liste_perio = "<select name='num_periodicite'>\n<option value='0'>" . $msg['abonnements_periodicite_manuel'] . "</option>\n";
        while ($rp = pmb_mysql_fetch_object($resultat)) {
            $liste_perio .= "<option value='" . $rp->periodicite_id . "' " . ($this->num_periodicite == $rp->periodicite_id ? "selected" : "") . ">" . htmlentities($rp->libelle, ENT_QUOTES, $charset) . "</option>\n";
        }
        $liste_perio .= "</select>";
        $r = str_replace("!!num_periodicite!!", $liste_perio, $r);
        //Durée d'abonnement
        $r = str_replace("!!duree_abonnement!!", $this->duree_abonnement, $r);
        //Date de début
        if (!$this->date_debut || $this->date_debut == "0000-00-00") {
            $date_debut = date("Ymd", time());
        } else {
            $date_debut = $this->date_debut;
        }
        $r = str_replace("!!date_debut!!", str_replace("-", "", $date_debut), $r);
        $r = str_replace("!!date_debut_lib!!", formatdate($date_debut), $r);
        //Date de fin
        if (!$this->date_fin || $this->date_fin == "0000-00-00") {
            $date_fin = pmb_sql_value("SELECT DATE_ADD('{$date_debut}', INTERVAL 1 YEAR)");
        } else {
            $date_fin = $this->date_fin;
        }
        $r = str_replace("!!date_fin!!", str_replace("-", "", $date_fin), $r);
        $r = str_replace("!!date_fin_lib!!", format_date($date_fin), $r);
        //Jours de la semaine exclus
        $days = "\n\t\t<table>";
        $days_t = "<tr>";
        $days_v = "<tr>";
        for ($i = 1; $i < 8; $i++) {
            $days_t .= "<td>" . $msg["week_days_short_" . $i] . "</td>";
            $days_v .= "<td><input type='checkbox' value='{$i}' " . (!$this->days[$i - 1] && $this->modele_id ? "checked" : "yes") . " name='days[{$i}]'/></td>";
        }
        $days_v .= "</tr>";
        $days_t .= "</tr>";
        $days .= $days_t . "\n" . $days_v . "\n\t\t</table>";
        $r = str_replace("!!days!!", $days, $r);
        //Jours du mois exclus
        $day_month = "\n\t\t<table>";
        for ($j = 0; $j < 3; $j++) {
            $days_t = "<tr>";
            $days_v = "<tr>";
            for ($i = 0; $i < 15; $i++) {
                if ($j * (14 + 1) + $i + 1 > 31) {
                    break;
                }
                $days_t .= "<td>" . ($j * (14 + 1) + $i + 1) . "</td>";
                $days_v .= "<td><input type='checkbox' value='" . ($j * 15 + $i + 1) . "' " . (!$this->day_month[$j * 15 + $i] && $this->modele_id ? "checked" : "yes") . " name='day_month[" . ($j * 15 + $i + 1) . "]'/></td>";
            }
            $days_v .= "</tr>";
            $days_t .= "</tr>";
            $day_month .= $days_t . "\n" . $days_v . "\n";
        }
        $day_month .= "\n\t\t</table>";
        $r = str_replace("!!days_month!!", $day_month, $r);
        //Semaines dans le mois exclues
        $week_month = "\n\t\t<table>";
        $days_t = "<tr>";
        $days_v = "<tr>";
        for ($i = 1; $i < 7; $i++) {
            $days_t .= "<td>" . $i . "</td>";
            $days_v .= "<td><input type='checkbox' value='{$i}' " . (!$this->week_month[$i - 1] && $this->modele_id ? "checked" : "yes") . " name='week_month[{$i}]'/></td>";
        }
        $days_v .= "</tr>";
        $days_t .= "</tr>";
        $week_month .= $days_t . "\n" . $days_v . "\n\t\t</table>";
        $r = str_replace("!!week_month!!", $week_month, $r);
        //Semaines dans l'année exclues
        $week_year = "\n\t\t<table>";
        $nb_x = 15;
        $nb = 54;
        for ($j = 0; $j < $nb / $nb_x; $j++) {
            $days_t = "<tr>";
            $days_v = "<tr>";
            for ($i = 0; $i < $nb_x; $i++) {
                if ($j * $nb_x + $i + 1 > $nb) {
                    break;
                }
                $days_t .= "<td>" . ($j * $nb_x + $i + 1) . "</td>";
                $days_v .= "<td><input type='checkbox' value='" . ($j * $nb_x + $i + 1) . "' " . (!$this->week_year[$j * $nb_x + $i] && $this->modele_id ? "checked" : "yes") . " name='week_year[" . ($j * $nb_x + $i + 1) . "]'/></td>";
            }
            $days_v .= "</tr>";
            $days_t .= "</tr>";
            $week_year .= $days_t . "\n" . $days_v . "\n";
        }
        $week_year .= "\n\t\t</table>";
        $r = str_replace("!!week_year!!", $week_year, $r);
        //Mois dans l'année exclus
        $month_year = "\n\t\t<table>";
        $nb_x = 6;
        $nb = 12;
        for ($j = 0; $j < $nb / $nb_x; $j++) {
            $days_t = "<tr>";
            $days_v = "<tr>";
            for ($i = 0; $i < $nb_x; $i++) {
                if ($j * $nb_x + $i + 1 > $nb) {
                    break;
                }
                $days_t .= "<td>" . $msg[$j * $nb_x + $i + 1006] . "</td>";
                $days_v .= "<td><input type='checkbox' value='" . ($j * $nb_x + $i + 1) . "' " . (!$this->month_year[$j * $nb_x + $i] && $this->modele_id ? "checked" : "yes") . " name='month_year[" . ($j * $nb_x + $i + 1) . "]'/></td>";
            }
            $days_v .= "</tr>";
            $days_t .= "</tr>";
            $month_year .= $days_t . "\n" . $days_v . "\n";
        }
        $month_year .= "\n\t\t</table>";
        $r = str_replace("!!month_year!!", $month_year, $r);
        //Numérotation:  Numéro
        $selected[$this->num_date_unite] = "selected='selected'";
        $str_unite = "\n\t\t\t<select id='num_date_unite' name='num_date_unite'>\n\t\t\t\t<option value='0'{$selected['0']}>{$msg['abonnements_periodicite_unite_jour']}</option>\n\t\t\t\t<option value='1'{$selected['1']}>{$msg['abonnements_periodicite_unite_mois']}</option>\n\t\t\t\t<option value='2'{$selected['2']}>{$msg['abonnements_periodicite_unite_annee']}</option>\n\t\t\t</select>";
        $selected[$this->num_date_unite] = '';
        $num = "<table>";
        $num_t = "<tr>";
        $num_v = "<tr>";
        $num_t .= "<td>" . $msg["abonnements_actif"] . "</td>";
        $num_v .= "<td><input type='checkbox' value='1' checked='checked'  disabled='disabled' name='facilite' id='facilite' /></td>";
        $num_t .= "</tr>";
        $num_v .= "</tr>";
        $num .= $num_t . "\n" . $num_v . "\n";
        $num_t = "<tr>";
        $num_v = "<tr>";
        $num_t .= "<td>" . $msg["abonnements_cyclique"] . "</td>";
        $num_v .= "<td><input type='checkbox' value='1' " . ($this->num_cycle ? "checked" : "yes") . " name='num_cycle[1]' id='num_cycle'  onClick='gere_num(\"num_cycle\");'/></td>";
        $num_t .= "</tr>";
        $num_v .= "</tr>";
        $num .= $num_t . "\n" . $num_v . "\n";
        $num_t = "<tr>";
        $num_v = "<tr>";
        $num_t .= "<td></td>";
        $num_v .= "<td></td>";
        $num_t .= "<td><input type='radio' name='num_increment' id='num_increment' value='0' " . ($this->num_increment == 0 ? "checked" : "yes") . ">" . $msg["abonnements_incrementation_selon_numero_1"] . "<input type='text' size='5' name='num_combien' id='num_combien' value='{$this->num_combien}'/>" . $msg["abonnements_incrementation_selon_numero_2"] . "</td>";
        $num_v .= "<td><input type='radio' name='num_increment' id='num_increment1' value='1' " . ($this->num_increment == 1 ? "checked" : "yes") . ">" . $msg["abonnements_incrementation_selon_date_1"] . "<input type='text' size='5' name='num_increment_date' id='num_increment_date' value='{$this->num_increment_date}'/>{$str_unite}" . $msg["abonnements_incrementation_selon_date_2"] . "</td>";
        $num_t .= "<td>" . $msg["abonnements_numero_depart"] . "</td>";
        $num_v .= "<td><input type='text' size='5' name='num_depart' id='num_depart' value='{$this->num_depart}' /></td>";
        $num_t .= "</tr>";
        $num_v .= "</tr>";
        $num .= $num_t . "\n" . $num_v . "\n";
        $num .= "</table>";
        $r = str_replace("!!numero!!", $num, $r);
        //Numérotation: Volume
        $selected[$this->vol_date_unite] = "selected='selected'";
        $str_unite = "\n\t\t\t<select id='vol_date_unite' name='vol_date_unite'>\n\t\t\t\t<option value='0'{$selected['0']}>{$msg['abonnements_periodicite_unite_jour']}</option>\n\t\t\t\t<option value='1'{$selected['1']}>{$msg['abonnements_periodicite_unite_mois']}</option>\n\t\t\t\t<option value='2'{$selected['2']}>{$msg['abonnements_periodicite_unite_annee']}</option>\n\t\t\t</select>";
        $selected[$this->vol_date_unite] = '';
        $vol = "<table>";
        $vol_t = "<tr>";
        $vol_v = "<tr>";
        $vol_t .= "<td>" . $msg["abonnements_actif"] . "</td>";
        $vol_v .= "<td><input type='checkbox' value='1' " . ($this->vol_actif && $this->modele_id ? "checked" : "yes") . " name='vol_actif[1]' id='vol_actif'  onClick='gere_num(\"vol_actif\");'/></td>";
        $vol_t .= "</tr>";
        $vol_v .= "</tr>";
        $vol .= $vol_t . "\n" . $vol_v . "\n";
        $vol_t = "<tr>";
        $vol_v = "<tr>";
        $vol_t .= "<td>" . $msg["abonnements_incrementation"] . "</td>";
        $vol_t .= "</tr>";
        $vol_v .= "</tr>";
        $vol .= $vol_t . "\n" . $vol_v . "\n";
        $vol_t = "<tr>";
        $vol_v = "<tr>";
        $vol_t .= "<td></td>";
        $vol_v .= "<td></td>";
        $vol_t .= "<td><input type='radio' name='vol_increment' id='vol_increment' value='0' " . ($this->vol_increment == 0 ? "checked" : "yes") . ">" . $msg["abonnements_incrementation_selon_numero_1"] . "<input type='text' size='5' name='vol_increment_numero' id='vol_increment_numero' value='{$this->vol_increment_numero}'/>" . $msg["abonnements_incrementation_selon_numero_2"] . "</td>";
        $vol_v .= "<td><input type='radio' name='vol_increment' id='vol_increment1' value='1' " . ($this->vol_increment == 1 ? "checked" : "yes") . ">" . $msg["abonnements_incrementation_selon_date_1"] . "<input type='text' size='5' name='vol_increment_date' id='vol_increment_date' value='{$this->vol_increment_date}'/>{$str_unite}" . $msg["abonnements_incrementation_selon_date_2"] . "</td>";
        $vol_t .= "</tr>";
        $vol_v .= "</tr>";
        $vol .= $vol_t . "\n" . $vol_v . "\n";
        $vol_t = "<tr>";
        $vol_v = "<tr>";
        $vol_t .= "<td>" . $msg["abonnements_cyclique"] . "</td>";
        $vol_v .= "<td><input type='checkbox' value='1' " . ($this->vol_cycle && $this->modele_id ? "checked" : "yes") . " name='vol_cycle[1]' id='vol_cycle'  onClick='gere_num(\"vol_cycle\");'/></td>";
        $vol_t .= "<td>" . $msg["abonnements_combien"] . "</td>";
        $vol_v .= "<td><input type='text' size='5' name='vol_combien' id='vol_combien' value='{$this->vol_combien}'/></td>";
        $vol_t .= "<td>" . $msg["abonnements_numero_depart"] . "</td>";
        $vol_v .= "<td><input type='text' size='5' name='vol_depart' id='vol_depart' value='{$this->vol_depart}'/></td>";
        $vol_t .= "</tr>";
        $vol_v .= "</tr>";
        $vol .= $vol_t . "\n" . $vol_v . "\n";
        $vol .= "</table>";
        $r = str_replace("!!volume!!", $vol, $r);
        //Numérotation: Tome
        $selected[$this->tom_date_unite] = "selected='selected'";
        $str_unite = "\n\t\t\t<select id='tom_date_unite' name='tom_date_unite'>\n\t\t\t\t<option value='0'{$selected['0']}>{$msg['abonnements_periodicite_unite_jour']}</option>\n\t\t\t\t<option value='1'{$selected['1']}>{$msg['abonnements_periodicite_unite_mois']}</option>\n\t\t\t\t<option value='2'{$selected['2']}>{$msg['abonnements_periodicite_unite_annee']}</option>\n\t\t\t</select>";
        $vol = "<table>";
        $tom = "<table>";
        $tom_t = "<tr>";
        $tom_v = "<tr>";
        $tom_t .= "<td>" . $msg["abonnements_actif"] . "</td>";
        $tom_v .= "<td><input type='checkbox' value='1' " . ($this->tom_actif && $this->modele_id ? "checked" : "yes") . " name='tom_actif[1]' id='tom_actif'   onClick='gere_num(\"tom_actif\");'/></td>";
        $tom_t .= "</tr>";
        $tom_v .= "</tr>";
        $tom .= $tom_t . "\n" . $tom_v . "\n";
        $tom_t = "<tr>";
        $tom_v = "<tr>";
        $tom_t .= "<td>" . $msg["abonnements_incrementation"] . "</td>";
        $tom_t .= "</tr>";
        $tom_v .= "</tr>";
        $tom .= $tom_t . "\n" . $tom_v . "\n";
        $tom_t = "<tr>";
        $tom_v = "<tr>";
        $tom_t .= "<td></td>";
        $tom_v .= "<td></td>";
        $tom_t .= "<td><input type='radio' name='tom_increment' id='tom_increment' value='0' " . ($this->tom_increment == 0 ? "checked" : "yes") . ">" . $msg["abonnements_incrementation_selon_volume_1"] . "<input type='text' size='5' name='tom_increment_numero' id='tom_increment_numero' value='{$this->tom_increment_numero}'/>" . $msg["abonnements_incrementation_selon_volume_2"] . "</td>";
        $tom_v .= "<td><input type='radio' name='tom_increment' id='tom_increment1'  value='1' " . ($this->tom_increment == 1 ? "checked" : "yes") . ">" . $msg["abonnements_incrementation_selon_date_1"] . "<input type='text' size='5' name='tom_increment_date' id='tom_increment_date' value='{$this->tom_increment_date}'/>{$str_unite}" . $msg["abonnements_incrementation_selon_date_2"] . "</td>";
        $tom_t .= "</tr>";
        $tom_v .= "</tr>";
        $tom .= $tom_t . "\n" . $tom_v . "\n";
        $tom_t = "<tr>";
        $tom_v = "<tr>";
        $tom_t .= "<td>" . $msg["abonnements_cyclique"] . "</td>";
        $tom_v .= "<td><input type='checkbox' value='1' " . ($this->tom_cycle && $this->modele_id ? "checked" : "yes") . " name='tom_cycle[1]' id='tom_cycle' onClick='gere_num(\"tom_cycle\");'/></td>";
        $tom_t .= "<td>" . $msg["abonnements_combien"] . "</td>";
        $tom_v .= "<td><input type='text' size='5' name='tom_combien' id='tom_combien' value='{$this->tom_combien}'/></td>";
        $tom_t .= "<td>" . $msg["abonnements_numero_depart"] . "</td>";
        $tom_v .= "<td><input type='text' size='5' name='tom_depart' id='tom_depart' value='{$this->tom_depart}'/></td>";
        $tom_t .= "</tr>";
        $tom_v .= "</tr>";
        $tom .= $tom_t . "\n" . $tom_v . "\n";
        $tom .= "</table>";
        $r = str_replace("!!tome!!", $tom, $r);
        $format = "<table>";
        $format_t = "<tr>";
        $format_v = "<tr>";
        $format_t .= "<td>" . $msg["abonnements_format_numero"] . "</td>";
        $format_v .= "<td><input type='text' size='100' name='format_aff' id='format_aff' value='" . htmlentities($this->format_aff, ENT_QUOTES, $charset) . "'/></td>";
        $format_t .= "</tr>";
        $format_v .= "</tr>";
        $format .= $format_t . "\n" . $format_v . "\n";
        $r = str_replace("!!format!!", $format, $r);
        $format_t = "<tr>";
        $format_v = "<tr>";
        $format_t .= "<td>" . $msg["abonnements_format_periode"] . "</td>";
        $format_v .= "<td><input type='text' size='100' name='format_periode' id='format_periode' value='" . htmlentities($this->format_periode, ENT_QUOTES, $charset) . "'/></td>";
        $format_t .= "</tr>";
        $format_v .= "</tr>";
        $format = $format_t . "\n" . $format_v . "\n";
        $format .= "</table>";
        $r = str_replace("!!format_periode!!", $format, $r);
        global $serial_id;
        $r = str_replace("!!action!!", "./catalog.php?categ=serials&sub=modele&serial_id=" . "{$serial_id}", $r);
        $r = str_replace("!!serial_id!!", $serial_id, $r);
        if ($this->modele_id) {
            $calend = "\n\t\t\t<script type=\"text/javascript\" src='./javascript/select.js'></script>\n\t\t\t<script type=\"text/javascript\" src='./javascript/ajax.js'></script>";
            $calend .= <<<ENDOFTEXT
\t\t\t<script type="text/javascript">
\t\t\tfunction ad_date(obj,e) {\t\t
\t\t\t\tif(!e) e=window.event;
\t\t\t\tvar tgt = e.target || e.srcElement; // IE doesn't use .target
\t\t\t\tvar strid = tgt.id;
\t\t\t\tvar type = tgt.tagName;
\t\t\t\te.cancelBubble = true;
\t\t\t\tif (e.stopPropagation) e.stopPropagation();\t\t\t\t\t
\t\t\t\tvar id_obj=document.getElementById(obj);
\t\t\t\tvar pos=findPos(id_obj);
\t\t\t\tif(type!='A'){
\t\t\t\t\tvar url="./catalog/serials/modele/modele_parution_edition.php?act=change&serial_id=!!serial_id!!&modele_id=!!modele_id!!&date_parution="+obj+"&type_serie=1&numero=";\t
\t\t\t\t}
\t\t\t\telse{
\t\t\t\t\tvar url="./catalog/serials/modele/modele_parution_edition.php?serial_id=!!serial_id!!&modele_id=!!modele_id!!&date_parution="+obj+"&type_serie=1&numero=";
\t\t\t\t}
\t\t\t\tvar notice_view=document.createElement("iframe");
\t\t\t\tnotice_view.setAttribute('id','frame_periodique');
\t\t\t\tnotice_view.setAttribute('name','periodique');
\t\t\t\tnotice_view.src=url; 
\t\t\t\t
\t\t\t\tvar att=document.getElementById("att");\t
\t\t\t\tnotice_view.style.visibility="hidden";
\t\t\t\tnotice_view.style.display="block";
\t\t\t\tnotice_view=att.appendChild(notice_view);
\t\t\t\tif(type=='A'){\t\t
\t\t\t\t\tw=notice_view.clientWidth;
\t\t\t\t\th=notice_view.clientHeight;
\t\t\t\t\tnotice_view.style.left=pos[0]+"px";
\t\t\t\t\tnotice_view.style.top=pos[1]+"px";
\t\t\t\t\tnotice_view.style.visibility="visible";\t\t\t
\t\t\t\t\t}\t
\t\t\t}
\t\t\tfunction kill_frame_periodique() {
\t\t\t\tvar notice_view=document.getElementById("frame_periodique");
\t\t\t\tnotice_view.parentNode.removeChild(notice_view);\t
\t\t\t}
\t\t\t</script>\t
ENDOFTEXT;
            $calend = str_replace("!!serial_id!!", $serial_id, $calend);
            $calend = str_replace("!!modele_id!!", $this->modele_id, $calend);
            $base_url = "./catalog.php?categ=serials&sub=modele&serial_id=" . "{$serial_id}&modele_id={$this->modele_id}";
            $base_url_mois = '';
            $calend .= "<div id='calendrier_tab' style='width:99%'>";
            $date = $this->date_debut;
            $calend .= "<A name='ancre_calendrier'></A>";
            $year = pmb_sql_value("SELECT YEAR('{$date}')");
            $cur_year = $year;
            //debut expand
            $calend .= "\n\t\t\t<div class='row'>&nbsp;</div>\n\t\t\t<div id='abts_year_{$year}' class='notice-parent'>\n\t\t\t\t<img src='./images/minus.gif' class='img_plus' name='imEx' id='abts_year_{$year}" . "Img' title='" . addslashes($msg['plus_detail']) . "' border='0' onClick=\"expandBase('abts_year_{$year}', true); return false;\" hspace='3'>\n\t\t\t\t<span class='notice-heada'>\n\t\t\t\t\t{$year}\n\t    \t\t</span>\n\t\t\t</div>\n\t\t\t<div id='abts_year_{$year}" . "Child' startOpen='Yes' class='notice-child' style='margin-bottom:6px;width:94%'> ";
            $i = pmb_sql_value("SELECT MONTH('{$date}')");
            if ($i == 2 || $i == 5 || $i == 8 || $i == 11) {
                $calend .= "<div class='row' style='padding-top: 5px'><div class='colonne3'>&nbsp;";
                $calend .= "</div>\n";
            }
            if ($i == 3 || $i == 6 || $i == 9 || $i == 12) {
                $calend .= "<div class='row' style='padding-top: 5px'><div class='colonne3'>&nbsp;";
                $calend .= "</div>\n";
                $calend .= "<div class='colonne3' style='padding-left: 3px'>&nbsp;";
                $calend .= "</div>\n";
            }
            do {
                $year = pmb_sql_value("SELECT YEAR('{$date}')");
                if ($year != $cur_year) {
                    $calend .= "</div>";
                    $calend .= "\n\t\t\t\t\t<div class='row'></div>\n\t\t\t\t\t<div id='abts_year_{$year}' class='notice-parent'>\n\t\t\t\t\t\t<img src='./images/plus.gif' class='img_plus' name='imEx' id='abts_year_{$year}" . "Img' title='" . addslashes($msg['plus_detail']) . "' border='0' onClick=\"expandBase('abts_year_{$year}', true); return false;\" hspace='3'>\n\t\t\t\t\t\t<span class='notice-heada'>\n\t\t\t\t\t\t\t{$year}\n\t\t\t    \t\t</span>\n\t\t\t\t\t</div>\n\t\t\t\t\t<div id='abts_year_{$year}" . "Child' class='notice-child' style='margin-bottom:6px;display:none;width:94%'>\n\t\t\t\t\t";
                    $cur_year = $year;
                }
                $i = pmb_sql_value("SELECT MONTH('{$date}')");
                if ($i == 1 || $i == 4 || $i == 7 || $i == 10) {
                    $calend .= "<div class='row' style='padding-top: 5px'><div class='colonne3'>";
                } else {
                    $calend .= "<div class='colonne3' style='padding-left: 3px'>";
                }
                $calend .= pmb_bidi(calendar_gestion(str_replace("-", "", $date), 0, $base_url, $base_url_mois, 0, $this->modele_id, 0));
                $calend .= "</div>\n";
                if ($i == 3 || $i == 6 || $i == 9 || $i == 12) {
                    $calend .= "</div>\n";
                }
                $date = pmb_sql_value("SELECT DATE_ADD('{$date}', INTERVAL 1 MONTH)");
                $diff = pmb_sql_value("SELECT DATEDIFF('{$date_fin}','{$date}')");
            } while ($diff >= 0);
            //fin expand
            $calend .= "</div>";
            $calend .= "</div>\n";
            $calend .= "<script type='text/javascript'>parent.location.href='#ancre_calendrier';</script>";
            $r .= $calend;
        }
        return $r;
    }
Esempio n. 2
0
        if (!$annee) {
            if (!$date) {
                $rqt_date = "select date_format(CURDATE(),'%Y') as annee ";
                $resultatdate = mysql_query($rqt_date);
                $resdate = mysql_fetch_object($resultatdate);
                $annee = $resdate->annee;
            } else {
                $annee = substr($date, 0, 4);
            }
        }
        $gg = '<IMG src="./images/gg.gif" border="0" title="' . $msg["calendrier_annee_prececente"] . '">';
        $dd = '<IMG src="./images/dd.gif" border="0" title="' . $msg["calendrier_annee_suivante"] . '">';
        echo "<div class='colonne3'><A href='" . $base_url . "&annee=" . ($annee - 1) . "&loc=" . $loc . "' >" . $gg . "</A></div><div class='colonne3' align='right'><A href='" . $base_url . "&annee=" . ($annee + 1) . "&loc=" . $loc . "'>" . $dd . "</A></div>\n";
        echo "<div id='calendrier_tab' style='width:99%'>";
        for ($i = 1; $i <= 12; $i++) {
            $mois = substr("0" . $i, -2);
            $date = $annee . $mois . "01";
            if ($i == 1 || $i == 3 || $i == 5 || $i == 7 || $i == 9 || $i == 11) {
                echo "<div class='row' style='padding-top: 10px'><div class='colonne3'>";
            } else {
                echo "<div class='colonne3' style='padding-left: 10px'>";
            }
            echo pmb_bidi(calendar_gestion($date, 0, $base_url, $base_url_mois, 0, $loc));
            echo "</div>\n";
            if ($i == 2 || $i == 4 || $i == 6 || $i == 8 || $i == 10 || $i == 12) {
                echo "</div>";
            }
        }
        echo "</div>\n";
        break;
}
Esempio n. 3
0
    function show_form()
    {
        global $creation_abonnement_form;
        global $serial_header;
        global $msg;
        global $charset;
        global $tpl_del_bouton, $tpl_copy_bouton, $serial_id, $edition_abonnement_form, $pmb_antivol;
        global $dbh;
        global $pmb_abt_label_perio;
        if (!$this->abt_id) {
            $r = $serial_header . $creation_abonnement_form;
            $r = str_replace('!!page_title!!', $msg[4000] . $msg[1003] . $msg["abts_abonnements_add_title"], $r);
            $r = str_replace('!!libelle_form!!', $msg["abts_abonnements_add_title"], $r);
            if ($pmb_abt_label_perio) {
                $serial = new serial($serial_id);
                $r = str_replace('!!abt_name!!', $serial->tit1, $r);
            }
            //Checkbox des modèles à associer à l'abonnement
            $resultat = mysql_query("select modele_id,modele_name from abts_modeles where num_notice='{$serial_id}'");
            $liste_modele = "<table>";
            //Confection du javascript pour tester au moins une sélection de modèle
            $test_liste_modele = "if(";
            $cpt = 0;
            while ($rp = mysql_fetch_object($resultat)) {
                if ($cpt++ > 0) {
                    $test_liste_modele .= " || ";
                }
                $liste_modele .= "<tr><td><input type='checkbox' value='{$rp->modele_id}' name='modele[{$rp->modele_id}]' id='modele[{$rp->modele_id}]'/>{$rp->modele_name}</td></tr>";
                $test_liste_modele .= " (document.getElementById('modele[" . $rp->modele_id . "]').checked==true) ";
            }
            $test_liste_modele .= ")\n\t\t\t{\n\t\t\t\treturn true;\n\t\t\t}else {\n\t\t\t\talert(\"{$msg['abonnements_err_msg_select_model']}\");\t\t\t\t\n\t\t\t\treturn false;\n\t\t\t}";
            $liste_modele .= "</table>";
            $r = str_replace("!!liste_modele!!", $liste_modele, $r);
            $r = str_replace("!!test_liste_modele!!", $test_liste_modele, $r);
            $copy_bouton = $del_bouton = "";
            $r = str_replace("!!abonnement_form1!!", "", $r);
            $bouton_prolonge = '';
            $bouton_raz = '';
        } else {
            $this->getData();
            $r = $serial_header . $edition_abonnement_form;
            $r = str_replace('!!page_title!!', $msg[4000] . $msg[1003] . $msg["abts_abonnements_modify_title"], $r);
            $r = str_replace('!!libelle_form!!', $msg["abts_abonnements_modify_title"], $r);
            $bouton_prolonge = "<input type=\"submit\" class='bouton' value='" . $msg["abonnement_prolonger_abonnement"] . "' onClick=\"document.getElementById('act').value='prolonge';if(test_form(this.form)==true) this.form.submit();else return false;\"/>";
            $bouton_raz = "<input type=\"submit\" class='bouton' value='" . $msg["abonnement_raz_grille"] . "' onClick=\"if(confirm('" . $msg['confirm_raz_grille'] . "')){document.getElementById('act').value='raz';if(test_form(this.form)==true) this.form.submit();else return false;} else return false;\"/>";
            //Durée d'abonnement
            if (!$this->duree_abonnement) {
                $this->duree_abonnement = 12;
            }
            $r = str_replace("!!duree_abonnement!!", $this->duree_abonnement, $r);
            //Date de début
            if (!$this->date_debut || $this->date_debut == "0000-00-00") {
                $date_debut = date("Ymd", time());
            } else {
                $date_debut = $this->date_debut;
            }
            $r = str_replace("!!date_debut!!", str_replace("-", "", $date_debut), $r);
            $r = str_replace("!!date_debut_lib!!", formatdate($date_debut), $r);
            //Date de fin
            if (!$this->date_fin || $this->date_fin == "0000-00-00") {
                $date_fin = pmb_sql_value("SELECT DATE_ADD('{$date_debut}', INTERVAL 1 YEAR)");
            } else {
                $date_fin = $this->date_fin;
            }
            $r = str_replace("!!date_fin!!", str_replace("-", "", $date_fin), $r);
            $r = str_replace("!!date_fin_lib!!", format_date($date_fin), $r);
            //Fournisseur
            $r = str_replace('!!lib_fou!!', pmb_sql_value("SELECT raison_sociale from entites where id_entite = '" . $this->fournisseur . "' "), $r);
            $r = str_replace('!!id_fou!!', $this->fournisseur, $r);
            //Destinataire:
            $r = str_replace('!!destinataire!!', $this->destinataire, $r);
            //Cote:
            $r = str_replace('!!cote!!', htmlentities($this->cote, ENT_QUOTES, $charset), $r);
            // select "type document"
            $r = str_replace('!!type_doc!!', do_selector('docs_type', 'typdoc_id', $this->typdoc_id), $r);
            $r = str_replace('!!exemplarisation_automatique!!', "<input type='checkbox' value='1' " . ($this->exemp_auto ? "checked" : "yes") . " name='exemp_auto' id='exemp_auto'/>", $r);
            $r = str_replace('!!abt_numeric_checked!!', $this->abt_numeric ? "checked" : "yes", $r);
            // select "localisation"
            $r = str_replace('!!localisation!!', gen_liste("select distinct idlocation, location_libelle from docs_location, docsloc_section where num_location=idlocation order by 2 ", "idlocation", "location_libelle", 'location_id', "calcule_section(this);", $this->location_id, "", "", "", "", 0), $r);
            // select "section"
            $r = str_replace('!!section!!', $this->do_selector(), $r);
            // select "owner"
            $r = str_replace('!!owner!!', do_selector('lenders', 'lender_id', $this->lender_id), $r);
            // select "statut"
            $r = str_replace('!!statut!!', do_selector('docs_statut', 'statut_id', $this->statut_id), $r);
            // select "code statistique"
            $r = str_replace('!!codestat!!', do_selector('docs_codestat', 'codestat_id', $this->codestat_id), $r);
            $selector = "";
            if ($pmb_antivol > 0) {
                // select "type_antivol"
                $selector = "<select name='type_antivol' id='type_antivol'>";
                $selector .= "<option value='0'";
                if ($this->type_antivol == 0) {
                    $selector .= ' SELECTED';
                }
                $selector .= '>';
                $selector .= $msg["type_antivol_aucun"] . '</option>';
                $selector .= "<option value='1'";
                if ($this->type_antivol == 1) {
                    $selector .= ' SELECTED';
                }
                $selector .= '>';
                $selector .= $msg["type_antivol_magnetique"] . '</option>';
                $selector .= "<option value='2'";
                if ($this->type_antivol == 2) {
                    $selector .= ' SELECTED';
                }
                $selector .= '>';
                $selector .= $msg["type_antivol_autre"] . '</option>';
                $selector .= '</select>';
            }
            $r = str_replace('!!type_antivol!!', $selector, $r);
            //Liste des formulaire de modèles (dépliables +,-)
            $modele_list = "";
            $requete = "select modele_id,num,vol,tome,delais,critique, num_statut_general from abts_abts_modeles where abt_id='{$this->abt_id}'";
            $resultat = mysql_query($requete, $dbh);
            if (!$resultat) {
                die($requete . "<br /><br />" . mysql_error());
            }
            while ($r_a = mysql_fetch_object($resultat)) {
                $modele_id = $r_a->modele_id;
                $num = $r_a->num;
                $vol = $r_a->vol;
                $tome = $r_a->tome;
                $delais = $r_a->delais;
                $critique = $r_a->critique;
                $modele_name = pmb_sql_value("select modele_name from abts_modeles where modele_id='{$modele_id}'");
                $num_periodicite = pmb_sql_value("select num_periodicite from abts_modeles where modele_id='{$modele_id}'");
                $periodicite = pmb_sql_value("select libelle from abts_periodicites where periodicite_id ='" . $num_periodicite . "'");
                $num_statut = $r_a->num_statut_general;
                if ($periodicite) {
                    $modele_name .= " ({$periodicite})";
                }
                if (!$num_statut) {
                    $num_statut = $this->statut_id;
                }
                $modele_list .= $this->gen_tpl_abt_modele($modele_id, $modele_name, $num, $vol, $tome, $delais, $critique, $num_statut);
            }
            $r = str_replace("!!modele_list!!", $modele_list, $r);
            // calendrier de réception s'il y a des enregistrement présents dans la grille
            if (pmb_sql_value("select sum(nombre) from abts_grille_abt where num_abt='{$this->abt_id}'")) {
                $calend = "\n\t\t\t\t<script type=\"text/javascript\" src='./javascript/select.js'></script>\n\t\t\t\t<script type=\"text/javascript\" src='./javascript/ajax.js'></script>";
                $calend .= <<<ENDOFTEXT
\t\t\t\t<script type="text/javascript">
\t\t\t\tfunction ad_date(obj,e) {
\t\t\t\t\tif(!e) e=window.event;\t\t\t
\t\t\t\t\tvar tgt = e.target || e.srcElement; // IE doesn't use .target
\t\t\t\t\tvar strid = tgt.id;
\t\t\t\t\tvar type = tgt.tagName;\t\t
\t\t\t\t\te.cancelBubble = true;
\t\t\t\t\tif (e.stopPropagation) e.stopPropagation();\t\t\t
\t\t\t\t\tvar id_obj=document.getElementById(obj);
\t\t\t\t\tvar pos=findPos(id_obj);\t\t\t\t\t
\t\t\t\t\tvar url="./catalog/serials/abonnement/abonnement_parution_edition.php?abonnement_id=!!abonnement_id!!&date_parution="+obj+"&type_serie=1&numero=";\t\t\t\t
\t\t\t\t\tvar notice_view=document.createElement("iframe");\t\t
\t\t\t\t\tnotice_view.setAttribute('id','frame_abts');
\t\t\t\t\tnotice_view.setAttribute('name','periodique');
\t\t\t\t\tnotice_view.src=url; \t\t\t
\t\t\t\t\tvar att=document.getElementById("att");\t
\t\t\t\t\tnotice_view.style.visibility="hidden";
\t\t\t\t\tnotice_view.style.display="block";
\t\t\t\t\tnotice_view=att.appendChild(notice_view);\t\t\t
\t\t\t\t\tw=notice_view.clientWidth;
\t\t\t\t\th=notice_view.clientHeight;
\t\t\t\t\tnotice_view.style.left=pos[0]+"px";
\t\t\t\t\tnotice_view.style.top=pos[1]+"px";
\t\t\t\t\tnotice_view.style.visibility="visible";\t\t\t
\t\t\t\t}


\t\t\t\tfunction duplique(obj,e) {
\t\t\t\t\tif(!e) e=window.event;\t\t\t
\t\t\t\t\tvar tgt = e.target || e.srcElement; // IE doesn't use .target
\t\t\t\t\tvar strid = tgt.id;
\t\t\t\t\tvar type = tgt.tagName;\t\t
\t\t\t\t\te.cancelBubble = true;
\t\t\t\t\tif (e.stopPropagation) e.stopPropagation();\t\t\t
\t\t\t\t\tvar id_obj=document.getElementById(obj);
\t\t\t\t\tvar pos=findPos(id_obj);\t\t\t\t\t
\t\t\t\t\tvar url="./catalog/serials/abonnement/abonnement_duplique.php?abonnement_id=!!abonnement_id!!&serial_id=!!serial_id!!";\t\t\t\t
\t\t\t\t\tvar notice_view=document.createElement("iframe");\t\t
\t\t\t\t\tnotice_view.setAttribute('id','frame_abts');
\t\t\t\t\tnotice_view.setAttribute('name','periodique');
\t\t\t\t\tnotice_view.src=url; \t\t\t
\t\t\t\t\tvar att=document.getElementById("att");\t
\t\t\t\t\tnotice_view.style.visibility="hidden";
\t\t\t\t\tnotice_view.style.display="block";
\t\t\t\t\tnotice_view=att.appendChild(notice_view);\t\t\t
\t\t\t\t\tw=notice_view.clientWidth;
\t\t\t\t\th=notice_view.clientHeight;
\t\t\t\t\tposx=(getWindowWidth()/2-(w/2))<0?0:(getWindowWidth()/2-(w/2))
\t\t\t\t\tposy=(getWindowHeight()/2-(h/2))<0?0:(getWindowHeight()/2-(h/2));
\t\t\t\t\tnotice_view.style.left=posx+"px";
\t\t\t\t\tnotice_view.style.top=posy+"px";
\t\t\t\t\tnotice_view.style.visibility="visible";\t
\t\t\t\t}\t\t\t\t
\t\t\t\t
\t\t\t\tfunction kill_frame_periodique() {
\t\t\t\t\tvar notice_view=document.getElementById("frame_abts");
\t\t\t\t\tnotice_view.parentNode.removeChild(notice_view);\t
\t\t\t\t}
\t\t\t\t</script>\t
ENDOFTEXT;
                $calend = str_replace("!!serial_id!!", $serial_id, $calend);
                $calend = str_replace("!!abonnement_id!!", $this->abt_id, $calend);
                $base_url = "./catalog.php?categ=serials&sub=abonnement&serial_id=" . "{$serial_id}&abonnement_id={$this->abonnement_id}";
                $base_url_mois = '';
                $calend .= "<div id='calendrier_tab' style='width:99%'>";
                $date = $this->date_debut;
                $calend .= "<A name='ancre_calendrier'></A>";
                $year = pmb_sql_value("SELECT YEAR('{$date}')");
                $cur_year = $year;
                //debut expand
                $calend .= "\n\t\t\t\t<div class='row'>&nbsp;</div>\n\t\t\t\t<div id='abts_year_{$year}' class='notice-parent'>\n\t\t\t\t\t<img src='./images/minus.gif' class='img_plus' name='imEx' id='abts_year_{$year}" . "Img' title='" . addslashes($msg['plus_detail']) . "' border='0' onClick=\"expandBase('abts_year_{$year}', true); return false;\" hspace='3'>\n\t\t\t\t\t<span class='notice-heada'>\n\t\t\t\t\t\t{$year}\n\t\t    \t\t</span>\n\t\t\t\t</div>\n\t\t\t\t<div id='abts_year_{$year}" . "Child' startOpen='Yes' class='notice-child' style='margin-bottom:6px;width:94%'>\n\t\t\t\t";
                $i = pmb_sql_value("SELECT MONTH('{$date}')");
                if ($i == 2 || $i == 5 || $i == 8 || $i == 11) {
                    $calend .= "<div class='row' style='padding-top: 5px'><div class='colonne3'>&nbsp;";
                    $calend .= "</div>\n";
                }
                if ($i == 3 || $i == 6 || $i == 9 || $i == 12) {
                    $calend .= "<div class='row' style='padding-top: 5px'><div class='colonne3'>&nbsp;";
                    $calend .= "</div>\n";
                    $calend .= "<div class='colonne3' style='padding-left: 3px'>&nbsp;";
                    $calend .= "</div>\n";
                }
                do {
                    $year = pmb_sql_value("SELECT YEAR('{$date}')");
                    if ($year != $cur_year) {
                        $calend .= "\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t";
                        $calend .= "\n\t\t\t\t\t\t<div class='row'></div>\n\t\t\t\t\t\t<div id='abts_year_{$year}' class='notice-parent'>\n\t\t\t\t\t\t\t<img src='./images/plus.gif' class='img_plus' name='imEx' id='abts_year_{$year}" . "Img' title='" . addslashes($msg['plus_detail']) . "' border='0' onClick=\"expandBase('abts_year_{$year}', true); return false;\" hspace='3'>\n\t\t\t\t\t\t\t<span class='notice-heada'>\n\t\t\t\t\t\t\t\t{$year}\n\t\t\t\t    \t\t</span>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t\t<div id='abts_year_{$year}" . "Child' class='notice-child' style='margin-bottom:6px;display:none;width:94%'>\n\t\t\t\t\t\t";
                        $cur_year = $year;
                    }
                    $i = pmb_sql_value("SELECT MONTH('{$date}')");
                    if ($i == 1 || $i == 4 || $i == 7 || $i == 10) {
                        $calend .= "<div class='row' style='padding-top: 5px'><div class='colonne3'>";
                    } else {
                        $calend .= "<div class='colonne3' style='padding-left: 3px'>";
                    }
                    $calend .= pmb_bidi(calendar_gestion(str_replace("-", "", $date), 0, $base_url, $base_url_mois, 0, 0, $this->abt_id));
                    $calend .= "</div>\n";
                    if ($i == 3 || $i == 6 || $i == 9 || $i == 12) {
                        $calend .= "</div>\n";
                    }
                    $date = pmb_sql_value("SELECT DATE_ADD('{$date}', INTERVAL 1 MONTH)");
                    $diff = pmb_sql_value("SELECT DATEDIFF('{$date_fin}','{$date}')");
                } while ($diff >= 0);
                //fin expand
                $calend .= "\t</div>";
                $calend .= "</div>\n";
                $calend .= "<script type='text/javascript'>parent.location.href='#ancre_calendrier';</script>";
                $r .= $calend;
            }
            $r = str_replace("!!test_liste_modele!!", "", $r);
        }
        $r = str_replace("!!action!!", "./catalog.php?categ=serials&sub=abon&serial_id=" . "{$serial_id}" . "&abt_id=" . "{$this->abt_id}", $r);
        $r = str_replace('!!bouton_prolonge!!', $bouton_prolonge, $r);
        $r = str_replace('!!bouton_raz!!', $bouton_raz, $r);
        $r = str_replace("!!serial_id!!", $serial_id, $r);
        //Remplacement des valeurs
        $r = str_replace("!!abt_id!!", htmlentities($this->abt_id, ENT_QUOTES, $charset), $r);
        $r = str_replace("!!abt_name!!", htmlentities($this->abt_name, ENT_QUOTES, $charset), $r);
        //Notice mère
        $perio = new serial_display($this->num_notice, 1);
        $r = str_replace("!!num_notice_libelle!!", $perio->header, $r);
        $r = str_replace("!!num_notice!!", $this->num_notice, $r);
        return $r;
    }