Ignore:
Timestamp:
01/03/13 08:46:17 (11 years ago)
Author:
acoutinho
Message:

Ticket #3259 - Otimizar carregamento de eventos no modulo ExpressoCalendar?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/prototype/services/iCal.php

    r7695 r7702  
    6464                            if (( isset($v['repeat']) ) && ( isset($v['repeat']['frequency']) && $v['repeat']['frequency'] && $v['repeat']['frequency'] != 'none' ))  
    6565                                    $vevent->setProperty('rrule', $this->formatIcalRepeat($v['repeat'])); 
    66                              
     66 
     67                $vevent->setProperty('dtstamp', array('timestamp' => ($v['dtstamp'] / 1000) )); 
    6768 
    6869                            if (isset($v['allDay']) && $v['allDay'] == 1) 
     
    200201                $eTime->setTimezone($apTimezoneOBJ); 
    201202 
     203                $vevent->setProperty('dtstamp', array('timestamp' => ($v['dtstamp'] / 1000) )); 
     204 
    202205                if (isset($v['allDay']) && $v['allDay'] == 1) { 
    203206                    $todo->setProperty('dtstart', $sTime->format(DATE_RFC822), array("VALUE" => "DATE")); 
     
    281284                            $vevent->setProperty('location', $v['location']); 
    282285                            $vevent->setProperty('tranp', (isset($v['tranparent']) && $v['tranparent'] == TRANSP_TRANSPARENT ) ? 'TRANSPARENT' : 'OPAQUE' ); 
     286 
     287                $vevent->setProperty('dtstamp', array('timestamp' => ($v['dtstamp'] / 1000) )); 
    283288 
    284289                            $timezone = new DateTimeZone('UTC'); 
     
    348353            $todo->setProperty('status', $this->_getStatusTodo($v['status'])); 
    349354 
     355            $vevent->setProperty('dtstamp', array('timestamp' => ($v['dtstamp'] / 1000) )); 
     356 
    350357            $timezone = new DateTimeZone('UTC'); 
    351358            $apTimezone = self::nomalizeTZID(( isset($v['timezone']) && $v['timezone'] != 'null' ) ? $v['timezone'] : $params['defaultTZI']); 
     
    543550                case 'VEVENT': 
    544551 
     552 
    545553                    switch ($method) { 
    546554                        case 'PUBLISH': 
     
    610618                            //Verifica a importação de eventos em que não participo 
    611619                            if ($pID) { 
     620 
    612621                                $interation['participant://' . $pID]['status'] = $params['status']; 
     622 
    613623                            } 
    614624                        } 
     
    848858                            break; 
    849859                    } 
    850          
    851                      
     860 
    852861                    $return[] = $interation; 
    853862                    break; 
     
    15621571        $objTimezone = new DateTimeZone($schedulable['timezone']); 
    15631572 
    1564         if (isset($startTime['params']['VALUE']) && $startTime['params']['VALUE'] === 'DATE' && isset($params['calendar_timezone'])) { 
     1573        if (isset($startTime['params']['VALUE']) && $startTime['params']['VALUE'] === 'DATE' ) { 
    15651574            $schedulable['allDay'] = 1; 
    15661575            $schedulable['startTime'] = self::date2timestamp($startTime['value']) - self::_getTzOffset('UTC', $schedulable['timezone'], '@' . self::date2timestamp($startTime['value'])) . '000'; 
     
    16671676            $intUser = Controller::find(array('concept' => 'user'), array('id', 'isExternal'), array('filter' => array('OR', array('=', 'mail', $mailUser), array('=', 'mailAlternateAddress', $mailUser)))); 
    16681677 
    1669             $user = null; 
     1678            $user = null; 
    16701679            if ($intUser && count($intUser) > 0) { 
    16711680                $participant['isExternal'] = isset($intUser[0]['isExternal']) ? $intUser[0]['isExternal'] : 0; 
     
    16891698 
    16901699        if ($property = $component->getProperty('organizer', FALSE, TRUE)) { 
    1691             $participant = array(); 
     1700 
    16921701            $mailUser = trim(str_replace('MAILTO:', '', $property['value'])); 
    16931702 
    1694             $participantID = mt_rand() . '2(Formatter)'; 
    1695  
    1696             $participant['schedulable'] = $eventID; 
    1697             $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 
    1698             $participant['isOrganizer'] = '1'; 
    1699             $participant['acl'] = 'rowi'; 
     1703 
     1704            if($participant = self::_getParticipantByMail($mailUser, $schedulable['participants'], true)){ 
     1705 
     1706                $participantID = $participant['id']; 
     1707 
     1708            }else{ 
     1709 
     1710                $participant = array(); 
     1711 
     1712                $participantID = mt_rand() . '2(Formatter)'; 
     1713                $participant['schedulable'] = $eventID; 
     1714                $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 
     1715                $participant['isOrganizer'] = '1'; 
     1716                $participant['acl'] = 'rowi'; 
     1717            } 
    17001718 
    17011719            /* Verifica se este usuario é um usuario interno do ldap */ 
    17021720            $intUser = Controller::find(array('concept' => 'user'), array('id', 'isExternal'), array('filter' => array('OR', array('=', 'mail', $mailUser), array('=', 'mailAlternateAddress', $mailUser)))); 
    1703  
    17041721            $user = null; 
    17051722            if ($intUser && count($intUser) > 0) { 
    1706                 $participant['isExternal'] = isset($intUser[0]['isExternal']) ? $intUser[0]['isExternal'] : 0; 
    1707                 $participant['user'] = $intUser[0]['id']; 
     1723                $participant['isExternal'] = isset($intUser[0]['isExternal']) ? $intUser[0]['isExternal'] : 0; 
     1724                $participant['user'] = $intUser[0]['id']; 
    17081725            } else { 
    1709                 $participant['isExternal'] = 1; 
    1710                 /* Gera um randon id para o contexto formater */ 
    1711                 $userID = mt_rand() . '4(Formatter)'; 
    1712  
    1713                 $user['mail'] = $mailUser; 
    1714                 $user['name'] = ( isset($property['params']['CN']) ) ? $property['params']['CN'] : ''; 
    1715                 $user['participants'] = array($participantID); 
    1716                 $user['isExternal'] = '1'; 
    1717                 $participant['user'] = $userID; 
    1718                 $interation['user://' . $userID] = $user; 
     1726                $participant['isExternal'] = 1; 
     1727                /* Gera um randon id para o contexto formater */ 
     1728                $userID = mt_rand() . '4(Formatter)'; 
     1729 
     1730                $user['mail'] = $mailUser; 
     1731                $user['name'] = ( isset($property['params']['CN']) ) ? $property['params']['CN'] : ''; 
     1732                $user['participants'] = array($participantID); 
     1733                $user['isExternal'] = '1'; 
     1734                $participant['user'] = $userID; 
     1735                $interation['user://' . $userID] = $user; 
    17191736            } 
    17201737 
     
    18281845        $interation['schedulable://' . $eventID] = $schedulable; 
    18291846 
    1830         return $interation; 
     1847        return $interation; 
    18311848    } 
    18321849     
     
    19561973            $mailUser = trim(str_replace('MAILTO:', '', $property['value'])); 
    19571974 
    1958             $participantID = mt_rand() . '2(Formatter)'; 
    1959  
    1960             $participant['schedulable'] = $todoID; 
    1961             $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 
    1962             $participant['isOrganizer'] = '1'; 
    1963             $participant['acl'] = 'rowi'; 
     1975        if($participant = self::_getParticipantByMail($mailUser, $schedulable['participants'], true)){ 
     1976 
     1977            $participantID = $participant['id']; 
     1978 
     1979        }else{ 
     1980 
     1981            $participant = array(); 
     1982 
     1983            $participantID = mt_rand() . '2(Formatter)'; 
     1984            $participant['schedulable'] = $todoID; 
     1985            $participant['status'] = (isset($property['params']['PARTSTAT']) && constant('STATUS_' . $property['params']['PARTSTAT']) !== null ) ? constant('STATUS_' . $property['params']['PARTSTAT']) : STATUS_UNANSWERED; 
     1986            $participant['isOrganizer'] = '1'; 
     1987            $participant['acl'] = 'rowi'; 
     1988        } 
    19641989 
    19651990            /* Verifica se este usuario é um usuario interno do ldap */ 
Note: See TracChangeset for help on using the changeset viewer.