<?php
// +-------------------------------------------------+
// © 2002-2004 PMB Services / www.sigb.net pmb@sigb.net et contributeurs (voir www.sigb.net)
// +-------------------------------------------------+
// $Id: abts_modeles.tpl.php,v 1.39 2025/10/10 12:30:17 dgoron Exp $

if (stristr($_SERVER['REQUEST_URI'], ".tpl.php")) die("no access");

global $serial_id, $msg, $current_module, $base_path;
global $modele_view, $modele_content_form, $modele_form, $modele_script1;
global $tpl_calendrier, $tpl_del_bouton, $tpl_copy_bouton;

if(!isset($serial_id)) $serial_id = 0;

$modele_view = "
<table width='100%' role='presentation'>
	<tr>
		<td>".$msg["abonnements_periodicite"].": !!num_periodicite!!</td>
		<td>".$msg["abonnements_duree_abonnement"].": !!duree_abonnement!!</td>
	</tr>
	<tr>
		<td>".$msg["abonnements_date_debut"].": !!date_debut!!</td>
		<td>".$msg["abonnements_date_fin"].": !!date_fin!!</td>
	</tr>
	<tr>
		<td>".$msg["abonnements_nombre_de_series"].": !!nombre_de_series!!</td>
		<td>".$msg["abonnements_nombre_de_horsseries"].": !!nombre_de_horsseries!!</td>
	</tr>
</table>
";

