@@ 90-100 (lines=11) @@ | ||
87 | { |
|
88 | /** @var Group $group */ |
|
89 | $group = $this->Groups->get($id, ['contain' => []]); |
|
90 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
91 | $group = $this->Groups->patchEntity($group, $this->request->getData()); |
|
92 | if ($result = $this->Groups->save($group)) { |
|
93 | $this->Flash->success(__d('community', 'The group has been updated.')); |
|
94 | return $this->App->redirect([ |
|
95 | 'apply' => ['action' => 'edit', $result->id] |
|
96 | ]); |
|
97 | } else { |
|
98 | $this->Flash->error(__d('community', 'The group could not be updated. Please, try again.')); |
|
99 | } |
|
100 | } |
|
101 | ||
102 | $parents = $this->Groups->getTreeList(); |
|
103 | $this->set(compact('group', 'parents')); |
@@ 95-108 (lines=14) @@ | ||
92 | $user = $this->Users->get($id); |
|
93 | $groups = $this->Users->Groups->getTreeList(); |
|
94 | ||
95 | if ($this->request->is(['patch', 'post', 'put'])) { |
|
96 | $group = $this->Users->patchEntity($user, $this->request->getData()); |
|
97 | if ($result = $this->Users->save($group)) { |
|
98 | $this->Flash->success(__d('community', 'The user {0} has been saved.', sprintf( |
|
99 | '<strong>«%s»</strong>', |
|
100 | $result->get('login') |
|
101 | ))); |
|
102 | return $this->App->redirect([ |
|
103 | 'apply' => ['action' => 'edit', $result->id] |
|
104 | ]); |
|
105 | } else { |
|
106 | $this->Flash->error(__d('community', 'User could not be updated. Please, try again.')); |
|
107 | } |
|
108 | } |
|
109 | ||
110 | $this |
|
111 | ->set(compact('user', 'groups')) |