| 4388 |
nelberth |
1 |
<?php
|
|
|
2 |
declare(strict_types=1);
|
|
|
3 |
|
|
|
4 |
namespace LeadersLinked\Controller;
|
|
|
5 |
|
|
|
6 |
use Laminas\Authentication\AuthenticationService;
|
|
|
7 |
use Laminas\Authentication\Result as AuthResult;
|
|
|
8 |
use Laminas\Db\Adapter\AdapterInterface;
|
|
|
9 |
use Laminas\Cache\Storage\Adapter\AbstractAdapter;
|
|
|
10 |
use Laminas\Mvc\Controller\AbstractActionController;
|
|
|
11 |
use Laminas\Mvc\I18n\Translator;
|
|
|
12 |
use Laminas\Log\LoggerInterface;
|
|
|
13 |
use Laminas\View\Model\ViewModel;
|
|
|
14 |
use Laminas\View\Model\JsonModel;
|
|
|
15 |
use LeadersLinked\Hydrator\ObjectPropertyHydrator;
|
| 4469 |
nelberth |
16 |
use LeadersLinked\Library\Functions;
|
| 4396 |
nelberth |
17 |
use LeadersLinked\Mapper\IndustryMapper;
|
|
|
18 |
use LeadersLinked\Mapper\GroupTypeMapper;
|
|
|
19 |
use LeadersLinked\Mapper\GroupMemberMapper;
|
|
|
20 |
use LeadersLinked\Mapper\QueryMapper;
|
| 4443 |
nelberth |
21 |
use LeadersLinked\Mapper\GroupMapper;
|
| 4396 |
nelberth |
22 |
use LeadersLinked\Model\GroupMember;
|
| 4441 |
nelberth |
23 |
use LeadersLinked\Model\Group;
|
| 4396 |
nelberth |
24 |
|
| 4480 |
nelberth |
25 |
use LeadersLinked\Form\ExtendedForm;
|
| 4401 |
nelberth |
26 |
|
| 4486 |
nelberth |
27 |
use LeadersLinked\Form\Group\AccessibilityForm;
|
|
|
28 |
use LeadersLinked\Form\Group\CoverForm;
|
|
|
29 |
use LeadersLinked\Form\Group\GroupTypeForm;
|
|
|
30 |
use LeadersLinked\Form\Group\ImageForm;
|
|
|
31 |
use LeadersLinked\Form\Group\IndustryForm;
|
|
|
32 |
use LeadersLinked\Form\Group\PrivacyForm;
|
|
|
33 |
use LeadersLinked\Form\Group\WebsiteForm;
|
| 4401 |
nelberth |
34 |
|
| 4481 |
nelberth |
35 |
|
| 4401 |
nelberth |
36 |
use LeadersLinked\Form\HighPerformanceTeamsMyGroupsForm;
|
|
|
37 |
|
| 4388 |
nelberth |
38 |
class HighPerformanceTeamsMyGroupsController extends AbstractActionController
|
|
|
39 |
{
|
|
|
40 |
/**
|
|
|
41 |
*
|
|
|
42 |
* @var AdapterInterface
|
|
|
43 |
*/
|
|
|
44 |
private $adapter;
|
|
|
45 |
|
|
|
46 |
|
|
|
47 |
/**
|
|
|
48 |
*
|
|
|
49 |
* @var AbstractAdapter
|
|
|
50 |
*/
|
|
|
51 |
private $cache;
|
|
|
52 |
|
|
|
53 |
/**
|
|
|
54 |
*
|
|
|
55 |
* @var LoggerInterface
|
|
|
56 |
*/
|
|
|
57 |
private $logger;
|
|
|
58 |
|
|
|
59 |
/**
|
|
|
60 |
*
|
|
|
61 |
* @var array
|
|
|
62 |
*/
|
|
|
63 |
private $config;
|
|
|
64 |
|
|
|
65 |
|
|
|
66 |
|
|
|
67 |
/**
|
|
|
68 |
*
|
|
|
69 |
* @param AdapterInterface $adapter
|
|
|
70 |
* @param AbstractAdapter $cache
|
|
|
71 |
* @param LoggerInterface $logger
|
|
|
72 |
* @param array $config
|
|
|
73 |
*/
|
|
|
74 |
public function __construct($adapter, $cache , $logger, $config)
|
|
|
75 |
{
|
|
|
76 |
$this->adapter = $adapter;
|
|
|
77 |
$this->cache = $cache;
|
|
|
78 |
$this->logger = $logger;
|
|
|
79 |
$this->config = $config;
|
|
|
80 |
|
|
|
81 |
|
|
|
82 |
}
|
|
|
83 |
public function indexAction()
|
|
|
84 |
{
|
| 4396 |
nelberth |
85 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
86 |
$currentUser = $currentUserPlugin->getUser();
|
| 4447 |
nelberth |
87 |
|
|
|
88 |
$currentCompany = $currentUserPlugin->getCompany();
|
| 4436 |
nelberth |
89 |
|
| 4388 |
nelberth |
90 |
|
|
|
91 |
$request = $this->getRequest();
|
|
|
92 |
if($request->isGet()) {
|
|
|
93 |
|
|
|
94 |
|
| 4396 |
nelberth |
95 |
$headers = $request->getHeaders();
|
| 4388 |
nelberth |
96 |
|
| 4396 |
nelberth |
97 |
$isJson = false;
|
|
|
98 |
if($headers->has('Accept')) {
|
|
|
99 |
$accept = $headers->get('Accept');
|
|
|
100 |
|
|
|
101 |
$prioritized = $accept->getPrioritized();
|
|
|
102 |
|
|
|
103 |
foreach($prioritized as $key => $value) {
|
|
|
104 |
$raw = trim($value->getRaw());
|
|
|
105 |
|
|
|
106 |
if(!$isJson) {
|
|
|
107 |
$isJson = strpos($raw, 'json');
|
|
|
108 |
}
|
|
|
109 |
|
|
|
110 |
}
|
|
|
111 |
}
|
|
|
112 |
|
|
|
113 |
if($isJson) {
|
| 4438 |
nelberth |
114 |
|
| 4396 |
nelberth |
115 |
$search = trim(filter_var($this->params()->fromQuery('search', ''), FILTER_SANITIZE_STRING));
|
|
|
116 |
|
|
|
117 |
$acl = $this->getEvent()->getViewModel()->getVariable('acl');
|
| 4439 |
nelberth |
118 |
// $allowView = $acl->isAllowed($currentUser->usertype_id, 'high-performance-teams/my-groups/view');
|
|
|
119 |
$allowEdit = $acl->isAllowed($currentUser->usertype_id, 'high-performance-teams/my-groups/edit');
|
|
|
120 |
$allowDelete = $acl->isAllowed($currentUser->usertype_id, 'high-performance-teams/my-groups/delete');
|
| 4440 |
nelberth |
121 |
|
| 4396 |
nelberth |
122 |
|
|
|
123 |
$queryMapper = QueryMapper::getInstance($this->adapter);
|
|
|
124 |
|
|
|
125 |
$select = $queryMapper->getSql()->select(GroupMapper::_TABLE);
|
|
|
126 |
$select->columns(['id', 'uuid', 'name', 'privacy', 'image', 'status']);
|
|
|
127 |
$select->where->equalTo('status', Group::STATUS_ACTIVE);
|
| 4442 |
nelberth |
128 |
|
| 4444 |
nelberth |
129 |
|
| 4396 |
nelberth |
130 |
if($search) {
|
|
|
131 |
$select->where->like('name', '%' . $search . '%');
|
|
|
132 |
}
|
| 4447 |
nelberth |
133 |
$select->where->equalTo('user_id', $currentUser->id)->equalTo('company_id', $currentCompany->id);
|
| 4396 |
nelberth |
134 |
$select->order('name ASC');
|
|
|
135 |
|
|
|
136 |
$records = $queryMapper->fetchAll($select);
|
| 4442 |
nelberth |
137 |
|
| 4396 |
nelberth |
138 |
$values = [
|
|
|
139 |
Group::PRIVACY_IS_PRIVATE => 'LABEL_PRIVATE',
|
|
|
140 |
Group::PRIVACY_IS_PUBLIC => 'LABEL_PUBLIC'
|
|
|
141 |
];
|
|
|
142 |
|
| 4446 |
nelberth |
143 |
|
| 4396 |
nelberth |
144 |
$items = [];
|
|
|
145 |
foreach($records as $record)
|
|
|
146 |
{
|
|
|
147 |
|
|
|
148 |
$item = [
|
|
|
149 |
'name' => $record['name'],
|
|
|
150 |
'privacy' => $values[$record['privacy']],
|
|
|
151 |
'image' => $this->url()->fromRoute('storage', ['type' => 'group', 'code' => $record['uuid'], 'filename' => $record['image'] ]),
|
| 4439 |
nelberth |
152 |
//'link_view' => $allowView ? $this->url()->fromRoute('group/view', ['id' => $record['uuid'] ]) : '',
|
| 4446 |
nelberth |
153 |
'link_edit' => $allowEdit ? $this->url()->fromRoute('high-performance-teams/my-groups/edit', ['id' => $record['uuid'] ]) : '',
|
|
|
154 |
'link_delete' => $allowDelete ? $this->url()->fromRoute('high-performance-teams/my-groups/delete', ['id' => $record['uuid'] ]) : '',
|
| 4396 |
nelberth |
155 |
|
|
|
156 |
];
|
|
|
157 |
|
|
|
158 |
array_push($items, $item);
|
|
|
159 |
}
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
$response = [
|
|
|
164 |
'success' => true,
|
|
|
165 |
'data' => $items
|
|
|
166 |
];
|
|
|
167 |
|
|
|
168 |
return new JsonModel($response);
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
} else {
|
|
|
172 |
$industries = [];
|
|
|
173 |
$industryMapper = IndustryMapper::getInstance($this->adapter);
|
|
|
174 |
$records = $industryMapper->fetchAllActives();
|
|
|
175 |
foreach($records as $record)
|
|
|
176 |
{
|
|
|
177 |
$industries[$record->uuid] = $record->name;
|
|
|
178 |
}
|
|
|
179 |
|
|
|
180 |
$groupTypes = [];
|
|
|
181 |
$groupTypeMapper = GroupTypeMapper::getInstance($this->adapter);
|
|
|
182 |
$records = $groupTypeMapper->fetchAllActives();
|
|
|
183 |
foreach($records as $record)
|
|
|
184 |
{
|
|
|
185 |
$groupTypes[$record->uuid] = $record->name;
|
|
|
186 |
}
|
|
|
187 |
|
| 4401 |
nelberth |
188 |
$formAdd = new HighPerformanceTeamsMyGroupsForm($this->adapter);
|
| 4396 |
nelberth |
189 |
|
|
|
190 |
$this->layout()->setTemplate('layout/layout-backend');
|
|
|
191 |
$viewModel = new ViewModel();
|
|
|
192 |
$viewModel->setTemplate('leaders-linked/high-performance-teams-my-groups/index.phtml');
|
|
|
193 |
$viewModel->setVariables([
|
|
|
194 |
'industries' => $industries,
|
|
|
195 |
'types' => $groupTypes,
|
|
|
196 |
'formAdd' => $formAdd
|
|
|
197 |
]);
|
|
|
198 |
return $viewModel ;
|
|
|
199 |
}
|
|
|
200 |
|
| 4388 |
nelberth |
201 |
} else {
|
|
|
202 |
return new JsonModel([
|
|
|
203 |
'success' => false,
|
|
|
204 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
| 4396 |
nelberth |
205 |
]);
|
| 4388 |
nelberth |
206 |
}
|
|
|
207 |
}
|
| 4449 |
nelberth |
208 |
|
| 4448 |
nelberth |
209 |
public function addAction()
|
|
|
210 |
{
|
|
|
211 |
$request = $this->getRequest();
|
| 4452 |
nelberth |
212 |
|
| 4460 |
nelberth |
213 |
|
| 4452 |
nelberth |
214 |
|
| 4448 |
nelberth |
215 |
if($request->isPost()) {
|
| 4456 |
nelberth |
216 |
$form = new HighPerformanceTeamsMyGroupsForm($this->adapter);
|
| 4448 |
nelberth |
217 |
$dataPost = $request->getPost()->toArray();
|
|
|
218 |
|
|
|
219 |
$form->setData($dataPost);
|
|
|
220 |
|
|
|
221 |
if($form->isValid()) {
|
|
|
222 |
|
| 4454 |
nelberth |
223 |
|
| 4448 |
nelberth |
224 |
$currentUserPlugin = $this->plugin('currentUserPlugin');
|
|
|
225 |
$currentUser = $currentUserPlugin->getUser();
|
| 4452 |
nelberth |
226 |
$currentCompany = $currentUserPlugin->getCompany();
|
| 4448 |
nelberth |
227 |
|
|
|
228 |
$dataPost = (array) $form->getData();
|
| 4396 |
nelberth |
229 |
|
| 4448 |
nelberth |
230 |
$industryMapper = IndustryMapper::getInstance($this->adapter);
|
|
|
231 |
$industry = $industryMapper->fetchOneByUuid($dataPost['industry_id']);
|
|
|
232 |
|
|
|
233 |
$groupTypeMapper = GroupTypeMapper::getInstance($this->adapter);
|
|
|
234 |
$groupType = $groupTypeMapper->fetchOneByUuid($dataPost['type_id']);
|
|
|
235 |
|
| 4462 |
nelberth |
236 |
|
| 4448 |
nelberth |
237 |
$group = new Group();
|
|
|
238 |
$group->name = $dataPost['name'];
|
|
|
239 |
$group->industry_id = $industry->id;
|
|
|
240 |
$group->type_id = $groupType->id;
|
|
|
241 |
$group->user_id = $currentUser->id;
|
| 4449 |
nelberth |
242 |
$group->company_id = $currentCompany->id;
|
| 4448 |
nelberth |
243 |
|
|
|
244 |
$groupMapper = GroupMapper::getInstance($this->adapter);
|
| 4458 |
nelberth |
245 |
$result = $groupMapper->insert($group);
|
| 4448 |
nelberth |
246 |
|
|
|
247 |
if($result) {
|
| 4463 |
nelberth |
248 |
|
| 4448 |
nelberth |
249 |
$groupMember = new GroupMember();
|
|
|
250 |
$groupMember->group_id = $group->id;
|
|
|
251 |
$groupMember->user_id = $group->user_id;
|
|
|
252 |
$groupMember->status = GroupMember::STATUS_ACCEPTED;
|
|
|
253 |
|
|
|
254 |
$groupMemberMapper = GroupMemberMapper::getInstance($this->adapter);
|
|
|
255 |
$groupMemberMapper->insert($groupMember);
|
|
|
256 |
|
| 4467 |
nelberth |
257 |
|
|
|
258 |
$this->logger->info('Se agrego el grupo : ' . $group->name, ['user_id' => $group->user_id, 'ip' => Functions::getUserIP()]);
|
| 4465 |
nelberth |
259 |
return new JsonModel([
|
|
|
260 |
'success' => true,
|
|
|
261 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
262 |
]);
|
| 4448 |
nelberth |
263 |
$data = [
|
|
|
264 |
'success' => true,
|
|
|
265 |
'data' => 'LABEL_RECORD_ADDED'
|
|
|
266 |
];
|
|
|
267 |
} else {
|
|
|
268 |
$data = [
|
|
|
269 |
'success' => false,
|
|
|
270 |
'data' => $group->getError()
|
|
|
271 |
];
|
|
|
272 |
|
|
|
273 |
}
|
|
|
274 |
|
|
|
275 |
return new JsonModel($data);
|
|
|
276 |
|
|
|
277 |
} else {
|
|
|
278 |
$messages = [];
|
|
|
279 |
$form_messages = (array) $form->getMessages();
|
|
|
280 |
foreach($form_messages as $fieldname => $field_messages)
|
|
|
281 |
{
|
|
|
282 |
|
|
|
283 |
$messages[$fieldname] = array_values($field_messages);
|
|
|
284 |
}
|
|
|
285 |
|
|
|
286 |
return new JsonModel([
|
|
|
287 |
'success' => false,
|
|
|
288 |
'data' => $messages
|
|
|
289 |
]);
|
|
|
290 |
}
|
|
|
291 |
|
|
|
292 |
} else {
|
|
|
293 |
$data = [
|
|
|
294 |
'success' => false,
|
|
|
295 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
296 |
];
|
|
|
297 |
|
|
|
298 |
return new JsonModel($data);
|
|
|
299 |
}
|
|
|
300 |
|
|
|
301 |
return new JsonModel($data);
|
|
|
302 |
}
|
| 4470 |
nelberth |
303 |
|
|
|
304 |
public function deleteAction()
|
|
|
305 |
{
|
| 4471 |
nelberth |
306 |
|
| 4470 |
nelberth |
307 |
$request = $this->getRequest();
|
|
|
308 |
$id = $this->params()->fromRoute('id');
|
|
|
309 |
|
|
|
310 |
if(!$id) {
|
|
|
311 |
$data = [
|
|
|
312 |
'success' => false,
|
|
|
313 |
'data' => 'ERROR_INVALID_PARAMETER'
|
|
|
314 |
];
|
|
|
315 |
|
|
|
316 |
return new JsonModel($data);
|
|
|
317 |
}
|
|
|
318 |
|
|
|
319 |
$groupMapper =GroupMapper::getInstance($this->adapter);
|
|
|
320 |
$group = $groupMapper->fetchOneByUuid($id);
|
|
|
321 |
if(!$group) {
|
|
|
322 |
$data = [
|
|
|
323 |
'success' => false,
|
|
|
324 |
'data' => 'ERROR_RECORD_NOT_FOUND'
|
|
|
325 |
];
|
|
|
326 |
|
|
|
327 |
return new JsonModel($data);
|
|
|
328 |
}
|
|
|
329 |
|
|
|
330 |
$currentUser = $this->plugin('currentUserPlugin');
|
|
|
331 |
if($currentUser->getUserId() != $group->user_id) {
|
|
|
332 |
$response = [
|
|
|
333 |
'success' => false,
|
|
|
334 |
'data' => 'ERROR_UNAUTHORIZED'
|
|
|
335 |
];
|
|
|
336 |
|
|
|
337 |
return new JsonModel($response);
|
|
|
338 |
}
|
|
|
339 |
|
|
|
340 |
|
|
|
341 |
if($request->isPost()) {
|
| 4474 |
nelberth |
342 |
|
|
|
343 |
$result = $groupMapper->delete($group);
|
| 4475 |
nelberth |
344 |
|
| 4470 |
nelberth |
345 |
if($result) {
|
|
|
346 |
$this->logger->info('Se borro el grupo : ' . $group->name, ['user_id' => $group->user_id, 'ip' => Functions::getUserIP()]);
|
|
|
347 |
|
|
|
348 |
$data = [
|
|
|
349 |
'success' => true,
|
|
|
350 |
'data' => 'LABEL_RECORD_DELETED'
|
|
|
351 |
];
|
|
|
352 |
} else {
|
|
|
353 |
|
|
|
354 |
$data = [
|
|
|
355 |
'success' => false,
|
|
|
356 |
'data' => $groupMapper->getError()
|
|
|
357 |
];
|
|
|
358 |
|
|
|
359 |
return new JsonModel($data);
|
|
|
360 |
}
|
|
|
361 |
|
|
|
362 |
} else {
|
|
|
363 |
$data = [
|
|
|
364 |
'success' => false,
|
|
|
365 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
366 |
];
|
|
|
367 |
|
|
|
368 |
return new JsonModel($data);
|
|
|
369 |
}
|
|
|
370 |
|
|
|
371 |
return new JsonModel($data);
|
|
|
372 |
}
|
| 4478 |
nelberth |
373 |
public function editAction()
|
|
|
374 |
{
|
|
|
375 |
$flashMessenger = $this->plugin('FlashMessenger');
|
|
|
376 |
|
|
|
377 |
|
|
|
378 |
$request = $this->getRequest();
|
|
|
379 |
$id = $this->params()->fromRoute('id');
|
|
|
380 |
|
|
|
381 |
|
|
|
382 |
if(!$id) {
|
|
|
383 |
$flashMessenger->addErrorMessage('ERROR_INVALID_PARAMETER');
|
|
|
384 |
return $this->redirect()->toRoute('dashboard');
|
|
|
385 |
}
|
|
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
|
389 |
$groupMapper =GroupMapper::getInstance($this->adapter);
|
|
|
390 |
$group = $groupMapper->fetchOneByUuid($id);
|
|
|
391 |
if(!$group) {
|
|
|
392 |
$flashMessenger->addErrorMessage('ERROR_RECORD_NOT_FOUND');
|
|
|
393 |
return $this->redirect()->toRoute('dashboard');
|
|
|
394 |
}
|
|
|
395 |
|
|
|
396 |
$currentUser = $this->plugin('currentUserPlugin');
|
|
|
397 |
if($currentUser->getUserId() != $group->user_id) {
|
|
|
398 |
$flashMessenger->addErrorMessage('ERROR_UNAUTHORIZED');
|
|
|
399 |
return $this->redirect()->toRoute('dashboard');
|
|
|
400 |
}
|
|
|
401 |
|
|
|
402 |
|
|
|
403 |
if($request->isGet()) {
|
|
|
404 |
|
|
|
405 |
$accessibilities = [
|
|
|
406 |
Group::ACCESSIBILITY_AUTO_JOIN => 'LABEL_AUTO_JOIN',
|
|
|
407 |
Group::ACCESSIBILITY_REQUEST_TO_JOIN => 'LABEL_REQUEST_TO_JOIN',
|
|
|
408 |
Group::ACCESSIBILITY_ADMIN_WILL_ADD => 'LABEL_ADMIN_WILL_ADD',
|
|
|
409 |
];
|
|
|
410 |
|
|
|
411 |
$accessibility = $accessibilities[$group->accessibility];
|
|
|
412 |
|
|
|
413 |
$privacies = [
|
|
|
414 |
Group::PRIVACY_IS_PRIVATE => 'LABEL_PRIVATE',
|
|
|
415 |
Group::PRIVACY_IS_PUBLIC => 'LABEL_PUBLIC'
|
|
|
416 |
];
|
|
|
417 |
|
|
|
418 |
$privacy = $privacies[$group->privacy];
|
|
|
419 |
|
|
|
420 |
$industryMapper = IndustryMapper::getInstance($this->adapter);
|
|
|
421 |
$record = $industryMapper->fetchOne($group->industry_id);
|
|
|
422 |
|
|
|
423 |
$industry = $record->name;
|
|
|
424 |
|
|
|
425 |
|
|
|
426 |
$industries = [];
|
|
|
427 |
$records = $industryMapper->fetchAllActives();
|
|
|
428 |
foreach($records as $record)
|
|
|
429 |
{
|
|
|
430 |
$industries[$record->uuid] = $record->name;
|
|
|
431 |
}
|
|
|
432 |
|
|
|
433 |
|
|
|
434 |
$groupTypeMapper = GroupTypeMapper::getInstance($this->adapter);
|
|
|
435 |
$record = $groupTypeMapper->fetchOne($group->type_id);
|
|
|
436 |
|
|
|
437 |
$group_type = $record->name;
|
|
|
438 |
|
|
|
439 |
$types = [];
|
|
|
440 |
$records = $groupTypeMapper->fetchAllActives();
|
|
|
441 |
foreach($records as $record)
|
|
|
442 |
{
|
|
|
443 |
$types[$record->uuid] = $record->name;
|
|
|
444 |
}
|
|
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
|
448 |
$formExtended = new ExtendedForm();
|
|
|
449 |
$formAccessibility = new AccessibilityForm();
|
|
|
450 |
$formPrivacy = new PrivacyForm();
|
|
|
451 |
$formType = new GroupTypeForm($this->adapter);
|
|
|
452 |
$formIndustry = new IndustryForm($this->adapter);
|
|
|
453 |
$formImage = new ImageForm($this->config);
|
|
|
454 |
$formCover = new CoverForm($this->config);
|
|
|
455 |
$formWebsite = new WebsiteForm();
|
|
|
456 |
|
|
|
457 |
|
|
|
458 |
$groupMemberMapper = GroupMemberMapper::getInstance($this->adapter);
|
|
|
459 |
$total_members = $groupMemberMapper->fetchTotalByGroupId($group->id);
|
|
|
460 |
|
|
|
461 |
$image_size_cover = $this->config['leaderslinked.image_sizes.group_cover_upload'];
|
|
|
462 |
$image_size_profile = $this->config['leaderslinked.image_sizes.group_image_upload'];
|
|
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
|
466 |
$this->layout()->setTemplate('layout/layout.phtml');
|
|
|
467 |
$viewModel = new ViewModel();
|
|
|
468 |
$viewModel->setTemplate('leaders-linked/high-performance-teams-my-groups/edit.phtml');
|
|
|
469 |
$viewModel->setVariables([
|
|
|
470 |
'total_members' => $total_members,
|
|
|
471 |
'accessibility' => $accessibility ,
|
|
|
472 |
'privacy' => $privacy,
|
|
|
473 |
'industry' => $industry,
|
|
|
474 |
'group_id' => $group->id,
|
|
|
475 |
'group_type' => $group_type,
|
|
|
476 |
'group_uuid' => $group->uuid,
|
|
|
477 |
'name' => trim($group->name),
|
|
|
478 |
'image' => $group->image,
|
|
|
479 |
'cover' => $group->cover,
|
|
|
480 |
'overview' => $group->description,
|
|
|
481 |
'website' => $group->website,
|
|
|
482 |
|
|
|
483 |
'formAccessibility' => $formAccessibility,
|
|
|
484 |
'formPrivacy' => $formPrivacy,
|
|
|
485 |
'formType' => $formType,
|
|
|
486 |
'formIndustry' => $formIndustry,
|
|
|
487 |
'formExtended' => $formExtended,
|
|
|
488 |
'formWebsite' => $formWebsite,
|
|
|
489 |
'formImage' => $formImage,
|
|
|
490 |
'formCover' => $formCover,
|
|
|
491 |
'image_size_cover' => $image_size_cover,
|
|
|
492 |
'image_size_profile' => $image_size_profile,
|
|
|
493 |
|
|
|
494 |
|
|
|
495 |
'industries' => $industries,
|
|
|
496 |
'types' => $types,
|
|
|
497 |
'privacies' => $privacies,
|
|
|
498 |
'accessibilities' => $accessibilities
|
|
|
499 |
]);
|
|
|
500 |
return $viewModel ;
|
|
|
501 |
|
|
|
502 |
} else {
|
|
|
503 |
$data = [
|
|
|
504 |
'success' => false,
|
|
|
505 |
'data' => 'ERROR_METHOD_NOT_ALLOWED'
|
|
|
506 |
];
|
|
|
507 |
|
|
|
508 |
return new JsonModel($data);
|
|
|
509 |
}
|
|
|
510 |
|
|
|
511 |
return new JsonModel($data);
|
|
|
512 |
}
|
| 4431 |
nelberth |
513 |
|
| 4478 |
nelberth |
514 |
|
| 4431 |
nelberth |
515 |
|
| 4388 |
nelberth |
516 |
}
|