$modele_script1 = "
<script type='text/javascript'>
function confirm_delete() {
	phrase = \"".$msg['abonnements_confirm_suppr_modele']."\";
	result = confirm(phrase);
	if(result)
		form.submit();
}
function test_form(form) {
	if(form.modele_name.value.replace(/^\s+|\s+$/g, '').length == 0) {
		alert(\"$msg[326]\");
		form.modele_name.focus();
		return false;
	}
	erreur_incrementation = \"".$msg['abonnements_erreur_incrementation']."\";
	if(form.vol_actif.checked) {
		if(document.getElementById('vol_increment').checked) {
			if(isNaN(form.vol_increment_numero.value) || (form.vol_increment_numero.value == 0)) {
				alert(erreur_incrementation);
				form.vol_increment_numero.focus();
				return false;
			}
		}
		if(document.getElementById('vol_increment1').checked) {
			if(isNaN(form.vol_increment_date.value) || (form.vol_increment_date.value == 0)) {
				alert(erreur_incrementation);
				form.vol_increment_date.focus();
				return false;
			}
		}
	}
	if(form.tom_actif.checked) {
		if(document.getElementById('tom_increment').checked) {
			if(isNaN(form.tom_increment_numero.value) || (form.tom_increment_numero.value == 0)) {
				alert(erreur_incrementation);
				form.tom_increment_numero.focus();
				return false;
			}
		}
		if(document.getElementById('tom_increment1').checked) {
			if(isNaN(form.tom_increment_date.value) || (form.tom_increment_date.value == 0)) {
				alert(erreur_incrementation);
				form.tom_increment_date.focus();
				return false;
			}
		}
	}
	return true;
}
</script>
<script type='text/javascript' src='./javascript/abts_modele.js'></script>
";

$modele_content_form = "
<div class='row'>
	<div class='row'>
		<div id='abts_exclusion' class='notice-parent'>
            ".get_expandBase_button('abts_exclusion')."
			<span class='notice-heada'>
					".$msg["abonnements_titre_exclusion_date"]."
			</span>
		</div>
		<div id='abts_exclusionChild' class='notice-child' style='margin-bottom:6px;display:none;width:94%'>
			!!days!!
			!!days_month!!
			!!week_month!!
			!!week_year!!
			!!month_year!!
			<div class='row'></div>
		</div>
	</div>
	<div class='row'>
		<div id='abts_numerotation' class='notice-parent'>
            ".get_expandBase_button('abts_numerotation')."
			<span class='notice-heada'>
					".$msg["abonnements_titre_numerotation"]."
			</span>
		</div>
		<div id='abts_numerotationChild' class='notice-child' style='margin-bottom:6px;display:none;width:94%'>
			<fieldset>
                <legend class='abts-legend'>".$msg['abonnements_titre_numero']."</legend>
				!!numero!!
			</fieldset>
            <fieldset>
                <legend class='abts-legend'>".$msg['abonnements_titre_volume']."</legend>
				!!volume!!
			</fieldset>
            <fieldset>
                <legend class='abts-legend'>".$msg['abonnements_titre_tome']."</legend>
				!!tome!!
			</fieldset>
            <fieldset>
                <legend class='abts-legend'>".$msg['abonnements_titre_format']."</legend>
				!!format!!
                !!format_periode!!
            </fieldset>
			<div class='row'>
				<a href='".$base_path."/includes/interpreter/doc?group=interpreter' target='_blank'>".$msg['interpreter_doc_interpreter_link']."</a>
			</div>
		</div>
	</div>
</div>";

$modele_form = "
<script type='text/javascript' src='./javascript/tablist.js'></script>
$modele_script1
<form class='form-$current_module' id='form_modele' name='form_modele' method='post' action='!!action!!'>
	<h3>!!num_notice_libelle!!: !!libelle_form!!</h3>
	<div class='form-contenu'>
        <input type='hidden' name='modele_id' value='!!modele_id!!'/>
        <input type='hidden' name='num_notice' id='num_notice' value='!!num_notice!!'/>
	   !!content_form!!
	</div>
	<div class='row'>
		<input type='hidden' id='act' name='act' value='' />
		<div class='left'><input type=\"submit\" class='bouton' value='".$msg["77"]."' onClick=\"document.getElementById('act').value='update';if(test_form(this.form)==true) this.form.submit();else return false;\"/>&nbsp;
			<input type='button' class='bouton' value='".$msg["bt_retour"]."' onClick=\"document.location='./catalog.php?categ=serials&sub=view&serial_id=!!serial_id!!&view=modele';\"/>&nbsp;
			!!copy_bouton!!
			<input type=\"submit\" class='bouton' value='".$msg["abonnement_generer_la_grille"]."' onClick=\"document.getElementById('act').value='gen';if(test_form(this.form)==true) this.form.submit();else return false;\"/>
		</div>
		<div class='right'>!!del_button!!</div>
	</div>
	<div class='row'></div>
</form>
";

$tpl_calendrier = "
<form class='form-$current_module' id='form_modele' name='form_modele' method='post' action='!!action!!'>
	<h3>!!libelle_form!!</h3>
	<div class='form-contenu'>
	<input type='hidden' name='modele_id' value='!!modele_id!!'/>
	!!calendrier!!
	</div> <!-- Fin du contenu -->
	<div class='row'>
		<input type='hidden' id='act' name='act' value='' />
		<div class='left'><input type=\"submit\" class='bouton' value='".$msg["77"]."' onClick=\"document.getElementById('act').value='update';this.form.submit();\"/>&nbsp;<input type='button' class='bouton' value='".$msg["76"]."' onClick=\"document.location='./catalog.php?categ=serials&sub=view&serial_id=!!serial_id!!&view=modele';\"/>&nbsp;<input type='button' class='bouton' value='".$msg["abts_modeles_copy_modele"]."'/></div><div class='right'>!!del_button!!</div>
	</div>
	<div class='row'></div>
</form>
";

$tpl_del_bouton="<input type=\"submit\" class='bouton' value='".$msg["63"]."' onClick=\"document.getElementById('act').value='del';confirm_delete();return false;\"/>";
$tpl_copy_bouton="<input type='button' class='bouton' value='".$msg["abts_modeles_copy_modele"]."' onclick=\"openPopUp('./select.php?what=perio&niveau_biblio=S&modele_id=!!modele_id!!&serial_id=!!serial_id!!&caller=notice&param1=f_rel_id_0&param2=f_rel_0&no_display=0', 'selector_notice')\" />";			