From abdf6f97800e7e838b5841820815385b183bab67 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 16 May 2016 20:19:07 -0400 Subject: Improve group controllers and views --- app/Controller/GroupModificationController.php | 53 ++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 app/Controller/GroupModificationController.php (limited to 'app/Controller/GroupModificationController.php') diff --git a/app/Controller/GroupModificationController.php b/app/Controller/GroupModificationController.php new file mode 100644 index 00000000..1f225a14 --- /dev/null +++ b/app/Controller/GroupModificationController.php @@ -0,0 +1,53 @@ +group->getById($this->request->getIntegerParam('group_id')); + } + + $this->response->html($this->template->render('group_modification/show', array( + 'errors' => $errors, + 'values' => $values, + ))); + } + + /** + * Validate and save a group + * + * @access public + */ + public function save() + { + $values = $this->request->getValues(); + list($valid, $errors) = $this->groupValidator->validateModification($values); + + if ($valid) { + if ($this->group->update($values) !== false) { + $this->flash->success(t('Group updated successfully.')); + return $this->response->redirect($this->helper->url->to('GroupListController', 'index'), true); + } else { + $this->flash->failure(t('Unable to update your group.')); + } + } + + return $this->show($values, $errors); + } +} -- cgit v1.2.3