source: trunk/prototype/modules/calendar/interceptors/Notifications.php @ 6034

Revision 6034, 21.8 KB checked in by cristiano, 12 years ago (diff)

Ticket #2640 - Erro calculo de data ao editar um evento

Line 
1<?php
2
3require_once ROOTPATH . '/modules/calendar/constants.php';
4require_once ROOTPATH . '/modules/calendar/interceptors/Helpers.php';
5require_once ROOTPATH . '/plugins/icalcreator/iCalcreator.class.php';
6require_once ROOTPATH . '/api/parseTPL.php';
7
8class Notifications extends Helpers {
9
10    public function formatNotification(&$uri, &$params, &$data, $original) {
11        switch ($params['type']) {
12            case 'suggestion':
13                self::formatSuggestion($params);
14                break;
15            case 'suggestionResponse':
16                self::formatSuggestionResponse($params);
17                break;
18        }
19    }
20
21    /**
22     * Analisa o commit do conceito participant e encaminha cada participant para seu devido metodo de notrificação
23     *
24     * @license    http://www.gnu.org/copyleft/gpl.html GPL
25     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
26     * @sponsor    Caixa Econômica Federal
27     * @author     Cristiano Corrêa Schmidt
28     * @return     void
29     * @access     public
30     */
31    public function commitParticipant(&$uri, &$result, &$data, $original) {
32        if (Config::regGet('noAlarm') !== false)
33            return; //Escapa notificações caso a flag de noAlarm esteja ativa.
34
35        $organizers = array(); //Cache Organizadores
36        $schedulables = array(); //Cache Schedulables
37
38        foreach ($data as $i => $concept) {
39            if ($concept['concept'] === 'participant') {
40                if ($concept['method'] == 'create')
41                    $created[] = $concept['id'];
42                else if ($concept['method'] == 'update')
43                    $updated[] = $concept['id'];
44            }
45            else if ($concept['concept'] === 'schedulable') { //Caso exista schedulable no commit antecipa o carregamento do owner
46                $schedulables[$concept['id']] = Controller::read(array('concept' => 'schedulable', 'id' => $concept['id']), false, array('deepness' => '2'));
47                foreach ($schedulables[$concept['id']]['participants'] as $i => $v) //salva em $organizers as informações do organizador     
48                    if (($v['isOrganizer'] === '1') && ($organizers[$concept['id']] = $v))
49                        break;
50            }else if ($concept['concept'] === 'schedulableToAttachment') {
51                $relationAttachment = Controller::find(array('concept' => 'schedulableToAttachment'), false, array('filter' => array('=', 'id', $concept['id'])));
52
53
54
55                foreach ($relationAttachment as $key => $value) {
56                    if (!array_key_exists('attachments', $schedulables[$value['schedulable']]))
57                        $schedulables[$value['schedulable']]['attachments'] = array();
58
59                    $temp = Controller::find(array('concept' => 'attachment'), false, array('filter' => array('=', 'id', $value['attachment'])));
60                    array_push($schedulables[$value['schedulable']]['attachments'], $temp[0]);
61                }
62            }
63        }
64
65        if (isset($created)) {
66            $psCreated = Controller::find(array('concept' => 'participant'), false, array('deepness' => '1', 'filter' => array('IN', 'id', $created)));
67            foreach ($psCreated as $i => $pCreated) {
68                if ($pCreated['isOrganizer'] == '1')
69                    continue; //escapa organizador
70                $schedulable = isset($schedulables[$pCreated['schedulable']]) ? $schedulables[$pCreated['schedulable']] : Controller::read(array('concept' => 'schedulable', 'id' => $pCreated['schedulable']), false, array('deepness' => '2'));
71                if (!self::futureEvent($schedulable['startTime'], $schedulable['rangeEnd']))
72                    continue; //Escapa eventos do passado
73
74                $organizer = isset($organizers[$pCreated['schedulable']]) ? $organizers[$pCreated['schedulable']] : self::getOrganizer($pCreated['schedulable']);
75
76                if ($pCreated['delegatedFrom'] != 0) {
77                    self::participantDelegated($pCreated, $schedulable, $organizer);
78                    continue;
79                }
80
81                switch ($pCreated['status']) {
82                    case STATUS_CONFIRMED:
83                        self::participantStatusChange($pCreated['id'], $schedulable, $organizer, STATUS_ACCEPTED);
84                        break;
85                    case STATUS_UNANSWERED:
86                        self::participantCreated($pCreated['id'], $schedulable, false, false, $organizer);
87                        break;
88                }
89            }
90        }
91
92        if (isset($updated)) {
93            $psUpdated = Controller::find(array('concept' => 'participant'), false, array('deepness' => '1', 'filter' => array('IN', 'id', $updated)));
94            foreach ($psUpdated as $i => $pUpdated) {
95                if ($pUpdated['isOrganizer'] == '1')
96                    continue; //escapa organizador
97                $schedulable = isset($schedulables[$pUpdated['schedulable']]) ? $schedulables[$pUpdated['schedulable']] : Controller::read(array('concept' => 'schedulable', 'id' => $pUpdated['schedulable']), false, array('deepness' => '2'));
98                if (!self::futureEvent($schedulable['startTime'], $schedulable['rangeEnd']))
99                    continue; //Escapa eventos do passado
100
101                foreach ($schedulable['participants'] as $i => $v) //salva em $organizer as informações do organizador     
102                    if (($v['isOrganizer'] === '1') && ($organizer = $v))
103                        break;
104
105                if ($pUpdated['delegatedFrom'] != 0) {
106                    self::participantDelegatedStatusChange($pUpdated, $schedulable, $organizer, $pUpdated['status']);
107                } else if ($pUpdated['status'] != STATUS_UNANSWERED && $pUpdated['status'] != STATUS_DELEGATED)
108                    self::participantStatusChange($pUpdated['id'], $schedulable, $organizer, $pUpdated['status']);
109            }
110        }
111    }
112
113    public function formatSuggestion(&$params) {
114
115        $schedulable = Controller::read(array('concept' => 'schedulable', 'id' => $params['schedulable']), null, array('deepness' => '2'));
116
117        foreach ($schedulable['participants'] as $i => $v) //salva em $organizer as informações do organizador     
118            if (($v['isOrganizer'] === '1') && ($organizer = $v))
119                break;
120
121        $method = 'COUNTER';
122        $notificationType = 'Sugestão de horário';
123        $part = 'other';
124
125        $schedulableReference = $schedulable;
126
127        $referenceSuggestion = array('startTime' => $params['startTime'],
128            'endTime' => $params['endTime'],
129            'allDay' => $params['allDay']
130        );
131        $schedulable = array_merge($schedulable, $referenceSuggestion);
132
133        self::mountStruture(false, $schedulable, false, $data, $subject, $ical, $part, $method, $notificationType);
134
135
136        $timezone = new DateTimeZone('UTC');
137        $sTime = new DateTime('@' . (int) ($schedulableReference['startTime'] / 1000), $timezone);
138        $eTime = new DateTime('@' . (int) ($schedulableReference['endTime'] / 1000), $timezone);
139
140        if (isset($schedulableReference['timezone'])) {
141            $sTime->setTimezone(new DateTimeZone($schedulableReference['timezone']));
142            $eTime->setTimezone(new DateTimeZone($schedulableReference['timezone']));
143        }
144
145        $data['nowStartDate'] = date_format($sTime, 'd/m/Y');
146        $data['nowStartTime'] = ($schedulableReference['allDay']) ? '' : date_format($sTime, 'H:i');
147        $data['nowEndDate'] = date_format($eTime, 'd/m/Y');
148        $data['nowEndTime'] = ($schedulableReference['allDay']) ? '' : date_format($eTime, 'H:i');
149        $data['userRequest'] = Config::me('uid');
150
151        $ical2 = $ical;
152        $ical2['type'] = 'text/calendar';
153        $ical2['name'] = 'thunderbird.ics';
154        $params['attachments'][] = $ical2;
155        $params['attachments'][] = $ical;
156        $params['isHtml'] = true;
157        $params['body'] = parseTPL::load_tpl($data, ROOTPATH . '/modules/calendar/templates/notify_suggestion_body.tpl');
158        $params['subject'] = parseTPL::load_tpl($subject, ROOTPATH . '/modules/calendar/templates/notify_subject.tpl');
159        ;
160        $params['from'] = '"' . Config::me('cn') . '" <' . Config::me('mail') . '>';
161        $params['to'] = $organizer['user']['mail'];
162    }
163
164    public function formatSuggestionResponse(&$params) {
165        $schedulable = $params['schedulable'];
166        foreach ($schedulable['participants'] as $i => $v) {//salva em $organizer as informações do organizador     
167            if ($v['isOrganizer'] === '1')
168                $organizer = $v;
169            if ($v['user']['mail'] == Config::me('mail'))
170                $me = $v;
171        }
172        $method = 'DECLINECOUNTER';
173        $notificationType = 'Sugestão de horário';
174        $part = 'other';
175
176        $schedulable['participants'] = array();
177        array_push($schedulable['participants'], $me, $organizer);
178
179        self::mountStruture(false, $schedulable, false, $data, $subject, $ical, $part, $method, $notificationType);
180
181        if ($params['status'] == 'DECLINECOUNTER')
182            $data['status'] = 'não pode ser aceito';
183        $ical2 = $ical;
184        $ical2['type'] = 'text/calendar';
185        $ical2['name'] = 'thunderbird.ics';
186        $params['attachments'][] = $ical2;
187        $params['attachments'][] = $ical;
188        $params['isHtml'] = true;
189        $params['body'] = parseTPL::load_tpl($data, ROOTPATH . '/modules/calendar/templates/notify_suggestion_response_body.tpl');
190        $params['subject'] = parseTPL::load_tpl($subject, ROOTPATH . '/modules/calendar/templates/notify_subject.tpl');
191        ;
192        $params['to'] = $params['from'];
193        $params['from'] = $params['from'] = '"' . Config::me('cn') . '" <' . Config::me('mail') . '>';
194    }
195
196    public static function _getAttendeeById($attendeId, $schedulable) {
197        foreach ($schedulable['participants'] as $id => $dv)
198            if ($dv['id'] == $attendeId)
199                return $dv;
200    }
201
202    /**
203     * Prepara para criação de email de delegação
204     *
205     * @license    http://www.gnu.org/copyleft/gpl.html GPL
206     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
207     * @sponsor    Caixa Econômica Federal
208     * @author     Adriano Coutinho da Silva
209     * @return     void
210     * @access     public
211     */
212    public static function participantDelegated(&$partID, &$schedulable, &$organizer) {
213
214        $delegatedParams = array();
215
216        $delegatedFrom = self::_getAttendeeById($partID['delegatedFrom'], $schedulable);
217        $delegatedParams['delegatedFrom'] = $delegatedFrom['user']['uid'];
218
219        self::participantCreated($partID['id'], $schedulable, STATUS_DELEGATED, $delegatedParams);
220
221        $delegatedTo = self::_getAttendeeById($partID['id'], $schedulable);
222        $delegatedParams['delegated'] = $delegatedTo['user']['uid'];
223
224        self::participantStatusChange($partID['delegatedFrom'], $schedulable, $organizer, STATUS_DELEGATED, $delegatedParams);
225    }
226
227    /**
228     * Monta o email de resposta que sera enviado ao delegatedFrom
229     *
230     * @license    http://www.gnu.org/copyleft/gpl.html GPL
231     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
232     * @sponsor    Caixa Econômica Federal
233     * @author     Cristiano Corrêa Schmidt
234     * @return     void
235     * @access     public
236     */
237    public static function participantDelegatedStatusChange(&$partID, &$schedulable, $organizer, &$type = false) {
238
239        $delegatedParams = array();
240
241        $delegated = self::_getAttendeeById($partID['id'], $schedulable);
242        $delegatedParams['delegated'] = $delegated['user']['uid'];
243
244        switch ($partID['status']) {
245            case STATUS_ACCEPTED:
246                $delegatedParams['status'] = 'aceitou';
247                break;
248            case STATUS_TENTATIVE:
249                $delegatedParams['status'] = 'marcou como tentativa';
250                break;
251            case STATUS_CANCELLED:
252                $delegatedParams['status'] = 'rejeitou';
253                break;
254            case STATUS_DELEGATED:
255                $delegatedParams['status'] = 'delegou para um novo participante';
256                break;
257        }
258        //notifica o organizador a resposta do delegado
259        self::participantStatusChange($partID['delegatedFrom'], $schedulable, $organizer, $type, $delegatedParams);
260
261        $method = 'REQUEST';
262        $notificationType = 'Resposta Delegação';
263        $part = 'attendees';
264        self::mountStruture($partID['delegatedFrom'], $schedulable, $type, $data, $subject, $ical, $part, $method, $notificationType);
265
266        $data = array_merge($data, $delegatedParams);
267
268        self::sendMail($data, $ical, $part['user']['mail'], $subject, 'notify_response_delegated_status_body');
269    }
270
271    public static function mountStruture($partID, &$schedulable, $type = false, &$data, &$subject, &$ical, &$part = false, &$method, &$notificationType, $regSet = false) {
272
273        if ((Config::regGet('ical://' . $schedulable['id'] . '/' . $method) === false) || ($method == 'CANCEL')) { //Verifica se o ical ja não esta no reg
274            $schedulable['URI']['concept'] = 'schedulable';
275            $ical['source'] = Controller::format(array('service' => 'iCal'), array($schedulable), array('method' => $method));
276            $ical['type'] = 'text/plain';
277            $ical['name'] = 'outlook.ics';
278            if ($regSet)
279                Config::regSet('ical://' . $schedulable['id'] . '/' . $method, $ical);
280        }
281        else
282            $ical = Config::regGet('ical://' . $schedulable['id'] . '/' . $method);
283       
284        if (!is_numeric($schedulable['endTime']))
285            $schedulable['startTime'] = self::parseTimeDate( $schedulable['startTime'], $schedulable['timezone'] );
286       
287        if (!is_numeric($schedulable['endTime'])){
288            $schedulable['endTime'] =    self::parseTimeDate( $schedulable['endTime'], $schedulable['timezone'] );
289
290            if($schedulable['allDay'])
291                $schedulable['endTime'] =  $schedulable['endTime']  + 86400000;
292        }
293       
294        $timezone = new DateTimeZone('UTC');
295        $sTime = new DateTime('@' . (int) ($schedulable['startTime'] / 1000), $timezone);
296        $eTime = new DateTime('@' . (int) ($schedulable['endTime'] / 1000), $timezone);
297       
298        if (isset($schedulable['timezone'])) {
299            $sTime->setTimezone(new DateTimeZone($schedulable['timezone']));
300            $eTime->setTimezone(new DateTimeZone($schedulable['timezone']));
301        }
302
303        $data = array('startDate' => date_format($sTime, 'd/m/Y'),
304            'startTime' => ($schedulable['allDay']) ? '' : date_format($sTime, 'H:i'),
305            'endDate' => date_format($eTime, 'd/m/Y'),
306            'endTime' => ($schedulable['allDay']) ? '' : date_format($eTime, 'H:i'),
307            'eventTitle' => $schedulable['summary'],
308            'eventLocation' => $schedulable['location'],
309            'timezone' => ($schedulable['timezone']) ? $schedulable['timezone'] : 'UTC');
310        $temp = $part;
311        $part = false;
312
313        switch ($temp) {
314            case 'attendees':
315                $attList = '<UL> ';
316                foreach ($schedulable['participants'] as $i => $v) {
317                    if ($part === false && $v['id'] == $partID)
318                        $part = $v;
319
320                    $attList .= ' <LI> ' . (isset($v['user']['name']) ? $v['user']['name'] : $v['user']['mail']);
321                }
322                $attList .= '</UL>';
323                $data['participants'] = $attList;
324                break;
325            case 'me':
326                $part = self::_getAttendeeById($partID, $schedulable);
327                $data['participant'] = isset($part['user']['name']) ? $part['user']['name'] : $part['user']['mail'];
328                break;
329            case 'othersAttendees':
330                $data['participants'] = '<UL> ';
331                foreach ($schedulable['participants'] as $ii => $participant) {
332                    if (Config::me('mail') !== $participant['user']['mail'])
333                        $part[] = $participant['user']['mail'];
334
335                    $data['participants'] .= ' <LI> ' . (isset($participant['user']['name']) ? $participant['user']['name'] : $participant['user']['mail']);
336                }
337                break;
338        }
339        $subject['notificationType'] = $notificationType;
340        $subject['eventTitle'] = mb_convert_encoding($schedulable['summary'], 'ISO-8859-1', 'ISO-8859-1,UTF-8');
341        $subject['startDate'] = date_format($sTime, 'd/m/Y');
342        $subject['startTime'] = ($schedulable['allDay']) ? '' : date_format($sTime, 'H:i');
343        $subject['endDate'] = date_format($eTime, 'd/m/Y');
344        $subject['endTime'] = ($schedulable['allDay']) ? '' : date_format($eTime, 'H:i');
345        $subject['participant'] = Config::me('uid');
346    }
347
348    /**
349     * Monta o email de convite que sera enviado ao participant
350     *
351     * @license    http://www.gnu.org/copyleft/gpl.html GPL
352     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
353     * @sponsor    Caixa Econômica Federal
354     * @author     Cristiano Corrêa Schmidt
355     * @return     void
356     * @access     public
357     */
358    public static function participantCreated(&$partID, &$schedulable, $type = false, $delegatedParams = false, $organizer = false) {
359        $method = 'REQUEST';
360        $notificationType = 'Convite de Calendario';
361        $part = 'attendees';
362        self::mountStruture($partID, $schedulable, $type, $data, $subject, $ical, $part, $method, $notificationType, true);
363
364        if ($delegatedParams)
365            $data = array_merge($data, $delegatedParams);
366
367        self::sendMail($data, $ical, $part['user']['mail'], $subject, !$delegatedParams ? 'notify_create_body' : 'notify_create_delegated_body', $organizer);
368    }
369
370    /**
371     * Monta o email de aceito que sera enviado ao organizador
372     *
373     * @license    http://www.gnu.org/copyleft/gpl.html GPL
374     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
375     * @sponsor    Caixa Econômica Federal
376     * @author     Cristiano Corrêa Schmidt
377     * @return     void
378     * @access     public
379     */
380    public static function participantStatusChange(&$partID, &$schedulable, &$organizer, $type, $delegatedParams = false) {
381        $method = 'REPLY';
382        $notificationType = 'Convite Aceito';
383        $part = 'me';
384
385        self::mountStruture($partID, $schedulable, $type, $data, $subject, $ical, $part, $method, $notificationType, true);
386
387        if ($delegatedParams) {
388            $data = array_merge($data, $delegatedParams);
389            $tplDelegated = 'notify_delegated_status_body';
390        }
391
392        switch ($type) {
393            case STATUS_ACCEPTED:
394                $tpl = !$delegatedParams ? 'notify_accept_body' : $tplDelegated;
395                $subject['notificationType'] = 'Convite Aceito';
396                break;
397            case STATUS_TENTATIVE:
398                $tpl = !$delegatedParams ? 'notify_attempt_body' : $tplDelegated;
399                $subject['notificationType'] = 'Convite  aceito provisoriamente';
400                break;
401            case STATUS_CANCELLED:
402                $tpl = !$delegatedParams ? 'notify_reject_body' : $tplDelegated;
403                $subject['notificationType'] = 'Convite rejeitado';
404                break;
405            case STATUS_DELEGATED:
406                if ($delegatedParams)
407                    $data = array_merge($data, $delegatedParams);
408                $tpl = 'notify_delegated_body';
409                $subject['notificationType'] = 'Convite delegado';
410                break;
411        }
412
413        self::sendMail($data, $ical, $organizer['user']['mail'], $subject, $tpl, false);
414    }
415
416    /**
417     * Monta o body e envia o email
418     *
419     * @license    http://www.gnu.org/copyleft/gpl.html GPL
420     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
421     * @sponsor    Caixa Econômica Federal
422     * @author     Cristiano Corrêa Schmidt
423     * @return     void
424     * @access     public
425     */
426    private static function sendMail(&$data, &$ical, $to, &$subject, $template, $from = false) {
427        $ical2 = $ical;
428        $ical2['type'] = 'text/calendar';
429        $ical2['name'] = 'thunderbird.ics';
430        $mail['attachments'][] = $ical2;
431        $mail['attachments'][] = $ical;
432        $mail['isHtml'] = true;
433        $mail['body'] = parseTPL::load_tpl($data, ROOTPATH . '/modules/calendar/templates/' . $template . '.tpl');
434        $mail['subject'] = parseTPL::load_tpl($subject, ROOTPATH . '/modules/calendar/templates/notify_subject.tpl');
435        ;
436        $mail['from'] = $from ? ('"' . $from['user']['name'] . '" <' . $from['user']['mail'] . '>') : ('"' . Config::me('cn') . '" <' . Config::me('mail') . '>');
437        $mail['to'] = $to;
438        Controller::create(array('service' => 'SMTP'), $mail);
439    }
440
441    /**
442     * Monta o email de cancelado que sera enviado a todos os participantes
443     *
444     * @license    http://www.gnu.org/copyleft/gpl.html GPL
445     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
446     * @sponsor    Caixa Econômica Federal
447     * @author     Cristiano Corrêa Schmidt
448     * @return     void
449     * @access     public
450     */
451    public function deleteEvent(&$uri, &$result, &$params, $original) {
452        $schedulable = Controller::read(array('concept' => 'schedulable', 'id' => $uri['id']), null, array('deepness' => '2'));
453        if ((Config::regGet('noAlarm') === false) && (self::futureEvent($schedulable['startTime'], $schedulable['rangeEnd']))) {
454            $method = 'CANCEL';
455            $notificationType = 'Cancelamento de Calendario';
456            $part = 'othersAttendees';
457            self::mountStruture($uri['id'], $schedulable, false, $data, $subject, $ical, $part, $method, $notificationType);
458
459            if (count($part) > 0)
460                self::sendMail($data, $ical, implode(',', $part), $subject, 'notify_cancel_body');
461        }
462    }
463
464    /**
465     * Monta o email de cancelado que sera enviado ao participant deleteado
466     *
467     * @license    http://www.gnu.org/copyleft/gpl.html GPL
468     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
469     * @sponsor    Caixa Econômica Federal
470     * @author     Cristiano Corrêa Schmidt
471     * @return     void
472     * @access     public
473     */
474    public function deleteParticipant(&$uri, &$result, &$params, $original) {
475
476        $participant = Controller::read(array('concept' => 'participant', 'id' => $uri['id']), null, array('deepness' => '1'));
477        $schedulable = Controller::read(array('concept' => 'schedulable', 'id' => $participant['schedulable']));
478
479        if ((Config::regGet('noAlarm') === false) && (self::futureEvent($schedulable['startTime'], $schedulable['rangeEnd']))) {
480            $method = 'CANCEL';
481            $notificationType = 'Cancelamento de Calendario';
482            $part = 'others';
483            self::mountStruture(false, $schedulable, false, $data, $subject, $ical, $part, $method, $notificationType);
484
485            self::sendMail($data, $ical, $participant['user']['mail'], $subject, 'notify_cancel_body');
486        }
487    }
488
489    /**
490     * Faz um diff do update se ouve realmente uma alteração envia um email a todos os participants
491     *
492     * @license    http://www.gnu.org/copyleft/gpl.html GPL
493     * @author     Consórcio Expresso Livre - 4Linux (www.4linux.com.br) e Prognus Software Livre (www.prognus.com.br)
494     * @sponsor    Caixa Econômica Federal
495     * @author     Cristiano Corrêa Schmidt
496     * @return     void
497     * @access     public
498     */
499    public function updateEvent(&$uri, &$params, &$criteria, $original) {
500        $schedulableOld = Controller::read(array('concept' => 'schedulable', 'id' => $uri['id']), null, array('deepness' => '2'));
501        $schedulable = $schedulableOld;
502        $alt = false;
503
504        foreach ($params as $i => $v) //Verifica se ouve alteração no evento
505            if (isset($schedulableOld[$i]) && $schedulableOld[$i] != $v && $i != 'participants') {
506                $schedulable[$i] = $v;
507                $alt = true;
508            }
509
510        if (($alt === true) && (Config::regGet('noAlarm') === false) && (self::futureEvent($schedulable['startTime'], $schedulable['rangeEnd']))) {
511            $method = 'REQUEST';
512            $notificationType = 'Modificação de Calendario';
513            $part = 'othersAttendees';   
514            self::mountStruture($uri['id'], $schedulable, false, $data, $subject, $ical, $part, $method, $notificationType);
515
516            if (isset($part) && $part && count($part) > 0)
517                self::sendMail($data, $ical, implode(',', $part), $subject, 'notify_modify_body');
518        }
519    }
520   
521   static private function parseTimeDate($time, $timezone){
522        return strtotime( $time . ' ' .$timezone).'000';         
523   }   
524
525?>
Note: See TracBrowser for help on using the repository browser.