Changeset 7704
- Timestamp:
- 01/04/13 09:54:02 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/services/iCal.php
r7702 r7704 580 580 $interation['calendarToSchedulable://' . mt_rand() . '(Formatter)'] = $calendarToSchedulable; 581 581 582 if (isset($params['status'])) { 583 if($params['owner'] != Config::me("uidNumber")){ 582 if (isset($params['status'])) 583 { 584 if($params['owner'] != Config::me("uidNumber")) 585 { 584 586 $user = Controller::Read(array('concept' => 'user'), false, array('filter' => array('=', 'id', $params['owner'])) ); 585 587 $pID = self::_getParticipantByMail($user[0]['mail'], $schedulable['participants']); 586 }else{ 588 } 589 else 590 { 587 591 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 588 //caso nõa seja participante adiciona a lista de participantes 589 if(!$pID){ 590 $pID = mt_rand() . '2(Formatter)'; 591 $interation['participant://' . $pID]['status'] = $params['status']; 592 $interation['participant://' . $pID]['user'] = $params['owner']; 593 $interation['participant://' . $pID]['isOrganizer'] = '0'; 594 $interation['participant://' . $pID]['schedulable'] = $schedulable['id']; 595 }else 596 $interation['participant://' . $pID]['status'] = $params['status']; 592 } 593 //caso nõa seja participante adiciona a lista de participantes 594 if(!$pID){ 595 $pID = mt_rand() . '2(Formatter)'; 596 $interation['participant://' . $pID]['status'] = $params['status']; 597 $interation['participant://' . $pID]['user'] = $params['owner']; 598 $interation['participant://' . $pID]['isOrganizer'] = '0'; 599 $interation['participant://' . $pID]['schedulable'] = $schedulable['id']; 600 } 601 else 602 { 603 $interation['participant://' . $pID]['status'] = $params['status']; 597 604 } 598 605 } … … 723 730 $participant['isOrganizer'] = '0'; 724 731 $participant['isExternal'] = 0; 725 $participant['user'] = array('mail' => Config::me('mail'), 'name' => Config::me('cn')); 732 733 $user = false; 734 if($params['owner'] != Config::me("uidNumber")) 735 { 736 $user = Controller::Read(array('concept' => 'user'), false, array('filter' => array('=', 'id', $params['owner'])) ); 737 } 738 739 $participant['user'] = $user ? array('mail' => $user['mail'], 'name' => $user['name']) : array('mail' => Config::me('mail'), 'name' => Config::me('cn')); 740 726 741 $sc['participants'][] = $participant; 727 742 $sc['type'] = EVENT_ID; … … 788 803 $mail['subject'] = parseTPL::load_tpl($subject, ROOTPATH . '/modules/calendar/templates/notify_subject.tpl'); 789 804 ; 790 $mail['from'] = '"' . Config::me('cn') . '" <' . Config::me('mail') . '>';805 $mail['from'] = $user ? '"' . $user['name'] . '" <' . $user['mail'] . '>' : '"' . Config::me('cn') . '" <' . Config::me('mail') . '>'; 791 806 $mail['to'] = $organizerMail; 792 793 807 794 808 Controller::create(array('service' => 'SMTP'), $mail); … … 1325 1339 } 1326 1340 } else { 1341 1342 ///Atualiza o Caldadav mesmo que o expresso não prescisse de atualização, pois os calendarios do caldav são independentes um de cada usuario diferente do expresso que so tem 1 evento e é compartilhado entre os usuarios 1343 if (Config::module('useCaldav', 'expressoCalendar')) { //Ignorar Put dos eventos ja vindos do caldav 1344 require_once ROOTPATH . '/modules/calendar/interceptors/DAViCalAdapter.php'; 1345 $calendars = self::schedulable2calendarToObject($schedulable['id'] , isset($params['owner']) ? $params['owner']: false ); //Busca os calendarios do usuario logado que contenham o evento 1346 if (is_array($calendars)) 1347 foreach ($calendars as $calendar) 1348 DAViCalAdapter::putIcal($data, array('uid' => $schedulable['uid'], 'location' => $calendar['calendar_location'])); 1349 } 1350 1327 1351 if (self::_getTime($component, 'dtstamp') > $schedulable['dtstamp'] || $component->getProperty('sequence', false, false) > $schedulable['sequence']) //Organizador esta requisitando que você atualize o evento 1328 1352 $interation = ($isOrganizer) ? ICAL_ACTION_ORGANIZER_UPDATE : ICAL_ACTION_UPDATE; … … 1426 1450 } 1427 1451 1428 1429 1452 private function _getStatusTodo($id) { 1430 1453 $a = array( … … 1459 1482 return array('action' => ICAL_ACTION_IMPORT, 'type' => 'calendarIds'); 1460 1483 } 1461 1462 1484 1463 1485 private static function _getParticipantByMail($mail, &$participants, $isFull = false) { 1464 1486 if ($participants && $participants != '') … … 2245 2267 } 2246 2268 2269 private static function schedulable2calendarToObject($Schedulable, $user = false) { 2270 return Controller::service('PostgreSQL')->execResultSql('SELECT calendar_to_calendar_object.id as calendar_to_calendar_Object , calendar.name as calendar_name ,calendar.location as calendar_location, calendar.id as calendar_id FROM calendar_to_calendar_object , calendar , calendar_signature' 2271 . ' WHERE calendar_signature.user_uidnumber = ' . $user ? $user : Config::me('uidNumber') 2272 // .' AND calendar_signature.is_owner = 1' 2273 . ' AND calendar_signature.calendar_id = calendar.id' 2274 . ' AND calendar_to_calendar_object.calendar_id = calendar.id' 2275 . ' AND calendar_to_calendar_object.calendar_object_id = ' . addslashes($Schedulable)); 2276 } 2247 2277 } 2248 2278
Note: See TracChangeset
for help on using the changeset viewer.