|
|
|
@ -29,10 +29,10 @@ class form extends common {
|
|
|
|
|
public static $data = [];
|
|
|
|
|
|
|
|
|
|
public static $pages = [];
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static $pagination;
|
|
|
|
|
|
|
|
|
|
const FORM_VERSION = '2.2';
|
|
|
|
|
|
|
|
|
|
const FORM_VERSION = '2.3';
|
|
|
|
|
|
|
|
|
|
// Objets
|
|
|
|
|
const TYPE_MAIL = 'mail';
|
|
|
|
@ -45,12 +45,12 @@ class form extends common {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static $types = [
|
|
|
|
|
self::TYPE_LABEL => 'Etiquette',
|
|
|
|
|
self::TYPE_LABEL => 'Etiquette',
|
|
|
|
|
self::TYPE_TEXT => 'Champ texte',
|
|
|
|
|
self::TYPE_TEXTAREA => 'Grand champ texte',
|
|
|
|
|
self::TYPE_MAIL => 'Champ mail',
|
|
|
|
|
self::TYPE_SELECT => 'Sélection',
|
|
|
|
|
self::TYPE_CHECKBOX => 'Case à cocher',
|
|
|
|
|
self::TYPE_CHECKBOX => 'Case à cocher',
|
|
|
|
|
self::TYPE_DATETIME => 'Date'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
@ -61,22 +61,22 @@ class form extends common {
|
|
|
|
|
* Configuration
|
|
|
|
|
*/
|
|
|
|
|
public function config() {
|
|
|
|
|
// Liste des utilisateurs
|
|
|
|
|
// Liste des utilisateurs
|
|
|
|
|
$userIdsFirstnames = helper::arrayCollumn($this->getData(['user']), 'firstname');
|
|
|
|
|
ksort($userIdsFirstnames);
|
|
|
|
|
self::$listUsers [] = '';
|
|
|
|
|
self::$listUsers [] = '';
|
|
|
|
|
foreach($userIdsFirstnames as $userId => $userFirstname) {
|
|
|
|
|
self::$listUsers [] = $userId;
|
|
|
|
|
}
|
|
|
|
|
// Soumission du formulaire
|
|
|
|
|
if($this->isPost()) {
|
|
|
|
|
// Configuration
|
|
|
|
|
// Option sélectionnée sans page choisie
|
|
|
|
|
$pageId = '';
|
|
|
|
|
if ($this->getInput('formConfigPageId') !== "") {
|
|
|
|
|
// Option sélectionnée sans page choisie
|
|
|
|
|
$pageId = '';
|
|
|
|
|
if ($this->getInput('formConfigPageId') !== "") {
|
|
|
|
|
// Option désactivée, réinitialiser l'id de la page sélectionnée.
|
|
|
|
|
$pageId = $this->getInput('formConfigPageIdToggle', helper::FILTER_BOOLEAN) === true ? $this->getInput('formConfigPageId', helper::FILTER_ID) : '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$this->setData([
|
|
|
|
|
'module',
|
|
|
|
|
$this->getUrl(0),
|
|
|
|
@ -93,7 +93,7 @@ class form extends common {
|
|
|
|
|
]
|
|
|
|
|
]);
|
|
|
|
|
// Génération des données vides
|
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
|
|
|
|
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
|
|
|
|
// Génération des champs
|
|
|
|
|
$inputs = [];
|
|
|
|
|
foreach($this->getInput('formConfigPosition', null) as $index => $position) {
|
|
|
|
@ -220,7 +220,7 @@ class form extends common {
|
|
|
|
|
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/data',
|
|
|
|
|
'notification' => 'Action non autorisée'
|
|
|
|
|
]);
|
|
|
|
|
} else {
|
|
|
|
|
} else {
|
|
|
|
|
$data = ($this->getData(['module', $this->getUrl(0), 'data']));
|
|
|
|
|
if (count($data) > 0 ) {
|
|
|
|
|
// Suppression multiple
|
|
|
|
@ -243,7 +243,7 @@ class form extends common {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Suppression
|
|
|
|
|
*/
|
|
|
|
@ -291,12 +291,12 @@ class form extends common {
|
|
|
|
|
AND $this->getInput('formCapcha', helper::FILTER_INT) !== $this->getInput('formCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('formCapchaSecondNumber', helper::FILTER_INT))
|
|
|
|
|
{
|
|
|
|
|
self::$inputNotices['formCapcha'] = 'Incorrect';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// Préparation le contenu du mail
|
|
|
|
|
$data = [];
|
|
|
|
|
$content = '';
|
|
|
|
|
$replyTo = null;
|
|
|
|
|
$content = '';
|
|
|
|
|
foreach($this->getData(['module', $this->getUrl(0), 'input']) as $index => $input) {
|
|
|
|
|
// Filtre la valeur
|
|
|
|
|
switch($input['type']) {
|
|
|
|
@ -306,20 +306,19 @@ class form extends common {
|
|
|
|
|
case self::TYPE_TEXTAREA:
|
|
|
|
|
$filter = helper::FILTER_STRING_LONG;
|
|
|
|
|
break;
|
|
|
|
|
case self::TYPE_DATETIME:
|
|
|
|
|
case self::TYPE_DATETIME:
|
|
|
|
|
$filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP
|
|
|
|
|
break;
|
|
|
|
|
case self::TYPE_CHECKBOX:
|
|
|
|
|
case self::TYPE_CHECKBOX:
|
|
|
|
|
$filter = helper::FILTER_BOOLEAN;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
$filter = helper::FILTER_STRING_SHORT;
|
|
|
|
|
}
|
|
|
|
|
$value = $this->getInput('formInput[' . $index . ']', $filter, $input['required']) === true ? 'X' : $this->getInput('formInput[' . $index . ']', $filter, $input['required']);
|
|
|
|
|
// premier chalmp email ajouté au mail en reply si option active
|
|
|
|
|
if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true &&
|
|
|
|
|
$input['type'] === 'mail' &&
|
|
|
|
|
$replyTo !== null) {
|
|
|
|
|
// premier champ email ajouté au mail en reply si option active
|
|
|
|
|
if ($this->getData(['module', $this->getUrl(0), 'config', 'replyto']) === true &&
|
|
|
|
|
$input['type'] === 'mail') {
|
|
|
|
|
$replyTo = $value;
|
|
|
|
|
}
|
|
|
|
|
// Préparation des données pour la création dans la base
|
|
|
|
@ -352,7 +351,7 @@ class form extends common {
|
|
|
|
|
$to[] = $user['mail'];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// Utilisateur désigné
|
|
|
|
|
if (!empty($singleuser)) {
|
|
|
|
|
$to[] = $singleuser;
|
|
|
|
|