aboutsummaryrefslogtreecommitdiff
path: root/app/class/Controllerpage.php
diff options
context:
space:
mode:
authorvincent-peugnet <v.peugnet@free.fr>2020-04-14 16:36:45 +0200
committervincent-peugnet <v.peugnet@free.fr>2020-04-14 16:36:45 +0200
commit8ccc4ac00c974ba3659762e6c67f75ed82020e37 (patch)
treefc9a5b656ca13b34cb2eaac6e909b0b59ca839e8 /app/class/Controllerpage.php
parentce3fcb72f2d5d154461a14183069bf87db1e5776 (diff)
downloadwcms-8ccc4ac00c974ba3659762e6c67f75ed82020e37.tar.gz
wcms-8ccc4ac00c974ba3659762e6c67f75ed82020e37.zip
finish flashmessages implementation
+ clean css
Diffstat (limited to 'app/class/Controllerpage.php')
-rw-r--r--app/class/Controllerpage.php36
1 files changed, 21 insertions, 15 deletions
diff --git a/app/class/Controllerpage.php b/app/class/Controllerpage.php
index 909a2c2..990f0b7 100644
--- a/app/class/Controllerpage.php
+++ b/app/class/Controllerpage.php
@@ -279,25 +279,31 @@ class Controllerpage extends Controller
{
$page = $this->pagemanager->getfromfile();
+ if($page !== false) {
- if(!empty($_POST['id'])) {
- $page->setid(idclean($_POST['id']));
- }
-
- if($_POST['datecreation']) {
- $page->setdatecreation($this->now);
- }
-
- if($_POST['author']) {
- $page->setauthors([$this->user->id()]);
- }
-
- $page->setdaterender($page->datecreation('date'));
+ if(!empty($_POST['id'])) {
+ $page->setid(idclean($_POST['id']));
+ }
+
+ if($_POST['datecreation']) {
+ $page->setdatecreation($this->now);
+ }
+
+ if($_POST['author']) {
+ $page->setauthors([$this->user->id()]);
+ }
+
+ $page->setdaterender($page->datecreation('date'));
- if($page !== false) {
if($_POST['erase'] || $this->pagemanager->get($page) === false) {
- $this->pagemanager->add($page);
+ if($this->pagemanager->add($page)) {
+ Model::sendflashmessage('Page successfully uploaded', 'success');
+ }
+ } else {
+ Model::sendflashmessage('Page ID already exist, check remplace if you want to erase it', 'warning');
}
+ } else {
+ Model::sendflashmessage('Error while importing page JSON', 'error');
}
$this->routedirect('home');
}