Proyectos de Subversion LeadersLinked - Services

Rev

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