@@ 144-169 (lines=26) @@ | ||
141 | /** |
|
142 | * Remove a link. |
|
143 | */ |
|
144 | public function remove() |
|
145 | { |
|
146 | $task = $this->getTask(); |
|
147 | $link_id = $this->request->getIntegerParam('link_id'); |
|
148 | $link = $this->taskExternalLinkModel->getById($link_id); |
|
149 | ||
150 | if (empty($link)) { |
|
151 | throw new PageNotFoundException(); |
|
152 | } |
|
153 | ||
154 | if ($this->request->isPost()) { |
|
155 | $this->request->checkCSRFToken(); |
|
156 | if ($this->taskExternalLinkModel->remove($link_id)) { |
|
157 | $this->flash->success(t('Link removed successfully.')); |
|
158 | } else { |
|
159 | $this->flash->failure(t('Unable to remove this link.')); |
|
160 | } |
|
161 | ||
162 | return $this->response->redirect($this->helper->url->to('Task/TaskController', 'show', ['task_id' => $task['id'], 'project_id' => $task['project_id']])); |
|
163 | } |
|
164 | ||
165 | return $this->response->html($this->template->render('task/external_link/remove', [ |
|
166 | 'link' => $link, |
|
167 | 'task' => $task, |
|
168 | ])); |
|
169 | } |
|
170 | } |
|
171 |
@@ 133-154 (lines=22) @@ | ||
130 | /** |
|
131 | * Remove a custom role. |
|
132 | */ |
|
133 | public function remove() |
|
134 | { |
|
135 | $project = $this->getProject(); |
|
136 | $role_id = $this->request->getIntegerParam('role_id'); |
|
137 | ||
138 | if ($this->request->isPost()) { |
|
139 | $this->request->checkCSRFToken(); |
|
140 | if ($this->projectRoleModel->remove($project['id'], $role_id)) { |
|
141 | $this->flash->success(t('Custom project role removed successfully.')); |
|
142 | } else { |
|
143 | $this->flash->failure(t('Unable to remove this project role.')); |
|
144 | } |
|
145 | ||
146 | return $this->response->redirect($this->helper->url->to('Project/ProjectRoleController', 'show', ['project_id' => $project['id']])); |
|
147 | } |
|
148 | ||
149 | $role = $this->projectRoleModel->getById($project['id'], $role_id); |
|
150 | ||
151 | return $this->response->html($this->helper->layout->project('project/role/remove', [ |
|
152 | 'project' => $project, |
|
153 | 'role' => $role, |
|
154 | ])); |
|
155 | } |
|
156 | } |
|
157 |