Proyectos de Subversion LeadersLinked - Antes de SPA

Rev

Rev 4131 | Rev 4148 | Ir a la última revisión | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 4131 Rev 4141
Línea 12... Línea 12...
12
use Laminas\View\Model\JsonModel;
12
use Laminas\View\Model\JsonModel;
13
use LeadersLinked\Mapper\UserMapper;
13
use LeadersLinked\Mapper\UserMapper;
14
use LeadersLinked\Mapper\ChatUserMapper;
14
use LeadersLinked\Mapper\ChatUserMapper;
15
use LeadersLinked\Mapper\ChatGroupMapper;
15
use LeadersLinked\Mapper\ChatGroupMapper;
16
use LeadersLinked\Mapper\ChatGroupUserMapper;
16
use LeadersLinked\Mapper\ChatGroupUserMapper;
-
 
17
use LeadersLinked\Mapper\CalendarEventMapper;
-
 
18
use LeadersLinked\Mapper\ZoomMeetingMapper;
-
 
19
use LeadersLinked\Model\CalendarEvent;
-
 
20
use LeadersLinked\Library\Functions;
Línea 17... Línea 21...
17
 
21
 
18
 
22
 
19
class CalendarController extends AbstractActionController
23
class CalendarController extends AbstractActionController
Línea 79... Línea 83...
79
 
83
 
80
 
84
 
Línea -... Línea 85...
-
 
85
    public function eventsAction()
-
 
