Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 7300 | | Comparar con el anterior | Ultima modificación | Ver Log |

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