Proyectos de Subversion LeadersLinked - Services

Rev

Rev 123 | Rev 125 | Ir a la última revisión | | Comparar con el anterior | Ultima modificación | Ver Log |

Rev Autor Línea Nro. Línea
1 efrain 1
<?php
2
 
3
declare(strict_types=1);
4
 
5
namespace LeadersLinked\Controller;
6
 
7
use Laminas\Db\Adapter\AdapterInterface;
8
 
9
use Laminas\Mvc\Controller\AbstractActionController;
10
use Laminas\Log\LoggerInterface;
11
use Laminas\View\Model\ViewModel;
12
use Laminas\View\Model\JsonModel;
13
use LeadersLinked\Mapper\UserMapper;
14
use LeadersLinked\Mapper\CalendarEventMapper;
15
use LeadersLinked\Mapper\ZoomMeetingMapper;
16
use LeadersLinked\Model\CalendarEvent;
17
use LeadersLinked\Library\Functions;
18
use LeadersLinked\Mapper\PerformanceEvaluationTestMapper;
19
use LeadersLinked\Mapper\PerformanceEvaluationFormMapper;
20
use LeadersLinked\Model\PerformanceEvaluationTest;
21
use LeadersLinked\Mapper\JobDescriptionMapper;
22
use LeadersLinked\Mapper\CompanyUserMapper;
23
use LeadersLinked\Model\CompanyUser;
24
use LeadersLinked\Mapper\CompanyMapper;
25
use LeadersLinked\Mapper\RecruitmentSelectionInterviewMapper;
26
use LeadersLinked\Mapper\RecruitmentSelectionCandidateMapper;
27
use LeadersLinked\Mapper\RecruitmentSelectionVacancyMapper;
28
use LeadersLinked\Model\RecruitmentSelectionInterview;
29
use Laminas\Mvc\I18n\Translator;
30
use LeadersLinked\Cache\CacheInterface;
31
use LeadersLinked\Mapper\SurveyTestMapper;
32
use LeadersLinked\Mapper\SurveyCampaignMapper;
33
 
34
 
