Sondage 1.2 Wip
This commit is contained in:
parent
5459c52e6b
commit
3cadf4db58
@ -15,9 +15,10 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
class sondage extends common {
|
class sondage extends common
|
||||||
|
{
|
||||||
|
|
||||||
const VERSION = '1.2';
|
const VERSION = '1.3';
|
||||||
const REALNAME = 'Sondage';
|
const REALNAME = 'Sondage';
|
||||||
const DELETE = true;
|
const DELETE = true;
|
||||||
const UPDATE = '0.0';
|
const UPDATE = '0.0';
|
||||||
@ -69,7 +70,8 @@ class sondage extends common {
|
|||||||
/**
|
/**
|
||||||
* Configuration
|
* Configuration
|
||||||
*/
|
*/
|
||||||
public function config() {
|
public function config()
|
||||||
|
{
|
||||||
// Liste des utilisateurs
|
// Liste des utilisateurs
|
||||||
$userIdsFirstnames = helper::arraycollumn($this->getData(['user']), 'firstname');
|
$userIdsFirstnames = helper::arraycollumn($this->getData(['user']), 'firstname');
|
||||||
ksort($userIdsFirstnames);
|
ksort($userIdsFirstnames);
|
||||||
@ -100,6 +102,7 @@ class sondage extends common {
|
|||||||
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
$this->setData(['module', $this->getUrl(0), 'data', []]);
|
||||||
// Génération des champs
|
// Génération des champs
|
||||||
$inputs = [];
|
$inputs = [];
|
||||||
|
if (is_array($this->getInput('formConfigPosition', null))) {
|
||||||
foreach ($this->getInput('formConfigPosition', null) as $index => $position) {
|
foreach ($this->getInput('formConfigPosition', null) as $index => $position) {
|
||||||
$inputs[] = [
|
$inputs[] = [
|
||||||
'name' => $this->getInput('formConfigName[' . $index . ']'),
|
'name' => $this->getInput('formConfigName[' . $index . ']'),
|
||||||
@ -109,6 +112,8 @@ class sondage extends common {
|
|||||||
'values' => $this->getInput('formConfigValues[' . $index . ']')
|
'values' => $this->getInput('formConfigValues[' . $index . ']')
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$this->setData(['module', $this->getUrl(0), 'input', $inputs]);
|
$this->setData(['module', $this->getUrl(0), 'input', $inputs]);
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
@ -138,7 +143,8 @@ class sondage extends common {
|
|||||||
/**
|
/**
|
||||||
* Données enregistrées
|
* Données enregistrées
|
||||||
*/
|
*/
|
||||||
public function data() {
|
public function data()
|
||||||
|
{
|
||||||
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
||||||
if (is_array($data)) {
|
if (is_array($data)) {
|
||||||
// Pagination
|
// Pagination
|
||||||
@ -174,7 +180,8 @@ class sondage extends common {
|
|||||||
/**
|
/**
|
||||||
* Réponses enregistrées
|
* Réponses enregistrées
|
||||||
*/
|
*/
|
||||||
public function result() {
|
public function result()
|
||||||
|
{
|
||||||
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
$data = $this->getData(['module', $this->getUrl(0), 'data']);
|
||||||
if ($data) {
|
if ($data) {
|
||||||
// Pagination
|
// Pagination
|
||||||
@ -207,7 +214,8 @@ class sondage extends common {
|
|||||||
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
* @author Frédéric Tempez <frederic.tempez@outlook.com>
|
||||||
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
|
||||||
*/
|
*/
|
||||||
public function export2csv() {
|
public function export2csv()
|
||||||
|
{
|
||||||
// Jeton incorrect
|
// Jeton incorrect
|
||||||
if ($this->getUrl(2) !== $_SESSION['csrf']) {
|
if ($this->getUrl(2) !== $_SESSION['csrf']) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -247,7 +255,8 @@ class sondage extends common {
|
|||||||
/**
|
/**
|
||||||
* Suppression
|
* Suppression
|
||||||
*/
|
*/
|
||||||
public function deleteall() {
|
public function deleteall()
|
||||||
|
{
|
||||||
// Jeton incorrect
|
// Jeton incorrect
|
||||||
if ($this->getUrl(2) !== $_SESSION['csrf']) {
|
if ($this->getUrl(2) !== $_SESSION['csrf']) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -282,7 +291,8 @@ class sondage extends common {
|
|||||||
/**
|
/**
|
||||||
* Suppression
|
* Suppression
|
||||||
*/
|
*/
|
||||||
public function delete() {
|
public function delete()
|
||||||
|
{
|
||||||
// Jeton incorrect
|
// Jeton incorrect
|
||||||
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
if ($this->getUrl(3) !== $_SESSION['csrf']) {
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
@ -317,14 +327,15 @@ class sondage extends common {
|
|||||||
/**
|
/**
|
||||||
* Accueil
|
* Accueil
|
||||||
*/
|
*/
|
||||||
public function index() {
|
public function index()
|
||||||
|
{
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if ($this->isPost()) {
|
if ($this->isPost()) {
|
||||||
// Check la capcha
|
// Check la capcha
|
||||||
if (
|
if (
|
||||||
$this->getData(['module', $this->getUrl(0), 'config', 'capcha'])
|
$this->getData(['module', $this->getUrl(0), 'config', 'capcha'])
|
||||||
AND $this->getInput('formCapcha', helper::FILTER_INT) !== $this->getInput('formCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('formCapchaSecondNumber', helper::FILTER_INT))
|
and $this->getInput('formCapcha', helper::FILTER_INT) !== $this->getInput('formCapchaFirstNumber', helper::FILTER_INT) + $this->getInput('formCapchaSecondNumber', helper::FILTER_INT)
|
||||||
{
|
) {
|
||||||
self::$inputNotices['formCapcha'] = 'Incorrect';
|
self::$inputNotices['formCapcha'] = 'Incorrect';
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -343,7 +354,7 @@ class sondage extends common {
|
|||||||
case self::TYPE_DATETIME:
|
case self::TYPE_DATETIME:
|
||||||
$filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP
|
$filter = helper::FILTER_STRING_SHORT; // Mettre TYPE_DATETIME pour récupérer un TIMESTAMP
|
||||||
break;
|
break;
|
||||||
CASE self::TYPE_CHECKBOX:
|
case self::TYPE_CHECKBOX:
|
||||||
$filter = helper::FILTER_BOOLEAN;
|
$filter = helper::FILTER_BOOLEAN;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@ -360,9 +371,11 @@ class sondage extends common {
|
|||||||
// Envoi du mail
|
// Envoi du mail
|
||||||
// Rechercher l'adresse en fonction du mail
|
// Rechercher l'adresse en fonction du mail
|
||||||
$sent = true;
|
$sent = true;
|
||||||
$singleuser = $this->getData(['user',
|
$singleuser = $this->getData([
|
||||||
|
'user',
|
||||||
$this->getData(['module', $this->getUrl(0), 'config', 'user']),
|
$this->getData(['module', $this->getUrl(0), 'config', 'user']),
|
||||||
'mail']);
|
'mail'
|
||||||
|
]);
|
||||||
$singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']);
|
$singlemail = $this->getData(['module', $this->getUrl(0), 'config', 'mail']);
|
||||||
$group = $this->getData(['module', $this->getUrl(0), 'config', 'group']);
|
$group = $this->getData(['module', $this->getUrl(0), 'config', 'group']);
|
||||||
// Verification si le mail peut être envoyé
|
// Verification si le mail peut être envoyé
|
||||||
|
Loading…
Reference in New Issue
Block a user