module dolibarr Agefoddx version 1
This commit is contained in:
commit
1daa0d9019
17
ChangeLog.md
Normal file
17
ChangeLog.md
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
# CHANGELOG AGEFODDX
|
||||||
|
|
||||||
|
## version 1 - 28 / 02 / 2025
|
||||||
|
### Fonctionnalité
|
||||||
|
- Seconde version de l'application.
|
||||||
|
- Fonctionnalité d'importation et d'exportation de bases de données améliorée.
|
||||||
|
- Ajout de plus de commentaire pour détaillé le code
|
||||||
|
- Correction de bug mineur
|
||||||
|
- Modification du système d'import pour que celui-ci ne décale plus les id lors de la modification de valeurs
|
||||||
|
|
||||||
|
## version 0.1 - 07 / 02 / 2025
|
||||||
|
### Fonctionnalité
|
||||||
|
- Première version de l'application.
|
||||||
|
- Fonctionnalité d'importation et d'exportation de bases de données.
|
||||||
|
- Système de gestion des tables et des lignes avec compatibilité pour plusieurs bases externes.
|
||||||
|
- Interface de paramétrage pour les connexions aux bases de données.
|
||||||
|
- Gestion des clés étrangères et des conversions de données.
|
||||||
56
README_FR.md
Normal file
56
README_FR.md
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
<html lang="fr" style="width:100vw">
|
||||||
|
<body style = "padding: 0 ; margin: 0;">
|
||||||
|
<div id="title" style="padding: 10px; margin: 0 0 0 0; background-color: #968CC0FF">
|
||||||
|
<h1 style=" color : #2d2d2d; padding: 10% 0 10px 0; margin: 0 0 0 0; text-align: center;"> AGEFODDX </h1>
|
||||||
|
</div>
|
||||||
|
<div id="tableofcontent" style="padding: 10px; margin: 0 0 0 0; background-color: #444444FF">
|
||||||
|
<h2 style="text-align: left; padding: 5% 0 10px 0; margin: 0 0 0 0 ; color: #c6c1de"> Table des Matières </h2>
|
||||||
|
<ol style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 30px; color: #b0a8b9">
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9"><a href="#about" style="text-decoration: none; color: #cd9ee3">A propos d'Agefoddx</a></li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9"><a href="#requirements" style="text-decoration: none; color: #cd9ee3">Exigences du module</a></li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9"><a href="#installation" style="text-decoration: none; color: #cd9ee3">Installation</a></li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9"><a href="#started" style="text-decoration: none; color: #cd9ee3">Comment l'utiliser</a></li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
<div id="about" style="padding: 10px; margin: 0 0 0 0; background-color: #444444FF">
|
||||||
|
<h2 style="text-align: left; padding: 5% 0 10px 0; margin: 0 0 0 0 ; color: #c6c1de">A propos d'Agefoddx</h2>
|
||||||
|
<p style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 0; color: #b0a8b9">Agefoddx est un module de dolibarr développer par Desal-Soul, pour CFPO. <br>
|
||||||
|
Ce module a pour objectif la possiblité de permètre et facilité l'importation de donnée depuis<br>
|
||||||
|
une base de donnée exterieurs à dolibarr vers celle d'agefodd</p>
|
||||||
|
</div>
|
||||||
|
<div id="requirements" style="padding: 10px; margin: 0 0 0 0; background-color: #444444FF">
|
||||||
|
<h2 style="text-align: left; padding: 5% 0 10px 0; margin: 0 0 0 0 ; color: #c6c1de">Exigences du module</h2>
|
||||||
|
<p style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 0; color: #b0a8b9">Ce module necessite :</p>
|
||||||
|
<ul style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 30px; color: #b0a8b9" type="square">
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9"><p style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 0; color: #b0a8b9">dolibarr 19, ou plus</p></li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9"><p style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 0; color: #b0a8b9">php 7.4</p></li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9"><p style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 0; color: #b0a8b9">agefodd</p></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="installation" style="padding: 10px; margin: 0 0 0 0; background-color: #444444FF">
|
||||||
|
<h2 style="text-align: left; padding: 5% 0 10px 0; margin: 0 0 0 0 ; color: #c6c1de">Installation</h2>
|
||||||
|
<ul style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 30px; color: #b0a8b9" type="none">
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Pour installer se module, veuillez le télécharger depuis github.</li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Puis le glisser dans le dossier custom dans htdocs de votre dolibarr.</li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Une fois cela fait déziper le dossier.</li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Le module est prêt à être utilisé.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div id="started" style="padding: 10px; margin: 0 0 0 0; background-color: #444444FF">
|
||||||
|
<h2 style="text-align: left; padding: 5% 0 10px 0; margin: 0 0 0 0 ; color: #c6c1de">Comment l'utiliser</h2>
|
||||||
|
<p style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 0; color: #b0a8b9">Avant de commencer pour utiliser Agefoddx, il faut être administrateur.</p>
|
||||||
|
<ol style = "text-align : justify; padding: 0 0 0 0 ; margin: 0 0 0 30px; color: #b0a8b9" type="1">
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Pour commencer rendez-vous dans la section Configuration "Modules / Application"</li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Ensuite descender jusqu'à atteindre "Desal-Tools".</li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Une fois cela fait activer le module, puis appuyer sur l'engrenage<br>
|
||||||
|
Vous êtes maintenant sur la page de configuration de Agefoddx,<br>
|
||||||
|
toutes les actions possibles avec ce module sont uniquement accessibles
|
||||||
|
depuis cette page.</li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Maintenant sur cette page clicker sur le bouton plus.</li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Entrer les informations demandées</li>
|
||||||
|
<li style = "text-align : justify; padding: 0 0 0 2px ; margin: 0 0 0 5px; color: #b0a8b9">Vous avez réussi à lier votre première base de donnée, vous pouvez maitenant faire la même<br>
|
||||||
|
chose pour les tables et les lignes. Et exporter toutes ces infos depuis l'interface des tables.</li>
|
||||||
|
</ol>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
1
admin/.htaccess
Normal file
1
admin/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all granted
|
||||||
112
admin/about.php
Normal file
112
admin/about.php
Normal file
@ -0,0 +1,112 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file htdocs/modulebuilder/template/admin/about.php
|
||||||
|
* \ingroup Agefoddx
|
||||||
|
* \brief About page of module Agefoddx.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
$res = 0;
|
||||||
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
|
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) {
|
||||||
|
$res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";
|
||||||
|
}
|
||||||
|
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||||
|
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||||
|
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {
|
||||||
|
$i--;
|
||||||
|
$j--;
|
||||||
|
}
|
||||||
|
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {
|
||||||
|
$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";
|
||||||
|
}
|
||||||
|
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {
|
||||||
|
$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";
|
||||||
|
}
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (!$res && file_exists("../../main.inc.php")) {
|
||||||
|
$res = @include "../../main.inc.php";
|
||||||
|
}
|
||||||
|
if (!$res && file_exists("../../../main.inc.php")) {
|
||||||
|
$res = @include "../../../main.inc.php";
|
||||||
|
}
|
||||||
|
if (!$res) {
|
||||||
|
die("Include of main fails");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
||||||
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
|
||||||
|
require_once '../lib/Agefoddx.lib.php';
|
||||||
|
|
||||||
|
// Translations
|
||||||
|
$langs->loadLangs(array("errors", "admin", "Agefoddx@Agefoddx"));
|
||||||
|
|
||||||
|
// Access control
|
||||||
|
if (!$user->admin) {
|
||||||
|
accessforbidden();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parameters
|
||||||
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Actions
|
||||||
|
*/
|
||||||
|
|
||||||
|
// None
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$help_url = '';
|
||||||
|
$page_name = "AgefoddxAbout";
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-Agefoddx page-admin_about');
|
||||||
|
|
||||||
|
// Subheader
|
||||||
|
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||||
|
|
||||||
|
// Configuration header
|
||||||
|
$head = AgefoddxAdminPrepareHead();
|
||||||
|
print dol_get_fiche_head($head, 'about', $langs->trans($page_name), 0, 'Agefoddx@Agefoddx');
|
||||||
|
|
||||||
|
dol_include_once('/Agefoddx/core/modules/modagefoddLink.classe.php');
|
||||||
|
print "
|
||||||
|
<div>
|
||||||
|
<h1>Agefoddx</h1>
|
||||||
|
<p>".$langs->trans("AgefoddxAboutIntro")."</p>
|
||||||
|
<p>".$langs->trans("AgefoddxAboutP1")."</p>
|
||||||
|
<p>".$langs->trans("AgefoddxAboutP2")."</p>
|
||||||
|
<p>".$langs->trans("AgefoddxLogoSource")." : <a href=\"https://www.flaticon.com/fr/icones-gratuites/serveur\" title=\"serveur icônes\">".$langs->trans("AgefoddxSmashicons")."</a></p>
|
||||||
|
</div>
|
||||||
|
";
|
||||||
|
// Page end
|
||||||
|
print dol_get_fiche_end();
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
133
admin/setup.php
Normal file
133
admin/setup.php
Normal file
@ -0,0 +1,133 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
|
* Copyright (C) ---Put here your own copyright and developer email---
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
use Module\Agefoddx\Classe\Controleur\ControleurGenerique;
|
||||||
|
use Module\Agefoddx\Classe\Controleur\ControleurBd;
|
||||||
|
use Module\Agefoddx\Classe\Controleur\ControleurTable;
|
||||||
|
use Module\Agefoddx\Classe\Controleur\ControleurLigne;
|
||||||
|
use Module\Agefoddx\Lib\Psr4AutoloaderClass;
|
||||||
|
require_once __DIR__ . '/../lib/Psr4AutoloaderClass.php';
|
||||||
|
/**
|
||||||
|
* \file htdocs/modulebuilder/template/admin/setup.php
|
||||||
|
* \ingroup Agefoddx
|
||||||
|
* \brief Agefoddx setup page.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Load Dolibarr environment
|
||||||
|
$res = 0;
|
||||||
|
global $db, $hookmanager, $conf;
|
||||||
|
// Try main.inc.php into web root known defined into CONTEXT_DOCUMENT_ROOT (not always defined)
|
||||||
|
if (!$res && !empty($_SERVER["CONTEXT_DOCUMENT_ROOT"])) { $res = @include $_SERVER["CONTEXT_DOCUMENT_ROOT"]."/main.inc.php";}
|
||||||
|
// Try main.inc.php into web root detected using web root calculated from SCRIPT_FILENAME
|
||||||
|
$tmp = empty($_SERVER['SCRIPT_FILENAME']) ? '' : $_SERVER['SCRIPT_FILENAME']; $tmp2 = realpath(__FILE__); $i = strlen($tmp) - 1; $j = strlen($tmp2) - 1;
|
||||||
|
while ($i > 0 && $j > 0 && isset($tmp[$i]) && isset($tmp2[$j]) && $tmp[$i] == $tmp2[$j]) {$i--;$j--;}
|
||||||
|
if (!$res && $i > 0 && file_exists(substr($tmp, 0, ($i + 1))."/main.inc.php")) {$res = @include substr($tmp, 0, ($i + 1))."/main.inc.php";}
|
||||||
|
if (!$res && $i > 0 && file_exists(dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php")) {$res = @include dirname(substr($tmp, 0, ($i + 1)))."/main.inc.php";}
|
||||||
|
// Try main.inc.php using relative path
|
||||||
|
if (!$res && file_exists("../../main.inc.php")) {$res = @include "../../main.inc.php";}
|
||||||
|
if (!$res && file_exists("../../../main.inc.php")) {$res = @include "../../../main.inc.php";}
|
||||||
|
if (!$res) {die("Include of main fails");}
|
||||||
|
|
||||||
|
global $langs, $user;
|
||||||
|
|
||||||
|
// Libraries
|
||||||
|
require_once DOL_DOCUMENT_ROOT."/core/lib/admin.lib.php";
|
||||||
|
require_once '../lib/Agefoddx.lib.php';
|
||||||
|
//require_once "../classe/myclass.classe.php";
|
||||||
|
|
||||||
|
// Translations
|
||||||
|
$langs->loadLangs(array("admin", "Agefoddx@Agefoddx"));
|
||||||
|
|
||||||
|
// Initialize technical object to manage hooks of page. Note that conf->hooks_modules contains array of hook context
|
||||||
|
$hookmanager->initHooks(array('Agefoddxsetup', 'globalsetup'));
|
||||||
|
|
||||||
|
// Access control
|
||||||
|
if (!$user->admin) {accessforbidden();}
|
||||||
|
|
||||||
|
// Parameters
|
||||||
|
$action = GETPOST('action', 'aZ09');
|
||||||
|
$backtopage = GETPOST('backtopage', 'alpha');
|
||||||
|
$modulepart = GETPOST('modulepart', 'aZ09'); // Used by actions_setmoduleoptions.inc.php
|
||||||
|
|
||||||
|
$value = GETPOST('value', 'alpha');
|
||||||
|
$label = GETPOST('label', 'alpha');
|
||||||
|
$scandir = GETPOST('scan_dir', 'alpha');
|
||||||
|
$type = 'myobject';
|
||||||
|
|
||||||
|
|
||||||
|
$error = 0;
|
||||||
|
$setupnotempty = 0;
|
||||||
|
|
||||||
|
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* View
|
||||||
|
*/
|
||||||
|
|
||||||
|
$form = new Form($db);
|
||||||
|
|
||||||
|
$help_url = '';
|
||||||
|
$page_name = "AgefoddxSetup";
|
||||||
|
|
||||||
|
llxHeader('', $langs->trans($page_name), $help_url, '', 0, 0, '', '', '', 'mod-Agefoddx page-admin');
|
||||||
|
|
||||||
|
// Subheader
|
||||||
|
$linkback = '<a href="'.($backtopage ? $backtopage : DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1').'">'.$langs->trans("BackToModuleList").'</a>';
|
||||||
|
|
||||||
|
print load_fiche_titre($langs->trans($page_name), $linkback, 'title_setup');
|
||||||
|
|
||||||
|
// Configuration header
|
||||||
|
$head = AgefoddxAdminPrepareHead();
|
||||||
|
print dol_get_fiche_head($head, 'settings', $langs->trans($page_name), -1, "Agefoddx@Agefoddx");
|
||||||
|
|
||||||
|
// Setup page goes here
|
||||||
|
echo '<span classe="opacitymedium">'.$langs->trans("AgefoddxSetupPage").'</span><br><br>';
|
||||||
|
/* Setup semi structure MVC*/
|
||||||
|
|
||||||
|
$chargeurDeClasse = new Psr4AutoloaderClass(false);
|
||||||
|
$chargeurDeClasse->register();
|
||||||
|
$chargeurDeClasse->addNamespace('Module\Agefoddx','..');
|
||||||
|
if (!isset($_POST['controleur'])){
|
||||||
|
$controleur = 'bd';
|
||||||
|
} else {
|
||||||
|
$controleur = $_POST['controleur'];
|
||||||
|
}
|
||||||
|
$nomDeClasseControleur = 'Module\Agefoddx\Classe\Controleur\Controleur'.ucfirst($controleur);
|
||||||
|
if (class_exists($nomDeClasseControleur)){
|
||||||
|
if (isset($_POST['action'])){
|
||||||
|
$action = $_POST['action'];
|
||||||
|
$methodes = get_class_methods($nomDeClasseControleur);
|
||||||
|
if (in_array($action, $methodes)){
|
||||||
|
$nomDeClasseControleur::$action();
|
||||||
|
}else {
|
||||||
|
$nomDeClasseControleur::afficherErreur("<tr><th><h1>Erreur 404</h1></th></tr>
|
||||||
|
<tr><th><p>page not found</p></th></tr>");
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
ControleurBd::afficherListe();
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
ControleurBd::afficherListe();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Page end
|
||||||
|
print dol_get_fiche_end();
|
||||||
|
|
||||||
|
llxFooter();
|
||||||
|
$db->close();
|
||||||
1
classe/.htaccess
Normal file
1
classe/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
15
classe/Classe/GestionTexte.php
Normal file
15
classe/Classe/GestionTexte.php
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\Classe;
|
||||||
|
|
||||||
|
|
||||||
|
class GestionTexte {
|
||||||
|
/**
|
||||||
|
* @param string $texte texte avec ou sans parenthèse
|
||||||
|
* @param string $parametre paramètre qui remplacera parenthèse
|
||||||
|
* @return string return le texte donné en parameter modifié
|
||||||
|
*/
|
||||||
|
public static function tronquerParentheses(string $texte, string $parametre = "") : string {
|
||||||
|
$texte_modifie = preg_replace('/\(.*?\)/', $parametre, $texte);
|
||||||
|
return $texte_modifie;
|
||||||
|
}
|
||||||
|
}
|
||||||
119
classe/Controleur/ControleurBd.php
Normal file
119
classe/Controleur/ControleurBd.php
Normal file
@ -0,0 +1,119 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\Controleur;
|
||||||
|
use Exception;
|
||||||
|
use Module\Agefoddx\Classe\Classe\GestionTexte;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdGestion;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdExterneInteraction;
|
||||||
|
|
||||||
|
class ControleurBd extends ControleurGenerique {
|
||||||
|
/**
|
||||||
|
* @var string $lien represent le chemin relatif vers la vue
|
||||||
|
*/
|
||||||
|
protected static string $lien = "../view/gestionBD";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affiche la liste des bds
|
||||||
|
*/
|
||||||
|
public static function afficherListe(string $message = "") {
|
||||||
|
global $langs;
|
||||||
|
$liste = (new bdGestion())->getListeBD();
|
||||||
|
$titre = $langs->trans("AgefoddxAfficherListeBD");
|
||||||
|
self::afficherVue(["titre"=>"$titre", "cheminCorpsVue" => ControleurBd::$lien."/afficherListe.php", "listeBD" => $liste, "message" => $message]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affiche la page d'ajout de base de données
|
||||||
|
*/
|
||||||
|
public static function ajouter(string $message = ""){
|
||||||
|
global $langs;
|
||||||
|
$titre = $langs->trans("AgefoddxAjouterBD");
|
||||||
|
self::afficherVue(["titre"=>"$titre", "cheminCorpsVue" => ControleurBd::$lien."/ajouter.php", "message"=>$message]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void gestion de l'insertion des liens vers des bases de données
|
||||||
|
*/
|
||||||
|
public static function insertion() {
|
||||||
|
global $langs;
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$lien = $_POST["lienBD"];
|
||||||
|
$user = $_POST["user"];
|
||||||
|
if (isset($_POST["port"])) { try { $port = intval($_POST["port"]); } catch (Exception $ex){ self::afficherListe($ex);} }
|
||||||
|
$mdp = $_POST["mdp"];
|
||||||
|
if (isset($nom) && isset($lien) && isset($user) && isset($mdp)) $test_connection = new bdExterneInteraction(null, $nom, $lien, $user, $port);
|
||||||
|
$test_connection->setMdp($mdp);
|
||||||
|
if ($test_connection->connectionBD()){
|
||||||
|
$value = (new bdGestion())->insertionBD($nom, $lien, $user, $port);
|
||||||
|
if ($value)self::afficherListe($langs->trans("AgefoddxInsertionTrueBD"));
|
||||||
|
else self::ajouter($langs->trans("AgefoddxInsertionFalseBD"));
|
||||||
|
}else self::ajouter($langs->trans("AgefoddxConnexionBDImp"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affiche la page de modification de liens dans la table
|
||||||
|
*/
|
||||||
|
public static function modifier(string $message = "") {
|
||||||
|
global $langs;
|
||||||
|
$titre = $langs->trans("AgefoddxModifierBD");
|
||||||
|
$id = $_POST["idBD"];
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$liste = (new bdGestion())->getBdByPk($id);
|
||||||
|
self::afficherVue(["titre"=>"$titre $nom","cheminCorpsVue" => ControleurBd::$lien."/modifier.php", "idBD"=>$id, "nomBD" => $nom, "liste" => $liste, "message" => $message]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void met à jour les données récupéré dans la table
|
||||||
|
*/
|
||||||
|
public static function update() {
|
||||||
|
global $langs;
|
||||||
|
if (isset($_POST["idBD"])) {try {$id = intval($_POST["idBD"]);} catch (Exception $ex){ self::afficherListe($ex);}}
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$lien = $_POST["lienBD"];
|
||||||
|
$user = $_POST["user"];
|
||||||
|
if (isset($_POST["port"])) {try {$port = intval($_POST["port"]);} catch (Exception $ex){self::afficherListe($ex);}}
|
||||||
|
$mdp = $_POST["mdp"];
|
||||||
|
|
||||||
|
if (isset($nom) && isset($lien) && isset($user) && isset($mdp))
|
||||||
|
$test_connection = new bdExterneInteraction($id, $nom, $lien, $user, $port);
|
||||||
|
$test_connection->setMdp($mdp);
|
||||||
|
if ($test_connection->connectionBD()){
|
||||||
|
$value = (new bdGestion())->modificationBD($id, $nom, $lien, $user, $port);
|
||||||
|
if ($value)self::afficherListe($langs->trans("AgefoddxModificationTrueBD"));
|
||||||
|
else self::modifier($langs->trans("AgefoddxModificationFalseBD"));
|
||||||
|
}else self::modifier($langs->trans("AgefoddxConnexionBDImp"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affiche la page de suppression bd
|
||||||
|
*/
|
||||||
|
public static function supprimer(string $message = ""){
|
||||||
|
global $langs;
|
||||||
|
$titre = $langs->trans("AgefoddxSupprimerBD");
|
||||||
|
$idBD = $_POST["idBD"];
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
self::afficherVue(["titre"=>"$titre $nomBD", "cheminCorpsVue" => ControleurBd::$lien."/supprimer.php", "nomBD" => $nomBD, "idBD"=>$idBD, "message"=>$message]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void supprime le lien avec la bd
|
||||||
|
*/
|
||||||
|
public static function suppression() {
|
||||||
|
global $langs;
|
||||||
|
$idBD = $_POST["idBD"];
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
$value = $_POST["ouiNon"];
|
||||||
|
$gestion = (new GestionTexte());
|
||||||
|
if ($value == "true" && $idBD && isset($nomBD)) {
|
||||||
|
$connexion_bd = new bdGestion();
|
||||||
|
if ($connexion_bd->bdPossedeDesTables($idBD))self::afficherListe($gestion::tronquerParentheses($langs->trans("AgefoddxTableExistante"), $nomBD) );
|
||||||
|
else {
|
||||||
|
$value = $connexion_bd->suppressionBD($idBD);
|
||||||
|
if ($value)self::afficherListe($gestion::tronquerParentheses($langs->trans("AgefoddxSuppressionTrueBD"), $nomBD));
|
||||||
|
else self::afficherListe($gestion::tronquerParentheses($langs->trans("AgefoddxSuppressionFalseBD"), $nomBD));
|
||||||
|
}} else self::afficherListe($gestion::tronquerParentheses($langs->trans("AgefoddxSuppressionAnnulerBD"), $nomBD) );
|
||||||
|
}
|
||||||
|
}
|
||||||
24
classe/Controleur/ControleurGenerique.php
Normal file
24
classe/Controleur/ControleurGenerique.php
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\Controleur;
|
||||||
|
|
||||||
|
class ControleurGenerique {
|
||||||
|
/**
|
||||||
|
* @param array $parametres liste de paramètre transmit à la page
|
||||||
|
* @return void affiche la vue générale et y transmet les paramètres
|
||||||
|
*/
|
||||||
|
protected static function afficherVue(array $parametres = []): void {
|
||||||
|
extract($parametres);
|
||||||
|
require_once "../view/vueGenerale.php"; // Charge la vue
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $messageErreur message d'erreur à afficher sur la page
|
||||||
|
* @return void affichage de la page d'erreur
|
||||||
|
*/
|
||||||
|
public static function afficherErreur(string $messageErreur = "") : void {
|
||||||
|
if ($messageErreur == ""){
|
||||||
|
$messageErreur = "Erreur 404";
|
||||||
|
}
|
||||||
|
self::afficherVue(["cheminCorpsVue" => "../view/erreur.php", "messageErreur" => $messageErreur]);
|
||||||
|
}
|
||||||
|
}
|
||||||
208
classe/Controleur/ControleurLigne.php
Normal file
208
classe/Controleur/ControleurLigne.php
Normal file
@ -0,0 +1,208 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\Controleur;
|
||||||
|
use Module\Agefoddx\Classe\Classe\GestionTexte;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdExterneLigneGestion;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdGestion;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\ligneGestion;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\tableGestion;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdExterneInteraction;
|
||||||
|
|
||||||
|
class ControleurLigne extends ControleurGenerique {
|
||||||
|
/**
|
||||||
|
* @var string $lien represent le chemin relatif vers la vue
|
||||||
|
*/
|
||||||
|
protected static string $lien = "../view/gestionLigne";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affichage de la liste des lignes
|
||||||
|
*/
|
||||||
|
public static function afficherListe ($message = "") {
|
||||||
|
global $langs;
|
||||||
|
$idBD = $_POST["idBD"];
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
$idTable = $_POST["idTable"];
|
||||||
|
|
||||||
|
$infoTable = (new tableGestion())->getTableByPk($idTable);
|
||||||
|
$nomTableAgefodd = $infoTable["nomTableAgefodd"];
|
||||||
|
$nomTableExterne = $infoTable["nomTableExterne"];
|
||||||
|
$titre = GestionTexte::tronquerParentheses($langs->trans("AgefoddxTitreAfficherListeColonne"), "$nomTableExterne ".$langs->trans("AgefoddxEt")." $nomTableAgefodd");
|
||||||
|
$liste = (new ligneGestion())->getListeLigneCorreler($idTable);
|
||||||
|
$addresse = "afficherListe";
|
||||||
|
self::afficherVue(["titre" => $titre, "cheminCorpsVue"=>self::$lien."/".$addresse.".php","message"=>$message,
|
||||||
|
"idBD"=>$idBD,"nomBD"=>$nomBD,
|
||||||
|
"idTable"=>$idTable, "nomTableA"=>$nomTableAgefodd, "nomTableE"=>$nomTableExterne,
|
||||||
|
"liste"=>$liste, "mdp"=>$_POST["mdp"]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $titre titre de la page
|
||||||
|
* @param string $actionApres action a réalisé
|
||||||
|
* @param string $titreAction label de l'action
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void permet la connection avec la base de donnée extérieur
|
||||||
|
*/
|
||||||
|
public static function getMdp ($titre, $actionApres, $titreAction, $message = "") {
|
||||||
|
$idBD = $_POST["idBD"];
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
$idTable = $_POST["idTable"];
|
||||||
|
$valeurBase = $_POST["valeurBase"] ?? $_POST["nomTableAgefodd"] ?? "";
|
||||||
|
$infoTable = (new tableGestion())->getTableByPk($idTable);
|
||||||
|
$nomTableAgefodd = $infoTable["nomTableAgefodd"];
|
||||||
|
$nomTableExterne = $infoTable["nomTableExterne"];
|
||||||
|
$addresse = "transition";
|
||||||
|
self::afficherVue(["titre" => $titre, "cheminCorpsVue"=>self::$lien."/".$addresse.".php","message"=>$message,
|
||||||
|
"idBD"=>$idBD,"nomBD"=>$nomBD, "valeurBase"=>$valeurBase,
|
||||||
|
"idTable"=>$idTable, "nomTableA"=>$nomTableAgefodd, "nomTableE"=>$nomTableExterne,
|
||||||
|
"actionApres"=>$actionApres, "titreAction"=>$titreAction]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affichage de la page d'ajout de lien entre les lignes
|
||||||
|
*/
|
||||||
|
public static function ajouter ($message = "") {
|
||||||
|
global $langs;
|
||||||
|
$idBD = $_POST["idBD"];
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
$idTable = $_POST["idTable"];
|
||||||
|
$valeurBase = $_POST["valeurBase"] ?? $_POST["nomTableAgefodd"] ?? $_POST["agefoddLigneFk"] ?? "";
|
||||||
|
$infoTable = (new tableGestion())->getTableByPk($idTable);
|
||||||
|
$nomTableAgefodd = $infoTable["nomTableAgefodd"];
|
||||||
|
$nomTableExterne = $infoTable["nomTableExterne"];
|
||||||
|
$titre = $langs->trans("AgefoddxAjouterLien")." $nomTableAgefodd ".$langs->trans("AgefoddxEt")." $nomTableExterne";
|
||||||
|
$tab = $_POST["tab"] ?? "tab1";
|
||||||
|
|
||||||
|
$addresse = "ajouter";
|
||||||
|
$mdp = $_POST["mdp"];
|
||||||
|
if ($mdp != "" && isset($mdp)){
|
||||||
|
$bdE_connexion = bdExterneInteraction::construireDepuisSQL((new bdGestion())->getBdByPk($idBD), $mdp);
|
||||||
|
if ($bdE_connexion->connectionBD()){
|
||||||
|
$listeE = bdExterneLigneGestion::getListeLigne($bdE_connexion, $nomTableExterne);
|
||||||
|
$listeA = (new ligneGestion())->getListeLigneAgefodd($nomTableAgefodd, $idTable);
|
||||||
|
$listeEFK = bdExterneLigneGestion::getListeFK($bdE_connexion, $nomTableExterne);
|
||||||
|
$listeAFK = (new ligneGestion())->getListeFK($nomTableAgefodd, $idTable);
|
||||||
|
if (in_array($valeurBase, $listeAFK[0])) $tab = "tab3";
|
||||||
|
self::afficherVue(["titre" => $titre, "cheminCorpsVue"=>self::$lien."/".$addresse.".php","message"=>$message,
|
||||||
|
"idBD"=>$idBD,"nomBD"=>$nomBD,
|
||||||
|
"idTable"=>$idTable, "nomTableA"=>$nomTableAgefodd, "nomTableE"=>$nomTableExterne,
|
||||||
|
"listeE"=>$listeE, "listeA"=>$listeA,"valeurBase"=>$valeurBase, "listeEFK"=>$listeEFK, "listeAFK"=>$listeAFK,"mdp"=>$mdp, "tab"=>$tab]);
|
||||||
|
} else {
|
||||||
|
self::getMdp($titre, 'ajouter', $langs->trans("AgefoddxAjouter"), $langs->trans("AgefoddxMDPInc"));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
self::getMdp($titre, 'ajouter', $langs->trans("AgefoddxAjouter"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void insertion de lien entre diver lignes
|
||||||
|
*/
|
||||||
|
public static function insertion() {
|
||||||
|
global $langs;
|
||||||
|
$idBD = $_POST["idBD"];
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
$idTable = $_POST["idTable"];
|
||||||
|
$infoTable = (new tableGestion())->getTableByPk($idTable);
|
||||||
|
$nomTableAgefodd = $infoTable["nomTableAgefodd"];
|
||||||
|
$nomTableExterne = $infoTable["nomTableExterne"];
|
||||||
|
$agefoddLigne = $_POST["agefoddLigne"];
|
||||||
|
$bdExterneLigne = $_POST["bdExterneLigne"];
|
||||||
|
$valeurFixe = $_POST["valeurFixe"];
|
||||||
|
$valeurBase = $_POST["valeurBase"] ?? $_POST["nomTableAgefodd"] ?? "";
|
||||||
|
$agefoddFk = $_POST["agefoddLigneFk"];
|
||||||
|
$externeFk = $_POST["bdExterneLigneFk"];
|
||||||
|
|
||||||
|
$mdp = $_POST["mdp"];
|
||||||
|
$tab = $_POST["tab"];
|
||||||
|
$gestionLigne = new ligneGestion();
|
||||||
|
if (isset($idBD) && isset($nomBD) && isset($idTable) && isset($agefoddLigne) && isset($bdExterneLigne)){
|
||||||
|
if ($bdExterneLigne != '' && $agefoddLigne != ''){
|
||||||
|
if (!$gestionLigne->correlationEstDansTable($idTable, $agefoddLigne)){
|
||||||
|
$bdE_connexion = bdExterneInteraction::construireDepuisSQL((new bdGestion())->getBdByPk($idBD), $mdp);
|
||||||
|
$typeE = (new GestionTexte())->tronquerParentheses(bdExterneLigneGestion::getTypeLigne($bdE_connexion, $nomTableExterne, $bdExterneLigne));
|
||||||
|
$typeA = (new GestionTexte())->tronquerParentheses($gestionLigne->getTypeLigne($nomTableAgefodd, $agefoddLigne));
|
||||||
|
if ($gestionLigne->sontCompatible($typeA, $typeE)){
|
||||||
|
$value = $gestionLigne->insertion($idTable, $idBD, $agefoddLigne, $bdExterneLigne);
|
||||||
|
if ($value) self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionTrue"), "$agefoddLigne ".$langs->trans("AgefoddxEt")." $bdExterneLigne"));
|
||||||
|
else self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionFalse"), "$agefoddLigne ".$langs->trans("AgefoddxEt")." $bdExterneLigne"));
|
||||||
|
}else self::ajouter(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionInc"), "$agefoddLigne($typeA) ".$langs->trans("AgefoddxEtDe")." $bdExterneLigne($typeE) "));
|
||||||
|
}else self::ajouter(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionDejaLiee"), $agefoddLigne));
|
||||||
|
}else self::ajouter($langs->trans("AgefoddxMessageLigneInsertionDoitChoisirVal"));
|
||||||
|
}elseif (isset($idBD) && isset($nomBD) && isset($idTable) && isset($agefoddLigne) && $valeurFixe) {
|
||||||
|
if ($agefoddLigne != '') {
|
||||||
|
if (!$gestionLigne->correlationEstDansTable($idTable, $agefoddLigne)) {
|
||||||
|
$value = $gestionLigne->insertionValue($idTable, $idBD, $agefoddLigne, $valeurFixe);
|
||||||
|
if ($value) self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionTrue"), "$agefoddLigne " . $langs->trans("AgefoddxEtLaVal") . " $valeurFixe"));
|
||||||
|
else self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionTrue"), "$agefoddLigne " . $langs->trans("AgefoddxEtLaVal") . " $valeurFixe"));
|
||||||
|
} else self::ajouter(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionDejaLiee"), $agefoddLigne));
|
||||||
|
} else self::ajouter($langs->trans("AgefoddxMessageLigneInsertionDoitChoisirVal"));
|
||||||
|
}elseif (isset($idBD) && isset($nomBD) && isset($idTable) && isset($agefoddFk) && isset($externeFk)) {
|
||||||
|
list($agefoddFk, $tableReferenceA) = explode('|', $agefoddFk);
|
||||||
|
list($externeFk, $tableReferenceE) = explode('|', $externeFk);
|
||||||
|
if ((new tableGestion())->tablesDejaEnregistrer($tableReferenceA, $tableReferenceE)) {
|
||||||
|
$bdE_connexion = bdExterneInteraction::construireDepuisSQL((new bdGestion())->getBdByPk($idBD), $mdp);
|
||||||
|
$typeE = (new GestionTexte())->tronquerParentheses(bdExterneLigneGestion::getTypeLigne($bdE_connexion, $nomTableExterne, $externeFk));
|
||||||
|
$typeA = (new GestionTexte())->tronquerParentheses($gestionLigne->getTypeLigne($nomTableAgefodd, $agefoddFk));
|
||||||
|
if ($gestionLigne->sontCompatible($typeA, $typeE)){
|
||||||
|
$value = $gestionLigne->insertion($idTable, $idBD, $agefoddFk, $externeFk);
|
||||||
|
if ($value) self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionTrue"), "$agefoddFk " . $langs->trans("AgefoddxEt") . " $externeFk"));
|
||||||
|
else self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxMessageLigneInsertionTrue"), "$agefoddFk " . $langs->trans("AgefoddxEt") . " $externeFk"));
|
||||||
|
}
|
||||||
|
} else ControleurTable::ajouter(GestionTexte::tronquerParentheses($langs->trans("AgefoddxTableFkLierFalse"), "$tableReferenceA ".$langs->trans("AgefoddxEt")." $tableReferenceE"));
|
||||||
|
}else self::ajouter($langs->trans("AgefoddxMessageErreurSaisie"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affichage de la page de suppression de lien entre les lignes
|
||||||
|
*/
|
||||||
|
public static function supprimer ($message = "") {
|
||||||
|
global $langs;
|
||||||
|
$idBD = $_POST["idBD"];
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
$idTable = $_POST["idTable"];
|
||||||
|
$idLigne = $_POST["idLigne"];
|
||||||
|
|
||||||
|
$infoTable = (new tableGestion())->getTableByPk($idTable);
|
||||||
|
$nomTableAgefodd = $infoTable["nomTableAgefodd"];
|
||||||
|
$nomTableExterne = $infoTable["nomTableExterne"];
|
||||||
|
$infoLigne = (new ligneGestion())->getLigneByPk($idLigne);
|
||||||
|
$nomLigneExterne = $infoLigne["nomLigneE"];
|
||||||
|
$nomLigneAgefodd = $infoLigne["nomLigneA"];
|
||||||
|
|
||||||
|
$titre = $langs->trans("AgefoddxSupprimerLienTable")." $nomLigneExterne ".$langs->trans("AgefoddxEt")." $nomLigneAgefodd";
|
||||||
|
$addresse = "supprimer";
|
||||||
|
self::afficherVue(["titre" => $titre, "cheminCorpsVue"=>self::$lien."/".$addresse.".php","message"=>$message,
|
||||||
|
"idBD"=>$idBD,"nomBD"=>$nomBD,"mdp"=>$_POST["mdp"],
|
||||||
|
"idTable"=>$idTable, "nomTableA"=>$nomTableAgefodd, "nomTablE"=>$nomTableExterne,
|
||||||
|
"nomLigneE"=>$nomLigneExterne, "nomLigneA"=>$nomLigneAgefodd, "idLigne"=>$idLigne]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void suppression des liens dans entre les lignes dans la bd
|
||||||
|
*/
|
||||||
|
public static function suppression ($message = "") {
|
||||||
|
global $langs;
|
||||||
|
$idBD = intval($_POST["idBD"]);
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
$idTable = intval($_POST["idTable"]);
|
||||||
|
$idLigne = intval($_POST['idLigne']);
|
||||||
|
$mdp=$_POST["mdp"];
|
||||||
|
$infoTable = (new tableGestion())->getTableByPk($idTable);
|
||||||
|
$nomTableAgefodd = $infoTable["nomTableAgefodd"];
|
||||||
|
$nomTableExterne = $infoTable["nomTableExterne"];
|
||||||
|
$infoLigne = (new ligneGestion())->getLigneByPk($idLigne);
|
||||||
|
$nomLigneExterne = $infoLigne["nomLigneE"];
|
||||||
|
$nomLigneAgefodd = $infoLigne["nomLigneA"];
|
||||||
|
$value = $_POST["ouiNon"];
|
||||||
|
$et = " $nomLigneExterne ".$langs->trans("AgefoddxEt")." $nomLigneAgefodd ";
|
||||||
|
if ($value == "true" && $idLigne && isset($nomBD)){
|
||||||
|
$connexion_ligne = new ligneGestion();
|
||||||
|
$value = $connexion_ligne->suppression($idLigne);
|
||||||
|
if ($value)self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxSuppressionLienTrue"), $et));
|
||||||
|
else self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxSuppressionLienFalse"), $et));
|
||||||
|
} else self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxSuppressionLienAnnuler"), $et));
|
||||||
|
}
|
||||||
|
}
|
||||||
183
classe/Controleur/ControleurTable.php
Normal file
183
classe/Controleur/ControleurTable.php
Normal file
@ -0,0 +1,183 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\Controleur;
|
||||||
|
use Module\Agefoddx\Classe\Classe\GestionTexte;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdGestion;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\ligneGestion;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\tableGestion;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdExterneInteraction;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdExterneTableGestion;
|
||||||
|
|
||||||
|
class ControleurTable extends ControleurGenerique {
|
||||||
|
/**
|
||||||
|
* @var string $lien represent le chemin relatif vers la vue
|
||||||
|
*/
|
||||||
|
protected static string $lien = "../view/gestionTable";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affichage de la liste des tables
|
||||||
|
*/
|
||||||
|
public static function afficherListe(string $message = ""){
|
||||||
|
global $langs;
|
||||||
|
$id = intval($_POST["idBD"]);
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$titre = GestionTexte::tronquerParentheses($langs->trans("AgefoddxAfficherListeTable"), $nom);
|
||||||
|
if (isset($id)){
|
||||||
|
$liste = (new tableGestion())->getListeTableCorreler($id);
|
||||||
|
self::afficherVue(["titre"=>"$titre","cheminCorpsVue" => ControleurTable::$lien."/afficherListe.php", "liste" => $liste, "idBD"=>$id ,"nomBD"=>$nom, "message" => $message,"mdp"=>$_POST["mdp"]]);
|
||||||
|
}else ControleurBd::afficherListe($langs->trans("AgefoddxAfficherListeTableError"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $titre titre de la page
|
||||||
|
* @param string $actionApres action a réalisé
|
||||||
|
* @param string $titreAction label de l'action
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void permet la connection avec la base de donnée extérieur
|
||||||
|
*/
|
||||||
|
public static function connectionTr(string $titre, string $actionApres, string $titreAction, string $message = ""){
|
||||||
|
$id = intval($_POST["idBD"]);
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$idT = $_POST["idTable"] ?? "";
|
||||||
|
$nomA = $_POST["nomTableA"] ?? "";
|
||||||
|
$nomE = $_POST["nomTableE"] ?? "";
|
||||||
|
if (isset($id) && isset($nom)){
|
||||||
|
$bd = (bdExterneInteraction::construireDepuisSQL((new bdGestion())->getBdByPk($id)));
|
||||||
|
self::afficherVue(["titre"=>$titre,"actionApres"=>$actionApres, "nomTableA"=>$nomA, "nomTableE"=>$nomE, "titreAction"=>$titreAction, "cheminCorpsVue" => ControleurTable::$lien."/transition.php", "idBD"=>$id ,"nomBD"=>$nom, "idTable"=>$idT, "message" => $message]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affichage de la page d'ajout
|
||||||
|
*/
|
||||||
|
public static function ajouter(string $message = ""){
|
||||||
|
global $langs;
|
||||||
|
$id = intval($_POST["idBD"]);
|
||||||
|
$nom = $_POST["nomBD"] ?? "";
|
||||||
|
$mdp = $_POST["mdp"];
|
||||||
|
if ($mdp != ""){ $bd = bdExterneInteraction::construireDepuisSQL((new bdGestion())->getBdByPk($id), $mdp);
|
||||||
|
if ($bd->connectionBD()) {
|
||||||
|
if (isset($id) && isset($nom)){
|
||||||
|
$listeAgefodd = (new tableGestion())->getListeTableAgefodd();
|
||||||
|
$listeBdExterne = bdExterneTableGestion::getListeTables($bd);
|
||||||
|
self::afficherVue(["titre"=>$langs->trans("AgefoddxAjouterLien")." Agefodd ".$langs->trans("AgefoddxEt")." $nom", "cheminCorpsVue" => ControleurTable::$lien."/ajouter.php", "idBD"=>$id ,"nomBD"=>$nom, "message" => $message, "listeAgefodd"=>$listeAgefodd, "listeBdExterne"=>$listeBdExterne ,"bdConnection"=>$bd, "mdp"=>$mdp]);
|
||||||
|
}
|
||||||
|
} else self::connectionTr($langs->trans("AgefoddxConnexion")." $nom", "ajouter", $langs->trans("AgefoddxAjouter"), $langs->trans("AgefoddxMDPInc"));
|
||||||
|
} else self::connectionTr($langs->trans("AgefoddxConnexion")." $nom", "ajouter", $langs->trans("AgefoddxAjouter"));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void insert les liens
|
||||||
|
*/
|
||||||
|
public static function insertion(){
|
||||||
|
global $langs;
|
||||||
|
$id = intval($_POST["idBD"]);
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$mdp = $_POST["mdp"];
|
||||||
|
$tableA = $_POST["agefoddTable"];
|
||||||
|
$tableE = $_POST["bdExterneTable"];
|
||||||
|
if ((isset($tableE) && isset($tableA)) && ($tableA!='' && $tableE!='')){
|
||||||
|
$value = (new tableGestion())->tablesDejaEnregistrer($tableA, $tableE);
|
||||||
|
if ($value == true) self::afficherListe("$tableA ".$langs->trans("AgefoddxEt")." $tableE ".$langs->trans("AgefoddxTableDejaLiee"));
|
||||||
|
elseif ($value == false) {$ins = (new tableGestion)->insertionTable($id, $tableE, $tableA);
|
||||||
|
if ($ins) self::afficherListe($langs->trans("AgefoddxInsertionTrueTable"));
|
||||||
|
else self::ajouter($langs->trans("AgefoddxInsertionFalseTable"));
|
||||||
|
}else self::ajouter($langs->trans("AgefoddxPBConnexion"));
|
||||||
|
} else self::ajouter($langs->trans("AgefoddxTableNonSelect"));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affiche la page de suppression de lien entre les tables
|
||||||
|
*/
|
||||||
|
public static function supprimer(string $message = ""){
|
||||||
|
global $langs;
|
||||||
|
$id = intval($_POST["idBD"]);
|
||||||
|
$idT = intval($_POST["idTable"]);
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$nomA = $_POST["nomTableA"];
|
||||||
|
$nomE = $_POST["nomTableE"];
|
||||||
|
$titre = $langs->trans("AgefoddxSupprimerLienTable")." $nomA ".$langs->trans("AgefoddxEt")." $nomE";
|
||||||
|
self::afficherVue(["titre"=>"$titre","cheminCorpsVue" => ControleurTable::$lien."/supprimer.php", "idBD"=>$id, "idTable" => $idT ,"nomBD"=>$nom, "nomTableA"=>$nomA, "nomTableE"=>$nomE, "message" => $message, "mdp"=>$_POST["mdp"]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void supprime les liens entre les tables
|
||||||
|
*/
|
||||||
|
public static function suppression() {
|
||||||
|
global $langs;
|
||||||
|
$idT = intval($_POST["idTable"]);
|
||||||
|
$nomBD = $_POST["nomBD"];
|
||||||
|
$nomA = $_POST["nomTableA"];
|
||||||
|
$nomE = $_POST["nomTableE"];
|
||||||
|
$mdp=$_POST["mdp"];
|
||||||
|
$value = $_POST["ouiNon"];
|
||||||
|
$remp = $nomA . " " . $langs->trans("AgefoddxEt") . " " . $nomE;
|
||||||
|
if ($value == "true" && $idT && isset($nomBD) && isset($nomA) && isset($nomE)) {
|
||||||
|
$connexion_table = new tableGestion();
|
||||||
|
if ($connexion_table->tablePossedeDesLignes($idT)) self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxSuppressionImpLigneLiee"), $remp));
|
||||||
|
else {$value = $connexion_table->suppressionTable($idT);
|
||||||
|
if ($value)self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxSuppressionLienTrue"), $remp));
|
||||||
|
else self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxSuppressionLienFalse"), $remp));
|
||||||
|
}
|
||||||
|
}else self::afficherListe(GestionTexte::tronquerParentheses($langs->trans("AgefoddxSuppressionLienAnnuler"), $remp));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $message string message passable en parameter pour les interactions utilisateur
|
||||||
|
* @return void affiche la table d'importation des données
|
||||||
|
*/
|
||||||
|
public static function importer(string $message = "") {
|
||||||
|
global $langs;
|
||||||
|
$id = intval($_POST["idBD"]);
|
||||||
|
$idT = intval($_POST["idTable"]);
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$nomA = $_POST["nomTableA"];
|
||||||
|
$nomE = $_POST["nomTableE"];
|
||||||
|
$titre = $langs->trans("AgefoddxImporterDonnee")." $nomA ".$langs->trans("AgefoddxVers")." $nomE";
|
||||||
|
$value = (new tableGestion())->getParametreObligatoireNonRempli($nomA, $nomE);
|
||||||
|
$importationPossible = false;
|
||||||
|
if ($value == []) $importationPossible = true;
|
||||||
|
self::afficherVue(["titre"=>$titre,"cheminCorpsVue" => ControleurTable::$lien."/importer.php",
|
||||||
|
"idBD"=>$id, "idTable" => $idT ,"nomBD"=>$nom, "nomTableA"=>$nomA, "nomTableE"=>$nomE, "valueImportation" => $importationPossible, "liste"=>$value,"message" => $message, "mdp"=>$_POST["mdp"]]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void importe les données en fonction des tables liée
|
||||||
|
*/
|
||||||
|
public static function importation(){
|
||||||
|
global $langs;
|
||||||
|
$id = intval($_POST["idBD"]);
|
||||||
|
$idT = intval($_POST["idTable"]);
|
||||||
|
$nom = $_POST["nomBD"];
|
||||||
|
$nomA = $_POST["nomTableA"];
|
||||||
|
$nomE = $_POST["nomTableE"];
|
||||||
|
$mdp = $_POST["mdp"] ?? "";
|
||||||
|
$bd = bdExterneInteraction::construireDepuisSQL((new bdGestion())->getBdByPk($id), $mdp);
|
||||||
|
if ($mdp!=""){
|
||||||
|
if ($bd->connectionBD()) {
|
||||||
|
$idTableE = bdExterneTableGestion::getPk($bd, $nomE);
|
||||||
|
$parametre = (new TableGestion())->getParametreExterne($idT);
|
||||||
|
$parametre[] = ["id_source"=>$idTableE, "fixe"=>"false"];
|
||||||
|
|
||||||
|
$liste = bdExterneTableGestion::getValeurAExporter($bd, $parametre, $nomE);
|
||||||
|
if ((new ligneGestion())->possedeFk($nomA, $idT)){
|
||||||
|
$fkListe = (new ligneGestion())->getListeFKCorreler($nomA, $idT);
|
||||||
|
foreach ($fkListe as $ligne) {
|
||||||
|
$listeConvertion = (new tableGestion())->getTableConversionFK($ligne["TableReference"],(new ligneGestion())->getClefReferente($nomA, $ligne["NomLigne"]));
|
||||||
|
if ($listeConvertion != false ){
|
||||||
|
for ($x=0; $x<sizeof($liste); $x++){
|
||||||
|
$liste[$x][ $ligne["NomLigne"] ] = reset($listeConvertion[ $liste[$x] [$ligne["NomLigne"]] ]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$type = bdExterneTableGestion::getTypePk($bd, $nomE);
|
||||||
|
$message = (new tableGestion())->importerTout($liste,$nomE, $idTableE, $nomA, $type);
|
||||||
|
self::afficherListe($message);
|
||||||
|
} else self::connectionTr($langs->trans("AgefoddxImporter"), "importation", $langs->trans("AgefoddxImporter"), "mot de passe incorrecte");
|
||||||
|
} else self::connectionTr($langs->trans("AgefoddxImporter"), "importation", $langs->trans("AgefoddxImporter"));
|
||||||
|
}
|
||||||
|
}
|
||||||
65
classe/GestionBD/bdExterneInteraction.php
Normal file
65
classe/GestionBD/bdExterneInteraction.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\GestionBD;
|
||||||
|
use Exception;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
class bdExterneInteraction {
|
||||||
|
private ?int $id;
|
||||||
|
private string $nom;
|
||||||
|
private string $lien;
|
||||||
|
private string $user;
|
||||||
|
private ?string $mdp;
|
||||||
|
private int $port;
|
||||||
|
private ?PDO $pdo;
|
||||||
|
|
||||||
|
|
||||||
|
public function __construct($id, $nom, $lien, $user, $port) {
|
||||||
|
$this->id = $id;
|
||||||
|
$this->nom = $nom;
|
||||||
|
$this->lien = $lien;
|
||||||
|
$this->user = $user;
|
||||||
|
$this->mdp = "";
|
||||||
|
$this->port = $port;
|
||||||
|
$this->pdo = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return bool retourne la valeur de la connection avec la base de donnée et altère la variable pdo
|
||||||
|
*/
|
||||||
|
public function connectionBD(): bool {
|
||||||
|
try {
|
||||||
|
$this->pdo = new PDO("mysql:host=$this->lien;port=$this->port;dbname=$this->nom", $this->user, $this->mdp,
|
||||||
|
array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8mb4"));
|
||||||
|
// On active le mode d'affichage des erreurs, et le lancement d'exception en cas d'erreur
|
||||||
|
$this->pdo->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
|
} catch (Exception $ex) { return false; }
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function setMdp($mdp) {$this->mdp = $mdp;}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PDO|null si pdo est null essaye d'activer pdo sinon le return pdo
|
||||||
|
*/
|
||||||
|
public function getPdo(): ?PDO {
|
||||||
|
if ($this->pdo == null){
|
||||||
|
$this->connectionBD();
|
||||||
|
} return $this->pdo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param array $listeInfo liste des infos nécessaires à la connection bd
|
||||||
|
* @param string $mdp mot de passe de la bd entré par l'utilisateur
|
||||||
|
* @return bdExterneInteraction renvoie un objet de lui-même
|
||||||
|
*/
|
||||||
|
public static function construireDepuisSQL(array $listeInfo,string $mdp = ""){
|
||||||
|
$objet = (new bdExterneInteraction($listeInfo['idBD'], $listeInfo['nomBD'], $listeInfo['lienBD'], $listeInfo['user'], $listeInfo['port']));
|
||||||
|
$objet->setMdp($mdp);
|
||||||
|
return $objet;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return string renvoie le nom de la bd
|
||||||
|
*/
|
||||||
|
public function getNomBd(){return $this->nom;}
|
||||||
|
}
|
||||||
48
classe/GestionBD/bdExterneLigneGestion.php
Normal file
48
classe/GestionBD/bdExterneLigneGestion.php
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\GestionBD;
|
||||||
|
use Module\Agefoddx\Classe\Classe\GestionTexte;
|
||||||
|
class bdExterneLigneGestion {
|
||||||
|
/**
|
||||||
|
* @param bdExterneInteraction $bd bd externe qui permet le requêtage sql
|
||||||
|
* @param string $nomTable nom de la table
|
||||||
|
* @return array renvoie le nom des colones de la table
|
||||||
|
*/
|
||||||
|
public static function getListeLigne (bdExterneInteraction $bd, string $nomTable) {
|
||||||
|
$pdo = $bd->getPdo();
|
||||||
|
$list = [];
|
||||||
|
$resql= $pdo->query("SELECT column_name as 'row_name' FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$nomTable';");
|
||||||
|
foreach ($resql as $value){
|
||||||
|
if (!in_array($value["row_name"], self::getListeFK($bd, $nomTable)))
|
||||||
|
$list[] = $value["row_name"];
|
||||||
|
} return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bdExterneInteraction $bd bd externe qui permet le requêtage sql
|
||||||
|
* @param string $nomTable nom de la table
|
||||||
|
* @param string $nomLigne nom de la colonne
|
||||||
|
* @return string|null renvoie le type de la colonne
|
||||||
|
*/
|
||||||
|
public static function getTypeLigne(bdExterneInteraction $bd, string $nomTable, string $nomLigne) : ?string {
|
||||||
|
$pdo = $bd->getPdo();
|
||||||
|
$resql = $pdo->query("SELECT COLUMN_TYPE as 'colType'FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '$nomTable' AND COLUMN_NAME = '$nomLigne';");
|
||||||
|
foreach ($resql as $value)$result = $value["colType"];
|
||||||
|
if ($result != '') return $result;
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bdExterneInteraction $bd bd externe qui permet le requêtage sql
|
||||||
|
* @param string $nomTable nom de la table
|
||||||
|
* @return array renvoie la liste des clefs étrangères de la table
|
||||||
|
*/
|
||||||
|
public static function getListeFK(bdExterneInteraction $bd, string $nomTable) {
|
||||||
|
$pdo = $bd->getPdo();
|
||||||
|
$list = [];
|
||||||
|
$resql= $pdo->query("SELECT COLUMN_NAME as 'NomLigne', REFERENCED_TABLE_NAME AS 'TableReference' FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = '$nomTable' AND REFERENCED_TABLE_NAME IS NOT NULL;");
|
||||||
|
foreach ($resql as $value){
|
||||||
|
$list[] =["row_name" => $value["NomLigne"], "TableReference"=>$value['TableReference']];
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
}
|
||||||
78
classe/GestionBD/bdExterneTableGestion.php
Normal file
78
classe/GestionBD/bdExterneTableGestion.php
Normal file
@ -0,0 +1,78 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\GestionBD;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdExterneInteraction;
|
||||||
|
use PDO;
|
||||||
|
|
||||||
|
class bdExterneTableGestion {
|
||||||
|
/**
|
||||||
|
* @param bdExterneInteraction $bd bd externe qui permet le requêtage sql
|
||||||
|
* @return array renvoie la liste
|
||||||
|
*/
|
||||||
|
public static function getListeTables(bdExterneInteraction $bd) {
|
||||||
|
$pdo = $bd->getPdo();
|
||||||
|
$adresse = $bd->getNomBd();
|
||||||
|
$list = [];
|
||||||
|
$resql= $pdo->query("SELECT table_name FROM information_schema.tables WHERE table_schema = '$adresse';");
|
||||||
|
foreach ($resql as $value){
|
||||||
|
$list[] = $value["table_name"];
|
||||||
|
} return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bdExterneInteraction $bd bd externe qui permet le requêtage sql
|
||||||
|
* @param $table string nom de la table
|
||||||
|
* @return string return le type de la clef primaire
|
||||||
|
*/
|
||||||
|
public static function getTypePk(bdExterneInteraction $bd, string $table) : string {
|
||||||
|
$pdo = $bd->getPdo();
|
||||||
|
$sql = "SELECT DATA_TYPE
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_NAME = '$table'
|
||||||
|
AND COLUMN_KEY = 'PRI';";
|
||||||
|
$resql= $pdo->query($sql);
|
||||||
|
return $resql->fetch()[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bdExterneInteraction $bd bd externe qui permet le requêtage sql
|
||||||
|
* @param $table string nom de la table
|
||||||
|
* @return string return le nom de la colonne de la clef primaire
|
||||||
|
*/
|
||||||
|
public static function getPk(bdExterneInteraction $bd, string $table) {
|
||||||
|
$pdo = $bd->getPdo();
|
||||||
|
$sql = "SELECT COLUMN_NAME
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_NAME = '$table'
|
||||||
|
AND COLUMN_KEY = 'PRI';";
|
||||||
|
$nomClef = $pdo->query($sql);
|
||||||
|
$nomClef = $nomClef->fetch()["COLUMN_NAME"];
|
||||||
|
return $nomClef;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bdExterneInteraction $bd bd externe qui permet le requêtage sql
|
||||||
|
* @param $listeValue array liste des valeurs liée a récupéré
|
||||||
|
* @param $table string nom de la table
|
||||||
|
* @return array liste des valeurs récupérées
|
||||||
|
*/
|
||||||
|
public static function getValeurAExporter(bdExterneInteraction $bd, array $listeValue, string $table){
|
||||||
|
$pdo = $bd->getPdo();
|
||||||
|
$liste = [];
|
||||||
|
$parametreSelection = "";
|
||||||
|
foreach ($listeValue as $value){
|
||||||
|
if ($value["fixe"] == "false") $parametreSelection = $parametreSelection.", ".$value[key($value)];
|
||||||
|
}
|
||||||
|
$parametreSelection = substr($parametreSelection, 2);
|
||||||
|
$sql = "SELECT $parametreSelection FROM $table;";
|
||||||
|
$resql= $pdo->query($sql);
|
||||||
|
$ligne = [];
|
||||||
|
foreach ($resql as $row){
|
||||||
|
foreach ($listeValue as $value){
|
||||||
|
if ($value["fixe"] == "false") $ligne[key($value)] = $row[$value[key($value)]];
|
||||||
|
else $ligne[key($value)] = $value[key($value)];
|
||||||
|
}
|
||||||
|
$liste[] = $ligne;
|
||||||
|
}
|
||||||
|
return $liste;
|
||||||
|
}
|
||||||
|
}
|
||||||
132
classe/GestionBD/bdGestion.php
Normal file
132
classe/GestionBD/bdGestion.php
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\GestionBD;
|
||||||
|
|
||||||
|
class bdGestion {
|
||||||
|
/**
|
||||||
|
* @return array renvoie la liste de toutes les bd enregistrer dans la base de donnée
|
||||||
|
*/
|
||||||
|
public function getListeBD(){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
|
||||||
|
$sql = "SELECT bdid as bdid, nom as nom FROM llx_desal_external_bd bd ORDER BY bdid, nom";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
// Parcours des résultats avec fetch_array
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
// Accès aux colonnes via leur index ou alias
|
||||||
|
$row = ["bdid"=> htmlspecialchars($row['bdid']), "nom"=>htmlspecialchars($row['nom'])]; // Par alias (nom de la colonne)
|
||||||
|
// Affichage des résultats
|
||||||
|
$list[] = $row;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// Gestion de l'erreur
|
||||||
|
echo "Erreur SQL : " . $db->lasterror();
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $id id de la bd
|
||||||
|
* @return array renvoie les informations de la bd selectionné
|
||||||
|
*/
|
||||||
|
public function getBdByPk(int $id) {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$id = $db->escape($id);
|
||||||
|
$sql = "SELECT bdid as idbd, nom, lien, user, port FROM llx_desal_external_bd WHERE bdid='$id'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
// Parcours des résultats avec fetch_array
|
||||||
|
$row = $db->fetch_array($resql);
|
||||||
|
// Accès aux colonnes via leur index ou alias
|
||||||
|
$list = ["idBD"=>htmlspecialchars($row['idbd']), "nomBD"=>htmlspecialchars($row["nom"]), "lienBD"=>htmlspecialchars($row["lien"]), "user"=>htmlspecialchars($row["user"]), "port"=>htmlspecialchars($row["port"])]; // Par alias (nom de la colonne)
|
||||||
|
// Affichage des résultats
|
||||||
|
} else {
|
||||||
|
// Gestion de l'erreur
|
||||||
|
echo "Erreur SQL : " . $db->lasterror();
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $nom nom de la bd
|
||||||
|
* @param string $lien url de la bd
|
||||||
|
* @param string $user utilisateur a utilisé
|
||||||
|
* @param int $port port de la bd
|
||||||
|
* @return bool renvoie si l'insertion fu effective
|
||||||
|
*/
|
||||||
|
public function insertionBD(string $nom, string $lien, string $user, int $port): bool {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$nom = $db->escape($nom); // pour protéger contre l'injection sql
|
||||||
|
$lien = $db->escape($lien); // pour protéger contre l'injection sql
|
||||||
|
$user = $db->escape($user); // pour protéger contre l'injection sql
|
||||||
|
$port = $db->escape($port); // pour protéger contre l'injection sql
|
||||||
|
$sql = "INSERT INTO llx_desal_external_bd(nom, lien, user, port) VALUES ('$nom','$lien', '$user', $port);";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) { return true; }
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $idBD id de la base de donnée
|
||||||
|
* @param string $nom nom de la bd
|
||||||
|
* @param string $lien url de la bd
|
||||||
|
* @param string $user utilisateur a utilisé
|
||||||
|
* @param int $port port de la bd
|
||||||
|
* @return bool renvoie si la modification a pu être faite
|
||||||
|
*/
|
||||||
|
public function modificationBD(int $idBD, string $nom, string $lien, string $user, int $port): bool{
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$idBD = $db->escape($idBD); // pour protéger contre l'injection sql
|
||||||
|
$nom = $db->escape($nom); // pour protéger contre l'injection sql
|
||||||
|
$lien = $db->escape($lien); // pour protéger contre l'injection sql
|
||||||
|
$user = $db->escape($user); // pour protéger contre l'injection sql
|
||||||
|
$port = $db->escape($port); // pour protéger contre l'injection sql
|
||||||
|
|
||||||
|
$sql = "UPDATE llx_desal_external_bd SET nom='$nom',lien='$lien',user='$user',port='$port' WHERE bdid='$idBD'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $idBD id de la base de donnée
|
||||||
|
* @return bool renvoie si la suppression a été effectuer
|
||||||
|
*/
|
||||||
|
public function suppressionBD(int $idBD): bool {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$idBD = $db->escape($idBD); // pour protéger contre l'injection sql
|
||||||
|
$sql = "DELETE FROM llx_desal_external_bd WHERE bdid = $idBD;";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) { return true; } return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $id int id de la base de donnée
|
||||||
|
* @return int renvoie le nombre de tables liées à cette base de donnée
|
||||||
|
*/
|
||||||
|
public function bdPossedeDesTables(int $id) : int {
|
||||||
|
global $db;
|
||||||
|
$res = 0;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$id = $db->escape($id); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT COUNT(tid) as nbrow FROM llx_desal_external_table WHERE bdid = $id;";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$row = $db->fetch_array($resql);
|
||||||
|
$res = $row["nbrow"];
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
}
|
||||||
255
classe/GestionBD/ligneGestion.php
Normal file
255
classe/GestionBD/ligneGestion.php
Normal file
@ -0,0 +1,255 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\GestionBD;
|
||||||
|
|
||||||
|
class ligneGestion{
|
||||||
|
/**
|
||||||
|
* @param string $nomTable nom de la table d'agefodd
|
||||||
|
* @param int $tid id de la table
|
||||||
|
* @return array|false renvoie la liste des colonnes non liée présente dans la table ciblée d'agefodd, sans id_source et table_source car celle-ci sont généré par le code
|
||||||
|
*/
|
||||||
|
public function getListeLigneAgefodd(string $nomTable, int $tid) {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$nomTable = $db->escape($nomTable); // pour protéger contre l'injection sql
|
||||||
|
$list = [];
|
||||||
|
$sql = "SELECT column_name as 'NomLigne' FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_NAME = '$nomTable' AND column_name != 'id_source'
|
||||||
|
AND column_name != 'table_source' AND EXTRA != 'auto_increment';";
|
||||||
|
$resql1=$db->query($sql);
|
||||||
|
$listeFk = array_column(self::getListeFK($nomTable, $tid), "NomLigne") ?? [];
|
||||||
|
$listeLigneECorreler = array_column(self::getListeLigneCorreler($tid), "nomLigneA");
|
||||||
|
if ($resql1) {
|
||||||
|
while ($row = $db->fetch_array($resql1)) {
|
||||||
|
$rowid = htmlspecialchars($row['NomLigne']); // Par alias (nom de la colonne)
|
||||||
|
if(!in_array($rowid, $listeFk) && !in_array($rowid, $listeLigneECorreler)) $list[] = $rowid;
|
||||||
|
}
|
||||||
|
} else { return false; }
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $tid identifient de la table
|
||||||
|
* @return array renvoie la liste des lignes liées pour la table passée en paramètre
|
||||||
|
*/
|
||||||
|
public function getListeLigneCorreler(int $tid) : array{
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$tid = $db->escape($tid); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT rid, bdid, tid, nomligneexterne, nomligneagfodd FROM llx_desal_external_row WHERE tid = '$tid' ";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) { // Parcours des résultats avec fetch_array
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
$list[] = ["idBD"=>$row["bdid"], "idTable"=>$row["tid"],"idLigne"=>$row["rid"],"nomLigneE"=>$row["nomligneexterne"],"nomLigneA"=>$row["nomligneagfodd"]];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $rid id de la colonne
|
||||||
|
* @return array renvoie la ligne à partir de son id
|
||||||
|
*/
|
||||||
|
public function getLigneByPk(int $rid){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$rid = $db->escape($rid); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT rid, bdid, tid, nomligneexterne, nomligneagfodd FROM llx_desal_external_row WHERE rid = '$rid';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$row = $db->fetch_array($resql);
|
||||||
|
$list = ["idBD"=>$row["bdid"], "idTable"=>$row["tid"], "idLigne"=>$row["rid"],
|
||||||
|
"nomLigneE"=>$row["nomligneexterne"],"nomLigneA"=>$row["nomligneagfodd"]];
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $idTable id de la table
|
||||||
|
* @param string $ligneA nom de la colonne d'agefodd
|
||||||
|
* @return bool renvoie-la si la ligne est déjà liée dans cette table
|
||||||
|
*/
|
||||||
|
public function correlationEstDansTable(int $idTable, string $ligneA): bool{
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$ligneA = $db->escape($ligneA); $idTable = $db->escape($idTable); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT COUNT(*) as nb FROM llx_desal_external_row WHERE tid = $idTable AND nomLigneAgfodd = '$ligneA'";
|
||||||
|
$resql=$db->query($sql); $row = $db->fetch_array($resql); $nb = $row["nb"];
|
||||||
|
if ($nb == 0) return false; return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $tid id de la table
|
||||||
|
* @param int $bdid id de la base de donnée
|
||||||
|
* @param string $nomLigneA nom de la ligne d'agefodd
|
||||||
|
* @param string $nomLigneE nom de la ligne externe
|
||||||
|
* @return bool renvoie si l'insertion à fonctionner
|
||||||
|
*/
|
||||||
|
public function insertion(int $tid, int $bdid, string $nomLigneA, string $nomLigneE) : bool{
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$tid = $db->escape($tid); $bdid = $db->escape($bdid); // pour protéger contre l'injection sql
|
||||||
|
$nomLigneA = $db->escape($nomLigneA); $nomLigneE = $db->escape($nomLigneE); // pour protéger contre l'injection sql
|
||||||
|
$sql = "INSERT INTO llx_desal_external_row( bdid, tid, nomLigneExterne, nomLigneAgfodd )
|
||||||
|
VALUES ('$bdid','$tid','$nomLigneE','$nomLigneA')";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) return true;
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $tid id de la table
|
||||||
|
* @param int $bdid id de la bd
|
||||||
|
* @param string $nomLigneA nom de la ligne d'agefodd
|
||||||
|
* @param mixed $valueFixe la valeur fixe à lier avec la ligne d'agefodd
|
||||||
|
* @return bool renvoie si l'insertion a bien été éffectuer
|
||||||
|
*/
|
||||||
|
public function insertionValue(int $tid, int $bdid, string $nomLigneA, $valueFixe){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$tid = $db->escape($tid); $bdid = $db->escape($bdid); // pour protéger contre l'injection sql
|
||||||
|
$nomLigneA = $db->escape($nomLigneA); $valueFixe = $db->escape($valueFixe); // pour protéger contre l'injection sql
|
||||||
|
$sql = "INSERT INTO llx_desal_external_row( bdid, tid, valeurFixe, nomLigneAgfodd)
|
||||||
|
VALUES ('$bdid','$tid','$valueFixe','$nomLigneA')";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) return true; else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $rid id de la colonne
|
||||||
|
* @return bool renvoie la valeur de la suppression
|
||||||
|
*/
|
||||||
|
public function suppression(int $rid){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$rid = $db->escape($rid); // pour protéger contre l'injection sql
|
||||||
|
$sql = "DELETE FROM llx_desal_external_row WHERE rid='$rid';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) { return true; } return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $typeA type de la ligne d'agefodd
|
||||||
|
* @param string $typeE type de la ligne en correlation
|
||||||
|
* @return bool renvoie si les deux lignes sont corrélées
|
||||||
|
*/
|
||||||
|
public function sontCompatible(string $typeA, string $typeE) : bool {
|
||||||
|
$compatible_types = [
|
||||||
|
['int', 'bigint', 'smallint', 'mediumint', 'tinyint'],
|
||||||
|
['varchar', 'text', 'char'],
|
||||||
|
['decimal', 'float', 'double'],
|
||||||
|
['datetime', 'timestamp', 'date']
|
||||||
|
];
|
||||||
|
$super_type = ['varchar', 'text'];
|
||||||
|
$lien_plus_peux_moins = [['decimal', 'float', 'double'], ['int', 'bigint', 'smallint', 'mediumint', 'tinyint']];
|
||||||
|
if (in_array($typeA, $super_type)) return true;
|
||||||
|
if (in_array($typeA, $lien_plus_peux_moins[0]) && in_array($typeE, $lien_plus_peux_moins[1])) return true;
|
||||||
|
foreach ($compatible_types as $group) {
|
||||||
|
if (in_array($typeA, $group) && in_array($typeE, $group)) return true;
|
||||||
|
}return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $nomTable nom de la table
|
||||||
|
* @param string $nomLigne nom de la ligne
|
||||||
|
* @return string|null renvoie le type de la ligne
|
||||||
|
*/
|
||||||
|
public function getTypeLigne(string $nomTable, string $nomLigne) : ?string {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$nomTable = $db->escape($nomTable); $nomLigne = $db->escape($nomLigne);
|
||||||
|
$sql = "SELECT COLUMN_TYPE as 'colType'FROM INFORMATION_SCHEMA.COLUMNS
|
||||||
|
WHERE TABLE_NAME = '$nomTable' AND COLUMN_NAME = '$nomLigne';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) { while ( $row = $db->fetch_array($resql) ) { $liste = $row['colType']; } return $liste; }
|
||||||
|
else return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $tableA nom de la table d'agefodd
|
||||||
|
* @param int $tid id de la table
|
||||||
|
* @return array|false renvoie la liste des clefs primaires
|
||||||
|
*/
|
||||||
|
public function getListeFK(string $tableA, int $tid){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$tableA = $db->escape($tableA); // pour protéger contre l'injection sql
|
||||||
|
$tid = $db->escape($tid);
|
||||||
|
$sql = "SELECT COLUMN_NAME as 'NomLigne', REFERENCED_TABLE_NAME AS 'TableReference'
|
||||||
|
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
||||||
|
WHERE TABLE_NAME = '$tableA' AND REFERENCED_TABLE_NAME IS NOT NULL;";
|
||||||
|
$listeLigneECorreler = array_column(self::getListeLigneCorreler($tid), "nomLigneA");
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) { // Parcours des résultats avec fetch_array
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
if(!in_array($row['NomLigne'], $listeLigneECorreler))
|
||||||
|
$list[] = ["NomLigne"=>$row['NomLigne'], "TableReference"=>$row['TableReference']];
|
||||||
|
}
|
||||||
|
} else { return false; }return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $tableA nom table agefodd
|
||||||
|
* @param int $tid id de la table
|
||||||
|
* @return array|false renvoie la liste des clefs primaires corréler
|
||||||
|
*/
|
||||||
|
public function getListeFKCorreler(string $tableA, int $tid){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$tableA = $db->escape($tableA); // pour protéger contre l'injection sql
|
||||||
|
$tid = $db->escape($tid);
|
||||||
|
$sql = "SELECT COLUMN_NAME as 'NomLigne', REFERENCED_TABLE_NAME AS 'TableReference' FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = '$tableA' AND REFERENCED_TABLE_NAME IS NOT NULL;";
|
||||||
|
$listeLigneECorreler = array_column(self::getListeLigneCorreler($tid), "nomLigneA");
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {// Parcours des résultats avec fetch_array
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
if(in_array($row['NomLigne'], $listeLigneECorreler))$list[] = ["NomLigne"=>$row['NomLigne'], "TableReference"=>$row['TableReference']];
|
||||||
|
}
|
||||||
|
} else {return false;
|
||||||
|
}return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $tableA nom de la table d'agefodd
|
||||||
|
* @param int $tid id de la table
|
||||||
|
* @return bool renvoie si la table possède une clef primaire non corréler
|
||||||
|
*/
|
||||||
|
public function possedeFk(string $tableA, int $tid){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$tableA = $db->escape($tableA); // pour protéger contre l'injection sql
|
||||||
|
$tid = $db->escape($tid);
|
||||||
|
$sql = "SELECT COLUMN_NAME as 'NomLigne', REFERENCED_TABLE_NAME AS 'TableReference' FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE WHERE TABLE_NAME = '$tableA' AND REFERENCED_TABLE_NAME IS NOT NULL;";
|
||||||
|
$listeLigneECorreler = array_column(self::getListeLigneCorreler($tid), "nomLigneA");
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {// Parcours des résultats avec fetch_array
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
$list[] = ["NomLigne"=>$row['NomLigne'], "TableReference"=>$row['TableReference']];
|
||||||
|
}
|
||||||
|
} else { return false; }
|
||||||
|
return sizeof($list) > 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $table nom de la table
|
||||||
|
* @param string $clef nom de la clef
|
||||||
|
* @return false|string revoit la colonne de référence
|
||||||
|
*/
|
||||||
|
public function getClefReferente(string $table, string $clef) : string{
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$table = $db->escape($table); $clef = $db->escape($clef);
|
||||||
|
$sql = "SELECT REFERENCED_COLUMN_NAME AS 'fk'
|
||||||
|
FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
||||||
|
WHERE TABLE_NAME = '$table'
|
||||||
|
AND COLUMN_NAME = '$clef';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) { $clef = $db->fetch_array($resql)['fk'];
|
||||||
|
} else { return false; } return $clef;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
367
classe/GestionBD/tableGestion.php
Normal file
367
classe/GestionBD/tableGestion.php
Normal file
@ -0,0 +1,367 @@
|
|||||||
|
<?php
|
||||||
|
namespace Module\Agefoddx\Classe\GestionBD;
|
||||||
|
use Module\Agefoddx\Classe\Classe\GestionTexte;
|
||||||
|
|
||||||
|
class tableGestion {
|
||||||
|
/**
|
||||||
|
* @return array|false return la liste des noms tables présentes dans agefodd ou faux en cas d'erreur sql
|
||||||
|
*/
|
||||||
|
public function getListeTableAgefodd() { // function de récupération des données dans Agefodd
|
||||||
|
global $db;
|
||||||
|
$resql = $db->query("SELECT DATABASE()");
|
||||||
|
$adresse = $db->fetch_array($resql)[0];
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$sql = "SELECT table_name as 'NomTable' FROM information_schema.tables WHERE table_schema = '$adresse' AND table_name LIKE 'llx_agefodd_%';";
|
||||||
|
$resql1=$db->query($sql);
|
||||||
|
if ($resql1) {
|
||||||
|
// Parcours des résultats avec fetch_array
|
||||||
|
while ($row = $db->fetch_array($resql1)) {
|
||||||
|
// Accès aux colonnes via leur index ou alias
|
||||||
|
$rowid = htmlspecialchars($row['NomTable']); // Par alias (nom de la colonne)
|
||||||
|
$list[] = $rowid;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
} return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $id int identifient de la table à récupérer
|
||||||
|
* @return array|false renvoie la liste des infos de la table sous forme de dictionnaire (idTable, idBD, nomTableAgefodd, nomTableExterne)
|
||||||
|
*/
|
||||||
|
public function getTableByPk(int $id){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$id = $db->escape($id); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT tid, bdid, nomTableExterne, nomTableAgfodd FROM llx_desal_external_table WHERE tid=$id;";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
// Parcours des résultats avec fetch_array
|
||||||
|
$row = $db->fetch_array($resql);
|
||||||
|
$list = ['idTable'=>$row["tid"], "idBD"=>$row["bdid"],"nomTableExterne"=>$row["nomTableExterne"],"nomTableAgefodd"=>$row["nomTableAgfodd"]]; // Par alias (nom de la colonne)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
// Gestion de l'erreur
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $idBD id de la base de donnée
|
||||||
|
* @return array|false renvoie la liste des tables a lié
|
||||||
|
*/
|
||||||
|
public function getListeTableCorreler(int $idBD) {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$idBD = $db->escape($idBD);
|
||||||
|
$sql = "SELECT bd.bdid as bdid, bd.nom as nom, t.tid as tid, t.nomTableExterne as te, t.nomTableAgfodd as ta, COUNT(rid) as nbr
|
||||||
|
FROM llx_desal_external_bd bd JOIN llx_desal_external_table t ON bd.bdid = t.bdid
|
||||||
|
LEFT JOIN llx_desal_external_row r ON r.tid = t.tid
|
||||||
|
WHERE bd.bdid = $idBD
|
||||||
|
GROUP BY bd.bdid, bd.nom, t.tid, t.nomTableExterne, t.nomTableAgfodd
|
||||||
|
ORDER BY bd.bdid, t.tid, bd.nom";
|
||||||
|
$resql = $db->query($sql);
|
||||||
|
if ($resql) {// Parcours des résultats avec fetch_array
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
// Accès aux colonnes via leur index ou alias
|
||||||
|
$row = ["idBD" => htmlspecialchars($row["bdid"]), "nom"=>htmlspecialchars($row["nomBD"]), "idTable"=>htmlspecialchars($row["tid"]), "nomTableExterne"=>htmlspecialchars($row["te"]), "nomTableAgfodd"=>htmlspecialchars($row["ta"]), "nombreLigne"=>htmlspecialchars($row["nbr"])]; // Par alias (nom de la colonne)
|
||||||
|
// Affichage des résultats
|
||||||
|
$list[] = $row;
|
||||||
|
}} else {// Gestion de l'erreur
|
||||||
|
return false;
|
||||||
|
}return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int $idBD id de la base de donnée
|
||||||
|
* @param string $nomTableExterne nom de la table a lié
|
||||||
|
* @param string $nomTableAgefodd nom de la table d'Agefodd
|
||||||
|
* @return bool renvoie la valeur d'insertion dans la table
|
||||||
|
*/
|
||||||
|
public function insertionTable(int $idBD, string $nomTableExterne, string $nomTableAgefodd) : bool{
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$idBD = $db->escape($idBD); // pour protéger contre l'injection sql
|
||||||
|
$nomTableExterne = $db->escape($nomTableExterne);
|
||||||
|
$nomTableAgefodd = $db->escape($nomTableAgefodd);
|
||||||
|
$sql = "INSERT INTO llx_desal_external_table(bdid, nomTableExterne, nomTableAgfodd) VALUES ('$idBD', '$nomTableExterne', '$nomTableAgefodd');";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
return true;
|
||||||
|
} return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $idT int|string clef primaire de la table
|
||||||
|
* @return bool renvoie si la suppression a bien été efféctuer
|
||||||
|
*/
|
||||||
|
public function suppressionTable($idT) : bool {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$idT = $db->escape($idT); // pour protéger contre l'injection sql
|
||||||
|
$sql = "DELETE FROM llx_desal_external_table WHERE tid='$idT';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
return true;
|
||||||
|
}return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $tableA string nom de la table d'agefodd
|
||||||
|
* @param $tableE string nom de la table a lié
|
||||||
|
* @return bool|null renvoie si la table est déjà lié ou null en cas d'erreur sql
|
||||||
|
*/
|
||||||
|
public function tablesDejaEnregistrer(string $tableA, string $tableE) {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$sql = "SELECT COUNT(tid) as nbTable FROM llx_desal_external_table WHERE nomTableAgfodd = '$tableA' AND nomTableExterne = '$tableE'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$value = $db->fetch_array($resql)[0];
|
||||||
|
if ($value == 0) {
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $id string|int identifient de la table
|
||||||
|
* @return int return le nombre de lignes present dans llx_desal_external_row
|
||||||
|
*/
|
||||||
|
public function tablePossedeDesLignes($id) : int {
|
||||||
|
global $db;
|
||||||
|
$res = 0;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$id = $db->escape($id); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT COUNT(tid) as nbrow FROM llx_desal_external_row WHERE tid = $id;";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
$row = $db->fetch_array($resql);
|
||||||
|
$res = $row["nbrow"];
|
||||||
|
}
|
||||||
|
return $res;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $tableA string nom de la table d'agefodd
|
||||||
|
* @param $type_id string nom du type d'id
|
||||||
|
* @return void modifie la table pour y inséré id_source & table_source
|
||||||
|
*/
|
||||||
|
private function alterTableAjout(string $tableA, string $type_id) {
|
||||||
|
global $db;
|
||||||
|
$tableA = $db->escape($tableA); // pour protéger contre l'injection sql
|
||||||
|
$type_id = $db->escape($type_id);
|
||||||
|
if ($type_id == 'varchar') {$type_id=$type_id.'(255)';}
|
||||||
|
$sql = "ALTER TABLE $tableA ADD COLUMN id_source $type_id, ADD COLUMN table_source VARCHAR(255)";
|
||||||
|
$res = $db->query($sql);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $tableA string nom de la table d'agefodd
|
||||||
|
* @param $type_id string type de la clef primaire de $tableA (varchar, integer, ...)
|
||||||
|
* @return void modifie la table $tableA si cela n'a pas déjà été fait
|
||||||
|
*/
|
||||||
|
public function alterTableAvantPremiereInsertion(string $tableA, string $type_id) : void {
|
||||||
|
global $db;
|
||||||
|
$tableA = $db->escape($tableA); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT id_source FROM $tableA ;";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if (!$resql) $this->alterTableAjout($tableA, $type_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $nomTableA nom de la table d'agefodd
|
||||||
|
* @param string $nomTableE nom de la table à lier
|
||||||
|
* @return array|false return la liste des parameters obligatoire non rempli ou faux en cas d'erreur sql
|
||||||
|
*/
|
||||||
|
public function getParametreObligatoireNonRempli(string $nomTableA,string $nomTableE) {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$nomTableA = $db->escape($nomTableA);
|
||||||
|
$nomTableE = $db->escape($nomTableE);
|
||||||
|
$sql = "SELECT isc.COLUMN_NAME as 'cm', isc.IS_NULLABLE as 'value'
|
||||||
|
FROM INFORMATION_SCHEMA.COLUMNS isc
|
||||||
|
WHERE TABLE_NAME = '$nomTableA'
|
||||||
|
AND NOT EXISTS(
|
||||||
|
SELECT nomLigneAgfodd
|
||||||
|
FROM llx_desal_external_row as lder
|
||||||
|
JOIN llx_desal_external_table as ldet
|
||||||
|
ON lder.tid = ldet.tid
|
||||||
|
WHERE nomTableAgfodd = '$nomTableA'
|
||||||
|
AND nomTableExterne = '$nomTableE'
|
||||||
|
AND isc.COLUMN_NAME = nomLigneAgfodd
|
||||||
|
OR EXTRA = 'auto_increment'
|
||||||
|
);";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
if ($row["value"] == "NO") {
|
||||||
|
$list[] = ["nom"=>$row['cm'], "type"=>(new ligneGestion())->getTypeLigne($nomTableA, $row['cm'])];}
|
||||||
|
}
|
||||||
|
if (sizeof($list) == 0) return [];
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
else return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $idTable int|string identifiant de la table
|
||||||
|
* @return array|false return la liste des paramètres ou faux en cas d'erreur sql
|
||||||
|
*/
|
||||||
|
public function getParametreExterne($idTable){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$list = [];
|
||||||
|
$idTable = $db->escape($idTable); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT nomLigneExterne as 'nle', nomLigneAgfodd as 'nla', valeurFixe as 'vf' FROM llx_desal_external_row WHERE tid = $idTable;";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
// Parcours des résultats avec fetch_array
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
if ($row['vf']=="") $list[] = [$row["nla"]=>$row['nle'], "fixe"=>"false"];
|
||||||
|
else $list[] = [$row["nla"]=>$row['vf'], "fixe"=>"true"];
|
||||||
|
}
|
||||||
|
} else return false;
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $liste array liste des liaisons
|
||||||
|
* @param $tableE string nom de la table à lier
|
||||||
|
* @param $idTableE int|string identifient de la table à lier
|
||||||
|
* @param $tableA string nom de la table d'agefodd
|
||||||
|
* @param $type string type de la clef primaire
|
||||||
|
* @return string return le nombre d'insertions et le nombre d'erreurs sous format string
|
||||||
|
*/
|
||||||
|
public function importerTout(array $liste,string $tableE, $idTableE,string $tableA,string $type):string{
|
||||||
|
self::alterTableAvantPremiereInsertion($tableA, $type);
|
||||||
|
global $db, $langs;
|
||||||
|
$liste_clef = "";
|
||||||
|
$listeValeur = "";
|
||||||
|
$lien = "";
|
||||||
|
$enrg = 0;
|
||||||
|
$erreur = 0;
|
||||||
|
$idSource = "";
|
||||||
|
foreach ($liste as $item){
|
||||||
|
foreach (array_keys($item) as $clef){
|
||||||
|
$clef = $db->escape($clef);
|
||||||
|
$valeur = $db->escape($item[$clef]);
|
||||||
|
$liste_clef = $liste_clef .", ".$clef;
|
||||||
|
$listeValeur = $listeValeur .", '".$valeur."'";
|
||||||
|
if ($clef == "id_source") {$idSource = $valeur;}
|
||||||
|
}
|
||||||
|
$liste_clef = $liste_clef .", table_source";
|
||||||
|
$listeValeur = $listeValeur .", '".$tableE."'";
|
||||||
|
$liste_clef = substr($liste_clef, 1);
|
||||||
|
$listeValeur = substr($listeValeur, 1);
|
||||||
|
$value = self::importerUneLigne($tableA, $liste_clef, $listeValeur, $idSource, $tableE);
|
||||||
|
$liste_clef = "";
|
||||||
|
$listeValeur = "";
|
||||||
|
$lien = "";
|
||||||
|
if ($value) $enrg ++; else $erreur ++;
|
||||||
|
}
|
||||||
|
return GestionTexte::tronquerParentheses("$enrg ".$langs->trans("AgefoddxImporterTout"), $erreur);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $tableA string nom de la table en d'insertion
|
||||||
|
* @param $clef string|int nom de la colonne
|
||||||
|
* @param $valeur string valeur a inséré
|
||||||
|
* @param string $idSource
|
||||||
|
* @param string $tableE
|
||||||
|
* @return bool return si la ligne, c'est inséré
|
||||||
|
*/
|
||||||
|
private function importerUneLigne(string $tableA, $clef, string $valeur, string $idSource, string $tableE){
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$tableA = $db->escape($tableA); // pour protéger contre l'injection sql
|
||||||
|
$id = $this->estDansLaTable($tableA, $idSource, $tableE);
|
||||||
|
if ($id) {
|
||||||
|
$sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
||||||
|
WHERE TABLE_NAME = '$tableA' AND CONSTRAINT_NAME = 'PRIMARY';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
$nomId = $resql->fetch_array()["COLUMN_NAME"];
|
||||||
|
$sqlTemp = ["SET FOREIGN_KEY_CHECKS = 0;",
|
||||||
|
"DELETE FROM $tableA WHERE $nomId = '$id'",
|
||||||
|
"SET FOREIGN_KEY_CHECKS = 1;"];
|
||||||
|
foreach ($sqlTemp as $temp) { $resql=$db->query($temp);}
|
||||||
|
$sql = "INSERT INTO $tableA ($nomId, $clef) values ('$id', $valeur) ";
|
||||||
|
} else {$sql = "INSERT INTO $tableA ($clef) values ($valeur) ";}
|
||||||
|
//WHERE NOT EXISTS (SELECT 1 FROM $tableA WHERE $lien);";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) return true;
|
||||||
|
else {
|
||||||
|
echo "Erreur SQL : " . $db->lasterror().'</br>'; // affichage des erreurs SQL
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string $tableA
|
||||||
|
* @param string $id_source
|
||||||
|
* @param string $table_source
|
||||||
|
* @return string renvoie si un lien est déjà présent dans la table
|
||||||
|
*/
|
||||||
|
public function estDansLaTable(string $tableA, string $id_source, string $table_source) : string {
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$sql = "SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE
|
||||||
|
WHERE TABLE_NAME = '$tableA' AND CONSTRAINT_NAME = 'PRIMARY';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
$nomId = $resql->fetch_array()["COLUMN_NAME"];
|
||||||
|
$sql = "Select $nomId as id FROM $tableA WHERE id_source = '$id_source' AND table_source = '$table_source'";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
$resql = $resql->fetch_array()["id"];
|
||||||
|
if ($resql) return $resql;
|
||||||
|
else {//echo "Erreur SQL : " . $db->lasterror().'</br>'; // affichage des erreurs SQL
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $nomTableRef string nom de la table
|
||||||
|
* @param $fk string nom de la clef étrangère
|
||||||
|
* @return array|false return la liste des valeurs étrangères
|
||||||
|
*/
|
||||||
|
public function getTableConversionFK(string $nomTableRef, string $fk) {
|
||||||
|
global $db;
|
||||||
|
$list = [];
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$nomTableRef = $db->escape($nomTableRef); // pour protéger contre l'injection sql
|
||||||
|
$fk = $db->escape($fk); // pour protéger contre l'injection sql
|
||||||
|
$sql = "SELECT $fk as fk, id_source FROM $nomTableRef;";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) {
|
||||||
|
while ($row = $db->fetch_array($resql)) {
|
||||||
|
$list[] = [$row["id_source"]=>$row["fk"]];
|
||||||
|
}
|
||||||
|
}else return false;
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $tableA string nom de la table d'agefodd
|
||||||
|
* @param $tableE string nom de la table exterieur
|
||||||
|
* @return bool return si la suppression, c'est effectuée
|
||||||
|
*/
|
||||||
|
public function vider(string $tableA, string $tableE) {
|
||||||
|
return true;
|
||||||
|
global $db;
|
||||||
|
$db->query("SET NAMES 'utf8mb4'");
|
||||||
|
$tableA = $db->escape($tableA); // pour protéger contre l'injection sql
|
||||||
|
$tableE = $db->escape($tableE); // pour protéger contre l'injection sql
|
||||||
|
$sql = "DELETE FROM $tableA WHERE table_source = '$tableE';";
|
||||||
|
$resql=$db->query($sql);
|
||||||
|
if ($resql) { return true;
|
||||||
|
} else { return false; }
|
||||||
|
}
|
||||||
|
}
|
||||||
81
core/modules/modAgefoddx.class.php
Normal file
81
core/modules/modAgefoddx.class.php
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
require_once DOL_DOCUMENT_ROOT . "/core/modules/DolibarrModules.class.php";
|
||||||
|
|
||||||
|
class modAgefoddx extends DolibarrModules {
|
||||||
|
function __construct($db){
|
||||||
|
/** ** ** Base de la création de module dolibarr ** ** **/
|
||||||
|
global $langs; // Chargement des langues pour la traduction
|
||||||
|
$this->db = $db; // Chargement de la base de donnée
|
||||||
|
$langs->load('Agefoddx@Agefoddx'); // Chargement des informations pour la traduction dans template dolibarr
|
||||||
|
$this->numero = 340002; // numero unique pour l'identification du module
|
||||||
|
$this->editor_name = "Desal"; // nom du développeur ou de l'équipe de développement
|
||||||
|
$this->family = "Desal-Tools"; // lieu où le module est retrouvable
|
||||||
|
$this->name = preg_replace('/^mod/i', '', get_class($this)); // permet de récupérer le nom du module à partir du nom du fichier
|
||||||
|
$this->description = $langs->trans("AgefoddxDescription"); // description du module, permet une traduction grâce à la fonction traduction
|
||||||
|
$this->version = 1; // version actuelle du module
|
||||||
|
$this->const_name = 'MAIN_MODULE_'.strtoupper($this->name); // permet instantiation du module entent que module principal
|
||||||
|
$this->special = 2; // permet d'indiquer la position du module ?
|
||||||
|
$this->picto = 'Agefoddx.png@Agefoddx';
|
||||||
|
$this->module_parts = array ( // permet la gestion et l'execution des triggers et du js
|
||||||
|
'hooks'=>array(),
|
||||||
|
'js'=>array()
|
||||||
|
);
|
||||||
|
/** Création de répertoire dans la partie documentation **/
|
||||||
|
$this->dirs = array(); // Exemple de composent : "/templateDolibarr/temp"
|
||||||
|
$r = 0;
|
||||||
|
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
|
||||||
|
|
||||||
|
/** Gestion des dépendances et des modules obligatoires **/
|
||||||
|
$this->hidden = false;
|
||||||
|
$this->depends = array('modAgefodd'); // module obligatoire pour utilisation
|
||||||
|
$this->requireby = array(); // ne fonctionne plus ?
|
||||||
|
$this->conflictwith = array(); // liste des modules conflictuelle
|
||||||
|
$this->phpmin = array(7,0); // version minimum de php demander
|
||||||
|
$this->need_dolibarr_version = array(19,0,2); // version minimum de dolibarr demander
|
||||||
|
$this->langfiles = array($this->name.'@'.$this->name); // position du fichier de langue
|
||||||
|
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
|
||||||
|
|
||||||
|
$this->config_page_url = array("setup.php@".$this->name); // position du fichier de configuration
|
||||||
|
|
||||||
|
$this->const = array(); // liste des constantes pour l'utilisation de ce module
|
||||||
|
|
||||||
|
$tabArray = array(); // permet l'ajout d'onglet dans d'autre élément
|
||||||
|
$this->tabs = $tabArray;
|
||||||
|
|
||||||
|
$this->boxes = array(); // permet un affichage sur la page d'accueil
|
||||||
|
$r = 0;
|
||||||
|
|
||||||
|
/** ** ** Gestion des permissions ** ** **/
|
||||||
|
$this->rights = array();
|
||||||
|
$this->rights_class = $this->name;
|
||||||
|
$r=0;
|
||||||
|
|
||||||
|
/** ** ** ** ** ** ** ** ** ** ** ** ** **/
|
||||||
|
|
||||||
|
$this->menus = array();
|
||||||
|
global $dolibarr_main_url_root;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
function init($options=''){
|
||||||
|
global $conf, $langs;
|
||||||
|
$result = $this->_load_tables('/Agefoddx/sql/');
|
||||||
|
if ($result < 0) {
|
||||||
|
return -1; // Do not activate module if error 'not allowed' returned when loading module SQL queries (the _load_table run sql with run_sql with the error allowed parameter set to 'default')
|
||||||
|
}
|
||||||
|
$this->remove($options);
|
||||||
|
$sql = array();
|
||||||
|
return $this->_init($sql, $options);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @override
|
||||||
|
*/
|
||||||
|
function remove($options=''){
|
||||||
|
$sql = array();
|
||||||
|
return $this->_remove($sql, $options);
|
||||||
|
}
|
||||||
|
}
|
||||||
1
img/.htaccess
Normal file
1
img/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all granted
|
||||||
BIN
img/object_Agefoddx.png
Normal file
BIN
img/object_Agefoddx.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.1 KiB |
33
js/envoiePost.js
Normal file
33
js/envoiePost.js
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
/**
|
||||||
|
* @param data array liste de donnée
|
||||||
|
* @param url string url du controller frontal
|
||||||
|
* @param csrfToken string jeton de connexion dolibarr
|
||||||
|
* @do inject des formulaires invisible pour transmettre des données
|
||||||
|
*/
|
||||||
|
function envoyerPost(data, url, csrfToken) {
|
||||||
|
// Créer un formulaire
|
||||||
|
const form = document.createElement('form');
|
||||||
|
form.method = 'POST';
|
||||||
|
form.action = url;
|
||||||
|
|
||||||
|
// Ajouter chaque clé-valeur du tableau comme champ de formulaire
|
||||||
|
for (const [key, value] of Object.entries(data)) {
|
||||||
|
const input = document.createElement('input');
|
||||||
|
input.type = 'hidden';
|
||||||
|
input.name = key;
|
||||||
|
input.value = value;
|
||||||
|
form.appendChild(input);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ajouter le jeton CSRF au formulaire
|
||||||
|
const csrfInput = document.createElement('input');
|
||||||
|
csrfInput.type = 'hidden';
|
||||||
|
csrfInput.name = 'token';
|
||||||
|
csrfInput.value = csrfToken;
|
||||||
|
form.appendChild(csrfInput);
|
||||||
|
|
||||||
|
// Ajouter le formulaire au document, le soumettre et le supprimer
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
document.body.removeChild(form);
|
||||||
|
}
|
||||||
145
langs/en_EN/Agefoddx.lang
Normal file
145
langs/en_EN/Agefoddx.lang
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
# Dolibarr language file - en_EN - Agefoddx
|
||||||
|
CHARSET-UTF-8
|
||||||
|
## Generic
|
||||||
|
# Description
|
||||||
|
AgefoddxDescription = Agefoddx is a module designed to ensure compatibility between Agefodd and any other database.
|
||||||
|
# Setup Page
|
||||||
|
AgefoddxSetupTitre = Agefoddx DB settings
|
||||||
|
AgefoddxSetup = Agefoddx settings
|
||||||
|
AgefoddxSetupPage = Agefoddx settings page
|
||||||
|
# Info page
|
||||||
|
AgefoddxAbout = About Agefoddx
|
||||||
|
AgefoddxAboutIntro = The purpose of this module is to provide an easy way of linking a database to agefodd.
|
||||||
|
AgefoddxAboutP1 = If necessary, it is possible to modify the value of ‘llx_agefodd_’ in the ‘classeGestionBD\tableGestion’ folder. This value is used to restrict the Agefodd table.
|
||||||
|
AgefoddxAboutP2 = Before using Agefoddx, check that you have export rights for the target database.
|
||||||
|
|
||||||
|
|
||||||
|
## Database management
|
||||||
|
# DB list
|
||||||
|
AgefoddxListeBD = DB list
|
||||||
|
AgefoddxIdBD = DB Id
|
||||||
|
AgefoddxNomBD = BD name
|
||||||
|
AgefoddxListeTable = List of tables
|
||||||
|
AgefoddxAfficherListeTable = Table list display
|
||||||
|
AgefoddxParametresBD = Database settings
|
||||||
|
AgefoddxModifierBD = Modify DB
|
||||||
|
AgefoddxSupprimerBD = Delete DB
|
||||||
|
# Add DB
|
||||||
|
AgefoddxAjoutBD = Add DB
|
||||||
|
AgefoddxLienBD = Link
|
||||||
|
AgefoddxIdentifientBD = Login
|
||||||
|
AgefoddxPortBD = Port
|
||||||
|
AgefoddxMDP = Password
|
||||||
|
AgefoddxMentionMDP = The password is not saved, it is only used here to test the connection.
|
||||||
|
AgefoddxEnvoie = submit
|
||||||
|
# Edit DB
|
||||||
|
AgefoddxIdDansBD = id in DB
|
||||||
|
# Delete DB
|
||||||
|
AgefoddxSupprimer = Delete
|
||||||
|
AgefoddxTexteDeSuppression = Are you sure you want to permanently remove the link between
|
||||||
|
AgefoddxEt = and
|
||||||
|
AgefoddxOui = YES
|
||||||
|
AgefoddxNon = NO
|
||||||
|
|
||||||
|
|
||||||
|
## Table management
|
||||||
|
# Display Table List
|
||||||
|
AgefoddxIdTable = Id Table
|
||||||
|
AgefoddxNomTableExterne = Table to import
|
||||||
|
AgefoddxNomTableAgefodd = Agefodd equivalent
|
||||||
|
AgefoddxListeLigne = Lines list
|
||||||
|
AgefoddxAfficherListeLigne = display the list of lines
|
||||||
|
AgefoddxNBLigneTable = Number of linked lines
|
||||||
|
AgefoddxParametresTable = Table settings
|
||||||
|
AgefoddxImporterTable = Import table
|
||||||
|
AgefoddxSupprimerTable = Delete table
|
||||||
|
# Importer
|
||||||
|
AgefoddxImporter = Import
|
||||||
|
AgefoddxCLOAI = Columns must be linked before import
|
||||||
|
AgefoddxNom = Name
|
||||||
|
AgefoddxType = Type
|
||||||
|
AgefoddxAjouter = Add
|
||||||
|
Agefoddxajouter = add
|
||||||
|
# Add
|
||||||
|
AgefoddxAjouterTable = Add table
|
||||||
|
AgefoddxTable = Table
|
||||||
|
AgefoddxTableAjoutChoixOption = Select a table
|
||||||
|
|
||||||
|
|
||||||
|
## Line Management
|
||||||
|
# Display Line List
|
||||||
|
AgefoddxIdLigne = Line Id
|
||||||
|
AgefoddxNomLigneExterne = Line from
|
||||||
|
AgefoddxNomLigneAgefodd = equal in
|
||||||
|
AgefoddxParametresLigne = Line parameters
|
||||||
|
AgefoddxSupprimerLigne = delete line
|
||||||
|
AgefoddxValeurFixeItem = fixed value
|
||||||
|
# Add
|
||||||
|
AgefoddxLienColonne = Add a link to a
|
||||||
|
AgefoddxAjoutLienValFixe = Adding a link with a fixed value
|
||||||
|
AgefoddxLigne = Line
|
||||||
|
AgefoddxLigneAjoutChoixOption = Choose a line
|
||||||
|
AgefoddxValeurFixe = FixedValue
|
||||||
|
|
||||||
|
|
||||||
|
## Title and message DB management
|
||||||
|
# Management BD titles
|
||||||
|
AgefoddxAfficherListeBD = List of linked databases
|
||||||
|
AgefoddxAjouterBD = Add a new database
|
||||||
|
AgefoddxModifierBD = Modify
|
||||||
|
# Message DB management
|
||||||
|
AgefoddxInsertionTrueBD = Insert performed
|
||||||
|
AgefoddxInsertionFalseBD = Unsuccessful insertion
|
||||||
|
AgefoddxConnexionBDImp = Connection with the DB is not possible
|
||||||
|
AgefoddxModificationTrueBD = Modification completed
|
||||||
|
AgefoddxModificationFalseBD = Modification failed
|
||||||
|
AgefoddxTableExistante = Delete (DBName) cancel, because the DB has tables
|
||||||
|
AgefoddxSuppressionTrueBD = Delete (nameBD) perform
|
||||||
|
AgefoddxSuppressionFalseBD = Delete (nameBD) fail
|
||||||
|
AgefoddxSuppressionAnnulerBD = Delete (nameBD) cancel
|
||||||
|
|
||||||
|
## Title and message table management
|
||||||
|
# Management Table titles
|
||||||
|
AgefoddxAfficherListeTable = List of tables in (tableName)
|
||||||
|
AgefoddxAfficherListeTableError = no DB selected
|
||||||
|
AgefoddxConnexion = Connection
|
||||||
|
AgefoddxAjouterLien = Add a link between
|
||||||
|
AgefoddxSupprimerLienTable = Delete the link between
|
||||||
|
AgefoddxImporterDonnee = Importing data from
|
||||||
|
AgefoddxVers = to
|
||||||
|
# Message table management
|
||||||
|
AgefoddxMDPInc = Wrong password
|
||||||
|
AgefoddxTableDejaLiee = are already linked
|
||||||
|
AgefoddxInsertionTrueTable = Insert performed
|
||||||
|
AgefoddxInsertionFalseTable = Unsuccessful insertion
|
||||||
|
AgefoddxPBConnexion = problem when connecting
|
||||||
|
AgefoddxTableNonSelect = Please select the tables to be linked
|
||||||
|
AgefoddxSuppressionImpLigneLiee = Deleting the link between (E-name and A-name) is not possible, because lines are linked
|
||||||
|
AgefoddxSuppressionLienTrue = Remove the link between (A-name and E-name) perform
|
||||||
|
AgefoddxSuppressionLienFalse = Remove the link between (nameA and nameE) failed
|
||||||
|
AgefoddxSuppressionLienAnnuler = Remove the link between (A-name and E-name) undo
|
||||||
|
|
||||||
|
|
||||||
|
## Title and message line management
|
||||||
|
# Management Line titles
|
||||||
|
AgefoddxTitreAfficherListeColonne = List of columns linked between ($TableNameExternal and $TableNameAgefodd)
|
||||||
|
AgefoddxAjoutLienFK = Add a link to foreign keys
|
||||||
|
AgefoddxLienFK = Foreign key line
|
||||||
|
# Message line management
|
||||||
|
AgefoddxMessageLigneInsertionTrue = Insertion of the link between ($agefoddLigne and $bdExterneLigne) with success
|
||||||
|
AgefoddxMessageLigneInsertionFalse = Link insertion between ($agefoddLigne and $bdExterneLigne) to fail
|
||||||
|
AgefoddxMessageLigneInsertionInc = The types of ($agefoddLigne $typeA and $bdExterneLigne $typeE) are incompatible
|
||||||
|
AgefoddxEtDe = and
|
||||||
|
AgefoddxMessageLigneInsertionDejaLiee = The line ($agefoddLigne) is already linked
|
||||||
|
AgefoddxMessageLigneInsertionDoitChoisirVal = Please select a value for each field
|
||||||
|
AgefoddxEtLaVal = and the value
|
||||||
|
AgefoddxMessageErreurSaisie = An error has occurred, please try again.
|
||||||
|
AgefoddxTableFkLierFalse = Please first link the tables (tableA and tableB) before inserting the foreign key
|
||||||
|
|
||||||
|
## Managing messages from SQL managers
|
||||||
|
# TableGestion Management
|
||||||
|
AgefoddxImporterTout = lines import with success with (error) errors
|
||||||
|
|
||||||
|
|
||||||
|
AgefoddxLogoSource = Logo from
|
||||||
|
AgefoddxSmashicons = Server icons created by Smashicons - Flaticon
|
||||||
145
langs/es_Es/Agefoddx.lang
Normal file
145
langs/es_Es/Agefoddx.lang
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
# Archivo de idioma Dolibarr - es_ES - Agefoddx
|
||||||
|
CHARSET-UTF-8
|
||||||
|
## Genérico
|
||||||
|
# Descripción
|
||||||
|
AgefoddxDescription = Agefoddx es un módulo para asegurar la compatibilidad entre Agefodd y cualquier otra base de datos.
|
||||||
|
# Página de configuración
|
||||||
|
AgefoddxSetupTitre = Configuración de la base de datos Agefoddx
|
||||||
|
AgefoddxSetup = Configuración de Agefoddx
|
||||||
|
AgefoddxSetupPage = Página de configuración de Agefoddx
|
||||||
|
# Página de información
|
||||||
|
AgefoddxAbout = Acerca de Agefoddx
|
||||||
|
AgefoddxAboutIntro = El propósito de este módulo es proporcionar una manera fácil de vincular una base de datos a agefodd.
|
||||||
|
AgefoddxAboutP1 = Si es necesario, es posible modificar el valor de 'llx_agefodd_' en la carpeta «classe\GestionBD\tableGestion», es este valor el que permite la restricción a la tabla Agefodd.
|
||||||
|
AgefoddxAboutP2 = Antes de utilizar Agefoddx, compruebe que dispone de derechos de exportación en la base de datos de destino.
|
||||||
|
|
||||||
|
|
||||||
|
## DB Management
|
||||||
|
# DB list
|
||||||
|
AgefoddxListeBD = Lista de DB
|
||||||
|
AgefoddxIdBD = Id DB
|
||||||
|
AgefoddxNomBD = Nombre DB
|
||||||
|
AgefoddxListeTable = Lista de tablas
|
||||||
|
AgefoddxAfficherListeTable = Visualización de la lista de tablas
|
||||||
|
AgefoddxParametresBD = Configuración de la base de datos
|
||||||
|
AgefoddxModifierBD = Modificar DB
|
||||||
|
AgefoddxSupprimerBD = Borrar DB
|
||||||
|
# Añadir DB
|
||||||
|
AgefoddxAjoutBD = Añadir DB
|
||||||
|
AgefoddxLienBD = Enlazar
|
||||||
|
AgefoddxIdentifientBD = Identificar
|
||||||
|
AgefoddxPortBD = Puerto
|
||||||
|
AgefoddxMDP = Contraseña
|
||||||
|
AgefoddxMentionMDP = La contraseña no se guarda, sólo se utiliza aquí para probar la conexión.
|
||||||
|
AgefoddxEnvoie = enviar
|
||||||
|
# Modificación DB
|
||||||
|
AgefoddxIdDansBD = id en DB
|
||||||
|
# Borrar DB
|
||||||
|
AgefoddxSupprimer = Borrar
|
||||||
|
AgefoddxTexteDeSuppression = ¿Estás seguro de que quieres eliminar permanentemente el enlace entre
|
||||||
|
AgefoddxEt = y
|
||||||
|
AgefoddxEt = SÍ
|
||||||
|
AgefoddxNon = NO
|
||||||
|
|
||||||
|
|
||||||
|
## Gestionar Tabla
|
||||||
|
# Mostrar lista de tablas
|
||||||
|
AgefoddxIdTable = Id Tabla
|
||||||
|
AgefoddxNomTableExterne = Tabla a importar
|
||||||
|
AgefoddxNomTableAgefodd = Equivalente Agefodd
|
||||||
|
AgefoddxListeLigne = Lista de filas
|
||||||
|
AgefoddxAfficherListeLigne = mostrar la lista de filas
|
||||||
|
AgefoddxNBLigneTable = Número de filas enlazadas
|
||||||
|
AgefoddxParametresTable = Configuración de la tabla
|
||||||
|
AgefoddxImporterTable = Importar tabla
|
||||||
|
AgefoddxSupprimerTable = Borrar tabla
|
||||||
|
# Importar
|
||||||
|
AgefoddxImporter = Importar
|
||||||
|
AgefoddxCLOAI = Columnas que deben vincularse antes de la importación
|
||||||
|
AgefoddxNom = Nombre
|
||||||
|
AgefoddxType = Tipo
|
||||||
|
AgefoddxAjouter = Añadir
|
||||||
|
Agefoddxajouter = añadir
|
||||||
|
# Añadir
|
||||||
|
AgefoddxAjouterTable = Añadir Tabla
|
||||||
|
AgefoddxTable = Mesa
|
||||||
|
AgefoddxTableAjoutChoixOption = Elija una tabla
|
||||||
|
|
||||||
|
|
||||||
|
## Gestión de Líneas
|
||||||
|
# Visualizar Lista de Líneas
|
||||||
|
AgefoddxIdLigne = Id de línea
|
||||||
|
AgefoddxNomLigneExterne = Línea de
|
||||||
|
AgefoddxNomLigneAgefodd = equivalente en
|
||||||
|
AgefoddxParametresLigne = Parámetro de línea
|
||||||
|
AgefoddxSupprimerLigne = borrar línea
|
||||||
|
AgefoddxValeurFixeItem = valor fijo
|
||||||
|
# Añadir
|
||||||
|
AgefoddxLienColonne = Añadir un enlace con una columna de
|
||||||
|
AgefoddxAjoutLienValFixe = Añadir un enlace con un valor fijo
|
||||||
|
AgefoddxLigne = Línea
|
||||||
|
AgefoddxLigneAjoutChoixOption = Elija una línea
|
||||||
|
AgefoddxValeurFixe = ValorFijo
|
||||||
|
|
||||||
|
|
||||||
|
## Gestión de la DB de títulos y mensajes
|
||||||
|
# Título Gestión DB
|
||||||
|
AgefoddxAfficherListeBD = Lista de bases de datos vinculadas
|
||||||
|
AgefoddxAjouterBD = Añadir una nueva base de datos
|
||||||
|
AgefoddxModifierBD = Modificar
|
||||||
|
# Gestión de DB de mensajes
|
||||||
|
AgefoddxInsertionTrueBD = Inserción realizada
|
||||||
|
AgefoddxInsertionFalseBD = Inserción fallida
|
||||||
|
AgefoddxConnexionBDImp = No es posible la conexión con la base de datos
|
||||||
|
AgefoddxModificationTrueBD = Modificar
|
||||||
|
AgefoddxModificationFalseBD = Modificación fallida
|
||||||
|
AgefoddxTableExistante = Borrar (nombre DB) Cancelar, ya que la DB tiene tablas
|
||||||
|
AgefoddxSuppressionTrueBD = Suprimir (DBname) completo
|
||||||
|
AgefoddxSuppressionFalseBD = Borrado de (DBname) fallido
|
||||||
|
AgefoddxSuppressionAnnulerBD = Borrar (DBname) cancelar
|
||||||
|
|
||||||
|
## Gestión de las tablas de títulos y mensajes
|
||||||
|
# Gestión de tablas de títulos
|
||||||
|
AgefoddxAfficherListeTable = Lista de tablas en (tableName)
|
||||||
|
AgefoddxAfficherListeTableError = ninguna DB seleccionada
|
||||||
|
AgefoddxConnexion = Conexión
|
||||||
|
AgefoddxAjouterLien = Añadir un enlace entre
|
||||||
|
AgefoddxSupprimerLienTable = Eliminar enlace entre
|
||||||
|
AgefoddxImporterDonnee = Importar datos de
|
||||||
|
AgefoddxVers = a
|
||||||
|
# Gestión de la tabla de mensajes
|
||||||
|
AgefoddxMDPInc = contraseña incorrecta
|
||||||
|
AgefoddxTableDejaLiee = ya están vinculados
|
||||||
|
AgefoddxInsertionTrueTable = Inserción realizada
|
||||||
|
AgefoddxInsertionFalseTable = Inserción fallida
|
||||||
|
AgefoddxPBConnexion = problema durante la conexión
|
||||||
|
AgefoddxTableNonSelect = Por favor, seleccione las tablas a enlazar
|
||||||
|
AgefoddxSuppressionImpLigneLiee = Eliminación del enlace entre (nombreE y nombreA) imposible, porque las filas están enlazadas
|
||||||
|
AgefoddxSuppressionLienTrue = Eliminar enlace entre (nombreA y nombreE) realizar
|
||||||
|
AgefoddxSuppressionLienFalse = Eliminar enlace entre (nombreA y nombreE) fallar
|
||||||
|
AgefoddxSuppressionLienAnnuler = Eliminar enlace entre (nombreA y nombreE) cancelar
|
||||||
|
|
||||||
|
|
||||||
|
## Gestión de títulos y mensajes
|
||||||
|
## Gestión de la línea de título
|
||||||
|
AgefoddxTitreAfficherListeColonne = Lista de columnas vinculadas entre ($ExternalTableName y $AgefoddTableName)
|
||||||
|
AgefoddxAjoutLienFK = Añadir un enlace a claves foráneas
|
||||||
|
AgefoddxLienFK = Línea de claves foráneas
|
||||||
|
# Gestión de la línea de mensajes
|
||||||
|
AgefoddxMessageLigneInsertionTrue = Inserción del enlace entre ($agefoddLigne y $DBExterneLigne) con éxito
|
||||||
|
AgefoddxMessageLigneInsertionFalse = Inserción del enlace entre ($agefoddLigne y $DBExterneLigne) con fallo
|
||||||
|
AgefoddxMessageLigneInsertionInc = Los tipos de ($agefoddLigne $tipoA y $DBExterneLigne $tipoE) son incompatibles
|
||||||
|
AgefoddxEtDe = y
|
||||||
|
AgefoddxMessageLigneInsertionDejaLiee = La línea ($agefoddLigne) ya está vinculada
|
||||||
|
AgefoddxMessageLigneInsertionDoitChoisirVal = Por favor, seleccione un valor para cada uno de los campos
|
||||||
|
AgefoddxEtLaVal = y el valor
|
||||||
|
AgefoddxMessageErreurSaisie = Se ha producido un error, inténtelo de nuevo
|
||||||
|
AgefoddxTableFkLierFalse = Por favor, primero vincule las tablas (tablaA y tablaB) antes de insertar la clave foránea
|
||||||
|
|
||||||
|
## Gestión de mensajes de gestores SQL
|
||||||
|
# Gestión de TableManagement
|
||||||
|
AgefoddxImporterTout = líneas importar con éxito con (error) errores
|
||||||
|
|
||||||
|
|
||||||
|
AgefoddxLogoSource = Logotipo de
|
||||||
|
AgefoddxSmashicons = Iconos de servidor creados por Smashicons - Flaticon
|
||||||
145
langs/fr_FR/Agefoddx.lang
Normal file
145
langs/fr_FR/Agefoddx.lang
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
# Dolibarr language file - fr_FR - Agefoddx
|
||||||
|
CHARSET-UTF-8
|
||||||
|
## Générique
|
||||||
|
# Description
|
||||||
|
AgefoddxDescription = Agefoddx est un module ayant pour objectif une compatibilité entre Agefodd et toute autre base de donnée
|
||||||
|
# Setup Page
|
||||||
|
AgefoddxSetupTitre = Paramétrage BD de Agefoddx
|
||||||
|
AgefoddxSetup = Paramétrage Agefoddx
|
||||||
|
AgefoddxSetupPage = Page de paramétrage pour Agefoddx
|
||||||
|
# Page d'info
|
||||||
|
AgefoddxAbout = A propos de Agefoddx
|
||||||
|
AgefoddxAboutIntro = Ce module a pour objectif de mettre en place un moyen facile de lier une base de donnée à agefodd
|
||||||
|
AgefoddxAboutP1 = En cas de besoins, il est possible de modifiée la valeur de 'llx_agefodd_' dans le dossier "classe\GestionBD\tableGestion", c'est cette valeur qui permet la restriction au table de Agefodd
|
||||||
|
AgefoddxAboutP2 = Avant d'utiliser Agefoddx, vérifiez que vous disposez des droits d'exportation sur la base de données cible.
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion BD
|
||||||
|
# Liste BD
|
||||||
|
AgefoddxListeBD = Liste BD
|
||||||
|
AgefoddxIdBD = Id BD
|
||||||
|
AgefoddxNomBD = Nom BD
|
||||||
|
AgefoddxListeTable = Liste des tables
|
||||||
|
AgefoddxAfficherListeTable = Affichage liste des tables
|
||||||
|
AgefoddxParametresBD = Paramétrage de la base de donnée
|
||||||
|
AgefoddxModifierBD = Modifier BD
|
||||||
|
AgefoddxSupprimerBD = Supprimer BD
|
||||||
|
# Ajout BD
|
||||||
|
AgefoddxAjoutBD = Ajout BD
|
||||||
|
AgefoddxLienBD = Lien
|
||||||
|
AgefoddxIdentifientBD = Identifient
|
||||||
|
AgefoddxPortBD = Port
|
||||||
|
AgefoddxMDP = Mot de passe
|
||||||
|
AgefoddxMentionMDP = Le mot de passe n'est pas enregister, il sert ici seulement à tester la connection
|
||||||
|
AgefoddxEnvoie = envoie
|
||||||
|
# Modification BD
|
||||||
|
AgefoddxIdDansBD = id dans BD
|
||||||
|
# Supprimer BD
|
||||||
|
AgefoddxSupprimer = Supprimer
|
||||||
|
AgefoddxTexteDeSuppression = Êtes-vous bien sûr de vouloir définitivement supprimer le lien entre
|
||||||
|
AgefoddxEt = et
|
||||||
|
AgefoddxOui = OUI
|
||||||
|
AgefoddxNon = NON
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion Table
|
||||||
|
# Afficher Liste Table
|
||||||
|
AgefoddxIdTable = Id Table
|
||||||
|
AgefoddxNomTableExterne = Table a importer
|
||||||
|
AgefoddxNomTableAgefodd = équivalent Agefodd
|
||||||
|
AgefoddxListeLigne = Liste lignes
|
||||||
|
AgefoddxAfficherListeLigne = afficher la liste des lignes
|
||||||
|
AgefoddxNBLigneTable = Nombre de lignes liée
|
||||||
|
AgefoddxParametresTable = Paramétrage de la table
|
||||||
|
AgefoddxImporterTable = Importer la table
|
||||||
|
AgefoddxSupprimerTable = Supprimer la table
|
||||||
|
# Importer
|
||||||
|
AgefoddxImporter = Importer
|
||||||
|
AgefoddxCLOAI = Colonnes a lié obligatoirement avant importation
|
||||||
|
AgefoddxNom = Nom
|
||||||
|
AgefoddxType = Type
|
||||||
|
AgefoddxAjouter = Ajouter
|
||||||
|
Agefoddxajouter = ajouter
|
||||||
|
# Ajouter
|
||||||
|
AgefoddxAjouterTable = Ajouter Table
|
||||||
|
AgefoddxTable = Table
|
||||||
|
AgefoddxTableAjoutChoixOption = Choisissez une table
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion Ligne
|
||||||
|
# Afficher Liste Ligne
|
||||||
|
AgefoddxIdLigne = Id ligne
|
||||||
|
AgefoddxNomLigneExterne = Ligne de
|
||||||
|
AgefoddxNomLigneAgefodd = équivalent dans
|
||||||
|
AgefoddxParametresLigne = Paramètre des lignes
|
||||||
|
AgefoddxSupprimerLigne = supprimer ligne
|
||||||
|
AgefoddxValeurFixeItem = valeur fixe
|
||||||
|
# Ajouter
|
||||||
|
AgefoddxLienColonne = Ajout d'un lien avec une colonne de
|
||||||
|
AgefoddxAjoutLienValFixe = Ajout d'un lien avec valeur fixe
|
||||||
|
AgefoddxLigne = Ligne
|
||||||
|
AgefoddxLigneAjoutChoixOption = Choisissez une ligne
|
||||||
|
AgefoddxValeurFixe = ValeurFixe
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion BD titres et messages
|
||||||
|
# Gestion BD titres
|
||||||
|
AgefoddxAfficherListeBD = Liste des bases de données liée
|
||||||
|
AgefoddxAjouterBD = Ajouter une nouvelle base de donnée
|
||||||
|
AgefoddxModifierBD = Modifier
|
||||||
|
# Gestion BD messages
|
||||||
|
AgefoddxInsertionTrueBD = Insertion effectuer
|
||||||
|
AgefoddxInsertionFalseBD = Echec de l'insertion
|
||||||
|
AgefoddxConnexionBDImp = La connexion avec la bd n'est pas possible
|
||||||
|
AgefoddxModificationTrueBD = Modification effectuer
|
||||||
|
AgefoddxModificationFalseBD = Echec de la modification
|
||||||
|
AgefoddxTableExistante = Suppression de (nomBD) annuler, car la BD possède des tables
|
||||||
|
AgefoddxSuppressionTrueBD = Suppression de (nomBD) effectuer
|
||||||
|
AgefoddxSuppressionFalseBD = Suppression de (nomBD) à échouer
|
||||||
|
AgefoddxSuppressionAnnulerBD = Suppression de (nomBD) annuler
|
||||||
|
|
||||||
|
## Gestion Table titres et messages
|
||||||
|
# Gestion Table titres
|
||||||
|
AgefoddxAfficherListeTable = Liste des tables de (nomTable)
|
||||||
|
AgefoddxAfficherListeTableError = aucune BD sélectionnée
|
||||||
|
AgefoddxConnexion = Connexion
|
||||||
|
AgefoddxAjouterLien = Ajouter un lien entre
|
||||||
|
AgefoddxSupprimerLienTable = Supprimer le lien entre
|
||||||
|
AgefoddxImporterDonnee = Importation des données de
|
||||||
|
AgefoddxVers = vers
|
||||||
|
# Gestion Table messages
|
||||||
|
AgefoddxMDPInc = mot de passe incorrecte
|
||||||
|
AgefoddxTableDejaLiee = sont déjà liée
|
||||||
|
AgefoddxInsertionTrueTable = Insertion effectuer
|
||||||
|
AgefoddxInsertionFalseTable = Echec de l'insertion
|
||||||
|
AgefoddxPBConnexion = problème lors de la connexion
|
||||||
|
AgefoddxTableNonSelect = Veuillez choisir les tables à lié
|
||||||
|
AgefoddxSuppressionImpLigneLiee = Suppression du lien entre (nomE et nomA) impossible, car des lignes sont liée
|
||||||
|
AgefoddxSuppressionLienTrue = Suppression du lien entre (nomA et nomE) effectuer
|
||||||
|
AgefoddxSuppressionLienFalse = Suppression du lien entre (nomA et nomE) à échouer
|
||||||
|
AgefoddxSuppressionLienAnnuler = Suppression du lien entre (nomA et nomE) annuler
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion Ligne titres et messages
|
||||||
|
# Gestion Ligne titres
|
||||||
|
AgefoddxTitreAfficherListeColonne = Liste des colonnes liées entre ($nomTableExterne et $nomTableAgefodd)
|
||||||
|
AgefoddxAjoutLienFK = Ajout d'un lien sur les clefs étrangère
|
||||||
|
AgefoddxLienFK = Ligne clef étrangère
|
||||||
|
# Gestion Ligne messages
|
||||||
|
AgefoddxMessageLigneInsertionTrue = Insertion du lien entre ($agefoddLigne et $bdExterneLigne) avec success
|
||||||
|
AgefoddxMessageLigneInsertionFalse = Insertion du lien entre ($agefoddLigne et $bdExterneLigne) à échouer
|
||||||
|
AgefoddxMessageLigneInsertionInc = Les types de ($agefoddLigne $typeA et de $bdExterneLigne $typeE) sont incompatible
|
||||||
|
AgefoddxEtDe = et de
|
||||||
|
AgefoddxMessageLigneInsertionDejaLiee = La ligne ($agefoddLigne) est déjà liée
|
||||||
|
AgefoddxMessageLigneInsertionDoitChoisirVal = Veuillez sélectionner une valeur pour chacun des champs
|
||||||
|
AgefoddxEtLaVal = et la valeur
|
||||||
|
AgefoddxMessageErreurSaisie = Une erreur est survenue veuillez retenter la saisie
|
||||||
|
AgefoddxTableFkLierFalse = Veuillez d'abord liée les tables (tableA et tableB) avant l'insertion de la clef etrangère
|
||||||
|
|
||||||
|
## Gestion des messages depuis les gestionaires SQL
|
||||||
|
# TableGestion Gestion
|
||||||
|
AgefoddxImporterTout = lignes importer avec success avec (erreur) erreurs
|
||||||
|
|
||||||
|
|
||||||
|
AgefoddxLogoSource = Logo en provenance de
|
||||||
|
AgefoddxSmashicons = Serveur icônes créées par Smashicons - Flaticon
|
||||||
145
langs/oc_OC/Agefoddx.lang
Normal file
145
langs/oc_OC/Agefoddx.lang
Normal file
@ -0,0 +1,145 @@
|
|||||||
|
# Dolibarr language que fila - oc_OC - Agefoddx
|
||||||
|
CHARSET-UTF-8
|
||||||
|
## Generica
|
||||||
|
# Descripcion
|
||||||
|
AgefoddxDescription = Agefoddx qu'ei un module avent entà objectiu ua compatibilitat enter Agefodd e tota auta basa de dada
|
||||||
|
# Setup Page
|
||||||
|
AgefoddxSetupTitre = Paramétrage BD d'Agefoddx
|
||||||
|
AgefoddxSetup = Paramétrage Agefoddx
|
||||||
|
AgefoddxSetupPage = Page de paramétrage entà Agefoddx
|
||||||
|
# Page d'informacion
|
||||||
|
AgefoddxAbout = A perpaus d'Agefoddx
|
||||||
|
AgefoddxAboutIntro = Aqueth module qu'a entà objectiu de méter en plaça un mejan facile de ligar ua basa de dada a agefodd
|
||||||
|
AgefoddxAboutP1 = En cas de besonhs, qu'ei possible de modificada la valor de 'llx_agefodd_' dens lo dossièr "que classa\GestionBD\tableGestion", qu'ei aquera valor qui permet la restriccion au taula d'Agefodd
|
||||||
|
AgefoddxAboutP2 = Abans d'utilizar Agefoddx, que verificatz que dispausatz drets d'exportacion sus la basa de dadas cibla.
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion BD
|
||||||
|
# Lista BD
|
||||||
|
AgefoddxListeBD = Que lista BD
|
||||||
|
AgefoddxIdBD = Id BD
|
||||||
|
AgefoddxNomBD = Nom BD
|
||||||
|
AgefoddxListeTable = Que lista taulas
|
||||||
|
AgefoddxAfficherListeTable = Afichatge lista de las taulas
|
||||||
|
AgefoddxParametresBD = Paramétrage de la basa de dada
|
||||||
|
AgefoddxModifierBD = Modificar BD
|
||||||
|
AgefoddxSupprimerBD = Suprimir BD
|
||||||
|
# Ajustèr BD
|
||||||
|
AgefoddxAjoutBD = Ajustèr BD
|
||||||
|
AgefoddxLienBD = Ligam
|
||||||
|
AgefoddxIdentifientBD = Qu'identifican
|
||||||
|
AgefoddxPortBD = Pòrt
|
||||||
|
AgefoddxMDP = Mot de passa
|
||||||
|
AgefoddxMentionMDP = Lo mot de passa n'ei pas enregister, que sèrv ací solament a testar la connection
|
||||||
|
AgefoddxEnvoie = qu'envia
|
||||||
|
# Modificacion BD
|
||||||
|
AgefoddxIdDansBD = id dens BD
|
||||||
|
# Suprimir BD
|
||||||
|
AgefoddxSupprimer = Suprimir
|
||||||
|
AgefoddxTexteDeSuppression = Qu'Ètz segur de voler definitivament suprimir lo ligam enter
|
||||||
|
AgefoddxEt = e
|
||||||
|
AgefoddxOui = QUIÒ
|
||||||
|
AgefoddxNon = NON
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion Taula
|
||||||
|
# Afichar Lista Taula
|
||||||
|
AgefoddxIdTable = Id Que compta
|
||||||
|
AgefoddxNomTableExterne = Taula qu'a importar
|
||||||
|
AgefoddxNomTableAgefodd = equivalent Agefodd
|
||||||
|
AgefoddxListeLigne = Que lista linhas
|
||||||
|
AgefoddxAfficherListeLigne = afichar la lista de las linhas
|
||||||
|
AgefoddxNBLigneTable = Nombre de linhas ligada
|
||||||
|
AgefoddxParametresTable = Paramétrage de la taula
|
||||||
|
AgefoddxImporterTable = Importar la taula
|
||||||
|
AgefoddxSupprimerTable = Suprimir la taula
|
||||||
|
# Importar
|
||||||
|
AgefoddxImporter = Importar
|
||||||
|
AgefoddxCLOAI = Colomnas qu'a ligat obligatòriament abans importacion
|
||||||
|
AgefoddxNom = Nom
|
||||||
|
AgefoddxType = Que caracteriza
|
||||||
|
AgefoddxAjouter = Ajustar
|
||||||
|
Agefoddxajouter = ajustar
|
||||||
|
# Ajustar
|
||||||
|
AgefoddxAjouterTable = Ajustar Taula
|
||||||
|
AgefoddxTable = Que compta
|
||||||
|
AgefoddxTableAjoutChoixOption = Que causeishetz ua taula
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion Linha
|
||||||
|
# Afichar Lista Linha
|
||||||
|
AgefoddxIdLigne = Id linha
|
||||||
|
AgefoddxNomLigneExterne = Linha d'AgefoddxNomLigneAgefodd
|
||||||
|
= equivalent dens
|
||||||
|
AgefoddxParametresLigne = Paramètre de las linhas
|
||||||
|
AgefoddxSupprimerLigne = suprimir linha
|
||||||
|
AgefoddxValeurFixeItem = valor fixa
|
||||||
|
# Ajustar
|
||||||
|
AgefoddxLienColonne = Ajustèr d'un ligam dab ua colomna d'AgefoddxAjoutLienValFixe
|
||||||
|
= Ajustèr d'un ligam dab valor fixa
|
||||||
|
AgefoddxLigne = Linha
|
||||||
|
AgefoddxLigneAjoutChoixOption = Que
|
||||||
|
causeishetz = ua linha AgefoddxValeurFixe ValeurFixe
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion BD títols e messatges
|
||||||
|
# Gestion BD títols
|
||||||
|
AgefoddxAfficherListeBD = Que lista basas de dadas ligada
|
||||||
|
AgefoddxAjouterBD = Ajustar ua basa navèra de dada
|
||||||
|
AgefoddxModifierBD = Modificar
|
||||||
|
# Gestion BD messatges
|
||||||
|
AgefoddxInsertionTrueBD = Insercion efectuar
|
||||||
|
AgefoddxInsertionFalseBD = Mauescaduda de l'insercion
|
||||||
|
AgefoddxConnexionBDImp = La connexion dab la bd n'ei pas possibla
|
||||||
|
AgefoddxModificationTrueBD = Modificacion efectuar
|
||||||
|
AgefoddxModificationFalseBD = Mauescaduda de la modificacion
|
||||||
|
AgefoddxTableExistante = Supression de (nomBD) anullar, pr'amor que la BD possedeish taulas
|
||||||
|
AgefoddxSuppressionTrueBD = Supression de (nomBD) efectuar
|
||||||
|
AgefoddxSuppressionFalseBD = Supression de (nomBD) a s'i mauescàder
|
||||||
|
AgefoddxSuppressionAnnulerBD = Supression de (nomBD) anullar
|
||||||
|
|
||||||
|
## Gestion Taula títols e messatges
|
||||||
|
# Gestion Taula títols
|
||||||
|
AgefoddxAfficherListeTable = Que lista taulas de (nomTable)
|
||||||
|
AgefoddxAfficherListeTableError = nada BD seleccionada
|
||||||
|
AgefoddxConnexion = Connexion
|
||||||
|
AgefoddxAjouterLien = Ajustar un ligam enter
|
||||||
|
AgefoddxSupprimerLienTable = Suprimir lo ligam enter
|
||||||
|
AgefoddxImporterDonnee = Importacion de las dadas d'AgefoddxVers
|
||||||
|
= cap a
|
||||||
|
# Gestion Taula messatges
|
||||||
|
AgefoddxMDPInc = mot de passa incorrècta
|
||||||
|
AgefoddxTableDejaLiee = que son dejà ligada
|
||||||
|
AgefoddxInsertionTrueTable = Insercion efectuar
|
||||||
|
AgefoddxInsertionFalseTable = Mauescaduda de l'insercion
|
||||||
|
AgefoddxPBConnexion = problèma pendent la connexion
|
||||||
|
AgefoddxTableNonSelect = Volhatz causir las taulas a ligat
|
||||||
|
AgefoddxSuppressionImpLigneLiee = Supression deu ligam enter (nomE e nomA) impossible, pr'amor que linhas son ligada
|
||||||
|
AgefoddxSuppressionLienTrue = Supression deu ligam enter (nomA e nomE) efectuar
|
||||||
|
AgefoddxSuppressionLienFalse = Supression deu ligam enter (nomA e nomE) a s'i mauescàder
|
||||||
|
AgefoddxSuppressionLienAnnuler = Supression deu ligam enter (nomA e nomE) anullar
|
||||||
|
|
||||||
|
|
||||||
|
## Gestion Linha títols e messatges
|
||||||
|
# Gestion Linha títols
|
||||||
|
AgefoddxTitreAfficherListeColonne = Que lista colomnas ligadas enter ($nomTableExterne e $nomTableAgefodd)
|
||||||
|
AgefoddxAjoutLienFK = Ajustèr d'un ligam suus claus estrangèra
|
||||||
|
AgefoddxLienFK = Linha clau estrangèra
|
||||||
|
# Gestion Linha messatges
|
||||||
|
AgefoddxMessageLigneInsertionTrue = Insercion deu ligam enter ($agefoddLigne e $bdExterneLigne) dab success
|
||||||
|
AgefoddxMessageLigneInsertionFalse = Insercion deu ligam enter ($agefoddLigne e $bdExterneLigne) a s'i mauescàder
|
||||||
|
AgefoddxMessageLigneInsertionInc = Los tipes de ($agefoddLigne $typeA e de $bdExterneLigne $typeE) que son incompatible
|
||||||
|
AgefoddxEtDe = e d'AgefoddxMessageLigneInsertionDejaLiee
|
||||||
|
= La linha ($agefoddLigne) qu'ei dejà ligada
|
||||||
|
AgefoddxMessageLigneInsertionDoitChoisirVal = Volhatz seleccionar ua valor entà cadun deus camps
|
||||||
|
AgefoddxEtLaVal = e la valor
|
||||||
|
AgefoddxMessageErreurSaisie = Ua error qu'ei arribada volhatz tornar ensajar la sasida
|
||||||
|
AgefoddxTableFkLierFalse = Volhatz purmèr ligada las taulas (tableA e tableB) abans l'insercion de la clau etrangère
|
||||||
|
|
||||||
|
## Gestion deus messatges despuish los gestionaires SQL
|
||||||
|
# TableGestion Gestion
|
||||||
|
AgefoddxImporterTout = linhas importar dab success dab (error) errors
|
||||||
|
|
||||||
|
|
||||||
|
AgefoddxLogoSource = Logo en provenença de
|
||||||
|
AgefoddxSmashicons = Servidor icònas creadas per Smashicons - Flaticon
|
||||||
1
lib/.htaccess
Normal file
1
lib/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
75
lib/Agefoddx.lib.php
Normal file
75
lib/Agefoddx.lib.php
Normal file
@ -0,0 +1,75 @@
|
|||||||
|
<?php
|
||||||
|
/* Copyright (C) 2025 SuperAdmin
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \file temp/lib/temp.lib.php
|
||||||
|
* \ingroup temp
|
||||||
|
* \brief Library files with common functions for Temp
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prepare admin pages header
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
function AgefoddxAdminPrepareHead() {
|
||||||
|
global $langs, $conf;
|
||||||
|
|
||||||
|
// global $db;
|
||||||
|
// $extrafields = new ExtraFields($db);
|
||||||
|
// $extrafields->fetch_name_optionals_label('myobject');
|
||||||
|
|
||||||
|
$langs->load("Agefoddx@Agefoddx");
|
||||||
|
|
||||||
|
$h = 0;
|
||||||
|
$head = array();
|
||||||
|
|
||||||
|
$head[$h][0] = dol_buildpath("/Agefoddx/admin/setup.php", 1);
|
||||||
|
$head[$h][1] = $langs->trans("Settings");
|
||||||
|
$head[$h][2] = 'settings';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
/*
|
||||||
|
$head[$h][0] = dol_buildpath("/temp/admin/myobject_extrafields.php", 1);
|
||||||
|
$head[$h][1] = $langs->trans("ExtraFields");
|
||||||
|
$nbExtrafields = is_countable($extrafields->attributes['myobject']['label']) ? count($extrafields->attributes['myobject']['label']) : 0;
|
||||||
|
if ($nbExtrafields > 0) {
|
||||||
|
$head[$h][1] .= ' <span classe="badge">' . $nbExtrafields . '</span>';
|
||||||
|
}
|
||||||
|
$head[$h][2] = 'myobject_extrafields';
|
||||||
|
$h++;
|
||||||
|
*/
|
||||||
|
|
||||||
|
$head[$h][0] = dol_buildpath("/Agefoddx/admin/about.php", 1);
|
||||||
|
$head[$h][1] = $langs->trans("About");
|
||||||
|
$head[$h][2] = 'about';
|
||||||
|
$h++;
|
||||||
|
|
||||||
|
// Show more tabs from modules
|
||||||
|
// Entries must be declared in modules descriptor with line
|
||||||
|
//$this->tabs = array(
|
||||||
|
// 'entity:+tabname:Title:@temp:/temp/mypage.php?id=__ID__'
|
||||||
|
//); // to add new tab
|
||||||
|
//$this->tabs = array(
|
||||||
|
// 'entity:-tabname:Title:@temp:/temp/mypage.php?id=__ID__'
|
||||||
|
//); // to remove a tab
|
||||||
|
complete_head_from_modules($conf, $langs, null, $head, $h, 'Agefoddx@Agefoddx');
|
||||||
|
|
||||||
|
complete_head_from_modules($conf, $langs, null, $head, $h, 'Agefoddx@Agefoddx', 'remove');
|
||||||
|
|
||||||
|
return $head;
|
||||||
|
}
|
||||||
213
lib/Psr4AutoloaderClass.php
Normal file
213
lib/Psr4AutoloaderClass.php
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/*
|
||||||
|
PSR-4 autoloader example implementations given by
|
||||||
|
https://www.php-fig.org/psr/psr-4/
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Module\Agefoddx\Lib;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An example of a general-purpose implementation that includes the optional
|
||||||
|
* functionality of allowing multiple base directories for a single namespace
|
||||||
|
* prefix.
|
||||||
|
*
|
||||||
|
* Given a foo-bar package of classes in the file system at the following
|
||||||
|
* paths ...
|
||||||
|
*
|
||||||
|
* /path/to/packages/foo-bar/
|
||||||
|
* src/
|
||||||
|
* Baz.php # Foo\Bar\Baz
|
||||||
|
* Qux/
|
||||||
|
* Quux.php # Foo\Bar\Qux\Quux
|
||||||
|
* tests/
|
||||||
|
* BazTest.php # Foo\Bar\BazTest
|
||||||
|
* Qux/
|
||||||
|
* QuuxTest.php # Foo\Bar\Qux\QuuxTest
|
||||||
|
*
|
||||||
|
* ... add the path to the classe files for the \Foo\Bar\ namespace prefix
|
||||||
|
* as follows:
|
||||||
|
*
|
||||||
|
* <?php
|
||||||
|
* // instantiate the loader
|
||||||
|
* $loader = new \Example\Psr4AutoloaderClass;
|
||||||
|
*
|
||||||
|
* // register the autoloader
|
||||||
|
* $loader->register();
|
||||||
|
*
|
||||||
|
* // register the base directories for the namespace prefix
|
||||||
|
* $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/src');
|
||||||
|
* $loader->addNamespace('Foo\Bar', '/path/to/packages/foo-bar/tests');
|
||||||
|
*
|
||||||
|
* The following line would cause the autoloader to attempt to load the
|
||||||
|
* \Foo\Bar\Qux\Quux classe from /path/to/packages/foo-bar/src/Qux/Quux.php:
|
||||||
|
*
|
||||||
|
* <?php
|
||||||
|
* new \Foo\Bar\Qux\Quux;
|
||||||
|
*
|
||||||
|
* The following line would cause the autoloader to attempt to load the
|
||||||
|
* \Foo\Bar\Qux\QuuxTest classe from /path/to/packages/foo-bar/tests/Qux/QuuxTest.php:
|
||||||
|
*
|
||||||
|
* <?php
|
||||||
|
* new \Foo\Bar\Qux\QuuxTest;
|
||||||
|
*/
|
||||||
|
class Psr4AutoloaderClass
|
||||||
|
{
|
||||||
|
|
||||||
|
private bool $debug;
|
||||||
|
|
||||||
|
public function __construct(bool $debug=false)
|
||||||
|
{
|
||||||
|
$this->debug = $debug;
|
||||||
|
}
|
||||||
|
|
||||||
|
private function affichageDebogage(string $message) : void
|
||||||
|
{
|
||||||
|
if ($this->debug)
|
||||||
|
echo $message;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* An associative array where the key is a namespace prefix and the value
|
||||||
|
* is an array of base directories for classes in that namespace.
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
protected array $prefixes = array();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register loader with SPL autoloader stack.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function register() : void
|
||||||
|
{
|
||||||
|
spl_autoload_register(array($this, 'loadClass'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a base directory for a namespace prefix.
|
||||||
|
*
|
||||||
|
* @param string $prefix The namespace prefix.
|
||||||
|
* @param string $base_dir A base directory for classe files in the
|
||||||
|
* namespace.
|
||||||
|
* @param bool $prepend If true, prepend the base directory to the stack
|
||||||
|
* instead of appending it; this causes it to be searched first rather
|
||||||
|
* than last.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function addNamespace(string $prefix, string $base_dir, bool $prepend = false) : void
|
||||||
|
{
|
||||||
|
// normalize namespace prefix
|
||||||
|
$prefix = trim($prefix, '\\') . '\\';
|
||||||
|
|
||||||
|
// normalize the base directory with a trailing separator
|
||||||
|
$base_dir = rtrim($base_dir, DIRECTORY_SEPARATOR) . '/';
|
||||||
|
|
||||||
|
// initialize the namespace prefix array
|
||||||
|
if (isset($this->prefixes[$prefix]) === false) {
|
||||||
|
$this->prefixes[$prefix] = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
// retain the base directory for the namespace prefix
|
||||||
|
if ($prepend) {
|
||||||
|
array_unshift($this->prefixes[$prefix], $base_dir);
|
||||||
|
} else {
|
||||||
|
array_push($this->prefixes[$prefix], $base_dir);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Loads the classe file for a given classe name.
|
||||||
|
*
|
||||||
|
* @param string $class The fully-qualified classe name.
|
||||||
|
* @return mixed The mapped file name on success, or boolean false on
|
||||||
|
* failure.
|
||||||
|
*/
|
||||||
|
public function loadClass(string $class)
|
||||||
|
{
|
||||||
|
$this->affichageDebogage("<h3>Chargement automatique de classe $class </h3>");
|
||||||
|
// the current namespace prefix
|
||||||
|
$prefix = $class;
|
||||||
|
|
||||||
|
// work backwards through the namespace names of the fully-qualified
|
||||||
|
// classe name to find a mapped file name
|
||||||
|
while (false !== $pos = strrpos($prefix, '\\')) {
|
||||||
|
|
||||||
|
// retain the trailing namespace separator in the prefix
|
||||||
|
$prefix = substr($class, 0, $pos + 1);
|
||||||
|
|
||||||
|
// the rest is the relative classe name
|
||||||
|
$relative_class = substr($class, $pos + 1);
|
||||||
|
|
||||||
|
// try to load a mapped file for the prefix and relative classe
|
||||||
|
$mapped_file = $this->loadMappedFile($prefix, $relative_class);
|
||||||
|
if ($mapped_file) {
|
||||||
|
return $mapped_file;
|
||||||
|
}
|
||||||
|
|
||||||
|
// remove the trailing namespace separator for the next iteration
|
||||||
|
// of strrpos()
|
||||||
|
$prefix = rtrim($prefix, '\\');
|
||||||
|
}
|
||||||
|
|
||||||
|
// never found a mapped file
|
||||||
|
$this->affichageDebogage("<h3 style=\"color:red;font-weight: bold;\">Échec !</h3>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load the mapped file for a namespace prefix and relative classe.
|
||||||
|
*
|
||||||
|
* @param string $prefix The namespace prefix.
|
||||||
|
* @param string $relative_class The relative classe name.
|
||||||
|
* @return mixed Boolean false if no mapped file can be loaded, or the
|
||||||
|
* name of the mapped file that was loaded.
|
||||||
|
*/
|
||||||
|
protected function loadMappedFile(string $prefix, string $relative_class)
|
||||||
|
{
|
||||||
|
// are there any base directories for this namespace prefix?
|
||||||
|
if (isset($this->prefixes[$prefix]) === false) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// look through base directories for this namespace prefix
|
||||||
|
foreach ($this->prefixes[$prefix] as $base_dir) {
|
||||||
|
|
||||||
|
$this->affichageDebogage("Remplacement du préfixe $prefix par $base_dir<br>");
|
||||||
|
|
||||||
|
// replace the namespace prefix with the base directory,
|
||||||
|
// replace namespace separators with directory separators
|
||||||
|
// in the relative classe name, append with .php
|
||||||
|
$file = $base_dir
|
||||||
|
. str_replace('\\', '/', $relative_class)
|
||||||
|
. '.php';
|
||||||
|
|
||||||
|
// if the mapped file exists, require it
|
||||||
|
if ($this->requireFile($file)) {
|
||||||
|
// yes, we're done
|
||||||
|
return $file;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// never found it
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If a file exists, require it from the file system.
|
||||||
|
*
|
||||||
|
* @param string $file The file to require.
|
||||||
|
* @return bool True if the file exists, false if not.
|
||||||
|
*/
|
||||||
|
protected function requireFile(string $file) : bool
|
||||||
|
{
|
||||||
|
if (file_exists($file)) {
|
||||||
|
$this->affichageDebogage("<p><span style=\"color:green;font-weight: bold;\">Réussite</span> : fichier chargé <pre>$file</pre></p>");
|
||||||
|
require $file;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
$this->affichageDebogage("<p><span style=\"color:red;font-weight: bold;\">Échec</span> : fichier introuvable <pre>$file</pre></p>");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
sql/.htaccess
Normal file
1
sql/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
7
sql/llx_desal_external_bd.sql
Normal file
7
sql/llx_desal_external_bd.sql
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS llx_desal_external_bd (
|
||||||
|
bdid int NOT NULL auto_increment PRIMARY KEY,
|
||||||
|
nom varchar(64) NOT NULL,
|
||||||
|
lien varchar(256) NOT NULL,
|
||||||
|
user varchar(64) NOT NULL,
|
||||||
|
port int NOT NULL
|
||||||
|
);
|
||||||
2
sql/llx_desal_external_row.key.sql
Normal file
2
sql/llx_desal_external_row.key.sql
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
ALTER TABLE llx_desal_external_row ADD CONSTRAINT llx_fx_desal_ex_row_table FOREIGN KEY (tid) REFERENCES llx_desal_external_table (tid);
|
||||||
|
ALTER TABLE llx_desal_external_row ADD CONSTRAINT llx_fx_desal_ex_row_bd FOREIGN KEY (bdid) REFERENCES llx_desal_external_bd (bdid);
|
||||||
9
sql/llx_desal_external_row.sql
Normal file
9
sql/llx_desal_external_row.sql
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS llx_desal_external_row (
|
||||||
|
rid integer NOT NULL auto_increment PRIMARY KEY,
|
||||||
|
bdid integer NOT NULL,
|
||||||
|
tid integer NOT NULL,
|
||||||
|
nomLigneExterne varchar(64),
|
||||||
|
nomLigneAgfodd varchar(64) NOT NULL,
|
||||||
|
valeurFixe varchar(500)
|
||||||
|
);
|
||||||
|
|
||||||
1
sql/llx_desal_external_table.key.sql
Normal file
1
sql/llx_desal_external_table.key.sql
Normal file
@ -0,0 +1 @@
|
|||||||
|
ALTER TABLE llx_desal_external_table ADD CONSTRAINT llx_fx_desal_ex_table_bd FOREIGN KEY (bdid) REFERENCES llx_desal_external_bd (bdid);
|
||||||
6
sql/llx_desal_external_table.sql
Normal file
6
sql/llx_desal_external_table.sql
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
CREATE TABLE IF NOT EXISTS llx_desal_external_table (
|
||||||
|
tid integer NOT NULL auto_increment PRIMARY KEY,
|
||||||
|
bdid integer NOT NULL,
|
||||||
|
nomTableExterne varchar(64) NOT NULL,
|
||||||
|
nomTableAgfodd varchar(64) NOT NULL
|
||||||
|
);
|
||||||
1
view/.htaccess
Normal file
1
view/.htaccess
Normal file
@ -0,0 +1 @@
|
|||||||
|
Require all denied
|
||||||
9
view/erreur.php
Normal file
9
view/erreur.php
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
/** @var string $messageErreur **/
|
||||||
|
?>
|
||||||
|
<div class="centpercent div-table-responsive">
|
||||||
|
<table>
|
||||||
|
<?= $messageErreur ?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
62
view/gestionBD/afficherListe.php
Normal file
62
view/gestionBD/afficherListe.php
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
/** @var array $listeBD */
|
||||||
|
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 */ if (!isset($titre)){ $titre = "Agefoddx"; }
|
||||||
|
?>
|
||||||
|
<script src="../js/envoiePost.js"></script>
|
||||||
|
|
||||||
|
<table class="centpercent">
|
||||||
|
<tr class=" left col-left">
|
||||||
|
<th>
|
||||||
|
<a><?=$langs->trans("AgefoddxListeBD")?></a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col" class=" left col-left">
|
||||||
|
<h2><?= $titre ?></h2>
|
||||||
|
</th>
|
||||||
|
<th scope="col" class=" right col-right">
|
||||||
|
<a class="btnTitle btnTitlePlus" href="#" onclick="envoyerPost({action:'ajouter', controleur:'bd'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<span class="fa fa-plus-circle valignmiddle btnTitle-icon"></span>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<div class="div-table-responsive">
|
||||||
|
|
||||||
|
<table class="tagtable liste">
|
||||||
|
<thead>
|
||||||
|
<tr class="liste_titre">
|
||||||
|
<th scope="col" class="liste_titre center"><?= $langs->trans("AgefoddxIdBD") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxNomBD") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center" ><?= $langs->trans("AgefoddxListeTable") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center" colspan="2"><?= $langs->trans("AgefoddxParametresBD") ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($listeBD as $liste){ ?>
|
||||||
|
<tr class="oddeven">
|
||||||
|
<td class="center nowrap" scope="row"><?=$liste["bdid"]?></td>
|
||||||
|
<td class="center nowrap"><?= htmlspecialchars($liste["nom"])?></td>
|
||||||
|
<td class="center nowrap"><a href="#" onclick="envoyerPost({action:'afficherListe', controleur:'table', idBD:'<?=$liste["bdid"]?>', nomBD:'<?=$liste["nom"]?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<?= $langs->trans("AgefoddxAfficherListeTable") ?>
|
||||||
|
</a></td>
|
||||||
|
<td class="center nowrap"><a href="#" onclick="envoyerPost({action:'modifier', controleur:'bd', idBD:'<?=$liste["bdid"]?>', nomBD:'<?=$liste["nom"]?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<?= $langs->trans("AgefoddxModifierBD") ?>
|
||||||
|
</a></td>
|
||||||
|
<td class="center nowrap"><a href="#" onclick="envoyerPost({action:'supprimer', controleur:'bd', idBD:'<?=$liste["bdid"]?>', nomBD:'<?=$liste["nom"]?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<?= $langs->trans("AgefoddxSupprimerBD") ?>
|
||||||
|
</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
88
view/gestionBD/ajouter.php
Normal file
88
view/gestionBD/ajouter.php
Normal file
@ -0,0 +1,88 @@
|
|||||||
|
<?php
|
||||||
|
include_once "../../classe/ControleurBd.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 */
|
||||||
|
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><?=$langs->trans("AgefoddxAjoutBD")?></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>
|
||||||
|
|
||||||
|
<form method="post" autocomplete="off">
|
||||||
|
<input type='hidden' name='controleur' value='bd'>
|
||||||
|
<input type='hidden' name='action' value='insertion'>
|
||||||
|
<input type='hidden' name='token' value='<?=$csrfToken?>'>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="nomBD"><?=$langs->trans("AgefoddxNomBD")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="nomBD" name="nomBD" autocomplete="off" placeholder="dolibarr" required>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="lienBD"><?=$langs->trans("AgefoddxLienBD")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="lienBD" name="lienBD" autocomplete="off" placeholder="localhost" required>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="user"><?=$langs->trans("AgefoddxIdentifientBD")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="user" name="user" placeholder="identifiant" required>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="port"><?=$langs->trans("AgefoddxPortBD")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="number" id="port" autocomplete="off" name="port" placeholder="3306" required>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="mdp">*<?=$langs->trans("AgefoddxMDP")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="password" id="mdp" name="mdp" placeholder="********" required>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" colspan="2">
|
||||||
|
<input type="submit" value="<?=$langs->trans("AgefoddxEnvoie")?>" />
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" colspan="2">
|
||||||
|
<p>* <?=$langs->trans("AgefoddxMentionMDP")?> </th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
100
view/gestionBD/modifier.php
Normal file
100
view/gestionBD/modifier.php
Normal file
@ -0,0 +1,100 @@
|
|||||||
|
<?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 $nomBD */
|
||||||
|
/** @var array $liste */
|
||||||
|
|
||||||
|
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><?=$langs->trans("AgefoddxModifierBD")?></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>
|
||||||
|
|
||||||
|
<form method="post" AUTOCOMPLETE="OFF">
|
||||||
|
<input type='hidden' name='controleur' value='bd'>
|
||||||
|
<input type='hidden' name='action' value='update'>
|
||||||
|
<input type='hidden' name='token' value='<?=$csrfToken?>'>
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="idBD"><?=$langs->trans("AgefoddxIdDansBD")?>: </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="idBD" name="idBD" value="<?=$liste["idBD"]?>" AUTOCOMPLETE="OFF" readonly>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="nomBD"><?=$langs->trans("AgefoddxNomBD")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="nomBD" name="nomBD" value="<?=$liste["nomBD"]?>" AUTOCOMPLETE="OFF">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="lienBD"><?=$langs->trans("AgefoddxLienBD")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="lienBD" name="lienBD" value="<?=$liste["lienBD"]?>" AUTOCOMPLETE="OFF">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="user"><?=$langs->trans("AgefoddxIdentifientBD")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="text" id="user" name="user" value="<?=$liste["user"]?>" AUTOCOMPLETE="OFF">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="port"><?=$langs->trans("AgefoddxPortBD")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="number" id="port" name="port" value="<?=$liste["port"]?>" AUTOCOMPLETE="OFF">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="mdp">*<?=$langs->trans("AgefoddxMDP")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="password" id="mdp" name="mdp" value="" AUTOCOMPLETE="OFF">
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" colspan="2">
|
||||||
|
<input type="submit" value="<?=$langs->trans("AgefoddxEnvoie")?>" />
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" colspan="2">
|
||||||
|
<p>* <?=$langs->trans("AgefoddxMentionMDP")?></p>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
63
view/gestionBD/supprimer.php
Normal file
63
view/gestionBD/supprimer.php
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<?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 $idBD */
|
||||||
|
/** @var $nomBD */
|
||||||
|
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><?=$langs->trans("AgefoddxSupprimer")?></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>
|
||||||
|
<form method="post" autocomplete="off">
|
||||||
|
<input type='hidden' name='controleur' value='bd'>
|
||||||
|
<input type='hidden' name='action' value='suppression'>
|
||||||
|
<input type='hidden' name='idBD' value='<?=$idBD?>'>
|
||||||
|
<input type='hidden' name='nomBD' value='<?=$nomBD?>'>
|
||||||
|
<input type='hidden' name='token' value='<?=$csrfToken?>'>
|
||||||
|
<fieldset>
|
||||||
|
<table class="centpercent">
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row" colspan="2" >
|
||||||
|
<legend><?=$langs->trans("AgefoddxTexteDeSuppression")?> Agefodd <?=$langs->trans("AgefoddxEt")?> <?=$nomBD?> ? </legend>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row">
|
||||||
|
<input type="radio" id="true" name="ouiNon" value="true" />
|
||||||
|
<label for="true"><?=$langs->trans("AgefoddxOui")?></label>
|
||||||
|
</th>
|
||||||
|
<th scope="row">
|
||||||
|
<input type="radio" id="" name="ouiNon" value="" checked/>
|
||||||
|
<label for=""><?=$langs->trans("AgefoddxNon")?></label>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row" colspan="2" >
|
||||||
|
<button class="centpercent" type="submit"><?=$langs->trans("AgefoddxEnvoie")?></button>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
65
view/gestionLigne/afficherListe.php
Normal file
65
view/gestionLigne/afficherListe.php
Normal file
@ -0,0 +1,65 @@
|
|||||||
|
<?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 $liste */
|
||||||
|
|
||||||
|
/** @var $idBD */ /** @var $nomBD */ /** @var $mdp */
|
||||||
|
|
||||||
|
/** @var $idTable */ /** @var $nomTableA */ /** @var $nomTableE */
|
||||||
|
|
||||||
|
|
||||||
|
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><?=$langs->trans("AgefoddxListeLigne")?></a>
|
||||||
|
</th>
|
||||||
|
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col" class=" left col-left">
|
||||||
|
<h2><?= $titre ?></h2>
|
||||||
|
</th>
|
||||||
|
<th scope="col" class=" right col-right">
|
||||||
|
<a class="btnTitle btnTitlePlus" href="#" onclick="envoyerPost({action:'ajouter', controleur:'ligne', idBD:'<?=$idBD?>',idTable:'<?=$idTable?>', nomBD:'<?=$nomBD?>', nomTableA:'<?=$nomTableA?>', nomTableE:'<?=$nomTableE?>', mdp:'<?=$mdp?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<span class="fa fa-plus-circle valignmiddle btnTitle-icon"></span>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="div-table-responsive">
|
||||||
|
<table class="tagtable liste">
|
||||||
|
<thead>
|
||||||
|
<tr class="liste_titre">
|
||||||
|
<th scope="col" class="liste_titre center"><?= $langs->trans("AgefoddxIdLigne") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxNomLigneExterne"). " " . $nomTableE?></th>
|
||||||
|
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxNomLigneAgefodd"). " " . $nomTableA?></th>
|
||||||
|
<th scope="col" class="liste_titre center" colspan="2"><?= $langs->trans("AgefoddxParametresLigne") ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach ($liste as $item){ ?>
|
||||||
|
<tr class="oddeven">
|
||||||
|
<td class="center nowrap" scope="row"><?=$item["idLigne"]?></td>
|
||||||
|
<td class="center nowrap"><?= htmlspecialchars($item["nomLigneE"] ?? $langs->trans("AgefoddxValeurFixeItem"))?></td>
|
||||||
|
<td class="center nowrap"><?= htmlspecialchars($item["nomLigneA"])?></td>
|
||||||
|
<td class="center nowrap"><a href="#" onclick="envoyerPost({action:'supprimer', controleur:'ligne', idBD:'<?=$idBD?>', idTable:'<?=$idTable?>', idLigne:'<?=$item["idLigne"]?>', nomBD:'<?=$nomBD?>', nomTableA:'<?=$nomTableA?>', nomTableE:'<?=$nomTableE?>', nomLigneE:'<?=$item["nomLigneE"]?>',nomLigneA:'<?=$item["nomLigneA"]?>', mdp:'<?=$mdp?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<?= $langs->trans("AgefoddxSupprimerLigne") ?>
|
||||||
|
</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
144
view/gestionLigne/ajouter.php
Normal file
144
view/gestionLigne/ajouter.php
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
<?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>
|
||||||
71
view/gestionLigne/supprimer.php
Normal file
71
view/gestionLigne/supprimer.php
Normal file
@ -0,0 +1,71 @@
|
|||||||
|
<?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 $nomLigneE */ /** @var $nomLigneA */ /** @var $idLigne */
|
||||||
|
|
||||||
|
/** @var $idBD */ /** @var $nomBD */ /** @var $mdp */
|
||||||
|
|
||||||
|
/** @var $idTable */ /** @var $nomTableA */ /** @var $nomTableE */
|
||||||
|
|
||||||
|
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("AgefoddxSupprimer")?></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>
|
||||||
|
<form method="post" autocomplete="off">
|
||||||
|
<input type='hidden' name='controleur' value='ligne'>
|
||||||
|
<input type='hidden' name='action' value='suppression'>
|
||||||
|
<input type='hidden' name='idBD' value='<?=$idBD?>'>
|
||||||
|
<input type='hidden' name='idTable' value='<?=$idTable?>'>
|
||||||
|
<input type='hidden' name='idLigne' value='<?=$idLigne?>'>
|
||||||
|
<input type='hidden' name='nomBD' value='<?=$nomBD?>'>
|
||||||
|
<input type='hidden' name='nomTableA' value='<?=$nomTableA?>'>
|
||||||
|
<input type='hidden' name='nomTableE' value='<?=$nomTableE?>'>
|
||||||
|
<input type='hidden' name='token' value='<?=$csrfToken?>'>
|
||||||
|
<input type='hidden' name='mdp' value='<?=$mdp?>''>
|
||||||
|
<fieldset>
|
||||||
|
<table class="centpercent">
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row" colspan="2" >
|
||||||
|
<legend> <?=$langs->trans("AgefoddxTexteDeSuppression")?> <?=$nomLigneA?> <?=$langs->trans("AgefoddxEt")?> <?=$nomLigneE?> ? </legend>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row">
|
||||||
|
<input type="radio" id="true" name="ouiNon" value="true" />
|
||||||
|
<label for="true"><?=$langs->trans("AgefoddxOui")?></label>
|
||||||
|
</th>
|
||||||
|
<th scope="row">
|
||||||
|
<input type="radio" id="" name="ouiNon" value="" checked/>
|
||||||
|
<label for=""><?=$langs->trans("AgefoddxNon")?></label>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row" colspan="2" >
|
||||||
|
<button class="centpercent" type="submit"><?=$langs->trans("AgefoddxEnvoie")?></button>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
69
view/gestionLigne/transition.php
Normal file
69
view/gestionLigne/transition.php
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
<?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 $actionApres */ /** @var $titreAction */
|
||||||
|
|
||||||
|
/** @var $idBD */ /** @var $nomBD */ /** @var $mdp */
|
||||||
|
|
||||||
|
/** @var $idTable */ /** @var $nomTableA */ /** @var $nomTableE */
|
||||||
|
/** @var $valeurBase */
|
||||||
|
|
||||||
|
|
||||||
|
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><?=$titreAction?></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>
|
||||||
|
<form method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="controleur" value="ligne">
|
||||||
|
<input type="hidden" name="action" value="<?=$actionApres?>">
|
||||||
|
<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="valeurBase" value="<?=$valeurBase?>">
|
||||||
|
|
||||||
|
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="mdp"><?=$langs->trans("AgefoddxMDP")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="password" id="mdp" name="mdp" placeholder="********" required>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" colspan="2">
|
||||||
|
<input type="submit" value="<?=$langs->trans("AgefoddxEnvoie")?>" />
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
70
view/gestionTable/afficherListe.php
Normal file
70
view/gestionTable/afficherListe.php
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<?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 $nomBD */ /** @var $idBD */ /** @var $mdp */
|
||||||
|
/** @var array $liste*/
|
||||||
|
|
||||||
|
|
||||||
|
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><?=$nomBD?></a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="col" class=" left col-left">
|
||||||
|
<h2><?= $titre ?></h2>
|
||||||
|
</th>
|
||||||
|
<th scope="col" class=" right col-right">
|
||||||
|
<a class="btnTitle btnTitlePlus" href="#" onclick="envoyerPost({action:'ajouter', controleur:'table', idBD:'<?=$idBD?>', nomBD:'<?=$nomBD?>', mdp:'<?=$mdp?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<span class="fa fa-plus-circle valignmiddle btnTitle-icon"></span>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
<div class="div-table-responsive">
|
||||||
|
<table class="tagtable liste">
|
||||||
|
<thead>
|
||||||
|
<tr class="liste_titre">
|
||||||
|
<th scope="col" class="liste_titre center"><?= $langs->trans("AgefoddxIdTable") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxNomTableExterne") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxNomTableAgefodd") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center" ><?= $langs->trans("AgefoddxListeLigne") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxNBLigneTable") ?></th>
|
||||||
|
<th scope="col" class="liste_titre center" colspan="2"><?= $langs->trans("AgefoddxParametresTable") ?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
foreach ($liste as $item){ ?>
|
||||||
|
<tr class="oddeven">
|
||||||
|
<td class="center nowrap" scope="row"><?=$item["idTable"]?></td>
|
||||||
|
<td class="center nowrap"><?= htmlspecialchars($item["nomTableExterne"])?></td>
|
||||||
|
<td class="center nowrap"><?= htmlspecialchars($item["nomTableAgfodd"])?></td>
|
||||||
|
<td class="center nowrap"><a href="#" onclick="envoyerPost({action:'afficherListe', controleur:'ligne', idTable:'<?=$item["idTable"]?>', idBD:'<?=$idBD?>', nomBD:'<?=$nomBD?>', mdp:'<?=$mdp?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<?= $langs->trans("AgefoddxAfficherListeLigne") ?>
|
||||||
|
</a></td>
|
||||||
|
<td class="center nowrap"><?= htmlspecialchars($item["nombreLigne"])?></td>
|
||||||
|
<td class="center nowrap"><a href="#" onclick="envoyerPost({action:'importer', controleur:'table', idTable:'<?=$item["idTable"]?>', idBD:'<?=$idBD?>', nomBD:'<?=$nomBD?>', mdp:'<?=$mdp?>', nomTableA:'<?=$item["nomTableAgfodd"]?>', nomTableE:'<?=$item["nomTableExterne"]?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<?= $langs->trans("AgefoddxImporterTable") ?>
|
||||||
|
</a></td>
|
||||||
|
<td class="center nowrap"><a href="#" onclick="envoyerPost({action:'supprimer', controleur:'table', idTable:'<?=$item["idTable"]?>', idBD:'<?=$idBD?>', nomBD:'<?=$nomBD?>', mdp:'<?=$mdp?>', nomTableA:'<?=$item["nomTableAgfodd"]?>', nomTableE:'<?=$item["nomTableExterne"]?>'}, 'setup.php', '<?=$csrfToken?>')">
|
||||||
|
<?= $langs->trans("AgefoddxSupprimerTable") ?>
|
||||||
|
</a></td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
80
view/gestionTable/ajouter.php
Normal file
80
view/gestionTable/ajouter.php
Normal file
@ -0,0 +1,80 @@
|
|||||||
|
<?php
|
||||||
|
global $langs , $db;
|
||||||
|
use Module\Agefoddx\Classe\GestionBD\bdExterneInteraction;
|
||||||
|
|
||||||
|
$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 $nomBD */
|
||||||
|
/** @var $idBD */
|
||||||
|
/** @var $mdp */
|
||||||
|
/** @var $listeAgefodd */
|
||||||
|
/** @var $listeBdExterne */
|
||||||
|
/** @var bdExterneInteraction $bdConnection */
|
||||||
|
|
||||||
|
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><?=$langs->trans("AgefoddxAjouterTable")?></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>
|
||||||
|
<form method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="controleur" value="table">
|
||||||
|
<input type="hidden" name="action" value="insertion">
|
||||||
|
<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="mdp" value="<?=$mdp?>">
|
||||||
|
<table class="tagtable centpercent">
|
||||||
|
<thead class="centpercent">
|
||||||
|
<tr class="liste_titre">
|
||||||
|
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxTable")?> Agefodd</th>
|
||||||
|
<th scope="col" class="liste_titre center"><?=$langs->trans("AgefoddxTable")?> <?=$nomBD?></th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="centpercent">
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label type="hidden" for="agefoddTable"></label><select name="agefoddTable" id="agefoddTable">
|
||||||
|
<?php echo "<option value=''>-- ".$langs->trans("AgefoddxTableAjoutChoixOption")." --</option>";
|
||||||
|
foreach ($listeAgefodd as $table) {?>
|
||||||
|
<option value="<?=$table?>"><?=$table?></option>
|
||||||
|
<?php }?>
|
||||||
|
</select>
|
||||||
|
</th>
|
||||||
|
<th>
|
||||||
|
<label type="hidden" for="bdExterneTable"></label><select name="bdExterneTable" id="bdExterneTable">
|
||||||
|
<?php echo "<option value=''>-- ".$langs->trans("AgefoddxTableAjoutChoixOption")." --</option>";
|
||||||
|
foreach ($listeBdExterne as $table) {?>
|
||||||
|
<option value="<?=$table?>"><?=$table?></option>
|
||||||
|
<?php }?>
|
||||||
|
</select>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" colspan="2">
|
||||||
|
<input type="submit" value="<?=$langs->trans("AgefoddxEnvoie")?>" />
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
96
view/gestionTable/importer.php
Normal file
96
view/gestionTable/importer.php
Normal file
@ -0,0 +1,96 @@
|
|||||||
|
<?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 $nomBD */
|
||||||
|
/** @var $idBD */
|
||||||
|
/** @var $valueImportation */
|
||||||
|
/** @var $liste */
|
||||||
|
/** @var $idTable */ /** @var $mdp */
|
||||||
|
/** @var $nomTableA */ /** @var $nomTableE */
|
||||||
|
|
||||||
|
if (!isset($titre)) {
|
||||||
|
$titre = "Agefoddx";
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Doit pouvoir réaliser divers importations si et seulement si touts les champs non null sont définis **/
|
||||||
|
?>
|
||||||
|
<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><?=$langs->trans("AgefoddxImporter")?></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>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<?php if(!$valueImportation) {?>
|
||||||
|
<div class="div-table-responsive">
|
||||||
|
<h3><?=$langs->trans("AgefoddxCLOAI")?></h3>
|
||||||
|
<table class="tagtable liste">
|
||||||
|
<thead>
|
||||||
|
<tr class="liste_titre">
|
||||||
|
<th scope="col" class="liste_titre center">
|
||||||
|
<?=$langs->trans("AgefoddxNom")?>
|
||||||
|
</th>
|
||||||
|
<th scope="col" class="liste_titre center">
|
||||||
|
<?=$langs->trans("AgefoddxType")?>
|
||||||
|
</th>
|
||||||
|
<th scope="col" class="liste_titre center">
|
||||||
|
<?=$langs->trans("AgefoddxAjouter")?>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach ($liste as $item) {?>
|
||||||
|
<tr class="oddeven">
|
||||||
|
<th class="center nowrap">
|
||||||
|
<?=$item["nom"]?>
|
||||||
|
</th>
|
||||||
|
<td class="center nowrap">
|
||||||
|
<?=$item["type"]?>
|
||||||
|
</td>
|
||||||
|
<td class="center nowrap">
|
||||||
|
<a href="#" onclick="envoyerPost({action:'ajouter', controleur:'ligne', idBD:'<?=$idBD?>',idTable:'<?=$idTable?>', nomBD:'<?= $nomBD ?>', valeurBase:'<?= $item["nom"] ?>', mdp:'<?=$mdp?>'}, 'setup.php', '<?= $csrfToken ?>')">
|
||||||
|
<?=$langs->trans("Agefoddxajouter")?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php }?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<?php } else {?>
|
||||||
|
<div class="tabBar" style="padding: 0">
|
||||||
|
<table class="tagtable centpercent">
|
||||||
|
<tbody class="centpercent">
|
||||||
|
<tr style="display: flex; justify-content: space-evenly">
|
||||||
|
<th scope="row">
|
||||||
|
<a href="#" onclick="envoyerPost({action:'importation', controleur:'table', idBD:'<?=$idBD?>',idTable:'<?=$idTable?>', nomBD:'<?= $nomBD ?>', nomTableA:'<?=$nomTableA?>', nomTableE:'<?=$nomTableE?>', mdp:'<?=$mdp?>'}, 'setup.php', '<?= $csrfToken ?>')">
|
||||||
|
<?=$langs->trans("AgefoddxImporter")?>
|
||||||
|
</a>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
<?php }?>
|
||||||
68
view/gestionTable/supprimer.php
Normal file
68
view/gestionTable/supprimer.php
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<?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 $nomBD */ /** @var $idBD */ /** @var $idTable */
|
||||||
|
/** @var $nomTableA */ /** @var $nomTableE */
|
||||||
|
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><?=$langs->trans("AgefoddxSupprimer")?></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>
|
||||||
|
<form method="post" autocomplete="off">
|
||||||
|
<input type='hidden' name='controleur' value='table'>
|
||||||
|
<input type='hidden' name='action' value='suppression'>
|
||||||
|
<input type='hidden' name='idBD' value='<?=$idBD?>'>
|
||||||
|
<input type='hidden' name='idTable' value='<?=$idTable?>'>
|
||||||
|
<input type='hidden' name='nomBD' value='<?=$nomBD?>'>
|
||||||
|
<input type='hidden' name='nomTableA' value='<?=$nomTableA?>'>
|
||||||
|
<input type='hidden' name='nomTableE' value='<?=$nomTableE?>'>
|
||||||
|
<input type='hidden' name='token' value='<?=$csrfToken?>'>
|
||||||
|
<input type="hidden" name="mdp" value="<?=$mdp?>">
|
||||||
|
<fieldset>
|
||||||
|
<table class="centpercent">
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row" colspan="2" >
|
||||||
|
<legend><?=$langs->trans("AgefoddxTexteDeSuppression")?> <?=$nomTableA?> <?=$langs->trans("AgefoddxEt")?> <?=$nomTableE?> ? </legend>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row">
|
||||||
|
<input type="radio" id="true" name="ouiNon" value="true" />
|
||||||
|
<label for="true"><?=$langs->trans("AgefoddxOui")?></label>
|
||||||
|
</th>
|
||||||
|
<th scope="row">
|
||||||
|
<input type="radio" id="" name="ouiNon" value="" checked/>
|
||||||
|
<label for=""><?=$langs->trans("AgefoddxNon")?></label>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
<tr class="centpercent">
|
||||||
|
<th scope="row" colspan="2" >
|
||||||
|
<button class="centpercent" type="submit"><?=$langs->trans("AgefoddxEnvoie")?></button>
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</fieldset>
|
||||||
|
</form>
|
||||||
61
view/gestionTable/transition.php
Normal file
61
view/gestionTable/transition.php
Normal file
@ -0,0 +1,61 @@
|
|||||||
|
<?php
|
||||||
|
/** @var $titre */
|
||||||
|
/** @var $nomBD */
|
||||||
|
/** @var $idBD */
|
||||||
|
/** @var $idTable */
|
||||||
|
/** @var $actionApres */
|
||||||
|
/** @var $titreAction */
|
||||||
|
/** @var $nomTableE */
|
||||||
|
/** @var $nomTableA */
|
||||||
|
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'];
|
||||||
|
?>
|
||||||
|
<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><?= $titreAction ?></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>
|
||||||
|
<form method="post" autocomplete="off">
|
||||||
|
<input type="hidden" name="controleur" value="table">
|
||||||
|
<input type="hidden" name="action" value="<?=$actionApres?>">
|
||||||
|
<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="nomTableE" value="<?=$nomTableE?>">
|
||||||
|
<input type="hidden" name="nomTableA" value="<?=$nomTableA?>">
|
||||||
|
<table>
|
||||||
|
<tbody>
|
||||||
|
<tr>
|
||||||
|
<th scope="row">
|
||||||
|
<label for="mdp"><?=$langs->trans("AgefoddxMDP")?> : </label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<input type="password" id="mdp" name="mdp" placeholder="********" required>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<th scope="row" colspan="2">
|
||||||
|
<input type="submit" value="<?=$langs->trans("AgefoddxEnvoie")?>" />
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</form>
|
||||||
18
view/vueGenerale.php
Normal file
18
view/vueGenerale.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @var string $cheminCorpsVue
|
||||||
|
*/
|
||||||
|
echo "<div>";
|
||||||
|
|
||||||
|
/** @var $message */
|
||||||
|
/** @var $popup */
|
||||||
|
|
||||||
|
if ($message != "") {
|
||||||
|
echo "<p>$message</p>";
|
||||||
|
} else if ($popup != "") {
|
||||||
|
echo '<script type="text/javascript">window.alert("' . $popup . '");</script>';
|
||||||
|
} if (isset($cheminCorpsVue)){
|
||||||
|
require __DIR__ . "/{$cheminCorpsVue}";
|
||||||
|
}
|
||||||
|
echo "</div>";
|
||||||
|
?>
|
||||||
Loading…
x
Reference in New Issue
Block a user