Ignore:
Timestamp:
05/02/13 15:19:28 (11 years ago)
Author:
cristiano
Message:

Ticket #3209 - Integrar módulo de sincronização Z-push ao Expresso

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zpush/backend/expresso/providers/calendarProvider.php

    r8030 r8131  
    154154    public function ChangeFolder($folderid, $oldid, $displayname, $type) 
    155155    { 
     156        if($oldid) 
     157        { 
     158            $idNumber = (int)str_replace('calendar' , '' , $oldid); 
     159            $calendarSignature =  Controller::read( array( 'concept' => 'calendarSignature' , 'id' => $idNumber )); 
     160 
     161            Controller::update( array('concept' => 'calendar' , 'id' => $calendarSignature['calendar']), array( 'name' => $displayname) ); 
     162 
     163            return $this->StatFolder($oldid); 
     164        } 
     165        else 
     166        { 
     167             $cal = array('name' => $displayname, 
     168                'timezone' => 'America/Sao_Paulo', 
     169                'type' => '0' 
     170            ); 
     171 
     172            $calCreated = Controller::create(array('concept' => 'calendar'), $cal); 
     173 
     174            if(!$calCreated){ 
     175                return false; 
     176            } 
     177 
     178            $sig = array('user' => $_SESSION['wallet']['user']['uidNumber'], 
     179                'calendar' => $calCreated['id'], 
     180                'isOwner' => '1', 
     181                'dtstamp' => time() . '000', 
     182                'fontColor' => 'FFFFFF', 
     183                'backgroundColor' => '3366CC', 
     184                'borderColor' => '3366CC', 
     185            ); 
     186 
     187            $sigCreated = Controller::create(array('concept' => 'calendarSignature'), $sig); 
     188 
     189            if(!$sigCreated){ 
     190                return false; 
     191            } 
     192            else 
     193            { 
     194                $return = array(); 
     195                $return["id"] = 'calendar'.$calCreated; 
     196                $return["parent"] = 0; 
     197                $return["mod"] = $displayname; 
     198                return $return; 
     199            } 
     200        } 
     201 
    156202        return false; 
    157203 
     
    168214     * @throws StatusException              could throw specific SYNC_FSSTATUS_* exceptions 
    169215     */ 
    170     public function DeleteFolder($id, $parentid) 
    171     { 
    172         return false; 
     216    public function DeleteFolder($id, $parent) 
     217    { 
     218        $interation = array(); 
     219        $idNumber = (int)str_replace('calendar' , '' , $id); 
     220        $calendarSignature =  Controller::read( array( 'concept' => 'calendarSignature' , 'id' => $idNumber )); 
     221 
     222        $interation['calendar://' . $calendarSignature['calendar']] = false; 
     223        ob_start(); 
     224        $args = $interation; 
     225        include EXPRESSO_PATH.'/prototype/Sync.php'; 
     226        ob_end_clean(); 
     227 
     228        return true; 
    173229    } 
    174230 
Note: See TracChangeset for help on using the changeset viewer.