86
    {
-
 
87
        
-
 
88
        $request = $this->getRequest();
-
 
89
        if($request->isGet()) {
-
 
90
            
81
    public function eventsAction()
91
            $currentUserPlugin = $this->plugin('currentUserPlugin');
82
    {
92
            $currentUser = $currentUserPlugin->getUser();
83
        
93
            
84
        $textColor = '#000000';
94
            $textColor = '#000000';
85
        $reservationSameLocation = '#80ff80';
95
            $reservationSameLocation = '#80ff80';
86
        $reservationOtherLocation = '#008000';
96
            $reservationOtherLocation = '#008000';
87
        $contract = '#8080ff';
97
            $contract = '#8080ff';
88
        $contractDelayed = '#ff0000';
98
            $contractDelayed = '#ff0000';
89
        $contractOtherLocation = '#ffc0c0';
99
            $contractOtherLocation = '#ffc0c0';
90
        $orderRepair = '#c0c0c0';
100
            $orderRepair = '#c0c0c0';
-
 
101
            
-
 
102
            $start  = $this->params()->fromQuery('start');
-
 
103
            $end    = $this->params()->fromQuery('end');
-
 
104
            
-
 
105
            if(!empty($start) && !empty($end)) {
-
 
106
            
-
 
107
                $dtStart = \DateTime::createFromFormat('Y-m-d', $start);
-
 
108
                $dtEnd = \DateTime::createFromFormat('Y-m-d', $end);
-
 
109
            } else {
-
 
110
                $dtStart = null; 
-
 
111
                $dtEnd = null;
-
 
112
            }
-
 
113
            
-
 
114
            if(!$dtStart || !$dtEnd) {
-
 
115
              $t = time();
-
 
116
              $year = intval(date('Y', $t), 10);
-
 
117
              $month = intval(date('m', $t), 10);
-
 
118
              $last_day = intval(date('t', $t), 10);
-
 
119
              
-
 
120
              $start = mktime(0, 0, 0, $month, 1, $year);
-
 
121
              $start = date('Y-m-d H:i:s');
-
 
122
              
-
 
123
              $start = mktime(23, 56, 59, $month, $last_day, $year);
-
 
124
              $end = date('Y-m-d H:i:s');
-
 
125
                
-
 
126
            } else {
-
 
127
                $dtStart->setTime(0, 0, 0);
-
 
128
                $start = $dtStart->format('Y-m-d H:i:s');
-
 
129
                
-
 
130
                $dtEnd->setTime(23, 59, 59);
91
        
131
                $end  = $dtEnd->format('Y-m-d H:i:s');
-
 
132
            }
Línea -... Línea 133...
-
 
133
            
-
 
134
            
-
 
135
            $events = [];
-
 
136
 
-
 
137
            
-
 
138
    
-
 
139
            $zoomMeetingMapper = ZoomMeetingMapper::getInstance($this->adapter);
-
 
140
            
-
 
141
            $calendarEventMapper = CalendarEventMapper::getInstance($this->adapter);
92
        $start  = $this->params()->fromQuery('start');
142
            $records = $calendarEventMapper->fetchAllByUserIdAndStartTimeAndEndTime($currentUser->id, $start, $end);
-
 
143
            foreach($records as $record) 
-
 
144
            {
-
 
145
                switch($record->type)
-
 
146
                {
-
 
147
                    case CalendarEvent::TYPE_ZOOM : 
-
 
148
                        $zoomMeeting = $zoomMeetingMapper->fetchOne($record->relational_id);
-
 
149
                        if($zoomMeeting) {
-
 
150
                            
-
 
151
                            
-
 
152
                            if($currentUser->timezone && $currentUser->timezone != $zoomMeeting->timezone) {
-
 
153
                                
-
 
154
                                $start =  str_replace(' ', 'T', Functions::convertDateTimeBetweenTimeZones($zoomMeeting->start_time, $zoomMeeting->timezone, $currentUser->timezone));
-
 
155
                                $end =  str_replace(' ', 'T', Functions::convertDateTimeBetweenTimeZones($zoomMeeting->end_time, $zoomMeeting->timezone, $currentUser->timezone));
93
        $end    = $this->params()->fromQuery('send');
156
                                
94
        
157
                                
-
 
158
                                
95
 
159
                                
96
        $events = [];
160
                                
-
 
161
                            } else {
97
        
162
                                $start = str_replace(' ', 'T', $zoomMeeting->start_time);
-
 
163
                                $end = str_replace(' ', 'T', $zoomMeeting->end_time);
-
 
164
                            }
-
 
165
                            
-
 
166
                            
-
 
167
                            $agenda = "<a href=\"{$zoomMeeting->join_url}\" target=\"_blank\">" .  $zoomMeeting->agenda . "<br>" . 
-
 
168
                                " LABEL_ZOOM_MEETING_START_DATE : " . $dtStart->format('Y-m-d') . "<br>" .
-
 
169
                                " LABEL_ZOOM_MEETING_START_TIME : " . $dtStart->format('H:i a') . "<br>" .
98
        $dt = new \DateTime();
170
                                " LABEL_ZOOM_MEETING_TIMEZONE : " . $zoomMeeting->timezone . "<br>" .
99
        $dt->add(new \DateInterval('P1D'));
171
                                " LABEL_ZOOM_MEETING_TITLE :  " . $zoomMeeting->topic  . "<br>" .
-
 
172
                                " LABEL_ZOOM_MEETING_URL : " . $zoomMeeting->join_url . "<br>" .
-
 
173
                                " LABEL_ZOOM_MEETING_PASSWORD : " . $zoomMeeting->password . "<br>" . 
-
 
174
                                "</a>";
-
 
175
                            
-
 
176
                            array_push($events, [
-
 
177
                                'id'                => $zoomMeeting->id,
-
 
178
                                'name'              => $zoomMeeting->topic,
-
 
179
                                'agenda'            => $agenda,
-
 
180
                                'start'             => $start,
100
        $dt->setTime(9, 0);
181
                                'end'               => $end,
-
 
182
                                'url'               => $zoomMeeting->join_url,
-
 
183
                                'backgroundColor'   => $contract,
-
 
184
                                'textColor'         => $textColor
101
        
185
                            ]);
102
        $event_start = $dt->format('H-m-d\TH:i:s');
186
                        }
-
 
187
                        break;
-
 
188
                        
-
 
189
                   
-
 
190
                }
-
 
191
                
-
 
192
                
-
 
193
                
-
 
194
            }
-
 
195
            
-
 
196
            
-
 
197
            
-
 
198
            
Línea 103... Línea -...
103
        
-
 
104
        $dt->setTime(12, 30);
-
 
105
        
-
 
106
        $event_end = $dt->format('H-m-d\TH:i:s');
-
 
107
        
-
 
108
 
199
            
109
 
-
 
110
        
-
 
111
        array_push($events, 
-
 
112
            [
-
 
113
                'id' => '001',
-
 
114
                'name' => 'Name 001',
-
 
115
                'description' => 'Efrain<br>Yanez',
-
 
116
                'title' =>  'Title 001',
-
 
Línea -... Línea 200...
-
 
200
    
-
 
201
            
-
 
202
           
-
 
203
        
117
                'start' =>  '2022-12-12T10:30:00-05:00',
204
 
118
                'end' => '2022-12-12T12:30:00-05:00',
205
            return new JsonModel($events);
Línea 119... Línea 206...
119
                'url' =>  'https://google.com/',
206
            
120
                'backgroundColor' =>   $contract,
207
        } else {