Ignore:
Timestamp:
11/03/11 13:21:19 (12 years ago)
Author:
wmerlotto
Message:

Ticket #2305 - Enviando alteracoes, desenvolvidas internamente na Prognus, do modulo calendar.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/calendar/inc/class.socalendar_sql.inc.php

    r4316 r5132  
    1313  *  option) any later version.                                              * 
    1414  \**************************************************************************/ 
    15  
     15if($_SESSION['isCrun']){ 
     16        $_SESSION['isCrun'] = false; 
     17        $_SESSION['rootPath'] = PHPGW_INCLUDE_ROOT; 
     18        require_once $_SESSION['rootPath'].'/API/class.servicelocator.php'; 
     19}else{ 
     20        require_once $_SESSION['rootPath'].'/API/class.servicelocator.php'; 
     21} 
    1622 
    1723        if (@$GLOBALS['phpgw_info']['flags']['included_classes']['socalendar_']) 
     
    569575                                $this->set_title(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('title')))); 
    570576                                $this->set_description(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('description')))); 
    571                                 $this->set_observations(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('observations')))); 
    572                                 $this->set_notifications_owner(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('notifications_owner')))); 
    573                                 $this->set_alter_by(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('alter_by')))); 
    574                                 $this->set_attachment(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('attachment')))); 
    575577                                $this->set_ex_participants(stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('ex_participants')))); 
    576578                                $this->add_attribute('uid',$GLOBALS['phpgw']->strip_html($this->stream->f('uid'))); 
    577579                                $this->add_attribute('location',stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('location')))); 
     580                                $this->add_attribute('organizer',stripslashes($GLOBALS['phpgw']->strip_html($this->stream->f('organizer')))); 
    578581                                $this->add_attribute('reference',(int)$this->stream->f('reference')); 
    579582 
     
    737740                        else 
    738741                        { 
    739                                 //$user_where .= $this->user; 
    740742                                $user_where .= $this->user . ') OR (phpgw_cal.owner=' . $this->user; 
    741743                        } 
     
    902904                } 
    903905 
    904                 function save_event(&$event) 
     906                function save_event(&$event,$sendMail = true, $importAccount = false) 
    905907                { 
    906908 
     
    954956                        $enddate = $this->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; 
    955957                        $today = time() - $GLOBALS['phpgw']->datetime->tz_offset; 
    956 // 
    957 //                      if($event['recur_type'] != MCAL_RECUR_NONE) 
    958 //                      { 
    959 //                              $type = 'M'; 
    960 //                      } 
    961 //                      else 
    962 //                      { 
     958 
     959 
    963960                                if ($event['type'] == 'hourAppointment') 
    964961                                        $type = 'H'; 
     
    967964                                }else 
    968965                                        $type = 'E'; 
    969 //                      } 
    970                         if(is_array($event['attachment'])) 
    971                             $sattach=serialize($event['attachment']); 
    972                         else if(is_array(unserialize($event['attachment']))) 
    973                             $sattach=$event['attachment']; 
    974                         else 
    975                             $sattach=''; 
     966                         
    976967 
    977968                        $sql = 'UPDATE phpgw_cal SET ' 
     
    986977                                        . "title='".$this->stream->db_addslashes($event['title'])."', " 
    987978                                        . "description='".$this->stream->db_addslashes($event['description'])."', " 
    988                                         . "observations='".$this->stream->db_addslashes($event['observations'])."', " 
    989                     . 'notifications_owner='.(int)$event['notifications_owner'].',' 
    990                                         . "attachment='".$this->stream->db_addslashes($sattach)."', " 
    991                                         . "alter_by='".$this->stream->db_addslashes($GLOBALS['phpgw_info']['user']['fullname'])."', " 
    992979                                        . "ex_participants='".$this->stream->db_addslashes($event['ex_participants'])."', " 
     980                                        . "organizer='".$this->stream->db_addslashes($event['organizer'])."', " 
    993981                                        . "location='".$this->stream->db_addslashes($event['location'])."', " 
    994982                                        . ($event['groups']?"groups='".(count($event['groups'])>1?implode(',',$event['groups']):','.$event['groups'][0].',')."', ":'') 
     
    10951083                        $GLOBALS['phpgw_info']['cal_new_event_id'] = $event['id']; 
    10961084                        $this->event = $event; 
     1085 
     1086                        if($sendMail) 
     1087                        { 
     1088                            if($importAccount) 
     1089                                $this->sendEmailEvendAccepted($event,$importAccount); 
     1090                            else 
     1091                                $this->sendEmailEvendAccepted($event); 
     1092                        } 
     1093         
    10971094                        return True; 
    10981095                } 
     1096 
     1097                function sendEmailEvendAccepted($event,$importAccount = false) 
     1098                { 
     1099 
     1100                    if(!$importAccount) 
     1101                        $importAccount['mail'] = $GLOBALS['phpgw_info']['user']['email']; 
     1102 
     1103                    //verifica se eh um evento externo se sim envia o vcard de aceitação em anexo 
     1104                    if($event['owner'] == '-2') 
     1105                    { 
     1106                        $mailService = ServiceLocator::getService('mail'); 
     1107 
     1108                        $tmpbody.= "<b>".lang("Event Accepted")."</b> "; 
     1109                        $tmpbody.= "<br><br>".lang("name").": ".$event['title']."<br>"; 
     1110                        $tmpbody.= "<br>".lang("description").": ".$event['description']."<br>"; 
     1111 
     1112                        $ev[0] = $event; 
     1113 
     1114                        $tmpattach=  $GLOBALS['calendar']->bocalendar->create_vcard($ev,'REPLY',true,$importAccount); 
     1115                         
     1116                        $mailService->addStringAttachment($tmpattach, 'suggestion.ics', 'application/ics'); 
     1117                        $mailService->addStringAttachment($tmpattach, 'vcalendar.ics', 'utf-8', 'text/calendar; charset=utf-8; method=REPLY;', '7bit', ''); 
     1118                  
     1119                        if(strchr($event['organizer'],'@') && strchr($event['organizer'],'<') && strchr($event['organizer'],'>')) 
     1120                        { 
     1121                            $mail = substr($event['organizer'], strpos($event['organizer'],'<'), strpos($event['organizer'],'>')); 
     1122                            $mail = str_replace('<','', str_replace('>','',$mail)); 
     1123                        } 
     1124 
     1125                        if($mail) 
     1126                            $mailService->sendMail($mail,$importAccount['mail'],$event['title'],$tmpbody); 
     1127 
     1128                    } 
     1129                    else 
     1130                        $GLOBALS['calendar']->bocalendar->send_update(MSG_ACCEPTED, $event['participants'],$event); 
     1131 
     1132                    return; 
     1133                } 
    10991134 
    11001135                function get_alarm($cal_id) 
Note: See TracChangeset for help on using the changeset viewer.