- Timestamp:
- 03/15/13 18:17:23 (10 years ago)
- Location:
- trunk/zpush
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zpush/backend/expresso/providers/calendarProvider.php
r7687 r8022 30 30 { 31 31 $return = array(); 32 $sigs = Controller::find(array('concept' => 'calendarSignature'), array( 'id','calendar' ), array( 'filter' => array( '=' , 'user' , $this->_uidnumber ))); 33 34 foreach($sigs as $sig) 35 { 36 $calendar = Controller::read( array( 'concept' => 'calendar' , 'id' => $sig['calendar'] )); 37 if($calendar['type'] != 0 ) continue; //ecluir grupo de tarefas 38 39 $tmpSig = array(); 40 $tmpSig["id"] = 'calendar'.$sig['id']; 41 $tmpSig["parent"] = 0; 42 $tmpSig["mod"] = $calendar['name']; 43 $return[] = $tmpSig; 32 $criteria = CALENDAR_SYNC_SIGNED_CALENDARS ? array( 'filter' => array( 'AND' , array( '=' , 'type' , '0' ) , array( '=' , 'user' , $this->_uidnumber ))) : array( 'filter' => array ( 'AND' ,array( '=' , 'isOwner' , '1' ),array( '=' , 'type' , '0' ) , array( '=' , 'user' , $this->_uidnumber ))); 33 $sigs = Controller::find(array('concept' => 'calendarSignature'), array( 'id','calendar' ), $criteria); 34 35 if(Request::GetDeviceType() == 'iPhone') 36 { 37 foreach($sigs as $sig) 38 { 39 $calendar = Controller::read( array( 'concept' => 'calendar' , 'id' => $sig['calendar'] )); 40 $tmpSig = array(); 41 $tmpSig["id"] = 'calendar'.$sig['id']; 42 $tmpSig["parent"] = 0; 43 $tmpSig["mod"] = $calendar['name']; 44 $return[] = $tmpSig; 45 } 46 } 47 else 48 { 49 $defaultCalendar = Controller::find(array('concept' => 'modulePreference'), array('value','id') , array('filter' => array( 'and' , array('=' , 'name' , 'defaultCalendar') , array('=' , 'module' , 'expressoCalendar') , array('=' , 'user' , $this->_uidnumber ) )) ); 50 51 if(isset($defaultCalendar[0])) //Prioriza agenda default de importação pois o android so sincroniza a primeira agenda. 52 { 53 foreach($sigs as $i => $sig) 54 { 55 if($sig['calendar'] == $defaultCalendar[0]['value']) 56 { 57 $calendar = Controller::read( array( 'concept' => 'calendar' , 'id' => $sig['calendar'] )); 58 $tmpSig = array(); 59 $tmpSig["id"] = 'calendar'.$sig['id']; 60 $tmpSig["parent"] = 0; 61 $tmpSig["mod"] = $calendar['name']; 62 $return[] = $tmpSig; 63 } 64 } 65 } 66 else 67 { 68 $sig = $sigs[0]; 69 $calendar = Controller::read( array( 'concept' => 'calendar' , 'id' => $sig['calendar'] )); 70 $tmpSig = array(); 71 $tmpSig["id"] = 'calendar'.$sig['id']; 72 $tmpSig["parent"] = 0; 73 $tmpSig["mod"] = $calendar['name']; 74 $return[] = $tmpSig; 75 76 } 44 77 } 45 78 … … 121 154 public function ChangeFolder($folderid, $oldid, $displayname, $type) 122 155 { 123 return false;156 return false; 124 157 125 158 } … … 283 316 case STATUS_ACCEPTED: 284 317 $message->busystatus = 2; 285 break;318 break; 286 319 case STATUS_TENTATIVE: 287 320 $message->busystatus = 1; … … 300 333 //------------------------------------------------------------------------------------------------------------// 301 334 302 /*303 * Sincronização de Recorrência304 */335 /* 336 * Sincronização de Recorrência 337 */ 305 338 $repeats = Controller::find(array('concept' => 'repeat'), null , array( 'filter' => array( 'and' , array( '=' , 'schedulable' , $schedulable['id'] ),array( '!=' , 'frequency' , 'none' ) ) )); 306 339 if(is_array($repeats) && count($repeats) > 0) … … 326 359 327 360 if($repeat['endTime']) 328 $recur->until = (int) substr($repeat['endTime'], 0, -3);361 $recur->until = (int) substr($repeat['endTime'], 0, -3); 329 362 330 363 $recur->interval = $repeat['interval'] ? $repeat['interval'] : 1; … … 697 730 if($v['user']['id'] == $this->_uidnumber ) 698 731 { 699 $schedulable['participants'][$i]['status'] = $this->formatBusy($message->busystatus);732 $schedulable['participants'][$i]['status'] = $this->formatBusy($message->busystatus); 700 733 } 701 734 } … … 735 768 $schedulable['startTime'] = (($message->starttime + $GMT_CEL) + ($calendarSignatureTimezone->getOffset(new DateTime('@'.($message->starttime + $GMT_CEL), new DateTimeZone('UTC'))) * -1) ) *1000; //$message->starttime * 1000; 736 769 $schedulable['endTime'] = (($message->endtime + $GMT_CEL) + ($calendarSignatureTimezone->getOffset(new DateTime('@'.($message->endtime + $GMT_CEL), new DateTimeZone('UTC')))* -1)) *1000;//$message->endtime * 1000; 770 771 $sv = new DateTime('@'.($message->starttime + $GMT_CEL), $calendarSignatureTimezone); 772 773 if($sv->format('I') == 0) 774 $schedulable['startTime'] = $schedulable['startTime'] - 3600000; 775 776 $ev = new DateTime('@'.($message->endtime + $GMT_CEL), $calendarSignatureTimezone); 777 778 if($ev->format('I') == 0) 779 $schedulable['endTime'] = $schedulable['endTime'] - 3600000; 780 737 781 $schedulable['timezone'] = $calendar['timezone']; 738 739 782 740 783 … … 749 792 $participant['isOrganizer'] = '1'; 750 793 $participant['acl'] = 'rowi'; 794 $participant['status'] = '1'; 751 795 752 796 if($message->organizeremail) … … 966 1010 if($v['user']['id'] == $this->_uidnumber && $v['user']['isOrganizer'] == '1') 967 1011 { 968 $delete = true;1012 $delete = true; 969 1013 } 970 1014 } … … 1033 1077 1034 1078 //Inicia Variaveis de para API expresso 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1079 if(!isset($_SESSION)) 1080 session_start(); 1081 1082 $userWallet = array(); 1083 $userWallet['uidNumber'] = $entries[0]['uidnumber'][0]; 1084 $userWallet['uid'] = $entries[0]['uid'][0]; 1085 $userWallet['mail'] = $entries[0]['mail'][0]; 1086 1087 $_SESSION['wallet'] = array(); 1088 $_SESSION['wallet']['user'] = $userWallet; 1089 $_SESSION['flags']['currentapp'] = 'expressoCalendar'; 1046 1090 1047 1091 //----------------------------------------------------------------------------------------// … … 1207 1251 break; 1208 1252 case 0: 1209 return STATUS_UNANSWERED;1253 return STATUS_UNANSWERED; 1210 1254 break; 1211 1255 } -
trunk/zpush/config.php
r7706 r8022 311 311 define('IMAP_USE_IMAPMAIL', true); 312 312 313 define('CALENDAR_SYNC_SIGNED_CALENDARS', false); 313 314 314 315 $rs = pg_query( $GLOBALS['connections']['db'], 'SELECT app_id FROM phpgw_applications WHERE app_name = \'zpush\'' );
Note: See TracChangeset
for help on using the changeset viewer.