| <?php |
|
|
| namespace Kanboard\Model; |
|
|
| use Kanboard\Core\Base; |
|
|
| |
| |
| |
| |
| |
| |
| class ProjectNotificationModel extends Base |
| { |
| |
| |
| |
| |
| |
| |
| |
| |
| public function sendNotifications($project_id, $event_name, array $event_data) |
| { |
| $project = $this->projectModel->getById($project_id); |
|
|
| $types = array_merge( |
| $this->projectNotificationTypeModel->getHiddenTypes(), |
| $this->projectNotificationTypeModel->getSelectedTypes($project_id) |
| ); |
|
|
| foreach ($types as $type) { |
| $this->projectNotificationTypeModel->getType($type)->notifyProject($project, $event_name, $event_data); |
| } |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function saveSettings($project_id, array $values) |
| { |
| $this->db->startTransaction(); |
|
|
| $types = empty($values['notification_types']) ? array() : array_keys($values['notification_types']); |
| $this->projectNotificationTypeModel->saveSelectedTypes($project_id, $types); |
|
|
| $this->db->closeTransaction(); |
| } |
|
|
| |
| |
| |
| |
| |
| |
| |
| public function readSettings($project_id) |
| { |
| return array( |
| 'notification_types' => $this->projectNotificationTypeModel->getSelectedTypes($project_id), |
| ); |
| } |
| } |
|
|