From 8ac5a09605992f1e434cb793ceca7497c6f46d23 Mon Sep 17 00:00:00 2001 From: n-peugnet Date: Wed, 30 Jan 2019 21:15:17 +0100 Subject: feat: editBy to store the current editor of an art --- app/class/controllerart.php | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) (limited to 'app/class/controllerart.php') 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']); -- cgit v1.2.3