Changeset 6295 for trunk/prototype/services/iCal.php
- Timestamp:
- 05/24/12 16:26:24 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/services/iCal.php
r6248 r6295 248 248 $calendarToSchedulable['schedulable'] = $schedulable['id']; 249 249 $interation['calendarToSchedulable://' . mt_rand() . '(Formatter)'] = $calendarToSchedulable; 250 250 251 251 if (isset($params['status'])) { 252 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 252 if(isset($params['fromPermission'])){ 253 $signaturesOfOwner = Controller::Read(array('concept' => 'calendarSignature'), false, array('filter' => array('AND', array('=', 'calendar', $params['fromPermission']) , array('=','isOwner','1')), 'deepness' => 2 )); 254 $pID = self::_getParticipantByMail($signaturesOfOwner[0]['user']['mail'], $schedulable['participants']); 255 }else 256 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 253 257 $interation['participant://' . $pID]['status'] = $params['status']; 254 258 } … … 265 269 266 270 if (isset($params['status'])) { 267 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 271 if(isset($params['fromPermission'])){ 272 $signaturesOfOwner = Controller::Read(array('concept' => 'calendarSignature'), false, array('filter' => array('AND', array('=', 'calendar', $params['fromPermission']) , array('=','isOwner','1')), 'deepness' => 2 )); 273 $pID = self::_getParticipantByMail($signaturesOfOwner[0]['user']['mail'], $schedulable['participants']); 274 }else 275 $pID = self::_getParticipantByMail(Config::me('mail'), $schedulable['participants']); 268 276 //Verifica a importação de eventos em que não participo 269 277 if ($pID) { … … 566 574 $interation = ($isOrganizer) ? ICAL_ACTION_ORGANIZER_NONE : ICAL_ACTION_NONE; 567 575 } 568 if (!$isParticipant) 569 $interation = ICAL_ACTION_ORGANIZER_NONE; 576 if (!$isParticipant){ 577 $interation = self::_checkParticipantByPermissions($schedulable); 578 } 570 579 }else 571 580 $interation = ICAL_ACTION_IMPORT; … … 651 660 } 652 661 662 private static function _checkParticipantByPermissions($schedulable) { 663 664 $calendarIds = Controller::find(array('concept' => 'calendarSignature'), array('calendar'), array('filter' => array('AND', array('=','isOwner','0'), array('=', 'user', Config::me("uidNumber"))))); 665 666 if($calendarIds && isset($calendarIds[0])){ 667 $ids = array(); 668 foreach($calendarIds as $value) 669 array_push($ids, $value['calendar']); 670 671 $signaturesOfOwners = Controller::find(array('concept' => 'calendarSignature'), false, array('filter' => array('AND', array('IN', 'calendar', $ids) , array('=','isOwner','1')), 'deepness' => 2 )); 672 673 foreach($signaturesOfOwners as $value){ 674 if(self::_getParticipantByMail($value['user']['mail'], $schedulable['participants'])){ 675 $eventoFromCalendar = Controller::read( array( 'concept' => 'calendarToSchedulable') , false, array('filter' => array('AND', array('=','schedulable',$schedulable['id']), array('=','calendar', $value['calendar']['id'])))); 676 677 return ($eventoFromCalendar && isset($eventoFromCalendar[0])) ? ICAL_ACTION_NONE_FROM_PERMISSION : array('action' => ICAL_ACTION_IMPORT_FROM_PERMISSION, 'calendar' => $value['calendar']['id'] ); 678 } 679 } 680 } 681 return ICAL_ACTION_ORGANIZER_NONE; 682 } 683 684 653 685 private static function _getParticipantByMail($mail, &$participants) { 654 686 if ($participants && $participants != '')
Note: See TracChangeset
for help on using the changeset viewer.