Changeset 4898 for contrib/z-push/backend/BackendCalendarExpresso.php
- Timestamp:
- 08/03/11 12:00:08 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
contrib/z-push/backend/BackendCalendarExpresso.php
r4219 r4898 7 7 * Created : 06.12.2010 - emerson-faria.nobre@serpro.gov.br 8 8 * 9 * ï¿œ Zarafa Deutschland GmbH, www.zarafaserver.de9 * ᅵ Zarafa Deutschland GmbH, www.zarafaserver.de 10 10 * This file is distributed under GPL v2. 11 11 * Consult LICENSE file for details … … 65 65 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 66 66 while ($row = pg_fetch_row($result)) { 67 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> L êitem do BD (cal_id: '.$row[0].', title: '.$row[4].', last_update: '.date("d/m/Y G:i:s",substr($row[1], 0, strlen($row[1])-3)).', last_update_timestamp: '.$row[1].', datetime: '.date("d/m/Y G:i:s",$row[2]).', datetime_timestamp: '.$row[2].', cal_type: '.$row[3].')');67 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> Lê item do BD (cal_id: '.$row[0].', title: '.$row[4].', last_update: '.date("d/m/Y G:i:s",substr($row[1], 0, strlen($row[1])-3)).', last_update_timestamp: '.$row[1].', datetime: '.date("d/m/Y G:i:s",$row[2]).', datetime_timestamp: '.$row[2].', cal_type: '.$row[3].')'); 68 68 $result_recur = pg_query($this->db,"select recur_enddate from phpgw_cal_repeats where cal_id = " . $row[0] . ";"); 69 69 if ($result_recur == FALSE) throw new Exception(pg_last_error($this->db)); 70 70 if ($row[3] == 'M') { 71 71 if ($recur_enddate = pg_fetch_result($result_recur, 0, 0)) { 72 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> Evento '.$row[0].' érecorrente: recur_enddate : '.date("d/m/Y G:i:s",$recur_enddate).', recur_enddate_timestamp: '.$recur_enddate);72 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> Evento '.$row[0].' é recorrente: recur_enddate : '.date("d/m/Y G:i:s",$recur_enddate).', recur_enddate_timestamp: '.$recur_enddate); 73 73 if ($recur_enddate < $row[2]) { 74 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> ERRO: Esse evento n ão será adicionado na lista porque o campo phpgw_cal_repeats.recur_enddate émenor que o campo phpgw_cal.datetime. Corrija o valor de um dos campos');74 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> ERRO: Esse evento não será adicionado na lista porque o campo phpgw_cal_repeats.recur_enddate é menor que o campo phpgw_cal.datetime. Corrija o valor de um dos campos'); 75 75 continue; // Nao sincroniza este evento, porque a data final da recorrencia eh menor que a data inicial do evento. Eh o BD do Expresso que esta inconsistente. 76 76 } … … 91 91 if ($result_invalid_ref == FALSE) throw new Exception(pg_last_error($this->db)); 92 92 while ($row_invalid_ref = pg_fetch_row($result_invalid_ref)) { 93 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> ERRO: Evento com campo reference inv álido (cal_id: '.$row_invalid_ref[0].', title: '.$row_invalid_ref[4].', reference: '.$row_invalid_ref[5].', last_update: '.date("d/m/Y G:i:s",substr($row_invalid_ref[1], 0, strlen($row[1])-3)).', last_update_timestamp: '.$row_invalid_ref[1].', datetime: '.date("d/m/Y G:i:s",$row_invalid_ref[2]).', datetime_timestamp: '.$row_invalid_ref[2].', cal_type: '.$row_invalid_ref[3].')');93 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> ERRO: Evento com campo reference inválido (cal_id: '.$row_invalid_ref[0].', title: '.$row_invalid_ref[4].', reference: '.$row_invalid_ref[5].', last_update: '.date("d/m/Y G:i:s",substr($row_invalid_ref[1], 0, strlen($row[1])-3)).', last_update_timestamp: '.$row_invalid_ref[1].', datetime: '.date("d/m/Y G:i:s",$row_invalid_ref[2]).', datetime_timestamp: '.$row_invalid_ref[2].', cal_type: '.$row_invalid_ref[3].')'); 94 94 } 95 95 // Evento fora da faixa filtrada … … 107 107 debugLog("exception -> " . $e->getMessage() . " - ARQUIVO: " . $e->getFile() . " - LINHA: " . $e->getLine()); 108 108 } 109 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> Fim normal da fun ção');109 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageList-> Fim normal da função'); 110 110 return $messages; 111 111 } … … 147 147 if($folderid != "calendar") return false; 148 148 try { 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 149 $result = pg_query($this->db,"BEGIN;"); 150 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 151 $result_calendar = pg_query($this->db, "select last_update from phpgw_cal where cal_id = " . $id . ";"); 152 if ($result_calendar == FALSE) throw new Exception(pg_last_error($this->db)); 153 while ($row_calendar = pg_fetch_row($result_calendar)) { 154 if(isset($row_calendar[0])) { 155 $message = array(); 156 $message["mod"] = substr($row_calendar[0], 0, strlen($row_calendar[0])-3); 157 $message["id"] = $id; 158 $message["flags"] = 1; 159 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::StatMessage-> mod: '.$message["mod"].', id: '.$message["id"]); 160 return $message; 161 } 162 } 163 $result = pg_query($this->db,"COMMIT;"); 164 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 165 165 } catch (Exception $e) { 166 166 pg_query($this->db,"ROLLBACK;"); 167 167 debugLog("exception -> " . $e->getMessage() . " - ARQUIVO: " . $e->getFile() . " - LINHA: " . $e->getLine()); 168 168 } 169 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::StatMessage: ERRO: N ão encontrou valor para o campo last_update para esse evento.');169 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::StatMessage: ERRO: Não encontrou valor para o campo last_update para esse evento.'); 170 170 return false; 171 171 } … … 186 186 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 187 187 if ($row = pg_fetch_row($result)) { 188 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> L êevento do DB para enviar para o celular (cal_id: '.$row[0].', title:'.$row[1].', location: '.$row[2].', mdatetime: '.$row[3].', datetime: '.$row[4].', edatetime: '.$row[5].', reference: '.$row[7].', isPublic: '.$row[8].')');188 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> Lê evento do DB para enviar para o celular (cal_id: '.$row[0].', title:'.$row[1].', location: '.$row[2].', mdatetime: '.$row[3].', datetime: '.$row[4].', edatetime: '.$row[5].', reference: '.$row[7].', isPublic: '.$row[8].')'); 189 189 if ($row[7] != 0) $has_parent_event = true; 190 190 else $has_parent_event = false; … … 236 236 } 237 237 } 238 $message->alldayevent = 0; // (0 - N ão(default), 1- Sim)238 $message->alldayevent = 0; // (0 - Não(default), 1- Sim) 239 239 $message->busystatus = 2; // 2 - Ocupado 240 240 //TODO: Tratar $message - timezone 241 // $tz = $this->_getGMTTZ();241 // $tz = $this->_getGMTTZ(); 242 242 $tz = array("bias" => 180, "stdbias" => 0, "dstbias" => -60, "dstendyear" => 0, "dstendmonth" => 2, "dstendday" => 0, "dstendweek" => 2, "dstendhour" => 2, "dstendminute" => 0, "dstendsecond" => 0, "dstendmillis" => 0, 243 "dststartyear" => 0, "dststartmonth" =>10, "dststartday" =>0, "dststartweek" => 3, "dststarthour" => 2, "dststartminute" => 0, "dststartsecond" => 0, "dststartmillis" => 0);243 "dststartyear" => 0, "dststartmonth" =>10, "dststartday" =>0, "dststartweek" => 3, "dststarthour" => 2, "dststartminute" => 0, "dststartsecond" => 0, "dststartmillis" => 0); 244 244 $message->timezone = base64_encode($this->_getSyncBlobFromTZ($tz)); 245 245 //TODO: Se necessario, tratar $message - meetingstatus … … 265 265 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 266 266 if ($row = pg_fetch_row($result)){ 267 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> L ê recorrência do evento (recur_type: '.$row[0].', recur_use_end: '.$row[1].', recur_enddate: '.$row[2].', recur_interval: '.$row[3].', recur_data: '.$row[4].', recur_exception: '.$row[5].')');267 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> Lê recorrência do evento (recur_type: '.$row[0].', recur_use_end: '.$row[1].', recur_enddate: '.$row[2].', recur_interval: '.$row[3].', recur_data: '.$row[4].', recur_exception: '.$row[5].')'); 268 268 $recur = new SyncRecurrence(); 269 269 // Converte os tipos do Expresso para os tipos do Protocolo ActiveSync … … 311 311 } 312 312 $message->recurrence = $recur; 313 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> Fim do Bloco - L ê recorrência do evento.');313 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> Fim do Bloco - Lê recorrência do evento.'); 314 314 } 315 315 … … 318 318 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 319 319 while ($row_recur_exception = pg_fetch_row($result)) { 320 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO: L ê evento único da recorrência com id: '.$row_recur_exception[0]);320 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO: Lê evento único da recorrência com id: '.$row_recur_exception[0]); 321 321 $recur_exception = $this->GetMessageDAO($row_recur_exception[0]); 322 322 if ($recur_exception instanceof SyncAppointment) { … … 324 324 array_push($message->exceptions, $recur_exception); 325 325 } 326 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> Fim do Bloco - L ê evento único da recorrência com id: '.$row_recur_exception[0]);326 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> Fim do Bloco - Lê evento único da recorrência com id: '.$row_recur_exception[0]); 327 327 } 328 328 … … 331 331 $array_timestamps_recur_deleted = explode(",",$row[5]); 332 332 foreach ($array_timestamps_recur_deleted as $timestamp_recur_deleted) { 333 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO: Timestamps dos eventos únicos da recorrência do tipo deletados: '.$timestamp_recur_deleted);333 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO: Timestamps dos eventos únicos da recorrência do tipo deletados: '.$timestamp_recur_deleted); 334 334 $recur_deleted = new SyncAppointment(); 335 335 $recur_deleted->deleted = '1'; … … 340 340 } 341 341 //TODO: Tratar Participantes do Evento 342 343 342 } 344 343 $result = pg_query($this->db,"COMMIT;"); … … 349 348 return; 350 349 } 351 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> Fim do Bloco - L êevento do DB para enviar para o celular: '.$id);350 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::GetMessageDAO-> Fim do Bloco - Lê evento do DB para enviar para o celular: '.$id); 352 351 return $message; 353 352 } … … 389 388 return false; 390 389 } 391 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog("CalendarExpresso::DeleteMessage-> Fim normal da Fun ção.");390 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog("CalendarExpresso::DeleteMessage-> Fim normal da Função."); 392 391 return true; 393 392 } … … 399 398 function ChangeMessageDAO($id, $message) { 400 399 debugLog('CalendarExpresso::ChangeMessageDAO('.$id.', ..)'); 401 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> O evento do celular ser áinserido/atualizado no BD com o ID: '.$id);400 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> O evento do celular será inserido/atualizado no BD com o ID: '.$id); 402 401 try { 403 402 $result = pg_query($this->db,"BEGIN;"); … … 543 542 //TODO: Implementar para os tipos 3 e 6. O Expresso ainda nao suporta esses tipos :-( 544 543 if (isset($message->recurrence) and ($message->recurrence->type == 0 or $message->recurrence->type == 1 or $message->recurrence->type == 2 or $message->recurrence->type == 5)) { 545 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> O Evento éRecorrente.');544 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> O Evento é Recorrente.'); 546 545 switch ($message->recurrence->type) { 547 546 case 0: //repeticao diaria … … 562 561 break; 563 562 } 564 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorr ência-> recur_type: '.$arrayRecur["recur_type"]);563 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorrência-> recur_type: '.$arrayRecur["recur_type"]); 565 564 if (isset($message->recurrence->interval)) { 566 565 $arrayRecur["recur_interval"] = $message->recurrence->interval; 567 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorr ência-> recur_interval: '.$arrayRecur["recur_interval"]);566 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorrência-> recur_interval: '.$arrayRecur["recur_interval"]); 568 567 } 569 568 if ($message->recurrence->type == 1 or $message->recurrence->type == 3 or $message->recurrence->type == 6) { 570 569 if (isset($message->recurrence->dayofweek)) { 571 570 $arrayRecur["recur_data"] = $message->recurrence->dayofweek; 572 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorr ência-> recur_data: '.$arrayRecur["recur_data"]);571 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorrência-> recur_data: '.$arrayRecur["recur_data"]); 573 572 /*$day = $message->recurrence->dayofweek; 574 573 $day_of_week_counter = 0; … … 615 614 $arrayRecur["recur_enddate"] = 1893283200; // Se nao tem data de termino seta para 30/12/2029 616 615 } 617 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorr ência-> recur_enddate: '.$arrayRecur["recur_enddate"]);616 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorrência-> recur_enddate: '.$arrayRecur["recur_enddate"]); 618 617 619 618 // Trata excecoes da recorrencia … … 621 620 // Tem Excecoes de recorrencia do tipo Edicao 622 621 // Verifica se ja existe o registro do evento de excecao de recorrencia na tabela phpgw_cal 623 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento tem exce ção de recorrência');622 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento tem exceção de recorrência'); 624 623 $recur_exception_changed_ids = ""; 625 624 $recur_exception_deleted_starttimes = ""; … … 643 642 $except_description_from_DB = $row[2]; 644 643 $found_except_cal_id = true; 645 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Achou o evento na tabela phpgw_cal, vai ATUALIZAR a exce ção da recorrência nessa tabela');644 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Achou o evento na tabela phpgw_cal, vai ATUALIZAR a exceção da recorrência nessa tabela'); 646 645 } 647 646 } … … 653 652 if(isset($row[0])) { 654 653 $found_except_cal_user = true; 655 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Achou o evento na tabela phpgw_cal_user, vai ATUALIZAR a exce ção da recorrência nessa tabela');654 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Achou o evento na tabela phpgw_cal_user, vai ATUALIZAR a exceção da recorrência nessa tabela'); 656 655 } 657 656 } … … 661 660 if(isset($message->uid)) { 662 661 $arrayExceptCal["uid"] = $this->truncateString(utf8_decode($message->uid),255); 663 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exce ção De Recorrência-> uid: '.$arrayExceptCal["uid"]);662 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exceção De Recorrência-> uid: '.$arrayExceptCal["uid"]); 664 663 } 665 664 if(isset($recur_exception->subject)) { … … 668 667 $arrayExceptCal["title"] = $this->truncateString(utf8_decode($message->subject),299); 669 668 } 670 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exce ção De Recorrência-> title: '.$arrayExceptCal["title"]);669 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exceção De Recorrência-> title: '.$arrayExceptCal["title"]); 671 670 if(isset($recur_exception->location)) { 672 671 $arrayExceptCal["location"] = $this->truncateString(utf8_decode($recur_exception->location),255); … … 674 673 $arrayExceptCal["location"] = $this->truncateString(utf8_decode($message->location),255); 675 674 } 676 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exce ção De Recorrência-> location: '.$arrayExceptCal["location"]);675 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exceção De Recorrência-> location: '.$arrayExceptCal["location"]); 677 676 if(isset($recur_exception->dtstamp)) { 678 677 $arrayExceptCal["mdatetime"] = $recur_exception->dtstamp; … … 680 679 $arrayExceptCal["mdatetime"] = $message->dtstamp; 681 680 } 682 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exce ção De Recorrência-> mdatetime: '.$arrayExceptCal["mdatetime"]);681 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exceção De Recorrência-> mdatetime: '.$arrayExceptCal["mdatetime"]); 683 682 if(isset($recur_exception->starttime)) { 684 683 $arrayExceptCal["datetime"] = $recur_exception->starttime; … … 686 685 $arrayExceptCal["datetime"] = $message->starttime; 687 686 } 688 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exce ção De Recorrência-> datetime: '.$arrayExceptCal["datetime"]);687 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exceção De Recorrência-> datetime: '.$arrayExceptCal["datetime"]); 689 688 if(isset($recur_exception->endtime)) { 690 689 $arrayExceptCal["edatetime"] = $recur_exception->endtime; … … 692 691 $arrayExceptCal["edatetime"] = $message->endtime; 693 692 } 694 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exce ção De Recorrência-> edatetime: '.$arrayExceptCal["edatetime"]);693 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exceção De Recorrência-> edatetime: '.$arrayExceptCal["edatetime"]); 695 694 if(isset($recur_exception->sensitivity) and $recur_exception->sensitivity == 0) { 696 695 $arrayExceptCal["is_public"] = 1; // 1 - Normal … … 700 699 $arrayExceptCal["is_public"] = 1; // 1 - Normal 701 700 }else $arrayExceptCal["is_public"] = 0; // 0 - Privado 702 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exce ção De Recorrência-> is_public: '.$arrayExceptCal["is_public"]);701 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exceção De Recorrência-> is_public: '.$arrayExceptCal["is_public"]); 703 702 if (isset($recur_exception->body)) { 704 703 $arrayExceptCal["description"] = utf8_decode($recur_exception->body); … … 738 737 } 739 738 } 740 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exce ção De Recorrência-> category: '.$arrayExceptCal["category"]);739 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Exceção De Recorrência-> category: '.$arrayExceptCal["category"]); 741 740 //TODO: Converter eventos que sao alldayevent para iniciar as 0:00hs e terminar as 23:59hs. Isso porque o Expresso nao suporta alldayevents 742 741 // if(isset($message->alldayevent)) { … … 752 751 $result = pg_insert($this->db, 'phpgw_cal', $arrayExceptCal); 753 752 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 754 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento de Exce ção da Recorrência INSERIDO na tabela phpgw_cal com cal_id: '.$arrayExceptCal["cal_id"]);753 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento de Exceção da Recorrência INSERIDO na tabela phpgw_cal com cal_id: '.$arrayExceptCal["cal_id"]); 755 754 } else { 756 755 $result = pg_update($this->db, 'phpgw_cal', $arrayExceptCal, array('cal_id' => $except_cal_id)); 757 756 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 758 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento de Exce ção da Recorrência ATUALIZADO na tabela phpgw_cal');757 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento de Exceção da Recorrência ATUALIZADO na tabela phpgw_cal'); 759 758 } 760 759 … … 768 767 $result = pg_insert($this->db, 'phpgw_cal_user', $arrayExceptCalUser); 769 768 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 770 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento de Exce ção da Recorrência INSERIDO na tabela phpgw_cal_user com cal_id: '.$arrayExceptCalUser["cal_id"]);769 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento de Exceção da Recorrência INSERIDO na tabela phpgw_cal_user com cal_id: '.$arrayExceptCalUser["cal_id"]); 771 770 } else { 772 771 $result = pg_update($this->db, 'phpgw_cal_user', $arrayExceptCalUser, array('cal_id' => $except_cal_id, 'cal_login' => $this->_uidnumber)); 773 772 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 774 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento de Exce ção da Recorrência ATUALIZADO na tabela phpgw_cal_user');773 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento de Exceção da Recorrência ATUALIZADO na tabela phpgw_cal_user'); 775 774 } 776 775 if ($recur_exception_changed_ids == "") { … … 790 789 //Tem Excecoes de recorrencia do tipo Exclusao 791 790 $arrayRecur["recur_exception"] = $recur_exception_deleted_starttimes; 792 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento tem exce ção de recorrência do tipo exclusão com os seguintes starttimes: '.$recur_exception_deleted_starttimes);791 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Evento tem exceção de recorrência do tipo exclusão com os seguintes starttimes: '.$recur_exception_deleted_starttimes); 793 792 } else { 794 793 $arrayRecur["recur_exception"] = ""; 795 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> N ão tem exceção de recorrência do tipo exclusão para esse evento');794 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Não tem exceção de recorrência do tipo exclusão para esse evento'); 796 795 } 797 796 if ($recur_exception_changed_ids == "") { … … 801 800 $result = pg_query($this->db, "delete from phpgw_cal where reference = " . $cal_id . ";"); 802 801 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 803 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> N ão tem exceção de recorrência, então deleta possíveis eventos de exceção de recorrência criados anteriormente para esse evento.');802 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Não tem exceção de recorrência, então deleta possÃveis eventos de exceção de recorrência criados anteriormente para esse evento.'); 804 803 } else { 805 804 //Deleta as excecoes da recorrencia, exceto as inseridas/atualizadas acima … … 808 807 $result = pg_query($this->db, "delete from phpgw_cal where reference = " . $cal_id . " and cal_id not in (" . $recur_exception_changed_ids . ");"); 809 808 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 810 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Deleta as ex çeções da recorrência, exceto as inseridas/atualizadas pelo celular com os seguintes cal_id:'.$recur_exception_changed_ids);809 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Deleta as exçeções da recorrência, exceto as inseridas/atualizadas pelo celular com os seguintes cal_id:'.$recur_exception_changed_ids); 811 810 } 812 811 } else { … … 817 816 $result = pg_query($this->db, "delete from phpgw_cal where reference = " . $cal_id . ";"); 818 817 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 819 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> N ão tem exceção de recorrência, então deleta possíveis eventos de exceção de recorrência criados anteriormente para esse evento..');818 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Não tem exceção de recorrência, então deleta possÃveis eventos de exceção de recorrência criados anteriormente para esse evento..'); 820 819 } 821 820 if (!$found_cal_repeats){ … … 823 822 $result = pg_insert($this->db, 'phpgw_cal_repeats', $arrayRecur); 824 823 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 825 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorr ência INSERIDA na tabela phpgw_cal_repeats com cal_id: '.$arrayRecur["cal_id"]);824 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorrência INSERIDA na tabela phpgw_cal_repeats com cal_id: '.$arrayRecur["cal_id"]); 826 825 } else { 827 826 $result = pg_update($this->db, 'phpgw_cal_repeats', $arrayRecur, array('cal_id' => $cal_id)); 828 827 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 829 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorr ência ATUALIZADA na tabela phpgw_cal_repeats');828 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Recorrência ATUALIZADA na tabela phpgw_cal_repeats'); 830 829 } 831 830 } elseif ($found_cal_id) { … … 837 836 $result = pg_query($this->db, "delete from phpgw_cal_repeats where cal_id = " . $cal_id . ";"); 838 837 if ($result == FALSE) throw new Exception(pg_last_error($this->db)); 839 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> N ão tem recorrência, então deleta possíveis eventos de recorrência criados anteriormente para esse evento');838 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Não tem recorrência, então deleta possÃveis eventos de recorrência criados anteriormente para esse evento'); 840 839 } 841 840 $result = pg_query($this->db,"COMMIT;"); … … 847 846 return false; 848 847 } 849 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Fim normal da Fun ção');848 if (TRACE_UID !== false and (TRACE_TYPE == 'CALENDAR' or TRACE_TYPE == 'ALL')) traceLog('CalendarExpresso::ChangeMessageDAO-> Fim normal da Função'); 850 849 return $id; 851 850 } … … 917 916 918 917 function removeAccents($data){ 919 $data = strtr($data,"ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÜÚÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùüúþÿ","aaaaaaaceeeeiiii noooooxouuutbaaaaaaaceeeeiiii nooooo/ouuuty"); 918 $data = strtr($data,"ÃÃÃÃÃà 919 ÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃÃà áâãÀåÊçÚéêëìÃîïðñòóÎõö÷ÞùÌúßÿ","aaaaaaaceeeeiiii noooooxouuutbaaaaaaaceeeeiiii nooooo/ouuuty"); 920 920 return $data; 921 921 } … … 944 944 function _getGMTTZ() { 945 945 //$tz = array("bias" => 0, "stdbias" => 0, "dstbias" => 0, "dstendyear" => 0, "dstendmonth" => 2, "dstendday" => 0, "dstendweek" => 2, "dstendhour" => 2, "dstendminute" => 0, "dstendsecond" => 0, "dstendmillis" => 0, 946 // 947 $tz = array("bias" => 120, "stdbias" => 0, "dstbias" => -60, "dstendyear" => 0, "dstendmonth" => 2, "dstendday" => 0, "dstendweek" => 2, "dstendhour" => 2, "dstendminute" => 0, "dstendsecond" => 0, "dstendmillis" => 0, 948 "dststartyear" => 0, "dststartmonth" =>10, "dststartday" =>0, "dststartweek" => 3, "dststarthour" => 2, "dststartminute" => 0, "dststartsecond" => 0, "dststartmillis" => 0);946 //"dststartyear" => 0, "dststartmonth" =>10, "dststartday" =>0, "dststartweek" => 3, "dststarthour" => 2, "dststartminute" => 0, "dststartsecond" => 0, "dststartmillis" => 0); 947 $tz = array("bias" => 120, "stdbias" => 0, "dstbias" => -60, "dstendyear" => 0, "dstendmonth" => 2, "dstendday" => 0, "dstendweek" => 2, "dstendhour" => 2, "dstendminute" => 0, "dstendsecond" => 0, "dstendmillis" => 0, "dststartyear" => 0, "dststartmonth" =>10, "dststartday" =>0, "dststartweek" => 3, "dststarthour" => 2, "dststartminute" => 0, "dststartsecond" => 0, "dststartmillis" => 0); 948 949 949 return $tz; 950 950 }
Note: See TracChangeset
for help on using the changeset viewer.