Changeset 6331 for trunk/prototype/modules/calendar/interceptors
- Timestamp:
- 05/28/12 21:17:51 (12 years ago)
- Location:
- trunk/prototype/modules/calendar/interceptors
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/prototype/modules/calendar/interceptors/DBMapping.php
r6299 r6331 373 373 /////////////////////////////////////////////////////////////////////////////////////////////////////////////// 374 374 375 public function updateCalendar(&$uri, &$params, &$criteria, $original) { 376 if (isset($params['calendar'])) { 377 $calendarObjects = self::schedulable2calendarToObject($uri['id']); 378 $params2['calendar'] = $params['calendar']; 379 380 foreach ($calendarObjects as $calendarObject) 375 public function updateCalendar(&$uri, &$params, &$criteria, $original) { 376 if (isset($params['calendar'])) { 377 if(isset($params['lastCalendar'])){ 378 $calendarObjects = self::referenceCalendarToObject($uri['id'], $params['lastCalendar']); 379 $params2['calendar'] = $params['calendar']; 380 }else{ 381 $calendarObjects = self::schedulable2calendarToObject($uri['id']); 382 $params2['calendar'] = $params['calendar']; 383 } 384 385 foreach ($calendarObjects as $calendarObject) 381 386 Controller::update(array('concept' => 'calendarToSchedulable', 'id' => $calendarObject['calendar_to_calendar_object']), $params2); 382 387 … … 717 722 $idCalendar = $criteria['filter'][2][2]; 718 723 719 if(!self::ownerSchedulable($idSchedulable )){724 if(!self::ownerSchedulable($idSchedulable, $criteria['filter'][3][2])){ 720 725 $isPermissionFromOwner = self::permissionFromCalendarSignature($idCalendar, $idSchedulable); 721 726 … … 727 732 728 733 foreach($calendarsToSchedulable as $value) 729 if($value['calendar_id'] == $idCalendar){ 734 if($value['calendar_id'] == $idCalendar){ 735 736 $participant = Controller::read(array('concept' => 'participant'), array('id'), array('filter' => 737 array('AND', 738 array('=', 'user', $criteria['filter'][3][2]), 739 array('=', 'schedulable', $idSchedulable) 740 ))); 741 742 Controller::call(('update'), array('concept' => 'participant', 'id' => $participant[0]['id']), array('status' => STATUS_CANCELLED)); 730 743 Controller::delete(array('concept' => 'calendarToSchedulable', 'id' => $value['calendar_to_calendar_object'])); 731 744 break; … … 740 753 $calendarsToSchedulable = self::schedulable2calendarToObject($uri['id']); 741 754 742 if (!self::ownerSchedulable($uri['id'] ) && !self::isAllowDeleteInCalendar($calendarsToSchedulable[0]['calendar_id'])) {755 if (!self::ownerSchedulable($uri['id'], Config::me('uidNumber')) && !self::isAllowDeleteInCalendar($calendarsToSchedulable[0]['calendar_id'])) { 743 756 744 757 foreach ($calendarsToSchedulable as $i => $v) { … … 750 763 751 764 /* Seta o participante como rejeitado */ 752 Controller::update(array('concept' => 'participant'), array('status' => STATUS_CANCELLED), array('filter' =>765 $participant = Controller::read(array('concept' => 'participant'), array('id'), array('filter' => 753 766 array('AND', 754 767 array('=', 'user', Config::me('uidNumber')), 755 array('=', 'schedulable', $uri['id']) 756 ))); 768 array('=', 'schedulable', $idSchedulable) 769 ))); 770 771 Controller::call(('update'), array('concept' => 'participant', 'id' => $participant[0]['id']), array('status' => STATUS_CANCELLED)); 757 772 758 773 return false; /* Mata o restante da execução */ … … 1017 1032 1018 1033 1019 private static function ownerSchedulable($id ) {1034 private static function ownerSchedulable($id, $me) { 1020 1035 1021 1036 $isOwner = Controller::find(array('concept' => 'participant'), array('id'), array('filter' => 1022 1037 array('AND', 1023 1038 array('=', 'isOrganizer', '1'), 1024 array('=', 'user', $ _SESSION['wallet']['user']['uidNumber']),1039 array('=', 'user', $me), 1025 1040 array('=', 'schedulable', $id) 1026 1041 ))); … … 1028 1043 return ( isset($isOwner[0]['id']) ) ? true : false; 1029 1044 } 1030 1045 1046 1047 private static function referenceCalendarToObject($schedulable, $calendar) { 1048 return Controller::service('PostgreSQL')->execResultSql('SELECT calendar_to_calendar_object.id as calendar_to_calendar_Object FROM calendar_to_calendar_object' 1049 . ' WHERE calendar_to_calendar_object.calendar_id = '. $calendar 1050 . ' AND calendar_to_calendar_object.calendar_object_id = ' . addslashes($schedulable)); 1051 } 1052 1031 1053 private static function schedulable2calendarToObject($Schedulable) { 1032 1054 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' -
trunk/prototype/modules/calendar/interceptors/Notifications.php
r6190 r6331 92 92 if (isset($updated)) { 93 93 $psUpdated = Controller::find(array('concept' => 'participant'), false, array('deepness' => '1', 'filter' => array('IN', 'id', $updated))); 94 94 95 foreach ($psUpdated as $i => $pUpdated) { 95 96 if ($pUpdated['isOrganizer'] == '1') … … 237 238 */ 238 239 public static function participantDelegatedStatusChange(&$partID, &$schedulable, $organizer, &$type = false) { 239 240 240 $delegatedParams = array(); 241 241 … … 270 270 } 271 271 272 public static function mountStruture( $partID, &$schedulable, $type = false, &$data, &$subject, &$ical, &$part = false, &$method, &$notificationType, $regSet = false) {272 public static function mountStruture(&$partID, &$schedulable, $type = false, &$data, &$subject, &$ical, &$part = false, &$method, &$notificationType, $regSet = false) { 273 273 274 274 if ((Config::regGet('ical://' . $schedulable['id'] . '/' . $method) === false) || ($method == 'CANCEL')) { //Verifica se o ical ja não esta no reg … … 327 327 $part = self::_getAttendeeById($partID, $schedulable); 328 328 $data['participant'] = isset($part['user']['name']) ? $part['user']['name'] : $part['user']['mail']; 329 $partID = $part; 329 330 break; 330 331 case 'othersAttendees': … … 344 345 $subject['endDate'] = date_format($eTime, 'd/m/Y'); 345 346 $subject['endTime'] = ($schedulable['allDay']) ? '' : date_format($eTime, 'H:i'); 346 $subject['participant'] = Config::me('uid');347 $subject['participant'] = (is_array($partID) && isset($partID['user']) )? $partID['user']['uid'] : Config::me('uid'); 347 348 } 348 349 … … 379 380 * @access public 380 381 */ 381 public static function participantStatusChange(&$partID, &$schedulable, &$organizer, $type, $delegatedParams = false) { 382 public static function participantStatusChange(&$partID, &$schedulable, &$organizer, $type, $delegatedParams = false) { 382 383 $method = 'REPLY'; 383 384 $notificationType = 'Convite Aceito'; … … 412 413 } 413 414 414 self::sendMail($data, $ical, $organizer['user']['mail'], $subject, $tpl, false);415 self::sendMail($data, $ical, $organizer['user']['mail'], $subject, $tpl, $partID); 415 416 } 416 417
Note: See TracChangeset
for help on using the changeset viewer.