@@ 117-133 (lines=17) @@ | ||
114 | * |
|
115 | * @return array |
|
116 | */ |
|
117 | public function getAllByRole($project_id, $role) |
|
118 | { |
|
119 | return $this->db |
|
120 | ->table(self::TABLE) |
|
121 | ->columns( |
|
122 | self::TABLE.'.restriction_id', |
|
123 | self::TABLE.'.project_id', |
|
124 | self::TABLE.'.role_id', |
|
125 | self::TABLE.'.column_id', |
|
126 | self::TABLE.'.rule', |
|
127 | 'pr.role' |
|
128 | ) |
|
129 | ->eq(self::TABLE.'.project_id', $project_id) |
|
130 | ->eq('pr.role', $role) |
|
131 | ->left(ProjectRoleModel::TABLE, 'pr', 'role_id', self::TABLE, 'role_id') |
|
132 | ->findAll(); |
|
133 | } |
|
134 | ||
135 | /** |
|
136 | * Create a new column restriction. |
@@ 99-114 (lines=16) @@ | ||
96 | * |
|
97 | * @return array |
|
98 | */ |
|
99 | public function getAllByRole($project_id, $role) |
|
100 | { |
|
101 | return $this->db |
|
102 | ->table(self::TABLE) |
|
103 | ->columns( |
|
104 | self::TABLE.'.restriction_id', |
|
105 | self::TABLE.'.project_id', |
|
106 | self::TABLE.'.role_id', |
|
107 | self::TABLE.'.rule', |
|
108 | 'pr.role' |
|
109 | ) |
|
110 | ->eq(self::TABLE.'.project_id', $project_id) |
|
111 | ->eq('role', $role) |
|
112 | ->left(ProjectRoleModel::TABLE, 'pr', 'role_id', self::TABLE, 'role_id') |
|
113 | ->findAll(); |
|
114 | } |
|
115 | ||
116 | /** |
|
117 | * Create a new restriction. |
@@ 104-113 (lines=10) @@ | ||
101 | * |
|
102 | * @return array |
|
103 | */ |
|
104 | public function getUsers($project_id) |
|
105 | { |
|
106 | return $this->db->table(self::TABLE) |
|
107 | ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', self::TABLE.'.role') |
|
108 | ->join(UserModel::TABLE, 'id', 'user_id') |
|
109 | ->eq('project_id', $project_id) |
|
110 | ->asc(UserModel::TABLE.'.username') |
|
111 | ->asc(UserModel::TABLE.'.name') |
|
112 | ->findAll(); |
|
113 | } |
|
114 | ||
115 | /** |
|
116 | * Get all users (fetch users from groups). |
@@ 59-74 (lines=16) @@ | ||
56 | * |
|
57 | * @return array |
|
58 | */ |
|
59 | public function getById($task_link_id) |
|
60 | { |
|
61 | return $this->db |
|
62 | ->table(self::TABLE) |
|
63 | ->columns( |
|
64 | self::TABLE.'.id', |
|
65 | self::TABLE.'.opposite_task_id', |
|
66 | self::TABLE.'.task_id', |
|
67 | self::TABLE.'.link_id', |
|
68 | LinkModel::TABLE.'.label', |
|
69 | LinkModel::TABLE.'.opposite_id AS opposite_link_id' |
|
70 | ) |
|
71 | ->eq(self::TABLE.'.id', $task_link_id) |
|
72 | ->join(LinkModel::TABLE, 'id', 'link_id') |
|
73 | ->findOne(); |
|
74 | } |
|
75 | ||
76 | /** |
|
77 | * Get the opposite task link (use the unique index task_has_links_unique). |
@@ 206-215 (lines=10) @@ | ||
203 | * |
|
204 | * @return array |
|
205 | */ |
|
206 | private function getEverybodyWithNotificationEnabled($exclude_user_id) |
|
207 | { |
|
208 | return $this->db |
|
209 | ->table(UserModel::TABLE) |
|
210 | ->columns(UserModel::TABLE.'.id', UserModel::TABLE.'.username', UserModel::TABLE.'.name', UserModel::TABLE.'.email', UserModel::TABLE.'.language', UserModel::TABLE.'.notifications_filter') |
|
211 | ->eq('notifications_enabled', '1') |
|
212 | ->neq(UserModel::TABLE.'.id', $exclude_user_id) |
|
213 | ->eq(UserModel::TABLE.'.is_active', 1) |
|
214 | ->findAll(); |
|
215 | } |
|
216 | } |
|
217 |