2025-03-26 10:22:20 +01:00

145 lines
8.0 KiB
PHP

<?php
global $langs, $db;
$langs->loadLangs(array("admin", "Agefoddx@Agefoddx"));
require_once DOL_DOCUMENT_ROOT . '/core/class/html.form.class.php';
$form = new Form($db);
$csrfToken = function_exists('newToken') ? newToken() : $_SESSION['newtoken'];
/** @var $titre */ /** @var $listeA */ /** @var $listeE */ /** @var $listeAFK */ /** @var $listeEFK */
/** @var $idBD */ /** @var $nomBD */ /** @var $mdp */
/** @var $idTable */ /** @var $nomTableA */ /** @var $nomTableE */
/** @var $valeurBase */
$tabActif = $tab ?? $_POST['tab'];
$tab1Css = ""; $tab1CssDiv = "tabunactive"; $tab1Lien = "<a href='#' onclick=\"envoyerPost({action:'ajouter', controleur:'ligne', idBD:'$idBD', idTable:'$idTable', nomBD:'$nomBD', tab:'tab1', mdp:'$mdp', nomTableA:'$nomTableA', nomTableE:'$nomTableE'}, 'setup.php', '$csrfToken')\">";
$tab2Css = ""; $tab2CssDiv = "tabunactive"; $tab2Lien = "<a href='#' onclick=\"envoyerPost({action:'ajouter', controleur:'ligne', idBD:'$idBD', idTable:'$idTable', nomBD:'$nomBD', tab:'tab2', mdp:'$mdp', nomTableA:'$nomTableA', nomTableE:'$nomTableE'}, 'setup.php', '$csrfToken')\">";
$tab3Css = ""; $tab3CssDiv = "tabunactive"; $tab3Lien = "<a href='#' onclick=\"envoyerPost({action:'ajouter', controleur:'ligne', idBD:'$idBD', idTable:'$idTable', nomBD:'$nomBD', tab:'tab3', mdp:'$mdp', nomTableA:'$nomTableA', nomTableE:'$nomTableE'}, 'setup.php', '$csrfToken')\">";
if ($tabActif == "tab1") { $titreSection = $langs->trans("AgefoddxLigne")." ".$nomBD; $tab1Css = "tabsElemActive"; $tab1CssDiv = "tabactive"; $tab1Lien = "<a>"; $input = '<input type="hidden" name="tab" value="tab1">';
} else if ($tabActif == "tab2") { $titreSection = $langs->trans("AgefoddxValeurFixe"); $tab2Css = "tabsElemActive"; $tab2CssDiv = "tabactive"; $tab2Lien = "<a>"; $input = '<input type="hidden" name="tab" value="tab2">';
} else if ($tabActif == "tab3") { $titreSection = $langs->trans("AgefoddxLienFK"); $tab3Css = "tabsElemActive"; $tab3CssDiv = "tabactive"; $tab3Lien = "<a>"; $input = '<input type="hidden" name="tab" value="tab3">';}
if (!isset($titre)) $titre = "Agefoddx";
?>
<script src="../js/envoiePost.js"></script>
<table class="centpercent">
<tr class=" left col-left">
<th>
<a href="#" onclick="envoyerPost({action:'afficherListe', controleur:'bd'},'setup.php', '<?= $csrfToken ?>')"><?=$langs->trans("AgefoddxListeBD")?>\</a>
<a href="#" onclick="envoyerPost({action:'afficherListe', controleur:'table', idBD:'<?= $idBD ?>', nomBD:'<?= $nomBD ?>', mdp:'<?=$mdp?>'}, 'setup.php', '<?= $csrfToken ?>')"><?= $nomBD ?>\</a>
<a href="#" onclick="envoyerPost({action:'afficherListe', controleur:'ligne', idTable:'<?=$idTable?>', idBD:'<?=$idBD?>', nomBD:'<?=$nomBD?>', mdp:'<?=$mdp?>'}, 'setup.php', '<?=$csrfToken?>')"><?=$langs->trans("AgefoddxListeLigne")?>\</a>
<a><?=$langs->trans("AgefoddxAjouter")?></a>
</th>
</tr>
<tr>
<th scope="col" class=" left col-left">
<h2><?= $titre ?></h2>
</th>
<th scope="col" class=" right col-right">
</th>
</tr>
</table>
<div class="tabs" data-role="controlgroup" data-type="horizontal">
<div class="inline-block tabsElem <?=$tab1Css?>">
<div class="tab <?=$tab1CssDiv?>" style="padding: 2px 5px; margin: 0">
<?=$tab1Lien?>
<?=$langs->trans("AgefoddxLienColonne")?> <?=$nomTableE?>
</a>
</div>
</div>
<div class="inline-block tabsElem <?=$tab2Css?>">
<div class="tab <?=$tab2CssDiv?>" style="padding: 2px 5px; margin: 0">
<?=$tab2Lien?>
<?=$langs->trans("AgefoddxAjoutLienValFixe")?>
</a>
</div>
</div>
<div class="inline-block tabsElem <?=$tab3Css?>">
<div class="tab <?=$tab3CssDiv?>" style="padding: 2px 5px; margin: 0">
<?=$tab3Lien?>
<?=$langs->trans("AgefoddxAjoutLienFK")?>
</a>
</div>
</div>
</div>
<div class="tabBar" style="padding: 0">
<form method="post" autocomplete="off">
<input type="hidden" name="controleur" value="ligne">
<input type="hidden" name="token" value="<?=$csrfToken?>">
<input type="hidden" name="nomBD" value="<?=$nomBD?>">
<input type="hidden" name="idBD" value="<?=$idBD?>">
<input type="hidden" name="idTable" value="<?=$idTable?>">
<input type="hidden" name="action" value="insertion">
<input type="hidden" name="mdp" value="<?=$mdp?>">
<?=$input?>
<table class="tagtable centpercent">
<thead class="centpercent">
<tr class="liste_titre">
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxLigne")?> Agefodd</th>
<th scope="col" class="liste_titre center"><?=$titreSection?></th>
</tr>
</thead>
<tbody class="centpercent">
<tr>
<th scope="row">
<?php if ($tabActif == "tab1" OR $tabActif == "tab2"){?>
<label type="hidden" for="agefoddLigne"></label>
<select name="agefoddLigne" id="agefoddLigne">
<?php echo "<option value=''>-- ".$langs->trans("AgefoddxLigneAjoutChoixOption")." --</option>";
foreach ($listeA as $table) {?>
<option <?php if ($table==$valeurBase) {?>selected="yes"<?php } ?> value="<?=$table?>"><?=$table?></option>
<?php } ?>
</select>
<?php } else if ($tabActif == "tab3"){?>
<label type="hidden" for="agefoddLigneFk"></label>
<select name="agefoddLigneFk" id="agefoddLigneFk">
<?php echo "<option value=''>-- ".$langs->trans("AgefoddxLigneAjoutChoixOption")." --</option>";
foreach ($listeAFK as $table) {?>
<option <?php if ($table["NomLigne"]==$valeurBase) {?>selected="yes"<?php } ?> value="<?=$table["NomLigne"]."|".$table["TableReference"]?>"><?=$table["NomLigne"]?> <= [<?=$table["TableReference"]?>]</option>
<?php } ?>
</select>
<?php } ?>
</th>
<th>
<?php if ($tabActif == "tab1") { ?>
<label type="hidden" for="bdExterneLigne"></label>
<select name="bdExterneLigne" id="bdExterneLigne">
<?php echo "<option value=''>-- ".$langs->trans("AgefoddxLigneAjoutChoixOption")." --</option>";
foreach ($listeE as $table) {?>
<option value="<?=$table?>"><?=$table?></option>
<?php }?>
</select>
<?php } else if ($tabActif == "tab2") { ?>
<label hidden for="valeurFixe"><?=$langs->trans("AgefoddxValeurFixe")?>: </label>
<input type="text" id="valeurFixe" name="valeurFixe" autocomplete="off" placeholder="<?=$langs->trans("AgefoddxValeurFixe")?>" required>
<?php } else if ($tabActif == "tab3") { ?>
<label type="hidden" for="bdExterneLigneFk"></label>
<select name="bdExterneLigneFk" id="bdExterneLigneFk">
<?php echo "<option value=''>-- ".$langs->trans("AgefoddxLigneAjoutChoixOption")." --</option>";
foreach ($listeEFK as $table) {?>
<option value="<?=$table["row_name"]."|".$table["TableReference"]?>"><?=$table["row_name"] . " <= [". $table["TableReference"]?>]</option>
<?php }?>
</select>
<?php } ?>
</th>
</tr>
<tr>
<th scope="row" colspan="2">
<input type="submit" value="<?=$langs->trans("AgefoddxEnvoie")?>" />
</th>
</tr>
</tbody>
</table>
</form>
</div>