diff options
author | n-peugnet <n.peugnet@free.fr> | 2019-01-30 21:15:17 +0100 |
---|---|---|
committer | vincent-peugnet <v.peugnet@free.fr> | 2019-01-30 23:16:26 +0100 |
commit | 8ac5a09605992f1e434cb793ceca7497c6f46d23 (patch) | |
tree | 091f9879f8f94b849300fef2d1a1238f3881f78e /app/class/controllerart.php | |
parent | 396a5776cd043e899e4897ec50fc8edc52585512 (diff) | |
download | wcms-8ac5a09605992f1e434cb793ceca7497c6f46d23.tar.gz wcms-8ac5a09605992f1e434cb793ceca7497c6f46d23.zip |
feat: editBy to store the current editor of an art
Diffstat (limited to 'app/class/controllerart.php')
-rw-r--r-- | app/class/controllerart.php | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/app/class/controllerart.php b/app/class/controllerart.php index ef720a1..dfdde7f 100644 --- a/app/class/controllerart.php +++ b/app/class/controllerart.php @@ -275,6 +275,7 @@ class Controllerart extends Controller $this->art->hydrate($date); $this->art->updateedited(); $this->art->addauthor($this->user->id()); + $this->art->removeeditby($this->user->id()); $this->artmanager->update($this->art); @@ -293,6 +294,41 @@ class Controllerart extends Controller $this->routedirect('art'); } + /** + * This function set the actual editor of the page + * + * @param string $artid as the page id + */ + public function editby(string $artid) + { + $this->art = new Art2(['id' => $artid]); + if($this->importart($artid)) { + $this->art->addeditby($this->user->id()); + $this->artmanager->update($this->art); + echo json_encode(['success' => true]); + } else { + $this->error(400); + } + } + + /** + * This function remove the actual editor of the page + * + * @param string $artid as the page id + */ + public function removeeditby(string $artid) + { + $this->art = new Art2(['id' => $artid]); + if($this->importart($artid)) { + $this->art->removeeditby($this->user->id()); + $this->artmanager->update($this->art); + echo json_encode(['success' => true]); + } else { + $this->error(400); + } + } + + public function movepanels() { $_SESSION['workspace']['showrightpanel'] = isset($_POST['workspace']['showrightpanel']); |