protection changement module

This commit is contained in:
Fred Tempez 2020-10-11 16:54:52 +02:00
parent 96041f1842
commit ef71b79225
2 changed files with 59 additions and 58 deletions

View File

@ -76,7 +76,8 @@ class page extends common {
$this->addOutput([
'access' => false
]);
} else {
return;
}
// Adresse sans le token
$url = explode('&',$this->getUrl(2));
// La page n'existe pas
@ -127,7 +128,6 @@ class page extends common {
'state' => true
]);
}
}
/**
@ -349,7 +349,8 @@ class page extends common {
}
}
// Supprime les données du module en cas de changement de module
if($this->getInput('pageEditModuleId') !== $this->getData(['page', $this->getUrl(2), 'moduleId'])) {
if( !empty($this->getInput('pageEditModuleId') )
AND $this->getInput('pageEditModuleId') !== $this->getData(['page', $this->getUrl(2), 'moduleId'])) {
$this->deleteData(['module', $pageId]);
}
// Supprime l'ancienne page si l'id a changée

View File

@ -51,12 +51,12 @@ echo template::formOpen('pageEditForm');
<div class="row">
<div class="col9">
<?php echo template::hidden('pageEditModuleRedirect'); ?>
<?php echo template::select('pageEditModuleId', $module::$moduleIds, [
<?php echo template::select('pageEditModuleId', $listModules, [
'help' => 'En cas de changement de module, les données du module précédent seront supprimées.',
'label' => 'Module',
'selected' => $this->getData(['page', $this->getUrl(2), 'moduleId']),
'disabled' => !($module::$actions['delete'] < $this->getUser('group'))
'selected' => $this->getData(['page', $this->getUrl(2), 'moduleId'])
]); ?>
<!-- Confirmation de suppression e ca sd'annulation -->
<?php echo template::hidden('pageEditModuleIdOld',['value' => $this->getData(['page', $this->getUrl(2), 'moduleId'])]); ?>
<?php echo template::hidden('pageEditModuleIdOldText',[
'value' => array_key_exists($this->getData(['page', $this->getUrl(2), 'moduleId']),$module::$moduleNames)? $module::$moduleNames[$this->getData(['page', $this->getUrl(2), 'moduleId'])] : ucfirst($this->getData(['page', $this->getUrl(2), 'moduleId']))