Ignore:
Timestamp:
12/03/12 17:01:59 (11 years ago)
Author:
douglas
Message:

Ticket #3143 - problema ao copiar evento ou tarefa no modulo expressocalendar

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.4/prototype/services/iCal.php

    r7254 r7594  
    111111                                        $this->createAttachment($v['attachments'], $vevent); 
    112112 
    113                             $vevent->setProperty('uid', $v['uid']);   
     113                            $vevent->setProperty('uid', $v['uid']); 
     114 
     115 
     116                $vevent->setProperty('uid', $v['uid']); 
     117 
     118                $timezoneDayligth = Controller::read(array('concept' => 'timezones'), null, array('filter' => array('=', 'tzid', $apTimezone))); 
     119 
     120                if(!empty( $timezoneDayligth ) && count( $timezoneDayligth ) > 0){ 
     121 
     122                    if(array_key_exists(0, $timezoneDayligth)) 
     123                        $timezoneDayligth = $timezoneDayligth[0]; 
     124 
     125                    date_default_timezone_set('UTC'); 
     126 
     127                    require_once ROOTPATH . '/plugins/when/When.php'; 
     128 
     129                    $r = new When(); 
     130 
     131                    $start = new DateTime('1970-01-01 '.$timezoneDayligth['standardDtstart']); 
     132 
     133                    $r = new When(); 
     134                    $r->recur($start, $timezoneDayligth['standardFrequency']) 
     135                        ->until($start->modify('+1 years')) 
     136                        ->bymonth(array( $timezoneDayligth['standardBymonth'] )) 
     137                        ->byday(array(  $timezoneDayligth['daylightByday'] )); 
     138 
     139                   $date = $r->next(); 
     140 
     141                    $timezone = &$ical->newComponent('vtimezone'); 
     142                    $timezone->setProperty('tzid',$apTimezone ); 
     143 
     144                    $standard  = &$timezone->newComponent( "standard" ); 
     145                    $standard->setProperty( "tzoffsetfrom", $timezoneDayligth['standardFrom'] ); 
     146                    $standard->setProperty( "tzoffsetto", $timezoneDayligth['standardTo'] ); 
     147 
     148                    $standard->setProperty( "dtstart", $date->format(DATE_RFC822), array("VALUE" => "DATE") ); 
     149 
     150                    $rrule = array( 
     151                                        'FREQ' => $timezoneDayligth['standardFrequency'], 
     152                        'BYMONTH' =>  $timezoneDayligth['standardBymonth'], 
     153                        'BYday' => array(preg_replace("/[^0-9]/", "", $timezoneDayligth['standardByday']),  "DAY" => preg_replace("/[^a-zA-Z\s]/", "", $timezoneDayligth['standardByday'])) 
     154                    ); 
     155 
     156                    $standard->setProperty('rrule', $rrule); 
     157 
     158                    $daylight  = &$timezone->newComponent( "daylight" ); 
     159 
     160                    $daylight->setProperty( "tzoffsetfrom", $timezoneDayligth['daylightFrom'] ); 
     161                    $daylight->setProperty( "tzoffsetto", $timezoneDayligth['daylightTo'] ); 
     162 
     163 
     164                    $start = new DateTime('1970-01-01 '.$timezoneDayligth['daylightDtstart']); 
     165 
     166                    $r->recur($start, $timezoneDayligth['daylightFrequency']) 
     167                        ->until($start->modify('+1 years')) 
     168                        ->bymonth(array( $timezoneDayligth['daylightBymonth'] )) 
     169                        ->byday(array(  $timezoneDayligth['daylightByday'] )); 
     170 
     171                    $date = $r->next(); 
     172 
     173                    $daylight->setProperty( "dtstart", $date->format(DATE_RFC822), array("VALUE" => "DATE") ); 
     174 
     175                    $rrule = array( 
     176                        'FREQ' => $timezoneDayligth['daylightFrequency'], 
     177                        'BYMONTH' =>  $timezoneDayligth['daylightBymonth'], 
     178                        'BYday' => array(preg_replace("/[^0-9]/", "", $timezoneDayligth['daylightByday']),  "DAY" => preg_replace("/[^a-zA-Z\s]/", "", $timezoneDayligth['daylightByday'])) 
     179                    ); 
     180 
     181                    $daylight->setProperty('rrule', $rrule); 
     182                } 
     183 
    114184                            break; 
    115185            case TODO_ID: 
Note: See TracChangeset for help on using the changeset viewer.