From 48b40ec7bff777ca9c4c7ec2f91c8e803baab57b Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 30 Oct 2017 16:46:39 -0700 Subject: Add section for predefined contents --- .../ProjectPredefinedContentController.php | 61 ++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 app/Controller/ProjectPredefinedContentController.php (limited to 'app/Controller/ProjectPredefinedContentController.php') diff --git a/app/Controller/ProjectPredefinedContentController.php b/app/Controller/ProjectPredefinedContentController.php new file mode 100644 index 00000000..1195dfa3 --- /dev/null +++ b/app/Controller/ProjectPredefinedContentController.php @@ -0,0 +1,61 @@ +getProject(); + + $this->response->html($this->helper->layout->project('project_predefined_content/show', array( + 'values' => empty($values) ? $project : $values, + 'errors' => $errors, + 'project' => $project, + 'title' => t('Predefined Contents') + ))); + } + + /** + * Validate and update a project + * + * @access public + */ + public function update() + { + $project = $this->getProject(); + $values = $this->request->getValues(); + + $values = array( + 'id' => $project['id'], + 'name' => $project['name'], + 'predefined_email_subjects' => isset($values['predefined_email_subjects']) ? $values['predefined_email_subjects'] : '', + ); + + list($valid, $errors) = $this->projectValidator->validateModification($values); + + if ($valid) { + if ($this->projectModel->update($values)) { + $this->flash->success(t('Project updated successfully.')); + return $this->response->redirect($this->helper->url->to('ProjectPredefinedContentController', 'show', array('project_id' => $project['id'])), true); + } else { + $this->flash->failure(t('Unable to update this project.')); + } + } + + return $this->show($values, $errors); + } +} -- cgit v1.2.3