35
class CalendarController extends AbstractActionController
36
{
37
    /**
38
     *
39
     * @var \Laminas\Db\Adapter\AdapterInterface
40
     */
41
    private $adapter;
42
 
43
    /**
44
     *
45
     * @var \LeadersLinked\Cache\CacheInterface
46
     */
47
    private $cache;
48
 
49
 
50
    /**
51
     *
52
     * @var \Laminas\Log\LoggerInterface
53
     */
54
    private $logger;
55
 
56
    /**
57
     *
58
     * @var array
59
     */
60
    private $config;
61
 
62
 
63
    /**
64
     *
65
     * @var \Laminas\Mvc\I18n\Translator
66
     */
67
    private $translator;
68
 
69
 
70
    /**
71
     *
72
     * @param \Laminas\Db\Adapter\AdapterInterface $adapter
73
     * @param \LeadersLinked\Cache\CacheInterface $cache
74
     * @param \Laminas\Log\LoggerInterface LoggerInterface $logger
75
     * @param array $config
76
     * @param \Laminas\Mvc\I18n\Translator $translator
77
     */
78
    public function __construct($adapter, $cache, $logger, $config, $translator)
79
    {
80
        $this->adapter      = $adapter;
81
        $this->cache        = $cache;
82
        $this->logger       = $logger;
83
        $this->config       = $config;
84
        $this->translator   = $translator;
85
    }
86
 
87
 
88
 
89
    public function indexAction()
90
    {
91
        return new JsonModel([
92
            'success' => false,
93
            'data' => 'ERROR_METHOD_NOT_ALLOWED'
94
        ]);
95
    }
96
 
97
 
98
 
99
 
100
    public function eventsAction()
101
    {
102
 
103
        $request = $this->getRequest();
104
        if($request->isGet()) {
105
 
106
            $currentUserPlugin = $this->plugin('currentUserPlugin');
107
            $currentUser = $currentUserPlugin->getUser();
108
 
109
            $currentNetworkPlugin = $this->plugin('currentNetworkPlugin');
110
            $currentNetwork = $currentNetworkPlugin->getNetwork();
111
 
112
 
113
 
114
            $start  = $this->params()->fromQuery('start');
115
            $end    = $this->params()->fromQuery('end');
116
 
117
            if(!empty($start) && !empty($end)) {
118
 
119
                $dtStart = \DateTime::createFromFormat('Y-m-d', $start);
120
                $dtEnd = \DateTime::createFromFormat('Y-m-d', $end);
121
            } else {
122
                $dtStart = null;
123
                $dtEnd = null;
124
            }
125
 
126
            if(!$dtStart || !$dtEnd) {
127
              $t = time();
128
              $year = intval(date('Y', $t), 10);
129
              $month = intval(date('m', $t), 10);
130
              $last_day = intval(date('t', $t), 10);
131
 
132
              $start = mktime(0, 0, 0, $month, 1, $year);
133
              $start = date('Y-m-d H:i:s');
134
 
135
              $end = mktime(23, 56, 59, $month, $last_day, $year);
136
              $end = date('Y-m-d H:i:s');
137
 
138
            } else {
139
                $dtStart->setTime(0, 0, 0);
140
                $start = $dtStart->format('Y-m-d H:i:s');
141
 
142
                $dtEnd->setTime(23, 59, 59);
143
                $end  = $dtEnd->format('Y-m-d H:i:s');
144
            }
145
 
146
 
147
            $events = [];
148
 
149
 
150
 
151
            //3 días
152
            $expirePeriod = 86400 * 3;
153
            $t1 = time();
154
 
155
 
156
            $companies = [];
157
            $companyMapper = CompanyMapper::getInstance($this->adapter);
158
 
159
            $companyUsers = [];
160
            $companyUserMapper = CompanyUserMapper::getInstance($this->adapter);
161
            $records = $companyUserMapper->fetchAllByUserId($currentUser->id);
162
 
163
            foreach($records as $record) {
164
                $companyUsers[$record->company_id] = $record->backend == CompanyUser::BACKEND_YES;
165
             }
166
 
167
 
168
 
169
 
170
 
171
 
172
            $zoomMeetingMapper = ZoomMeetingMapper::getInstance($this->adapter);
173
            $recruitmentSelectionCandidateMapper = RecruitmentSelectionCandidateMapper::getInstance($this->adapter);
174
            $recruitmentSelectionVacancyMapper = RecruitmentSelectionVacancyMapper::getInstance($this->adapter);
175
            $recruitmentSelectionInterviewMapper = RecruitmentSelectionInterviewMapper::getInstance($this->adapter);
176
            $performanceEvaluationTestMapper = PerformanceEvaluationTestMapper::getInstance($this->adapter);
177
            $performanceEvaluationFormMapper = PerformanceEvaluationFormMapper::getInstance($this->adapter);
178
            $jobDescriptionMapper = JobDescriptionMapper::getInstance($this->adapter);
179
            $userMapper = UserMapper::getInstance($this->adapter);
180
 
181
            $calendarEventMapper = CalendarEventMapper::getInstance($this->adapter);
182
            $records = $calendarEventMapper->fetchAllByUserIdAndStartTimeAndEndTime($currentUser->id, $start, $end);
183
 
124 efrain 184
            $response = $this->getResponse();
123 efrain 185
 
124 efrain 186
            $headers = $response->getHeaders();
187
            $headers->clearHeaders();
188
            $headers->addHeaderLine('Content-type', 'application/json; charset=UTF-8');
189
 
190
            Functions::addCrossSiteToResponse($response);
123 efrain 191
            print_r($records); exit;
192
 
1 efrain 193
            foreach($records as $record)
194
            {
195
                switch($record->type)
196
                {
197
                    case CalendarEvent::TYPE_SURVEY_NORMAL:
198
                        $backgroundColor = $currentNetwork->css_calendar_survey_bg_color;
199
                        $textColor = $currentNetwork->css_calendar_survey_text_color;
200
 
201
                        $surveyTestMapper = SurveyTestMapper::getInstance($this->adapter);
202
                        $surveyTest = $surveyTestMapper->fetchOne($record->relational_id);
203
 
204
                        if($surveyTest && $surveyTest->user_id == $currentUser->id) {
205
 
206
                            $surveyCampaingMapper = SurveyCampaignMapper::getInstance($this->adapter);
207
                            $surveyCampaing = $surveyCampaingMapper->fetchOne($surveyTest->campaign_id);
208
 
209
                            $url = '';
210
                            $hasLink = !empty($companyUsers[$surveyTest->company_id]);
211
 
212
                            if ($hasLink) {
213
 
214
                                if (!isset($companies[$surveyTest->company_id])) {
215
                                    $company  = $companyMapper->fetchOne($surveyTest->company_id);
216
 
217
                                    $companies[$company->id]  = $company;
218
                                } else {
219
                                    $company = $companies[$surveyTest->company_id];
220
                                }
221
 
222
 
223
                                $url = $this->url()->fromRoute('backend/signin-company', [
224
                                    'id' => $company->uuid,
225
                                    'relational' => $surveyTest->uuid,
226
                                    'type' => CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE,
227
                                ]);
228
                            }
229
 
230
                            $dtStart = \DateTime::createFromFormat('Y-m-d', $surveyCampaing->end_date);
231
 
232
 
233
                            array_push($events, [
234
                                'id'                => $surveyTest->uuid,
235
                                'title'             => $surveyCampaing->name,
236
                                'start'             => $dtStart->format('d/m/Y'),
237
                                'url'               => $url,
238
                                'backgroundColor'   => $backgroundColor,
239
                                'textColor'         => $textColor,
240
                                'allDay'            => true,
241
                                'type'              => 'task',
242
                            ]);
243
                        }
244
 
245
                        break;
246
 
247
                    case CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE:
248
                        $backgroundColor = $currentNetwork->css_calendar_organizational_climate_bg_color;
249
                        $textColor = $currentNetwork->css_calendar_organizational_climate_text_color;
250
 
251
                        $surveyTestMapper = SurveyTestMapper::getInstance($this->adapter);
252
                        $surveyTest = $surveyTestMapper->fetchOne($record->relational_id);
253
 
254
                        if($surveyTest && $surveyTest->user_id == $currentUser->id) {
255
 
256
                            $surveyCampaingMapper = SurveyCampaignMapper::getInstance($this->adapter);
257
                            $surveyCampaing = $surveyCampaingMapper->fetchOne($surveyTest->campaign_id);
258
 
259
                            $url = '';
260
                            $hasLink = !empty($companyUsers[$surveyTest->company_id]);
261
 
262
                            if ($hasLink) {
263
 
264
                                if (!isset($companies[$surveyTest->company_id])) {
265
                                    $company  = $companyMapper->fetchOne($surveyTest->company_id);
266
 
267
                                    $companies[$company->id]  = $company;
268
                                } else {
269
                                    $company = $companies[$surveyTest->company_id];
270
                                }
271
 
272
 
273
                                $url = $this->url()->fromRoute('backend/signin-company', [
274
                                    'id' => $company->uuid,
275
                                    'relational' => $surveyTest->uuid,
276
                                    'type' => CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE,
277
                                ]);
278
                            }
279
 
280
                            $dtStart = \DateTime::createFromFormat('Y-m-d', $surveyCampaing->end_date);
281
 
282
 
283
                            array_push($events, [
284
                                'id'                => $surveyTest->uuid,
285
                                'title'             => $surveyCampaing->name,
286
                                'start'             => $dtStart->format('d/m/Y'),
287
                                'url'               => $url,
288
                                'backgroundColor'   => $backgroundColor,
289
                                'textColor'         => $textColor,
290
                                'allDay'            => true,
291
                                'type'              => 'task',
292
                            ]);
293
                        }
294
 
295
                        break;
296
 
297
 
298
 
299
 
300
 
301
                    case CalendarEvent::TYPE_RECRUITMENT_SELECTION_INTERVIEW  :
302
                        $backgroundColor = $currentNetwork->css_calendar_recruitment_and_selection_bg_color ;
303
                        $textColor = $currentNetwork->css_calendar_recruitment_and_selection_text_color;
304
 
305
 
306
                        $recruitmentSelectionInterview = $recruitmentSelectionInterviewMapper->fetchOne($record->relational_id);
307
                        if($recruitmentSelectionInterview) {
308
 
309
                            $recruitmentSelectionVacancy = $recruitmentSelectionVacancyMapper->fetchOne($recruitmentSelectionInterview->vacancy_id);
310
 
311
 
312
 
313
                            $recruitmentSelectionCandidate = $recruitmentSelectionCandidateMapper->fetchOne($recruitmentSelectionInterview->candidate_id);
314
                            if($recruitmentSelectionVacancy && $recruitmentSelectionCandidate) {
315
                                $jobDescription = $jobDescriptionMapper->fetchOne($recruitmentSelectionVacancy->job_description_id);
316
                                if($jobDescription) {
317
                                    $url = '';
318
                                    $hasLink = !empty($companyUsers[$recruitmentSelectionInterview->company_id]);
319
 
320
 
321
 
322
                                    if($hasLink) {
323
 
324
                                        if(!isset($companies[$recruitmentSelectionInterview->company_id])) {
325
                                            $company  = $companyMapper->fetchOne($recruitmentSelectionInterview->company_id);
326
 
327
                                            $companies[ $company->id ]  = $company;
328
                                        } else {
329
                                            $company = $companies[ $recruitmentSelectionInterview->company_id ];
330
                                        }
331
 
332
 
333
                                        $url = $this->url()->fromRoute('backend/signin-company', [
334
                                            'id' => $company->uuid,
335
                                            'relational' => $recruitmentSelectionInterview->uuid,
336
                                            'type' => CalendarEvent::TYPE_RECRUITMENT_SELECTION_INTERVIEW
337
                                        ]);
338
                                    }
339
 
340
                                    $agenda = " LABEL_RECRUITMENT_SELECTION_JOB_DESCRIPTION : " . $jobDescription->name . "<br>";
341
                                    switch($recruitmentSelectionInterview->type)
342
                                    {
343
                                        case RecruitmentSelectionInterview::TYPE_BOSS :
344
                                            $agenda .= " LABEL_RECRUITMENT_SELECTION_TYPE : LABEL_RECRUITMENT_SELECTION_TYPE_BOSS_INTERVIEW <br>";
345
                                            break;
346
 
347
                                        case RecruitmentSelectionInterview::TYPE_HUMAN_RESOURCE :
348
                                            $agenda .= " LABEL_RECRUITMENT_SELECTION_TYPE : LABEL_RECRUITMENT_SELECTION_TYPE_HUMAN_RESOURCE <br>";
349
                                            break;
350
                                    }
351
 
352
                                    $agenda .= " LABEL_RECRUITMENT_SELECTION_CANDIDATE : " . trim($recruitmentSelectionCandidate->first_name . ' ' . $recruitmentSelectionCandidate->last_name) . " <br>";
353
 
354
 
355
 
356
                                    $dtStart = \DateTime::createFromFormat('Y-m-d', $recruitmentSelectionInterview->last_date);
357
                                    $agenda .= " LABEL_PERFORMANCE_EVALUATION_LAST_DATE : " . $dtStart->format('Y-m-d') . "<br>" ;
358
 
359
 
360
                                    array_push($events, [
361
                                        'id'                => $recruitmentSelectionInterview->uuid,
362
                                        'title'             => $recruitmentSelectionVacancy->name,
363
                                        'agenda'            => $agenda,
364
                                        'url'               => $url,
365
                                        'start'             => $dtStart->format('Y-m-d'),
366
                                        'url'               => '',
367
                                        'backgroundColor'   => $backgroundColor,
368
                                        'textColor'         => $textColor,
369
                                        'allDay'            => true,
370
                                        'type'              => 'task',
371
                                    ]);
372
                                }
373
                            }
374
                        }
375
 
376
 
377
                        break;
378
 
379
                    case CalendarEvent::TYPE_PERFORMANCE_EVALUATION :
380
 
381
 
382
                        $backgroundColor = $currentNetwork->css_calendar_performance_evaluation_bg_color ;
383
                        $textColor = $currentNetwork->css_calendar_performance_evaluation_text_color;
384
 
385
 
386
                        $performanceEvaluationTest = $performanceEvaluationTestMapper->fetchOne($record->relational_id);
387
                        if($performanceEvaluationTest) {
388
 
389
 
390
 
391
                            $performanceEvaluationForm = $performanceEvaluationFormMapper->fetchOne($performanceEvaluationTest->form_id);
392
                            if($performanceEvaluationForm) {
393
                                $jobDescription = $jobDescriptionMapper->fetchOne($performanceEvaluationForm->job_description_id);
394
                                if($jobDescription) {
395
                                    $url = '';
396
                                    if($performanceEvaluationTest->supervisor_id) {
397
                                        $supervisor = $userMapper->fetchOne($performanceEvaluationTest->supervisor_id);
398
                                    } else {
399
                                        $supervisor = '';
400
                                    }
401
 
402
                                    if($performanceEvaluationTest->employee_id) {
403
                                        $employee = $userMapper->fetchOne($performanceEvaluationTest->employee_id);
404
                                    } else {
405
                                        $employee = '';
406
                                    }
407
 
408
 
409
                                    $hasLink = !empty($companyUsers[$performanceEvaluationTest->company_id]);
410
 
411
                                    switch ($performanceEvaluationTest->type)
412
                                    {
413
                                        case PerformanceEvaluationTest::TYPE_SUPERVISOR :
414
                                        case PerformanceEvaluationTest::TYPE_BOTH  :
415
                                            if($performanceEvaluationTest->supervisor_id != $currentUser->id) {
416
                                                $hasLink = false;
417
                                            }
418
                                            break;
419
 
420
                                        case  PerformanceEvaluationTest::TYPE_EMPLOYEE  :
421
                                            if($performanceEvaluationTest->employee_id != $currentUser->id) {
422
                                                $hasLink = false;
423
                                            }
424
                                            break;
425
 
426
                                        default :
427
                                            $hasLink = false;
428
                                            break;
429
                                    }
430
 
431
 
432
 
433
                                    if($hasLink) {
434
 
435
                                        if(!isset($companies[$performanceEvaluationTest->company_id])) {
436
                                            $company  = $companyMapper->fetchOne($performanceEvaluationTest->company_id);
437
 
438
                                            $companies[ $company->id ]  = $company;
439
                                        } else {
440
                                            $company = $companies[ $performanceEvaluationTest->company_id ];
441
                                        }
442
 
443
 
444
                                        $url = $this->url()->fromRoute('backend/signin-company', [
445
                                            'id' => $company->uuid,
446
                                            'relational' => $performanceEvaluationTest->uuid,
447
                                            'type' => CalendarEvent::TYPE_PERFORMANCE_EVALUATION
448
                                        ]);
449
 
450
 
451
 
452
                                    }
453
 
454
                                    $agenda = " LABEL_PERFORMANCE_EVALUATION_FORM_NAME : " . $performanceEvaluationForm->name . "<br>";
455
                                    $agenda .= " LABEL_PERFORMANCE_EVALUATION_JOB_DESCRIPTION : " . $jobDescription->name . "<br>";
456
 
457
                                    switch($performanceEvaluationTest->type)
458
                                    {
459
                                        case PerformanceEvaluationTest::TYPE_BOTH :
460
                                            $agenda .= " LABEL_PERFORMANCE_EVALUATION_TYPE : LABEL_PERFORMANCE_EVALUATION_TYPE_BOTH <br>";
461
                                            break;
462
 
463
                                        case PerformanceEvaluationTest::TYPE_SUPERVISOR :
464
                                            $agenda .= " LABEL_PERFORMANCE_EVALUATION_TYPE : LABEL_PERFORMANCE_EVALUATION_TYPE_SUPERVISOR <br>";
465
                                            break;
466
 
467
                                        case PerformanceEvaluationTest::TYPE_EMPLOYEE :
468
                                            $agenda .= " LABEL_PERFORMANCE_EVALUATION_TYPE : LABEL_PERFORMANCE_EVALUATION_TYPE_EMPLOYEE <br>";
469
                                            break;
470
 
471
 
472
                                    }
473
 
474
                                    if($supervisor) {
475
                                        $agenda .= " LABEL_PERFORMANCE_EVALUATION_SUPERVISOR : " . trim($supervisor->first_name . ' ' . $supervisor->last_name) . " <br>";
476
 
477
                                    }
478
                                    if($employee) {
479
                                        $agenda .= " LABEL_PERFORMANCE_EVALUATION_EMPLOYEE : " . trim($employee->first_name . ' ' . $employee->last_name) . " <br>";
480
 
481
                                    }
482
 
483
                                    $dtStart = \DateTime::createFromFormat('Y-m-d', $performanceEvaluationTest->last_date);
484
                                    $agenda .= " LABEL_PERFORMANCE_EVALUATION_LAST_DATE : " . $dtStart->format('Y-m-d') . "<br>" ;
485
 
486
 
487
 
488
                                    array_push($events, [
489
                                        'id'                => $performanceEvaluationTest->uuid,
490
                                        'title'             =>  $performanceEvaluationForm->name,
491
                                        'agenda'            => $agenda,
492
                                        'start'             => $dtStart->format('Y-m-d'),
493
                                        'url'               => $url,
494
                                        'backgroundColor'   => $backgroundColor,
495
                                        'textColor'         => $textColor,
496
                                        'allDay'            => true,
497
                                        'type'              => 'task',
498
                                    ]);
499
                                }
500
                            }
501
 
502
                        }
503
 
504
 
505
 
506
 
507
 
508
                        break;
509
 
510
                    case CalendarEvent::TYPE_ZOOM :
511
                        $zoomMeeting = $zoomMeetingMapper->fetchOne($record->relational_id);
512
                        if($zoomMeeting) {
513
 
514
                            $backgroundColor = $currentNetwork->css_calendar_zoom_bg_color ;
515
                            $textColor = $currentNetwork->css_calendar_zoom_text_color;
516
 
517
                            $dtStart = \DateTime::createFromFormat('Y-m-d H:i:s', $zoomMeeting->start_time);
518
                            $t2 = $dtStart->getTimestamp();
519
 
520
                            if($t2 > $t1) {
521
 
522
                                $t3 = $t1 + $expirePeriod;
523
                                if($t3 > $t2) {
524
                                    $backgroundColor = $currentNetwork->css_calendar_expire_bg_color;
525
                                    $textColor = $currentNetwork->css_calendar_expire_text_color;
526
                                }
527
 
528
                            }
529
 
530
 
531
 
532
                            if($currentUser->timezone && $currentUser->timezone != $zoomMeeting->timezone) {
533
 
534
                                $start =  str_replace(' ', 'T', Functions::convertDateTimeBetweenTimeZones($zoomMeeting->start_time, $zoomMeeting->timezone, $currentUser->timezone));
535
                                $end =  str_replace(' ', 'T', Functions::convertDateTimeBetweenTimeZones($zoomMeeting->end_time, $zoomMeeting->timezone, $currentUser->timezone));
536
 
537
 
538
 
539
 
540
 
541
                            } else {
542
                                $start = str_replace(' ', 'T', $zoomMeeting->start_time);
543
                                $end = str_replace(' ', 'T', $zoomMeeting->end_time);
544
                            }
545
 
546
 
547
 
548
 
549
 
550
 
551
                            $agenda = "<a href=\"{$zoomMeeting->join_url}\" target=\"_blank\">" .  $zoomMeeting->agenda . "<br>" .
552
                                " LABEL_ZOOM_MEETING_START_DATE : " . $dtStart->format('Y-m-d') . "<br>" .
553
                                " LABEL_ZOOM_MEETING_START_TIME : " . $dtStart->format('H:i a') . "<br>" .
554
                                " LABEL_ZOOM_MEETING_TIMEZONE : " . $zoomMeeting->timezone . "<br>" .
555
                                " LABEL_ZOOM_MEETING_TITLE :  " . $zoomMeeting->topic  . "<br>" .
556
                                " LABEL_ZOOM_MEETING_URL : " . $zoomMeeting->join_url . "<br>" .
557
                                " LABEL_ZOOM_MEETING_PASSWORD : " . $zoomMeeting->password . "<br>" .
558
                                "</a>";
559
 
560
                            array_push($events, [
561
                                'id'                => $zoomMeeting->id,
562
                                'title'             => $zoomMeeting->topic,
563
                                'agenda'            => $agenda,
564
                                'start'             => $start,
565
                                'end'               => $end,
566
                                'url'               => $zoomMeeting->join_url,
567
                                'backgroundColor'   => $backgroundColor,
568
                                'textColor'         => $textColor,
569
                                'type'              => 'event',
570
                            ]);
571
                        }
572
                        break;
573
 
574
 
575
                }
576
 
577
 
578
 
579
            }
580
 
581
 
582
 
583
 
121 efrain 584
            return new JsonModel([
585
                'success' => true,
586
                'data' => $events
587
            ]);
1 efrain 588
 
589
        } else {
590
            $response = [
591
                'success' => false,
592
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
593
            ];
594
        }
595
 
596
        return new JsonModel($response);
597
    }
598
 
599
 
600
 
601
 
602
}