diff options
author | vincent-peugnet <v.peugnet@free.fr> | 2018-11-11 22:04:49 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2018-11-11 22:04:49 +0100 |
commit | a64af357ff41a61f5248e2052274315b390e979c (patch) | |
tree | f08323727b1b2a1fc86f8290777cf847f9604334 /app/class/controllerart.php | |
parent | cea923a1e82a7e8ce696418c3a5a0f7703871101 (diff) | |
download | wcms-a64af357ff41a61f5248e2052274315b390e979c.tar.gz wcms-a64af357ff41a61f5248e2052274315b390e979c.zip |
clean
Diffstat (limited to 'app/class/controllerart.php')
-rw-r--r-- | app/class/controllerart.php | 38 |
1 files changed, 24 insertions, 14 deletions
diff --git a/app/class/controllerart.php b/app/class/controllerart.php index 9143375..0010f33 100644 --- a/app/class/controllerart.php +++ b/app/class/controllerart.php @@ -86,7 +86,7 @@ class Controllerart extends Controller $artlist = $this->artmanager->list(); - if(isset($_SESSION['workspace'])) { + if (isset($_SESSION['workspace'])) { $showleftpanel = $_SESSION['workspace']['showleftpanel']; $showrightpanel = $_SESSION['workspace']['showrightpanel']; } else { @@ -97,7 +97,7 @@ class Controllerart extends Controller $this->showtemplate('edit', ['art' => $this->art, 'artexist' => true, 'tablist' => $tablist, 'artlist' => $artlist, 'showleftpanel' => $showleftpanel, 'showrightpanel' => $showrightpanel]); } else { - $this->redirect('?id=' . $this->art->id()); + $this->routedirect('artread/', ['art' => $this->art->id()]); } } @@ -112,25 +112,35 @@ class Controllerart extends Controller public function add($id) { $this->setart($id); - $this->art->reset(); - $this->artmanager->add($this->art); - $this->redirect('?id=' . $this->art->id() . '&aff=edit'); + if ($this->user->canedit() && !$this->importart()) { + $this->art->reset(); + $this->artmanager->add($this->art); + $this->routedirect('artedit', ['art' => $this->art->id()]); + } else { + $this->routedirect('artread/', ['art' => $this->art->id()]); + } } - public function delete($id) + public function confirmdelete($id) { $this->setart($id); if ($this->user->canedit() && $this->importart()) { - if (isset($_POST['deleteconfirm']) && $_POST['deleteconfirm'] == true) { - $this->artmanager->delete($this->art); - $this->redirect('?id=' . $this->art->id()); - } else { - $this->showtemplate('delete', ['art' => $this->art, 'artexist' => true]); - } + $this->showtemplate('confirmdelete', ['art' => $this->art, 'artexist' => true]); + } else { - $this->redirect('?id=' . $this->art->id()); + $this->routedirect('artread/', ['art' => $this->art->id()]); + } + } + + public function delete($id) + { + $this->setart($id); + if ($this->user->canedit() && $this->importart()) { + + $this->artmanager->delete($this->art); } + $this->routedirect('backrouter'); } public function update($id) @@ -146,7 +156,7 @@ class Controllerart extends Controller } - $this->redirect('?id=' . $this->art->id() . '&aff=edit'); + $this->routedirect('artupdate', ['art' => $this->art->id()]); |