Proyectos de Subversion LeadersLinked - Services

Rev

Rev 126 | Rev 128 | 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
 
127 efrain 181
 
1 efrain 182
 
123 efrain 183
 
126 efrain 184
            header('Access-Control-Allow-Origin: *');
185
            header('Access-Control-Allow-Headers: *');
186
            header('Access-Control-Allow-Method: POST, GET, HEAD, OPTIONS');
187
            header('Access-Control-Max-Age: 86400');
125 efrain 188
 
127 efrain 189
            $calendarEventMapper = CalendarEventMapper::getInstance($this->adapter);
190
            $records = $calendarEventMapper->fetchAllByUserIdAndStartTimeAndEndTime($currentUser->id, $start, $end);
191
 
123 efrain 192
            print_r($records); exit;
193
 
1 efrain 194
            foreach($records as $record)
195
            {
196
                switch($record->type)
197
                {
198
                    case CalendarEvent::TYPE_SURVEY_NORMAL:
199
                        $backgroundColor = $currentNetwork->css_calendar_survey_bg_color;
200
                        $textColor = $currentNetwork->css_calendar_survey_text_color;
201
 
202
                        $surveyTestMapper = SurveyTestMapper::getInstance($this->adapter);
203
                        $surveyTest = $surveyTestMapper->fetchOne($record->relational_id);
204
 
205
                        if($surveyTest && $surveyTest->user_id == $currentUser->id) {
206
 
207
                            $surveyCampaingMapper = SurveyCampaignMapper::getInstance($this->adapter);
208
                            $surveyCampaing = $surveyCampaingMapper->fetchOne($surveyTest->campaign_id);
209
 
210
                            $url = '';
211
                            $hasLink = !empty($companyUsers[$surveyTest->company_id]);
212
 
213
                            if ($hasLink) {
214
 
215
                                if (!isset($companies[$surveyTest->company_id])) {
216
                                    $company  = $companyMapper->fetchOne($surveyTest->company_id);
217
 
218
                                    $companies[$company->id]  = $company;
219
                                } else {
220
                                    $company = $companies[$surveyTest->company_id];
221
                                }
222
 
223
 
224
                                $url = $this->url()->fromRoute('backend/signin-company', [
225
                                    'id' => $company->uuid,
226
                                    'relational' => $surveyTest->uuid,
227
                                    'type' => CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE,
228
                                ]);
229
                            }
230
 
231
                            $dtStart = \DateTime::createFromFormat('Y-m-d', $surveyCampaing->end_date);
232
 
233
 
234
                            array_push($events, [
235
                                'id'                => $surveyTest->uuid,
236
                                'title'             => $surveyCampaing->name,
237
                                'start'             => $dtStart->format('d/m/Y'),
238
                                'url'               => $url,
239
                                'backgroundColor'   => $backgroundColor,
240
                                'textColor'         => $textColor,
241
                                'allDay'            => true,
242
                                'type'              => 'task',
243
                            ]);
244
                        }
245
 
246
                        break;
247
 
248
                    case CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE:
249
                        $backgroundColor = $currentNetwork->css_calendar_organizational_climate_bg_color;
250
                        $textColor = $currentNetwork->css_calendar_organizational_climate_text_color;
251
 
252
                        $surveyTestMapper = SurveyTestMapper::getInstance($this->adapter);
253
                        $surveyTest = $surveyTestMapper->fetchOne($record->relational_id);
254
 
255
                        if($surveyTest && $surveyTest->user_id == $currentUser->id) {
256
 
257
                            $surveyCampaingMapper = SurveyCampaignMapper::getInstance($this->adapter);
258
                            $surveyCampaing = $surveyCampaingMapper->fetchOne($surveyTest->campaign_id);
259
 
260
                            $url = '';
261
                            $hasLink = !empty($companyUsers[$surveyTest->company_id]);
262
 
263
                            if ($hasLink) {
264
 
265
                                if (!isset($companies[$surveyTest->company_id])) {
266
                                    $company  = $companyMapper->fetchOne($surveyTest->company_id);
267
 
268
                                    $companies[$company->id]  = $company;
269
                                } else {
270
                                    $company = $companies[$surveyTest->company_id];
271
                                }
272
 
273
 
274
                                $url = $this->url()->fromRoute('backend/signin-company', [
275
                                    'id' => $company->uuid,
276
                                    'relational' => $surveyTest->uuid,
277
                                    'type' => CalendarEvent::TYPE_SURVEY_ORGANIZATIONAL_CLIMATE,
278
                                ]);
279
                            }
280
 
281
                            $dtStart = \DateTime::createFromFormat('Y-m-d', $surveyCampaing->end_date);
282
 
283
 
284
                            array_push($events, [
285
                                'id'                => $surveyTest->uuid,
286
                                'title'             => $surveyCampaing->name,
287
                                'start'             => $dtStart->format('d/m/Y'),
288
                                'url'               => $url,
289
                                'backgroundColor'   => $backgroundColor,
290
                                'textColor'         => $textColor,
291
                                'allDay'            => true,
292
                                'type'              => 'task',
293
                            ]);
294
                        }
295
 
296
                        break;
297
 
298
 
299
 
300
 
301
 
302
                    case CalendarEvent::TYPE_RECRUITMENT_SELECTION_INTERVIEW  :
303
                        $backgroundColor = $currentNetwork->css_calendar_recruitment_and_selection_bg_color ;
304
                        $textColor = $currentNetwork->css_calendar_recruitment_and_selection_text_color;
305
 
306
 
307
                        $recruitmentSelectionInterview = $recruitmentSelectionInterviewMapper->fetchOne($record->relational_id);
308
                        if($recruitmentSelectionInterview) {
309
 
310
                            $recruitmentSelectionVacancy = $recruitmentSelectionVacancyMapper->fetchOne($recruitmentSelectionInterview->vacancy_id);
311
 
312
 
313
 
314
                            $recruitmentSelectionCandidate = $recruitmentSelectionCandidateMapper->fetchOne($recruitmentSelectionInterview->candidate_id);
315
                            if($recruitmentSelectionVacancy && $recruitmentSelectionCandidate) {
316
                                $jobDescription = $jobDescriptionMapper->fetchOne($recruitmentSelectionVacancy->job_description_id);
317
                                if($jobDescription) {
318
                                    $url = '';
319
                                    $hasLink = !empty($companyUsers[$recruitmentSelectionInterview->company_id]);
320
 
321
 
322
 
323
                                    if($hasLink) {
324
 
325
                                        if(!isset($companies[$recruitmentSelectionInterview->company_id])) {
326
                                            $company  = $companyMapper->fetchOne($recruitmentSelectionInterview->company_id);
327
 
328
                                            $companies[ $company->id ]  = $company;
329
                                        } else {
330
                                            $company = $companies[ $recruitmentSelectionInterview->company_id ];
331
                                        }
332
 
333
 
334
                                        $url = $this->url()->fromRoute('backend/signin-company', [
335
                                            'id' => $company->uuid,
336
                                            'relational' => $recruitmentSelectionInterview->uuid,
337
                                            'type' => CalendarEvent::TYPE_RECRUITMENT_SELECTION_INTERVIEW
338
                                        ]);
339
                                    }
340
 
341
                                    $agenda = " LABEL_RECRUITMENT_SELECTION_JOB_DESCRIPTION : " . $jobDescription->name . "<br>";
342
                                    switch($recruitmentSelectionInterview->type)
343
                                    {
344
                                        case RecruitmentSelectionInterview::TYPE_BOSS :
345
                                            $agenda .= " LABEL_RECRUITMENT_SELECTION_TYPE : LABEL_RECRUITMENT_SELECTION_TYPE_BOSS_INTERVIEW <br>";
346
                                            break;
347
 
348
                                        case RecruitmentSelectionInterview::TYPE_HUMAN_RESOURCE :
349
                                            $agenda .= " LABEL_RECRUITMENT_SELECTION_TYPE : LABEL_RECRUITMENT_SELECTION_TYPE_HUMAN_RESOURCE <br>";
350
                                            break;
351
                                    }
352
 
353
                                    $agenda .= " LABEL_RECRUITMENT_SELECTION_CANDIDATE : " . trim($recruitmentSelectionCandidate->first_name . ' ' . $recruitmentSelectionCandidate->last_name) . " <br>";
354
 
355
 
356
 
357
                                    $dtStart = \DateTime::createFromFormat('Y-m-d', $recruitmentSelectionInterview->last_date);
358
                                    $agenda .= " LABEL_PERFORMANCE_EVALUATION_LAST_DATE : " . $dtStart->format('Y-m-d') . "<br>" ;
359
 
360
 
361
                                    array_push($events, [
362
                                        'id'                => $recruitmentSelectionInterview->uuid,
363
                                        'title'             => $recruitmentSelectionVacancy->name,
364
                                        'agenda'            => $agenda,
365
                                        'url'               => $url,
366
                                        'start'             => $dtStart->format('Y-m-d'),
367
                                        'url'               => '',
368
                                        'backgroundColor'   => $backgroundColor,
369
                                        'textColor'         => $textColor,
370
                                        'allDay'            => true,
371
                                        'type'              => 'task',
372
                                    ]);
373
                                }
374
                            }
375
                        }
376
 
377
 
378
                        break;
379
 
380
                    case CalendarEvent::TYPE_PERFORMANCE_EVALUATION :
381
 
382
 
383
                        $backgroundColor = $currentNetwork->css_calendar_performance_evaluation_bg_color ;
384
                        $textColor = $currentNetwork->css_calendar_performance_evaluation_text_color;
385
 
386
 
387
                        $performanceEvaluationTest = $performanceEvaluationTestMapper->fetchOne($record->relational_id);
388
                        if($performanceEvaluationTest) {
389
 
390
 
391
 
392
                            $performanceEvaluationForm = $performanceEvaluationFormMapper->fetchOne($performanceEvaluationTest->form_id);
393
                            if($performanceEvaluationForm) {
394
                                $jobDescription = $jobDescriptionMapper->fetchOne($performanceEvaluationForm->job_description_id);
395
                                if($jobDescription) {
396
                                    $url = '';
397
                                    if($performanceEvaluationTest->supervisor_id) {
398
                                        $supervisor = $userMapper->fetchOne($performanceEvaluationTest->supervisor_id);
399
                                    } else {
400
                                        $supervisor = '';
401
                                    }
402
 
403
                                    if($performanceEvaluationTest->employee_id) {
404
                                        $employee = $userMapper->fetchOne($performanceEvaluationTest->employee_id);
405
                                    } else {
406
                                        $employee = '';
407
                                    }
408
 
409
 
410
                                    $hasLink = !empty($companyUsers[$performanceEvaluationTest->company_id]);
411
 
412
                                    switch ($performanceEvaluationTest->type)
413
                                    {
414
                                        case PerformanceEvaluationTest::TYPE_SUPERVISOR :
415
                                        case PerformanceEvaluationTest::TYPE_BOTH  :
416
                                            if($performanceEvaluationTest->supervisor_id != $currentUser->id) {
417
                                                $hasLink = false;
418
                                            }
419
                                            break;
420
 
421
                                        case  PerformanceEvaluationTest::TYPE_EMPLOYEE  :
422
                                            if($performanceEvaluationTest->employee_id != $currentUser->id) {
423
                                                $hasLink = false;
424
                                            }
425
                                            break;
426
 
427
                                        default :
428
                                            $hasLink = false;
429
                                            break;
430
                                    }
431
 
432
 
433
 
434
                                    if($hasLink) {
435
 
436
                                        if(!isset($companies[$performanceEvaluationTest->company_id])) {
437
                                            $company  = $companyMapper->fetchOne($performanceEvaluationTest->company_id);
438
 
439
                                            $companies[ $company->id ]  = $company;
440
                                        } else {
441
                                            $company = $companies[ $performanceEvaluationTest->company_id ];
442
                                        }
443
 
444
 
445
                                        $url = $this->url()->fromRoute('backend/signin-company', [
446
                                            'id' => $company->uuid,
447
                                            'relational' => $performanceEvaluationTest->uuid,
448
                                            'type' => CalendarEvent::TYPE_PERFORMANCE_EVALUATION
449
                                        ]);
450
 
451
 
452
 
453
                                    }
454
 
455
                                    $agenda = " LABEL_PERFORMANCE_EVALUATION_FORM_NAME : " . $performanceEvaluationForm->name . "<br>";
456
                                    $agenda .= " LABEL_PERFORMANCE_EVALUATION_JOB_DESCRIPTION : " . $jobDescription->name . "<br>";
457
 
458
                                    switch($performanceEvaluationTest->type)
459
                                    {
460
                                        case PerformanceEvaluationTest::TYPE_BOTH :
461
                                            $agenda .= " LABEL_PERFORMANCE_EVALUATION_TYPE : LABEL_PERFORMANCE_EVALUATION_TYPE_BOTH <br>";
462
                                            break;
463
 
464
                                        case PerformanceEvaluationTest::TYPE_SUPERVISOR :
465
                                            $agenda .= " LABEL_PERFORMANCE_EVALUATION_TYPE : LABEL_PERFORMANCE_EVALUATION_TYPE_SUPERVISOR <br>";
466
                                            break;
467
 
468
                                        case PerformanceEvaluationTest::TYPE_EMPLOYEE :
469
                                            $agenda .= " LABEL_PERFORMANCE_EVALUATION_TYPE : LABEL_PERFORMANCE_EVALUATION_TYPE_EMPLOYEE <br>";
470
                                            break;
471
 
472
 
473
                                    }
474
 
475
                                    if($supervisor) {
476
                                        $agenda .= " LABEL_PERFORMANCE_EVALUATION_SUPERVISOR : " . trim($supervisor->first_name . ' ' . $supervisor->last_name) . " <br>";
477
 
478
                                    }
479
                                    if($employee) {
480
                                        $agenda .= " LABEL_PERFORMANCE_EVALUATION_EMPLOYEE : " . trim($employee->first_name . ' ' . $employee->last_name) . " <br>";
481
 
482
                                    }
483
 
484
                                    $dtStart = \DateTime::createFromFormat('Y-m-d', $performanceEvaluationTest->last_date);
485
                                    $agenda .= " LABEL_PERFORMANCE_EVALUATION_LAST_DATE : " . $dtStart->format('Y-m-d') . "<br>" ;
486
 
487
 
488
 
489
                                    array_push($events, [
490
                                        'id'                => $performanceEvaluationTest->uuid,
491
                                        'title'             =>  $performanceEvaluationForm->name,
492
                                        'agenda'            => $agenda,
493
                                        'start'             => $dtStart->format('Y-m-d'),
494
                                        'url'               => $url,
495
                                        'backgroundColor'   => $backgroundColor,
496
                                        'textColor'         => $textColor,
497
                                        'allDay'            => true,
498
                                        'type'              => 'task',
499
                                    ]);
500
                                }
501
                            }
502
 
503
                        }
504
 
505
 
506
 
507
 
508
 
509
                        break;
510
 
511
                    case CalendarEvent::TYPE_ZOOM :
512
                        $zoomMeeting = $zoomMeetingMapper->fetchOne($record->relational_id);
513
                        if($zoomMeeting) {
514
 
515
                            $backgroundColor = $currentNetwork->css_calendar_zoom_bg_color ;
516
                            $textColor = $currentNetwork->css_calendar_zoom_text_color;
517
 
518
                            $dtStart = \DateTime::createFromFormat('Y-m-d H:i:s', $zoomMeeting->start_time);
519
                            $t2 = $dtStart->getTimestamp();
520
 
521
                            if($t2 > $t1) {
522
 
523
                                $t3 = $t1 + $expirePeriod;
524
                                if($t3 > $t2) {
525
                                    $backgroundColor = $currentNetwork->css_calendar_expire_bg_color;
526
                                    $textColor = $currentNetwork->css_calendar_expire_text_color;
527
                                }
528
 
529
                            }
530
 
531
 
532
 
533
                            if($currentUser->timezone && $currentUser->timezone != $zoomMeeting->timezone) {
534
 
535
                                $start =  str_replace(' ', 'T', Functions::convertDateTimeBetweenTimeZones($zoomMeeting->start_time, $zoomMeeting->timezone, $currentUser->timezone));
536
                                $end =  str_replace(' ', 'T', Functions::convertDateTimeBetweenTimeZones($zoomMeeting->end_time, $zoomMeeting->timezone, $currentUser->timezone));
537
 
538
 
539
 
540
 
541
 
542
                            } else {
543
                                $start = str_replace(' ', 'T', $zoomMeeting->start_time);
544
                                $end = str_replace(' ', 'T', $zoomMeeting->end_time);
545
                            }
546
 
547
 
548
 
549
 
550
 
551
 
552
                            $agenda = "<a href=\"{$zoomMeeting->join_url}\" target=\"_blank\">" .  $zoomMeeting->agenda . "<br>" .
553
                                " LABEL_ZOOM_MEETING_START_DATE : " . $dtStart->format('Y-m-d') . "<br>" .
554
                                " LABEL_ZOOM_MEETING_START_TIME : " . $dtStart->format('H:i a') . "<br>" .
555
                                " LABEL_ZOOM_MEETING_TIMEZONE : " . $zoomMeeting->timezone . "<br>" .
556
                                " LABEL_ZOOM_MEETING_TITLE :  " . $zoomMeeting->topic  . "<br>" .
557
                                " LABEL_ZOOM_MEETING_URL : " . $zoomMeeting->join_url . "<br>" .
558
                                " LABEL_ZOOM_MEETING_PASSWORD : " . $zoomMeeting->password . "<br>" .
559
                                "</a>";
560
 
561
                            array_push($events, [
562
                                'id'                => $zoomMeeting->id,
563
                                'title'             => $zoomMeeting->topic,
564
                                'agenda'            => $agenda,
565
                                'start'             => $start,
566
                                'end'               => $end,
567
                                'url'               => $zoomMeeting->join_url,
568
                                'backgroundColor'   => $backgroundColor,
569
                                'textColor'         => $textColor,
570
                                'type'              => 'event',
571
                            ]);
572
                        }
573
                        break;
574
 
575
 
576
                }
577
 
578
 
579
 
580
            }
581
 
582
 
583
 
584
 
121 efrain 585
            return new JsonModel([
586
                'success' => true,
587
                'data' => $events
588
            ]);
1 efrain 589
 
590
        } else {
591
            $response = [
592
                'success' => false,
593
                'data' => 'ERROR_METHOD_NOT_ALLOWED'
594
            ];
595
        }
596
 
597
        return new JsonModel($response);
598
    }
599
 
600
 
601
 
602
 
603
}