diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-08-15 17:23:41 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-08-15 17:23:41 -0700 |
commit | 9eeded33f68872515954a2fc177fcb47a9273ae9 (patch) | |
tree | f3ef9507e087ca6bf3ce624232da240a8689b051 /app/Controller | |
parent | c539bdc8ab746c5afd48cf87de057dc38d50adac (diff) |
Add email notifications
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Base.php | 7 | ||||
-rw-r--r-- | app/Controller/Board.php | 2 | ||||
-rw-r--r-- | app/Controller/Config.php | 13 |
3 files changed, 16 insertions, 6 deletions
diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 7b1cfd85..11841e09 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -2,6 +2,7 @@ namespace Controller; +use Core\Tool; use Core\Registry; use Core\Security; use Core\Translator; @@ -24,6 +25,7 @@ use Model\LastLogin; * @property \Model\GitHub $gitHub * @property \Model\LastLogin $lastLogin * @property \Model\Ldap $ldap + * @property \Model\Notification $notification * @property \Model\Project $project * @property \Model\RememberMe $rememberMe * @property \Model\ReverseProxyAuth $reverseProxyAuth @@ -93,9 +95,7 @@ abstract class Base */ public function __get($name) { - $class = '\Model\\'.ucfirst($name); - $this->registry->$name = new $class($this->registry->shared('db'), $this->registry->shared('event')); - return $this->registry->shared($name); + return Tool::loadModel($this->registry, $name); } /** @@ -157,6 +157,7 @@ abstract class Base $this->action->attachEvents(); $this->project->attachEvents(); $this->webhook->attachEvents(); + $this->notification->attachEvents(); } /** diff --git a/app/Controller/Board.php b/app/Controller/Board.php index 14b1c02c..7fe9c4ae 100644 --- a/app/Controller/Board.php +++ b/app/Controller/Board.php @@ -373,7 +373,7 @@ class Board extends Base } if (isset($values['positions'])) { - $this->board->saveTasksPosition($values['positions']); + $this->board->saveTasksPosition($values['positions'], $values['selected_task_id']); } $this->response->html( diff --git a/app/Controller/Config.php b/app/Controller/Config.php index daa57790..498f3214 100644 --- a/app/Controller/Config.php +++ b/app/Controller/Config.php @@ -20,7 +20,8 @@ class Config extends Base $this->response->html($this->template->layout('config_index', array( 'db_size' => $this->config->getDatabaseSize(), 'user' => $_SESSION['user'], - 'projects' => $this->project->getList(), + 'user_projects' => $this->project->getAvailableList($this->acl->getUserId()), + 'notifications' => $this->notification->readSettings($this->acl->getUserId()), 'languages' => $this->config->getLanguages(), 'values' => $this->config->getAll(), 'errors' => array(), @@ -32,6 +33,13 @@ class Config extends Base ))); } + public function notifications() + { + $values = $this->request->getValues(); + $this->notification->saveSettings($this->acl->getUserId(), $values); + $this->response->redirect('?controller=config#notifications'); + } + /** * Validate and save settings * @@ -57,7 +65,8 @@ class Config extends Base $this->response->html($this->template->layout('config_index', array( 'db_size' => $this->config->getDatabaseSize(), 'user' => $_SESSION['user'], - 'projects' => $this->project->getList(), + 'user_projects' => $this->project->getAvailableList($this->acl->getUserId()), + 'notifications' => $this->notification->readSettings($this->acl->getUserId()), 'languages' => $this->config->getLanguages(), 'values' => $values, 'errors' => $errors, |