forked from ZwiiCMS-Team/ZwiiCMS
Vérification erreur de saisie nom gallerie WIP
This commit is contained in:
parent
9d059aa01b
commit
5d8ad82ad6
@ -474,7 +474,7 @@ class common {
|
|||||||
// La clef est une chaine
|
// La clef est une chaine
|
||||||
else {
|
else {
|
||||||
foreach($this->input as $type => $values) {
|
foreach($this->input as $type => $values) {
|
||||||
// Champ obligatoire
|
// Champ obligatoire
|
||||||
if($required) {
|
if($required) {
|
||||||
$this->addRequiredInputNotices($key);
|
$this->addRequiredInputNotices($key);
|
||||||
}
|
}
|
||||||
|
@ -125,11 +125,12 @@ class gallery extends common {
|
|||||||
public function add() {
|
public function add() {
|
||||||
// Soumission du formulaire
|
// Soumission du formulaire
|
||||||
if($this->isPost()) {
|
if($this->isPost()) {
|
||||||
|
$success = false;
|
||||||
if (!empty($this->getInput('galleryAddName')) ) {
|
if (!empty($this->getInput('galleryAddName')) ) {
|
||||||
$galleryId = helper::increment($this->getInput('galleryAddName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0)]));
|
$galleryId = helper::increment($this->getInput('galleryAddName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0)]));
|
||||||
$this->setData(['module', $this->getUrl(0), $galleryId, [
|
$this->setData(['module', $this->getUrl(0), $galleryId, [
|
||||||
'config' => [
|
'config' => [
|
||||||
'name' => $this->getInput('galleryAddName',helper::FILTER_STRING_SHORT,true),
|
'name' => $this->getInput('galleryAddName',helper::FILTER_STRING_SHORT, true),
|
||||||
'directory' => $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true),
|
'directory' => $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true),
|
||||||
'sort' => $this->getInput('galleryAddSort'),
|
'sort' => $this->getInput('galleryAddSort'),
|
||||||
'order' => count($this->getData(['module',$this->getUrl(0)])) + 1
|
'order' => count($this->getData(['module',$this->getUrl(0)])) + 1
|
||||||
@ -137,14 +138,12 @@ class gallery extends common {
|
|||||||
'legend' => []
|
'legend' => []
|
||||||
]]);
|
]]);
|
||||||
$success = true;
|
$success = true;
|
||||||
} else {
|
|
||||||
$success = false;
|
|
||||||
}
|
}
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => $success === true ? helper::baseUrl() . $this->getUrl() . '/config' : helper::baseUrl() . $this->getUrl() . '/add',
|
'redirect' => $success ? helper::baseUrl() . $this->getUrl(0) . '/config' : helper::baseUrl() . $this->getUrl(0) . '/add',
|
||||||
'notification' => $success === true ? 'Modifications enregistrées' : 'Le nom de la galerie est obligatoire',
|
'notification' => $success ? 'Modifications enregistrées' : 'Le nom de la galerie est obligatoire',
|
||||||
'state' => $success
|
'state' => $success
|
||||||
]);
|
]);
|
||||||
} else {
|
} else {
|
||||||
// valeurs en sortie
|
// valeurs en sortie
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
<?php echo template::text('galleryAddName', [
|
<?php echo template::text('galleryAddName', [
|
||||||
'label' => 'Nom'
|
'label' => 'Nom de la galerie'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col4">
|
<div class="col4">
|
||||||
|
Loading…
x
Reference in New Issue
Block a user