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.uicalendar.inc.php

    r4844 r5132  
    5757 
    5858                var $public_functions = array( 
    59                         'screen_delegate_event' => True, 
    60                         'delegate_event' => True, 
    6159                        'mini_calendar' => True, 
    6260                        'index' => True, 
     
    6765                        'year' => True, 
    6866                        'view' => True, 
     67                        //'suggest' => True, 
     68                        'send_suggest_owner' => True, 
    6969                        'edit' => True, 
    7070                        'export'        => True, 
     
    9292                function uicalendar() 
    9393                { 
     94                    $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 
     95                        $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 
     96                        $GLOBALS['phpgw_info']['flags']['currentapp'] = 'calendar'; 
     97                        include_once( $_SESSION['rootPath'].'/header.inc.php' ); 
     98 
    9499                        $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); 
    95100                        $GLOBALS['phpgw']->browser    = CreateObject('phpgwapi.browser'); 
     
    163168                        } 
    164169                        $this->html = &$GLOBALS['phpgw']->html; 
    165                 } 
    166  
    167                 function screen_delegate_event($params=NULL) { 
    168                         $module_name = 'expressoMail'.(str_replace("1.","1_",$GLOBALS['phpgw_info']['server']['cal_expressoMail'])); 
    169  
    170                         $sb = CreateObject('phpgwapi.sbox2'); 
    171                         $jscal = CreateObject('phpgwapi.jscalendar');   // before phpgw_header() !!! 
    172                         unset($GLOBALS['phpgw_info']['flags']['noheader']); 
    173                         unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 
    174                         $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 
    175                         $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 
    176                         $GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Calendar - Edit') : lang('Calendar - Delegate Event');  
    177                         $GLOBALS['phpgw']->common->phpgw_header(); 
    178  
    179                         $ldap_manager = CreateObject('contactcenter.bo_ldap_manager'); 
    180                         $_SESSION['phpgw_info']['expressomail']['user'] = $GLOBALS['phpgw_info']['user']; 
    181                         $_SESSION['phpgw_info']['expressomail']['user']['owner'] = $event['owner']; 
    182                         $_SESSION['phpgw_info']['expressomail']['server'] = $GLOBALS['phpgw_info']['server']; 
    183                         $_SESSION['phpgw_info']['expressomail']['ldap_server'] = $ldap_manager ? $ldap_manager->srcs[1] : null; 
    184                         $context = $GLOBALS['phpgw_info']['server']['ldap_context']; 
    185                         $user_context = array(); 
    186                         foreach(explode(",",$GLOBALS['phpgw_info']['user']['account_dn']) as $i => $dn_part){ 
    187                                 if($i) 
    188                                         $user_context[] = $dn_part; 
    189                         } 
    190                         // Prepara o contexto do usuario com sua OU raiz, pois ele pode pertencer a uma OU de nivel N. 
    191                         $user_ou = explode(",",str_replace($context,"",implode(",",$user_context))); 
    192                         $user_context = trim(strtolower($user_ou[count($user_ou) - 2].",".$context)); 
    193                         // Fim 
    194                         // Verifica o tipo da visualização da árvore LDAP, configurado no admin da Agenda 
    195                         $recursive = $GLOBALS['phpgw_info']['server']['cal_type_tree_participants'] == '1' ? true : false; 
    196                         $combo_org = $this->get_organizations(trim(strtolower($context)),$user_context, $recursive); 
    197  
    198                         $var = array( 
    199                                 "module_name"           => $module_name, 
    200                                 "lang_loading"          => lang("Loading"), 
    201                                 "lang_searching"        => lang("Searching"), 
    202                                 "lang_users"            => lang("Users"), 
    203                                 "lang_groups"           => lang("Groups"), 
    204                                 "recursive"             => ($recursive)?"":"search", 
    205                                 "options"               => $combo_org, 
    206                                 "id_event"              => $_REQUEST["id_event"], 
    207                                 "eventArray"            => $_REQUEST["eventArray"], 
    208                                 "delegator"             => $_REQUEST["delegator"], 
    209                                 "lang_avaliable_users"  => lang("Available Users and Groups"), 
    210                                 "lang_search_for"       => lang("Search for"), 
    211                                 "lang_ou"               => lang("Organization"), 
    212                                 "min_num_characters"    => $GLOBALS['phpgw_info']['server']['min_num_characters'], 
    213                                 "date"                  => $_REQUEST["date"], 
    214                                 "eventDelegation"       => 1, 
    215                                 "Delegate"              => lang("Delegate"), 
    216                                 'url_template'          => 'calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'] 
    217                         ); 
    218  
    219                         if(isset($_REQUEST["error"])) 
    220                         { 
    221                                 if($_REQUEST["error"] == 999){ 
    222                                         $var['error_msg'] = lang("Problems delegating. Make sure you have selected a user to delegate the appointment."); 
    223                                 }else { 
    224                                         $var['error_msg'] = lang("Problems delegating. Make sure you haven't delegated to a person that was also invited to the meeting"); 
    225                                 } 
    226                         } 
    227  
    228                         $template = CreateObject('phpgwapi.Template',$this->template_dir); 
    229                         $template->set_file( 
    230                                         array( 
    231                                                 "screen"=>"delegate.tpl" 
    232                                         ) 
    233                                 ); 
    234                         $template->set_var($var); 
    235                         print $template->fp('out','screen'); 
    236                 } 
    237  
    238  
    239                 function delegate_event($params=NULL) { 
    240                         //$ldap = CreateObject('expressoMail1_2.ldap_functions'); 
    241                         //$delegated = $ldap->uid2uidnumber($_REQUEST['delegated']); 
    242  
    243                         try { 
    244                                 $this->bo->delegar($_REQUEST['delegator'],$_REQUEST['delegated']/*$delegated*/,$_REQUEST['event']); 
    245                                 header("Location: index.php?menuaction=calendar.uicalendar.day&date=".$_REQUEST['date']); 
    246                         }catch(Exception $e) { 
    247                                 if($e->getMessage() == '999') { 
    248                                         header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=999"); 
    249                                 }else { 
    250                                         header("Location: index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event=". $_REQUEST["event"]."&delegator=".$_REQUEST["delegator"]."&date=".$_REQUEST["date"]."&error=1"); 
    251                                 } 
    252                         } 
    253170                } 
    254171 
     
    392309                                                { 
    393310//NDEE: class def what for? 
    394                                                     $dayToday = (int)(substr($today,6,2)); 
    395                                                     $seleDay = (int)(substr($_GET['date'],6,2)); 
    396                                                     if($day == $dayToday) 
    397                                                     { 
    398                                                         if($dayToday == $seleDay) 
    399                                                         { 
    400                                                             $day_params['class'] = 'minicaltodaysel'; 
    401                                                         } 
    402                                                         else 
    403                                                         { 
    404                                                             $day_params['class'] = 'minicaltoday'; 
    405                                                         } 
    406                                                     } 
    407  
    408                                                     if( isset($params['control']) && $params['control'] ) 
    409                                                     { 
    410                                                         if($day == $seleDay && $dayToday != $seleDay) 
    411                                                         { 
    412                                                             $day_params['class'] = 'minicalnottoday'; 
    413                                                         } 
    414                                                     } 
    415  
    416                                                         $str = '<a href="'.$this->page($params['link'],'&date='.$date).'" class="'.$day_params['class'].'" ' . ($day_params['class']=='bminicalhol' || $day_params['class']=='minicalhol'?' title="' . $day_params['holidays'][0] . '" ' :'') . ' >'.$day.'</a>'; 
     311                                                        $str = '<a href="'.$this->page($params['link'],'&date='.$date).'" class="'.$day_params['class'].'">'.$day.'</a>'; 
    417312                                                } 
    418313                                                else 
     
    473368                        $_SESSION['calendar']['categories'] = $this->cat->formated_list('select','all',$this->bo->cat_id,'True'); 
    474369                        if((!isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) || !$GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && count($this->bo->grants) > 0) 
     370                        {        
    475371                                $_SESSION['calendar']['cals'] = $this->bo->list_cals(); 
     372                        } 
    476373 
    477374                        if($this->bo->printer_friendly || $_GET['plain'] == 'True') 
    478375                        {        
    479                                 $app_css_path = $_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set']; 
    480                                 $app_print_css_path = $app_css_path; 
    481                                 if (!file_exists($GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$app_css_path.'/app.css')) 
    482                                         $app_css_path = 'default'; 
    483                                 if (!file_exists($GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$app_print_css_path.'/app_print.css')) 
    484                                         $app_print_css_path = 'default'; 
    485  
    486376                                $new_body = '<html>'."\n" 
    487377                                        .'<head>'."\n" 
    488                                         .'<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$app_css_path.'/app.css" type=text/css rel=StyleSheet>'."\n" 
    489                                         .'<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$app_print_css_path.'/app_print.css" type=text/css rel=StyleSheet media="print">'."\n" 
     378                                        .'<SCRIPT type="text/javascript"> 
     379                                                window.onbeforeunload = function() { 
     380                                                        return \'Gostaria realmente de fechar essa janela ?\'; 
     381                                                }                                        
     382                                        </SCRIPT>' 
     383                                        .'<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'].'/app.css" type=text/css rel=StyleSheet>'."\n" 
     384                                        .'<LINK href="'.$GLOBALS['phpgw_info']['server']['webserver_url'].'/calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'].'/app_print.css" type=text/css rel=StyleSheet media="print">'."\n" 
    490385                                        .'</head> 
    491386                                        <table id="calendar_print_main" class="calendar_print_main">                                             
     
    493388                                                        <td id="calendar_print_content" class="calendar_print_content">'.$body.'</td> 
    494389                                                </tr> 
     390                                                 
    495391                                                <tr> 
    496392                                                  <td> 
     393                                                        <br/> 
     394                                                        <br/> 
    497395                                                        <div> 
    498396                                                                <input class=button type="button" onClick="javascript:this.style.visibility=\'hidden\';window.print();window.close();" value="Imprimir esta p&aacute;gina"> 
     
    516414                                 
    517415                                $GLOBALS['phpgw']->common->phpgw_header(); 
    518                                 $new_body = $this->bo->debug_string.$body;                               
    519416                                 
    520                         } 
     417                                $new_body = $this->bo->debug_string.$body;                                                               
     418                } 
     419 
     420 
     421 
     422                         
    521423                        return $new_body; 
    522                 } 
     424                        } 
    523425 
    524426                function month() 
    525                 { 
    526                         if($_GET['month']||$_POST['month']){ 
    527                             $params['month'] = $_GET['month']?(int)$_GET['month']:(int)$_POST['month']; 
    528                             $params['year'] = $_GET['year']?(int)$_GET['year']:(int)$_POST['year']; 
    529                             $params['day'] = 1; 
    530  
    531                         }else{ 
    532                             $params['day'] = $_POST['date']?(int)substr($_POST['date'] , 6, 2):(int)substr($_GET['date'] , 6, 2); 
    533                             $params['month'] = $_POST['date']?(int)substr($_POST['date'] , 4, 2):(int)substr($_GET['date'] , 4, 2); 
    534                             $params['year'] = $_POST['date']?(int)substr($_POST['date'] , 0, 4):(int)substr($_GET['date'] , 0, 4); 
    535  
    536                         } 
    537  
    538                         if($_GET['friendly']==1) 
    539427                        { 
    540428                            echo $this->printer_friendly($this->get_month(),lang('Monthview')); 
    541                         } 
    542                         else 
    543                         { 
    544                             echo $this->printer_friendly($this->print_month_new($params),lang('Monthview')); 
    545                         } 
    546  
    547429                        $GLOBALS['phpgw']->common->phpgw_footer(); 
    548430                } 
     
    550432                function get_month() 
    551433                { 
     434                        $this->bo->read_holidays(); 
     435                         
    552436                        $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); 
    553437 
     
    594478                                $minical_next = ''; 
    595479                        } 
    596                         $this->bo->read_holidays($params['year']); 
     480 
    597481                        if($_POST['year']) {                     
    598482         
    599483                        } 
    600484 
     485                        $hoje = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow); 
     486                        $mes_hoje = (int)substr($hoje,4,2); 
     487                        $sday = 1; 
     488                        if($_POST['day']) { 
     489                                $day_ini = (int)$_POST['day']; 
     490                        }  
     491                        elseif($_GET['sday']){ 
     492                                if($_GET['month'] == $mes_hoje) 
     493                        { 
     494                                        $day_ini = $this->bo->day; 
     495                                }  
     496 
     497                                else 
     498                                { 
     499                                        $day_ini = (int)$_GET['sday']; 
     500                                } 
     501                        }  
     502                        elseif( ($_POST['dia_ini']) && ($_POST['dia_ini'] == $this->bo->day) ) 
     503                        { 
     504                                $day_ini = (int)substr($hoje,6,2); 
     505                        } 
     506                        else 
     507                        { 
     508                                $day_ini = $this->bo->day; 
     509                        } 
     510                        if($_POST['qtd_dias']) 
     511                        { 
     512                                $num_dias = (int)$_POST['qtd_dias']; 
     513                        }  
     514                        else 
     515                        { 
     516                                $num_dias = 0; 
     517                        } 
     518 
    601519                        if (!$this->bo->printer_friendly) 
    602520                        { 
    603                             $account_name = $_POST['user'] ? $_POST['user'] : ($_GET['account_name'] ? $_GET['account_name'] : ''); 
    604  
    605                             $accounts = CreateObject('phpgwapi.accounts'); 
    606                             $accountId = $accounts->name2id($account_name); 
    607  
    608                             $prefs = CreateObject('phpgwapi.preferences', $accountId); 
    609                             $account_prefs = $prefs->read(); 
    610  
    611521                            $printer = ''; 
    612522                            $prev_month_link = '<a href="'.$this->page('month','&year='.$prevyear.'&month='.$prev.'&sday='.$sday).'">&lt;&lt;</a>'; 
     
    614524                            $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$day_ini.'&num_dias='.$num_dias; 
    615525                            //$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'; 
    616                             /*if($account_prefs['calendar']['type_month_print'] == '0') 
    617                             { 
    618526                            $print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param). 
    619527                                            "','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '". 
    620528                                            lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 
    621                             } 
    622                             else 
    623                             { 
    624                             $print =  '<a href="javascript:void(0)" onclick="scheduler.toPDF('."'calendar/js/dhtmlx/server/generate.php'".')">['.lang('Printer Friendly').']</a>'; 
    625                             }*/ 
    626  
    627529                            //linha abaixo foi adicionada para exibir a pagina do mes em tela 
    628                             //$month,$year,$showyear,$owner=0; 
    629                             $params = Array( 
    630                                 'month' => $this->bo->month, 
    631                                 'year'  => $this->bo->year, 
    632                                 'showyear'      => True, 
    633                                 'owner' => $this->bo->owner 
    634                             ); 
    635                             $large_month = $this->display_month($params); 
     530                                $large_month = $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner);                             
    636531                        } 
    637532                        else 
     
    643538                            $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 
    644539                            //linha abaixo foi adicionada para exibir a pagina do mes para impressao 
    645  
    646                             //if($_GET['classic_print']==1) 
    647                             //  $large_month = $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner); 
    648                             //else 
    649540                            $large_month = $this->display_month_print($this->bo->month,$this->bo->year,True,$this->bo->owner); 
    650541                        } 
    651542 
    652543                        $this->bo->read_holidays(); 
    653  
    654                         $aux_month_identifier = lang(strftime("%B",$m)).' '.$this->bo->year; 
    655                         if(isset($_GET['friendly']) && $_GET['friendly'] ==1) 
    656                         { 
    657                             if( isset($_GET['num_dias']) && ($_GET['num_dias'] == 1) ) 
    658                             { 
    659                                 $year = $_GET['year']; 
    660                                 $month = $_GET['month']; 
    661                                 $day = $_GET['day_ini']; 
    662                                 $aux_month_identifier = $this->month_day_of_week($year,$month,$day).', '.$day.' de '.lang(strftime("%B",$m)).' de '.$this->bo->year; 
    663                             } 
    664                         } 
    665544 
    666545                        $var = Array( 
     
    669548                                'small_calendar_prev'       => $minical_prev, 
    670549                                'prev_month_link'           => $prev_month_link, 
    671                                 'month_identifier'          => $aux_month_identifier, 
     550                                'month_identifier'              =>      lang(strftime("%B",$m)).' '.$this->bo->year, 
    672551                                'username'                  => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner), 
    673552                                'next_month_link'           => $next_month_link, 
    674553                                'small_calendar_next'       => $minical_next, 
     554                                //'large_month'                         =>      $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner), 
    675555                                'large_month'               => $large_month, 
    676556                                'print'                     => $print 
     
    700580                function week() 
    701581                { 
    702  
    703                         if($_GET['month']||$_POST['month']){ 
    704                             $params['month'] = $_GET['month']?(int)$_GET['month']:(int)$_POST['month']; 
    705                             $params['year'] = $_GET['year']?(int)$_GET['year']:(int)$_POST['year']; 
    706                             $params['day'] = $_GET['day']?(int)$_GET['day']:(int)$_POST['day']; 
    707  
    708                         }else{ 
    709                             $params['day'] = $_POST['date']?(int)substr($_POST['date'] , 6, 2):(int)substr($_GET['date'] , 6, 2); 
    710                             $params['month'] = $_POST['date']?(int)substr($_POST['date'] , 4, 2):(int)substr($_GET['date'] , 4, 2); 
    711                             $params['year'] = $_POST['date']?(int)substr($_POST['date'] , 0, 4):(int)substr($_GET['date'] , 0, 4); 
    712  
    713                         } 
    714  
    715                         echo $this->printer_friendly($this->print_week_new($params),lang('Weekview')); 
    716                          
     582                        echo $this->printer_friendly($this->get_week(),lang('Weekview')); 
    717583                        $GLOBALS['phpgw']->common->phpgw_footer(); 
    718584                } 
     
    727593                        if (isset($this->bo->prefs['calendar']['display_minicals']) && $this->bo->prefs['calendar']['display_minicals'] == "1" && !$this->bo->printer_friendly) 
    728594                        { 
     595                                $minical_this = $this->mini_calendar( 
     596                                        Array( 
     597                                                'day'   => $this->bo->day, 
     598                                                'month' => $this->bo->month, 
     599                                                'year'  => $this->bo->year, 
     600                                                'link'  => 'day', 
     601                                                'butons'        => 'none', 
     602                                                'outside_month' => False 
     603                                        ) 
     604                                ); 
    729605                                $minical_prev = $this->mini_calendar( 
    730606                                        Array( 
     
    747623                                        ) 
    748624                                ); 
    749                                 $minical_this = $this->mini_calendar( 
    750                                         Array( 
    751                                                 'day'   => $this->bo->day, 
    752                                                 'month' => $this->bo->month, 
    753                                                 'year'  => $this->bo->year, 
    754                                                 'link'  => 'day', 
    755                                                 'butons'        => 'none', 
    756                                                 'outside_month' => False 
    757                                         ) 
    758                                 ); 
    759625                        } 
    760626                        else 
    761627                        { 
    762628 
    763                         //NDEE: printer-friendly what? 
     629//NDEE: printer-friendly what? 
    764630                                $minical_this = ''; 
    765631                                $minical_prev = ''; 
     
    773639                                $prev_week_link = '<a href="'.$this->page('week','&date='.$prev['full']).'">&lt;&lt;</a>'; 
    774640                                $next_week_link = '<a href="'.$this->page('week','&date='.$next['full']).'">&gt;&gt;</a>'; 
    775                                 $print = '<a href="javascript:void(0);" onclick="scheduler.toPDF('."'calendar/js/dhtmlx/server/generate.php'".')">['.lang('Printer Friendly').']</a>'; 
    776                                  
    777                                 //$print = '<a href="'.$this->page('week','&friendly=1&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day))."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."' \">[".lang('Printer Friendly').']</a>'; 
     641                                $print = '<a href="'.$this->page('week','&friendly=1&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day))."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 
    778642                        } 
    779643                        else 
    780644                        { 
    781645 
    782                                 //NDEE: printer-friendly (weekly-view) 
     646//NDEE: printer-friendly (weekly-view) 
    783647                                $printer = '<body bgcolor="'.$this->theme['bg_color'].'">'; 
    784648                                $prev_week_link = ''; 
     
    807671                                'print'                 =>      $print 
    808672                        ); 
    809                         //todo 
     673//todo 
    810674                        $p = CreateObject('phpgwapi.Template',$this->template_dir); 
    811675                        $p->set_file( 
     
    968832                        ); 
    969833 
    970                         $button_left = $button_center = $button_right = ''; 
     834                        $p->set_file(Array('form_button'                        => 'form_button_script.tpl'     )); 
     835 
     836                        $button_left = $button_center = $button_right = $button_right_suggestion = ''; 
    971837 
    972838                        if($this->bo->check_perms(PHPGW_ACL_EDIT,$event)) 
     
    976842                                        $var = Array( 
    977843                                                'action_url_button'     => $this->page('edit','&cal_id='.$cal_id), 
     844                                                // added date to the action parameteres so we can add an exception to an edited event  
     845                                                'action_url_button'     => $this->page('edit','&cal_id='.$cal_id.'&date='.$date),  
    978846                                                'action_text_button'    => lang('Edit Single'), 
    979847                                                'action_confirm_button' => '', 
     
    1027895                                                'action_url_button'     => $this->page('delete','&cal_id='.$cal_id), 
    1028896                                                'action_text_button'    => lang('Delete Single'), 
    1029                                                 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this single occurence?').'\\n'.lang('This will delete this entry for all users.')."')\"", 
     897                                                'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this single occurence?\\nThis will delete this entry for all users.')."')\"", 
    1030898                                                'action_extra_field'    => $this->html->input_hidden(array( 
    1031899                                                        'delete_type' => 'single', 
     
    1092960                                } 
    1093961                        } 
     962                        $uid             = $event['uid']; 
     963                        $owner           = $event['owner']; 
     964                        $title           = $event['title']; 
     965                        $description     = rtrim(utf8_encode($event['description']));  
     966                        $location        = $event['location']; 
     967                        $start                   = $event['start']; 
     968                        $end                 = $event['end']; 
     969                        
     970                        $p->set_var( 'suggestion', $this->build_suggestion( $event , $GLOBALS['phpgw_info']['user']['account_id']) ); 
    1094971 
    1095972                        $var = Array( 
     
    1113990                                $button_left .= '<td>'.$p->fp('button','form_button').'</td>'; 
    1114991                        } 
     992                         
     993                        $label_suggest = lang('Suggest new hour');  
     994                        $button_right_suggestion = "<td><input type=\"button\" style=\"height: 16px; width: 110px; font-size: 10px;\" value=\"" . $label_suggest . "\"onclick=\"show_suggestion()\";</td>";  
     995                         
    1115996                        $p->set_var(array( 
    1116997                                'button_left'   => $button_left, 
    1117998                                'button_center' => $button_center, 
    1118                                 'button_right'  => $button_right 
     999                                'button_right'  => $button_right, 
     1000                                'button_right_suggestion' => $button_right_suggestion 
    11191001                        )); 
    11201002                        $p->pfp('phpgw_body','view_event'); 
     
    11281010                } 
    11291011 
     1012                function build_suggestion( $event , $user = false ) 
     1013                { 
     1014                    $p = $GLOBALS['phpgw']->template; 
     1015 
     1016                    $p->set_file( 
     1017                            Array( 
     1018                                'suggestion'    => 'suggestion.tpl' 
     1019                            ) 
     1020                    ); 
     1021 
     1022                   include_once($_SESSION['rootPath'].'/calendar/inc/class.ex_participants.inc.php'); 
     1023                   $exParticipants = new exParticipants(); 
     1024                   $exParticipants->setParticipantsBySerializable($event['ex_participants']); 
     1025 
     1026                    $cal_id              = $event['id']; 
     1027                    $uid                 = $event['uid']; 
     1028                    $owner               = $event['owner']; 
     1029                    $title               = $event['title']; 
     1030                    $description         = rtrim(utf8_encode($event['description']));  
     1031                    $location            = $event['location']; 
     1032                    $start                       = $event['start']; 
     1033                    $end                     = $event['end']; 
     1034 
     1035                    if( $owner == -2 ) 
     1036                    { 
     1037                        $to = $event['organizer']; 
     1038                        $mail = array(); 
     1039 
     1040                        if( preg_match ('(<([^>]*@[^>]*)>)', $to, $mail ) ) 
     1041                            $to =  $mail[1]; 
     1042                    } 
     1043                    else 
     1044                    { 
     1045                        $preferences = CreateObject('phpgwapi.preferences',$owner); 
     1046                        $to = $preferences->email_address($owner); 
     1047                    } 
     1048       
     1049 
     1050                    if(((int)$start['month']) < 10 && strlen($start['month']) == 1) 
     1051                            $mes = "0" . $start['month']; 
     1052                    else 
     1053                            $mes = $start['month'];      
     1054 
     1055                    if(((int)$start['mday']) < 10 && strlen($start['mday']) == 1) 
     1056                            $dia = "0" . $start['mday']; 
     1057                    else 
     1058                            $dia = $start['mday'];               
     1059                     
     1060                    if(((int)$start['hour']) < 10 && strlen($start['hour']) == 1) 
     1061                            $hor = "0" . $start['hour']; 
     1062                    else 
     1063                            $hor = $start['hour']; 
     1064                     
     1065                    if(((int)$start['min']) < 10 && strlen($start['min']) == 1) 
     1066                            $min = "0" . $start['min']; 
     1067                    else 
     1068                            $min = $start['min']; 
     1069                     
     1070                    if(((int)$end['month']) < 10 && strlen($end['month']) == 1) 
     1071                            $end['month'] = "0" . $end['month']; 
     1072                     
     1073                    if(((int)$end['mday']) < 10 && strlen($end['mday']) == 1) 
     1074                            $end['mday'] = "0" . $end['mday']; 
     1075                     
     1076                    if(((int)$end['hour']) < 10 && strlen($end['hour']) == 1) 
     1077                            $end['hour'] = "0" . $end['hour']; 
     1078                             
     1079                    if(((int)$end['min']) < 10 && strlen($end['min']) == 1) 
     1080                            $end['min'] = "0" . $end['min']; 
     1081 
     1082                    $start_date  = $dia . "/" . $mes . "/" . $start['year'];  
     1083                    $start_hour  = $hor . ":" . $min;                            
     1084                    $end_date    =  $end['mday'] . "/" . $mes . "/" . $start['year']; 
     1085                    $end_hour    =  $end['hour'] . ":" . $end['min']; 
     1086 
     1087                    $notify_message = lang('suggest new hour'); 
     1088                    $start_h = substr($start_hour, 0, strpos($start_hour, ":")); 
     1089                    $start_m = substr($start_hour, strpos($start_hour, ":")+1); 
     1090                    $end_h   = substr($end_hour, 0, strpos($end_hour, ":")); 
     1091                    $end_m   = substr($end_hour, strpos($end_hour, ":")+1); 
     1092 
     1093                    $p->set_var('notify_message', $notify_message); 
     1094                    $p->set_var('action_form', $this->page('send_suggest_owner')); 
     1095                    $p->set_var('lang_start_hour', lang('Start hour')); 
     1096                    $p->set_var('lang_end_hour', lang('End hour')); 
     1097                    $p->set_var('lang_start_date', lang('Start date')); 
     1098                    $p->set_var('lang_end_date', lang('End date')); 
     1099                    $p->set_var('lang_suggest_new_hour', lang('Suggest new hour')); 
     1100                    $p->set_var('cal_id', $cal_id); 
     1101                    $p->set_var('to', $to); 
     1102                    $p->set_var('title', $title); 
     1103                    $p->set_var('description', $description); 
     1104                    $p->set_var('uid', $uid); 
     1105                    $p->set_var('location', $location); 
     1106                    $p->set_var('ex_participants', $exParticipants->getParticipantsMailsString()); 
     1107                    $p->set_var('start_date', $start_date); 
     1108                    $p->set_var('start_hour', $start_h); 
     1109                    $p->set_var('start_minute', $start_m); 
     1110                    $p->set_var('end_date', $end_date); 
     1111                    $p->set_var('end_hour', $end_h); 
     1112                    $p->set_var('end_minute', $end_m); 
     1113                    $p->set_var('url', $GLOBALS['phpgw_info']['server']['webserver_url']); 
     1114                    $p->set_var('user', $user); 
     1115 
     1116                    return $p->fp( 'suggestion', 'suggestion' ); 
     1117                } 
     1118 
     1119                /** 
     1120                 * @license http://www.gnu.org/copyleft/gpl.html GPL 
     1121                 * @abstract: método que envia a sugestão para o criador do compromisso. 
     1122                 * @author Prognus Software Livre (http://www.prognus.com.br) 
     1123                 */ 
     1124                function send_suggest_owner() 
     1125                {                                
     1126                        $array_data_inicio = explode('/',$_POST['data_inicio']); 
     1127                        $array_data_final  = explode('/',$_POST['data_final']); 
     1128                        $hora_inicio       = $_POST['hora_inicio']; 
     1129                        $minuto_inicio     = $_POST['minuto_inicio'];                                    
     1130                        $hora_final        = $_POST['hora_final']; 
     1131                        $minuto_final      = $_POST['minuto_final']; 
     1132                         
     1133                        $vars = $_GET['cal_id']; 
     1134                        $array_vars = explode(";", $vars); 
     1135                        $cal_id          = $array_vars[0]; 
     1136                        $to              = $array_vars[1]; 
     1137                        $title_          = $array_vars[2]; 
     1138                        $description_    = $array_vars[3]; 
     1139                        $uid             = $array_vars[4]; 
     1140                        $location        = $array_vars[5]; 
     1141                        $ex_participants = $array_vars[6]; 
     1142                        $user            = $array_vars[7];                       
     1143                        $time_suggest      = array('hora_inicio' => $hora_inicio, 'hora_final' => $hora_final, 'minuto_inicio' => $minuto_inicio, 'minuto_final' => $minuto_final); 
     1144 
     1145                        $cal_id = $this->bo->send_suggestion_external_owner($cal_id, $uid, $to, $time_suggest, $array_data_inicio, $array_data_final, $title_, $description_, $location, $ex_participants,$user); 
     1146 
     1147                        Header('Location: '.$this->page('view','&cal_id='.$cal_id)); 
     1148 
     1149                } 
     1150         
     1151                 
    11301152                function edit($params='') 
    11311153                { 
     
    11861208                                                'event' => $event, 
    11871209                                                'cd'    => $cd, 
    1188                                                 'plain' => $plain 
     1210                                                'plain' => $plain, 
     1211                                                'date'  =>  $_GET['date']  
    11891212                                        ) 
    11901213                                ); 
     
    12191242                function export($vcal_id=0) 
    12201243                { 
     1244                        $extern = true; 
     1245                        $method = 'PUBLISH'; 
    12211246                        $temp_path = $GLOBALS['phpgw_info']['server']['temp_dir'] . SEP; 
    12221247                        srand((double)microtime()*1000000); 
     
    12271252                        $cal_id = get_var('cal_id',array('GET','POST'),$vcal_id); 
    12281253                        $event[0] = $this->bo->read_entry($cal_id); 
     1254                         
    12291255                        include_once('class.bocalendar.inc.php'); 
    12301256                        $cal = new bocalendar; 
    1231                         $tmpattach=$cal->create_vcard($event); 
     1257                        $tmpattach=$cal->create_vcard($event, $method, $extern); 
    12321258                        fwrite($attach_fd,$tmpattach); 
    12331259                        header ("Content-Type: text/plain");  
     
    14221448                                } 
    14231449                                // Add participants 
    1424                                 //$participants = explode(";", $GLOBALS['phpgw']->session->appsession("participants") ); 
    1425                                 //for($_f_part=0; $_f_part<count($participants); $_f_part++) 
    1426                                 //{ 
    1427                                 //      $this->bo->add_attribute('participants','A',$participants[$_f_part]); 
    1428                                 //} 
     1450                                $participants = explode(";", $GLOBALS['phpgw']->session->appsession("participants") ); 
     1451                                for($_f_part=0; $_f_part<count($participants); $_f_part++) 
     1452                                { 
     1453                                        $this->bo->add_attribute('participants','A',$participants[$_f_part]); 
     1454                                } 
    14291455                                // Add misc 
    14301456                                $this->bo->add_attribute('participants','A',$this->bo->owner); 
     
    14871513                } 
    14881514 
     1515                 
     1516                 
     1517                function getLdap() 
     1518                { 
     1519                        include_once('../phpgwapi/inc/class.common.inc.php'); 
     1520                        $GLOBALS['phpgw_info']['server'] = $_SESSION['phpgw_info']['expresso']['server']; 
     1521                        $common = new common(); 
     1522         
     1523                        if ( (!empty($GLOBALS['phpgw_info']['server']['ldap_master_host'])) && 
     1524                                (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_dn'])) && 
     1525                                (!empty($GLOBALS['phpgw_info']['server']['ldap_master_root_pw'])) ) 
     1526                                { 
     1527                                        $ldap = $common->ldapConnect($GLOBALS['phpgw_info']['server']['ldap_master_host'], 
     1528                                                                                                $GLOBALS['phpgw_info']['server']['ldap_master_root_dn'], 
     1529                                                                                                $GLOBALS['phpgw_info']['server']['ldap_master_root_pw']); 
     1530                                } 
     1531                                else 
     1532                                { 
     1533                                        $ldap = $common->ldapConnect(); 
     1534                                } 
     1535 
     1536                        return $ldap; 
     1537                }        
     1538                 
     1539                 
     1540                 
    14891541                function disponibility($params) { 
    14901542 
     
    15051557                        $str_participants = substr($_GET['participants'],0,strlen($_GET['participants'])-1); //remove the last comma 
    15061558                        $participants= array(); 
    1507  
    15081559                        $participants_splited = explode(",",$str_participants); 
    1509                         foreach($participants_splited as $participant) { 
     1560                         
     1561                                         
     1562                        $ldap = $this->getLdap(); 
     1563                        foreach ($participants_splited as $participant) 
     1564            { 
    15101565                                $participant = substr($participant,0,strlen($participant)-1); 
     1566 
     1567                $entry = array(); 
     1568                                $extern_contact = false; 
     1569                                 
     1570                                $justthese = array('accountStatus'); 
     1571                $filter="(&(|(phpgwAccountType=u)(phpgwAccountType=l))(uidNumber=".(int)$participant."))"; 
     1572                $search = ldap_search($ldap, $GLOBALS['phpgw_info']['server']['ldap_context'], $filter, $justthese); 
     1573                $entry = ldap_get_entries($ldap, $search); 
     1574         
     1575                                if($entry[0]['accountstatus'][0] == "false") 
     1576                                        $extern_contact = true; 
     1577                         
     1578                                 
    15111579                                $acct_type = $GLOBALS['phpgw']->accounts->get_type((int)$participant); 
     1580                         
    15121581                                if($acct_type=='g') { 
    15131582                                        $bo_groups = CreateObject('expressoAdmin1_2.group'); 
    1514                                         $users = $bo_groups->get_info($participant,true); 
     1583                                        $users = $bo_groups->get_info($participant); 
    15151584                                        foreach($users['memberuid_info'] as $user) { 
    1516                                                 if($user['type']==u) 
     1585                                                if($user['type']==u){ 
     1586                                                        if (!$user['uidnumber']){ 
     1587                                                                continue; 
     1588                                                        } 
    15171589                                                        $participants[$user['uidnumber']] = 'U'; 
    15181590                                        } 
    15191591                                } 
    1520                                 else { 
     1592                                } 
     1593                                else  
     1594                                { 
     1595                                        if($extern_contact) 
     1596                                        { 
     1597                                                $participants[$participant] = 'I'; 
     1598                                                continue; 
     1599                                        } 
     1600                                         
     1601                                        if (!$participant) 
     1602                                                continue; 
     1603                                                 
    15211604                                        $participants[$participant] = 'U'; 
    15221605                                } 
     
    16651748                        "; 
    16661749 
     1750                        $extra_ = ""; 
     1751                         
    16671752                        $str.= "<table border=\'1\' bgcolor=\"#FFFFFF\" width=\"100%\" height=\"100%\"><tr><td>"; 
    16681753 
     
    16791764                        foreach($participants as $part => $nul) 
    16801765                        { 
     1766                                $extra_ = ""; 
     1767                                 
     1768                                if($nul == 'I') 
     1769                                        $extra_ = "(externalI)"; 
     1770                                 
    16811771                                $participants[$part] = $GLOBALS['phpgw']->common->grab_owner_name($part); 
     1772                                $participants[$part].= $extra_; 
    16821773                                // Much better for processor  :) 
    16831774                                $participants_id[]  .= $part; 
     
    16911782                                $GLOBALS['phpgw']->preferences->save_repository(); 
    16921783                        } 
    1693                         if($this->bo->prefs['calendar']['interval'] == '42') 
    1694                         { 
    1695                             $increment = 30; 
    1696                         } 
    1697                         elseif($this->bo->prefs['calendar']['interval'] == '84') 
    1698                         { 
    1699                             $increment = 15; 
    1700                         } 
     1784                        $increment = $this->bo->prefs['calendar']['interval']; 
    17011785                        $interval = (int)(60 / $increment); 
    17021786 
     
    17271811                        foreach($participants as $part => $fullname) 
    17281812                        { 
     1813                                $external = false; 
     1814                                if(strpos($fullname,"(externalI)"))  
     1815                                { 
     1816                                        $tmp_name = str_replace("(externalI)","",$fullname); 
     1817                                        $fullname = $tmp_name; 
     1818                                        $external = true; 
     1819                                } 
     1820                                 
    17291821                                $str .= '<tr align="center">' 
    17301822                                        . '<td width="15%" align="left"><font color="'.$this->theme['bg_text'].'" face="'.$this->theme['font'].'" size="-2">'.$fullname.'</font></td>'; 
     
    17431835                                        ) 
    17441836                                ); 
     1837 
     1838                                if($external)  
     1839                                { 
     1840                                        $str .= '<td height="1" align="center" colspan="22" bgcolor="'.$this->theme['bg_color'].'" color="#999999">' .lang('Agenda not available') .'</td>'; 
     1841                                        $str .= '</tr>' 
     1842                                        . '<tr><td height="1" colspan="'.((11 * $interval) + 1).'" bgcolor="#999999"><img src="'.$pix.'"></td></tr>'; 
     1843                                        continue; 
     1844                                } 
    17451845 
    17461846                                if(!$this->bo->cached_events[$date['full']]) 
     
    17721872                                                                        break; 
    17731873                                                                case '-': 
     1874                                                                        $time_slice[$index]['marker'] = "#"; 
    17741875                                                                        $time_slice[$index]['color'] = $this->theme['bg11']; 
    17751876                                                                        $link = $this->page('view','&cal_id='.$time_slice[$index]['id'].'&date='.$date['full']); 
     
    17971898                { 
    17981899 
    1799                         $next = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 1,$this->bo->year); 
    1800                         $prev = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day - 1,$this->bo->year); 
    1801  
    18021900                        $this->bo->read_holidays(); 
    18031901 
    1804                         $legend_holiday = $this->bo->cached_holidays[$_GET['date']][0]['name']?'('.$this->bo->cached_holidays[$_GET['date']][0]['name'].')':''; 
    18051902                        if (!$this->bo->printer_friendly || ($this->bo->printer_friendly && @$this->bo->prefs['calendar']['display_minicals'])) 
    18061903                        { 
    18071904                                $minical = $this->mini_calendar( 
    18081905                                        Array( 
    1809                                                 'day'           => 1, 
     1906                                                'day'   => $this->bo->day, 
    18101907                                                'month'         => $this->bo->month, 
    18111908                                                'year'          => $this->bo->year, 
    1812                                                 'link'          => 'day', 
    1813                                                 'control'       => True, 
    1814                                                 'outside_month' => False 
     1909                                                'link'  => 'day' 
    18151910                                        ) 
    18161911                                ); 
    1817                                 $minical1 = $this->mini_calendar( 
    1818                                         Array( 
    1819                                                 'day'           => 1, 
    1820                                                 'month'         => $this->bo->month+1, 
    1821                                                 'year'          => $this->bo->year, 
    1822                                                 'link'          => 'day', 
    1823                                                 'control'       => False, 
    1824                                                 'outside_month' => False 
    1825                                         ) 
    1826                                 ); 
    1827                                 $minical2 = $this->mini_calendar( 
    1828                                         Array( 
    1829                                                 'day'           => 1, 
    1830                                                 'month'         => $this->bo->month+2, 
    1831                                                 'year'          => $this->bo->year, 
    1832                                                 'link'          => 'day', 
    1833                                                 'control'       => False, 
    1834                                                 'outside_month' => False 
    1835                                         ) 
    1836                                 ); 
    18371912                        } 
    18381913                        else 
    18391914                        { 
    18401915 
    1841                                 //NDEE: printer-friendly (what?) 
     1916//NDEE: printer-friendly (what?) 
    18421917                                $minical = ''; 
    18431918                        } 
    18441919 
    1845                         if(isset($_GET['date'])) 
    1846                         { 
    1847                             $dia = substr($_GET['date'],-2); 
     1920                        if (!$this->bo->printer_friendly) 
     1921                        { 
     1922                                $printer = ''; 
     1923                                $param = '&date='.sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->day).'&friendly=1'; 
     1924                        //      $print = '<a href="'.$this->page('day'.$param)."\" TARGET=\"cal_printer_friendly\" onMouseOver=\"window.status = '".lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 
     1925                         
     1926                                //Adiciona modo que o mesmo abra uma nova janela nos navegadores IE e FF 
     1927                                $print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('day'.$param). 
     1928                                                "','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '". 
     1929                                                lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 
     1930                         
    18481931                        } 
    18491932                        else 
    18501933                        { 
    1851                             $dia = $_POST['day']; 
    1852                         } 
    1853  
    1854                         if (!$this->bo->printer_friendly) 
    1855                         { 
    1856                                 $printer = ''; 
    1857                                 $prev_day_link = '<a href="'.$this->page('day','&date='.$prev['full']).'">&lt;&lt;</a>'; 
    1858                                 $next_day_link = '<a href="'.$this->page('day','&date='.$next['full']).'">&gt;&gt;</a>'; 
    1859                                 //$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1'; 
    1860                                 //$print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param). 
    1861                                 //              "','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '". 
    1862                                 //              lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 
    1863                         } 
    1864                         else 
    1865                         { 
    1866  
    1867                                 //NDEE: printer-friendly (daily-view) 
     1934 
     1935//NDEE: printer-friendly (daily-view) 
    18681936                                $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 
    18691937                                $printer = '<body bgcolor="'.$this->theme['bg_color'].'">'; 
    1870                                 //$print =      ''; 
    1871                         } 
    1872                         $print =  '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>'; 
    1873  
    1874                         $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1'; 
     1938                                $print =        ''; 
     1939                        } 
    18751940 
    18761941                        $now    = $GLOBALS['phpgw']->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year); 
    18771942                        $now['raw'] += $GLOBALS['phpgw']->datetime->tz_offset; 
    1878  
    1879                         $week_days = array(lang('Sunday'), 
    1880                                                                 lang('Monday'), 
    1881                                                                 lang('Tuesday'), 
    1882                                                                 lang('Wednesday'), 
    1883                                                                 lang('Thursday'), 
    1884                                                                 lang('Friday'), 
    1885                                                                 lang('Saturday')); 
    18861943 
    18871944                        $p = $GLOBALS['phpgw']->template; 
     
    18981955                                'printer_friendly'          => $printer, 
    18991956                                'bg_text'                   => $this->theme['bg_text'], 
    1900                                 'daily_events'              => $this->print_day_new( 
     1957                                'daily_events'          => $this->print_day( 
    19011958                                        Array( 
    19021959                                                'year'      => $this->bo->year, 
     
    19051962                                        ) 
    19061963                                ), 
    1907                                 'small_calendar'            => $minical.'<br/>'.$minical1.'<br/>'.$minical2, 
    1908                                 'date'                      => $this->bo->long_date($now) . $legend_holiday, 
    1909                                 'day_of_week'           => $week_days[$now['dow']], 
     1964                                'small_calendar'        => $minical, 
     1965                                'date'                          => $this->bo->long_date($now), 
    19101966                                'username'                  => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner), 
    1911                                 'prev_day_link'             => $prev_day_link, 
    1912                                 'next_day_link'             => $next_day_link, 
    1913                                 'iprint'                    => $print, 
    1914                                 'param'                     => $param, 
     1967                                'print'                         => $print, 
    19151968                                'lang_todos'                => $todo_label, 
    19161969                                'todos'                     => $this->bo->printer_friendly ? $todos : 
    19171970 
    1918                                         //NDEE: todo's layout 
     1971//NDEE: todo's layout 
    19191972                                        "<div style=\"overflow: auto; max-height: 200px\">\n$todos</div>\n" 
    19201973                        ); 
     
    19221975                        $p->set_var($var); 
    19231976                        $p->parse('day_events','day_event'); 
    1924                         echo $this->printer_friendly($p->fp('out','day'),lang('Dayview')); 
     1977                        print $this->printer_friendly($p->fp('out','day'),lang('Dayview')); 
    19251978                        $GLOBALS['phpgw']->common->phpgw_footer(); 
    19261979                } 
     
    20422095                                                $notify_message = lang('This commitment has already been accepted!'); 
    20432096                                }        
    2044                                 else 
     2097                                else if($_GET['response'] == 2) 
    20452098                                {                                        
    20462099                                        if(!$duplicated_action)                                          
     
    20482101                                        else 
    20492102                                                $notify_message = lang('This commitment has already been rejected!'); 
     2103                                } 
     2104                                else if($_GET['response'] == 3) 
     2105                                {                                        
     2106                                        if(!$duplicated_action)                                          
     2107                                                $notify_message = lang('The commitment was tentatived successfully!'); 
     2108                                        else 
     2109                                                $notify_message = lang('This commitment has already been tentatived!'); 
    20502110                                } 
    20512111                                 
     
    20572117                                $tmpbody1 = $body1->pfp('out','list'); 
    20582118                } 
    2059                  
    2060                 function confirm_conflict($user_id,$event,$overlapping_events) 
    2061                 { 
    2062                         if(!$overlapping_events){                                        
    2063                                 $notify_message = lang('This event conflicts with your other event.'); 
    2064          
    2065                                 $action_ignore = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 3, 'response' => 1,'user_id' => $user_id, 'ignore_conflict' => 1)); 
    2066                                 $action_reject = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0, 'response' => 0)); 
    2067          
    2068                                 $body1 = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); 
    2069                                 $body1->set_file(Array('calendar' => 'conflict.tpl')); 
    2070                                 $body1->set_block('calendar','list'); 
    2071                                 $var = Array( 'notify_message'  => $notify_message, 
    2072                                                         'action_url' => $action_url, 
    2073                                                         'ignore_conflict' => 'Ignorar Conflito', 
    2074                                                         'reject_event' => 'Rejeitar Evento', 
    2075                                                         'action_reject' => $action_reject, 
    2076                                                         'action_ignore' => $action_ignore); 
    2077                                 $body1->set_var($var); 
    2078                                 $tmpbody1 = $body1->pfp('out','list'); 
    2079                         } 
    2080                         else 
    2081                         {                                
    2082                                 $month = $event['start']['month']; 
    2083                                 $mday = $event['start']['mday']; 
    2084                                 $year = $event['start']['year']; 
    2085          
    2086                                 $start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $GLOBALS['phpgw']->datetime->tz_offset; 
    2087                                 $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; 
    2088          
    2089                                 $overlap = ''; 
    2090                                 for($i=0;$i<count($overlapping_events);$i++) 
    2091                                 { 
    2092                                         $overlapped_event = $this->bo->read_entry($overlapping_events[$i],True); 
    2093                                         foreach($overlapped_event['participants'] as $id => $status) 
    2094                                         { 
    2095                                                 $conflict = isset($event['participants'][$user_id]); 
    2096                                                 $overlap .= '<li>'.($conflict?'<b>':''). 
    2097                                                         $GLOBALS['phpgw']->common->grab_owner_name($id). 
    2098                                                         ($conflict?'</b> - '.lang('Scheduling conflict'):'')."</li>"; 
    2099                                         } 
    2100                                  if ($this->bo->prefs['calendar']['hide_event_conflict']) 
    2101                                          $overlap .= '<ul><font size="1"><span>'. 
    2102                                                  $this->normDec($overlapped_event['start']['hour']).":". 
    2103                                                  $this->normDec($overlapped_event['start']['min'])."-". 
    2104                                                  $this->normDec($overlapped_event['end']['hour']).":". 
    2105                                                  $this->normDec($overlapped_event['end']['min']). 
    2106                                                  '<br><b>'.lang('title').": ".lang("Hidden"). 
    2107                                                  '</b><br>'.lang('description').": ".lang("Hidden").'<br></span></ul><br>'; 
    2108                                  else 
    2109                                          $overlap .= '<ul>'.$this->link_to_entry($overlapped_event,$month,$mday,$year)."</ul><br>";      
    2110                                 } 
    2111          
    2112                                 unset($GLOBALS['phpgw_info']['flags']['noheader']); 
    2113                                 unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 
    2114                                 $GLOBALS['phpgw_info']['flags']['noappheader'] = True; 
    2115                                 $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; 
    2116                                 $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Scheduling Conflict'); 
    2117                                 $GLOBALS['phpgw']->common->phpgw_header(); 
    2118          
    2119                                 $p = $GLOBALS['phpgw']->template; 
    2120                                 $p->set_file( 
    2121                                         Array( 
    2122                                                 'overlap'       => 'overlap.tpl', 
    2123                                                 'form_button'   => 'form_button_script.tpl' 
    2124                                         ) 
    2125                                 ); 
    2126          
    2127                                 $var = Array( 
    2128                                         'color'         => $this->theme['bg_text'], 
    2129                                         'overlap_title' => lang('Scheduling Conflict'), 
    2130                                         'overlap_text'  => lang('Your suggested time of <B> %1 - %2 </B> conflicts with the following existing calendar entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)), 
    2131                                         'overlap_list'  => $overlap 
    2132                                 ); 
    2133                                 $p->set_var($var); 
    2134          
    2135                                 $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday); 
    2136                                 $var = Array( 
    2137                                         'action_url_button'     => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 3, 'user_id' => $user_id, 'ignore_conflict' => 1)), 
    2138                                         'action_text_button'    => lang('Ignore Conflict'), 
    2139                                         'action_confirm_button' => '', 
    2140                                         'action_extra_field'    => '', 
    2141                                         'button_id'             => 'ignore_button' 
    2142                                 );                               
    2143                                 $action_reject = $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0, 'response' => 0)); 
    2144          
    2145                                 $this->output_template_array($p,'resubmit_button','form_button',$var); 
    2146          
    2147                                 $var = Array( 
    2148                                         'action_url_button'     => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.set_action','cal_id' => $event[id], 'action' => 0)), 
    2149                                         'action_text_button'    => lang('Reject'), 
    2150                                         'action_confirm_button' => '', 
    2151                                         'action_extra_field'    => '', 
    2152                                         'button_id'             => 'redit_button' 
    2153                                 ); 
    2154                                 $this->output_template_array($p,'reedit_button','form_button',$var); 
    2155                                 $p->pparse('out','overlap'); 
    2156                         } 
    2157                 } 
    2158                  
    21592119                function set_action() 
    21602120                { 
     
    21652125                        } 
    21662126                         
    2167                         $overlapping_events = false; 
    2168                         $event = $this->bo->read_entry((int)$_GET['cal_id']); 
    2169                         if((!$_GET['response'] == 0 && !$_GET['ignore_conflict'] == 1) ||  
    2170                                 (!isset($_GET['response']) && $_GET['action'] == 3 && !$_GET['ignore_conflict'] == 1)) 
    2171                         { 
    2172                                 if($event['id']) 
    2173                                 { 
    2174                                         $event_ids[] = $event['id']; 
    2175                                 } 
    2176                                 if($event['reference']) 
    2177                                 { 
    2178                                         $event_ids[] = $event['reference']; 
    2179                                 } 
    2180                                  
    2181                                 $event['participants'] = Array($_SESSION['phpgw_info']['expressomail']['user']['account_id'] => $event['participants'][$_SESSION['phpgw_info']['expressomail']['user']['account_id']]); 
    2182  
    2183                                 $overlapping_events = $this->bo->overlap( 
    2184                                         $this->bo->maketime($event['start']), 
    2185                                         $this->bo->maketime($event['end']), 
    2186                                         $event['participants'], 
    2187                                         $event['owner'], 
    2188                                         $event_ids 
    2189                                 ); 
    2190                         } 
     2127                        $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action'],(int)$_GET['user']); 
    21912128 
    21922129                        if(isset($_GET['response'])) 
    21932130                        { 
    2194                                 if($overlapping_events) 
    2195                                 { 
    2196                                         $this->confirm_conflict($_GET['user_id'],$event); 
    2197                                 }else 
    2198                                 { 
    2199                                         $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action']); 
    22002131                                        $this->confirm_action($confirm_status); 
    22012132                                        $GLOBALS['phpgw']->common->phpgw_exit(False); 
    22022133                                } 
    2203                         }else 
    2204                         { 
    2205                                 if($overlapping_events) 
    2206                                 {                                        
    2207                                         $this->confirm_conflict($_GET['user_id'],$event,$overlapping_events); 
    2208                                 }else 
    2209                                 { 
    2210                                 $confirm_status = $this->bo->set_status((int)$_GET['cal_id'],(int)$_GET['action']); 
     2134                        else 
     2135                                { 
    22112136                                        if ($this->bo->return_to) 
    22122137                                        { 
     
    22192144                                        $GLOBALS['phpgw']->common->phpgw_exit(); 
    22202145                                } 
    2221                         } 
    2222                          
    22232146                         
    22242147                } 
     
    22932216                                if ($this->always_app_header) $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Group Planner'); 
    22942217                                $GLOBALS['phpgw']->common->phpgw_header(); 
     2218                                $this->header(); 
    22952219                        } 
    22962220 
     
    25642488                        if (!$is_private) 
    25652489                        { 
    2566                                 $opt .= ' title="'.lang('Title').": ".$event['title']; 
     2490                                $opt .= ' title="'.lang('Title').": ".$event['title']."&nbsp| "; 
    25672491                                if ($event['description']) 
    25682492                                { 
    2569                                         $opt .= "\n".lang('Description').": ".$event['description']; 
     2493                                        $opt .= "\n".lang('Description').": ".$event['description']."&nbsp| "; 
    25702494                                } 
    25712495                        } 
     
    25772501                        $start = $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset); 
    25782502                        $end = $GLOBALS['phpgw']->common->show_date($this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset); 
    2579                         $opt .= "\n".lang('Start Date/Time').": ".$start."\n".lang('End Date/Time').": ".$end; 
     2503                        $opt .= "\n".lang('Start Date/Time').": ".$start."&nbsp| ".lang('End Date/Time').": ".$end."&nbsp| "; 
    25802504 
    25812505                        if ($event['location'] && !$is_private) 
     
    30532977                                        } 
    30542978                                } 
    3055                                 $GLOBALS['phpgw']->redirect_link('/index.php',$vars); 
     2979 
     2980                                unset($GLOBALS['phpgw_info']['flags']['noheader']); 
     2981                                unset($GLOBALS['phpgw_info']['flags']['nonavbar']); 
     2982                                $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Search Results'); 
     2983                                $GLOBALS['phpgw']->common->phpgw_header(); 
     2984 
     2985                                echo '<b>'.lang('Error').':</b>'.lang('no matches found'); 
     2986                                return; 
     2987                                //$GLOBALS['phpgw']->redirect_link('/index.php',$vars); 
    30562988                        } 
    30572989 
     
    32523184                                        'footer'        => 'footer.tpl', 
    32533185                                        'form_button'   => 'form_button_script.tpl' 
    3254                                         //'new_component'       => 'new_component.tpl' 
    32553186                                ) 
    32563187                        ); 
     
    32943225                                $str_ini .= '<option value="'.$i.'"'.($i == $day?' selected':'').'>'.$i.'</option>'."\n"; 
    32953226                        } 
    3296                         $str_qtd = '<option value="'.''.'"'.(!$_POST['qtd_dias']?' selected':'').'>'.''.'</option>'."\n"; 
     3227                        $str_qtd = '<option value="'.''.'"'.($i == $_POST['qtd_dias']?' selected':'').'>'.''.'</option>'."\n"; 
    32973228                        for ($i = 1; $i <= 45; $i++) 
    32983229                        { 
     
    33013232                        $display = ''; 
    33023233                        $display_view = ''; 
    3303 //                        if ($menuaction == 'calendar.uicalendar.month') 
    3304 //                      { 
    3305 //                            $accounts = CreateObject('phpgwapi.accounts'); 
    3306 //                            $accountId = $accounts->name2id($account_name); 
    3307 //                            $prefs = CreateObject('phpgwapi.preferences', $accountId); 
    3308 //                            $account_prefs = $prefs->read(); 
    3309 //                        } 
    3310                         if ( ($menuaction == 'calendar.uicalendar.week') || ($menuaction == 'calendar.uicalendar.day') || ($menuaction == 'calendar.uicalendar.year') || ($menuaction == 'calendar.uicalendar.planner')) 
     3234                        if ( ($menuaction == 'calendar.uicalendar.week') || ($menuaction == 'calendar.uicalendar.day') ) 
    33113235                        { 
    33123236                                $display = 'none'; 
     
    33213245                                'formname'              => 'SelectDay', 
    33223246                                'formonchange'          => 'document.SelectDay.submit()', 
    3323                                 'day_ini_label'         => lang('print start day'), 
     3247                                'day_ini_label'         => lang('print starting in'), 
    33243248                                'num_dias_label'        => lang('quantity of days'), 
    3325                                 'tip'                   => lang('empty prints from the start day chosen to the end of the current month'), 
    3326 //                              'day_ini_name'          => 'day', 
    3327 //                              'num_dias_name'         => 'qtd_dias', 
     3249                                'tip'                   => lang('empty prints from the day chosen below to the end of the current month'), 
     3250                                'day_ini_name'          => 'day', 
     3251                                'num_dias_name'         => 'qtd_dias', 
    33283252                                'row_ini'               => $str_ini, 
    33293253                                'row_qtd'               => $str_qtd, 
     
    33603284                                'form_onchange' => 'document.SelectMonth.submit()', 
    33613285                                'row'           => $str, 
    3362 //                              'dia_ini'       => $dia_ini, 
     3286                                'dia_ini'       => $dia_ini, 
    33633287                                'go'            => lang('Go!') 
    33643288                        ); 
     
    34643388                        $this->output_template_array($p,'b_row2','form_button',$var); 
    34653389 
    3466                         //$p->set_var('place_component',''); 
    34673390                        $p->parse('table_row','blank_row',True); 
     3391 
    34683392                        $p->pparse('out','footer_table'); 
    34693393                        unset($p); 
     
    35223446                        $viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event); 
    35233447 
     3448                        if(!$viewable && $event['type'] == 'E' && !$event['public']){ 
     3449                                return ""; 
     3450                        }  
     3451                         
    35243452                        $starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; 
    35253453                        $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; 
     
    35463474                                } 
    35473475 
    3548                                 if($endtime >= ($rawdate_offset + 86400)) 
    3549                                 { 
    3550                                         $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat); 
    3551                                 } 
    3552                                 else 
    3553                                 { 
     3476                               
     3477//                              if($endtime >= ($rawdate_offset + 86400 )) 
     3478//                              { 
     3479//                                    $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat); 
     3480//                              } 
     3481//                              else 
     3482//                              { 
    35543483                                        $end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat); 
    3555                                 } 
     3484//                              } 
    35563485                                $time = $start_time.'-'.$end_time; 
    35573486                        } 
     
    35823511                        $texttime=$time; 
    35833512                        $texttitle=$this->bo->get_short_field($event,$is_private,'title'); 
    3584  
    3585                         $account_name = $_POST['user'] ? 
    3586                                                         $_POST['user'] : 
    3587                                                         ($_GET['account_name'] ? 
    3588                                                          $_GET['account_name'] : ''); 
    3589  
    3590                         $accounts = CreateObject('phpgwapi.accounts'); 
    3591                         $accountId = $accounts->name2id($account_name); 
    3592  
    3593                         $prefs = CreateObject('phpgwapi.preferences', $accountId); 
    3594                         $account_prefs = $prefs->read(); 
    3595  
    3596                         $titleView = $account_prefs['calendar']['title_view']; 
    3597                         if($titleView == "1") 
    3598                         { 
    3599                             $textdesc = ''; 
    3600                         } 
    3601                         else 
    3602                         { 
    3603                             $textdesc = (!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 
    3604                             $textdesc=nl2br($textdesc); 
    3605                         } 
    3606  
     3513                        $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 
    36073514                        // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set 
    3608                         $textlocation= $event['location']?"<br/><b>Local:</b> ".$this->bo->get_short_field($event,$is_private,'location'):''; 
     3515                        $textlocation=$this->bo->get_short_field($event,$is_private,'location'); 
    36093516 
    36103517                        if ($viewable) 
     
    36583565                        } 
    36593566                        else 
    3660                         {if ($texttitle) 
     3567                        { 
    36613568                                $picture[] = Array( 
    36623569                                        'pict'  =>  $GLOBALS['phpgw']->common->image('calendar','single'), 
     
    36903597                                } 
    36913598                        } 
    3692  
    3693                         if($event['attachment'] != '') 
    3694                                 { 
    3695                                         $picture[] = Array( 
    3696                                                 'pict'  => $GLOBALS['phpgw']->common->image('calendar','clip'), 
    3697                                                 'width' => 9, 
    3698                                                 'height'=> 9, 
    3699                                                 'title' => lang('Notification with attachments sent.') 
    3700                                         ); 
    3701                                 } 
    37023599 
    37033600                        $description = $this->bo->get_short_field($event,$is_private,'description'); 
     
    37123609                                $this->output_template_array($this->link_tpl,'picture','pict',$var); 
    37133610                        } 
    3714                         if ($event['type'] == 'H' || $texttitle) 
     3611                        if ($texttitle) 
    37153612                        { 
    37163613                                $var = Array( 
     
    37203617                                        'users_status'=>$textstatus, 
    37213618                                        'desc'=> $textdesc, 
    3722                                         'location'=> $textlocation 
     3619                                        'location'=> "<br><b>Local:</b> ".$textlocation 
    37233620                                ); 
    37243621                                $this->output_template_array($this->link_tpl,'picture','link_text',$var); 
     
    37853682                        } 
    37863683                         
    3787                         $textTitlePrint = $textTimePrint = $textDescPrint = $textLocationPrint = $textObservationsPrint = $textstatus = ''; 
     3684                        $texttitle = $texttime = $textdesc = $textlocation = $textstatus = ''; 
     3685 
     3686                         
    37883687 
    37893688                        if(!$is_private) 
    37903689                        { 
     3690                                //$text .= $this->bo->display_status($event['users_status']); 
     3691                                 
    37913692                                // split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation     
    37923693                                $textstatus=$this->bo->display_status($event['users_status']);  
     
    37943695                        } 
    37953696 
    3796                         $account_name = $_POST['user'] ? 
    3797                                                         $_POST['user'] : 
    3798                                                         ($_GET['account_name'] ? 
    3799                                                          $_GET['account_name'] : ''); 
    3800                          
    3801                         $accounts = CreateObject('phpgwapi.accounts'); 
    3802                         $accountId = $accounts->name2id($account_name); 
    3803  
    3804                         $prefs = CreateObject('phpgwapi.preferences', $accountId); 
    3805                         $account_prefs = $prefs->read(); 
    3806  
    3807  
    3808                         $textTimePrint = $time; 
    3809                         $textTitlePrint = $is_private ? lang('Private event. You are not allowed to print it.') : ( $event['type'] == 'H' ? 'Apontamento de horas' : $this->bo->get_short_field($event,$is_private,'title' ) ); 
    3810  
    3811                         $fieldsToPrint = $account_prefs['calendar']['fields_to_print']; 
    3812                         if($fieldsToPrint == "0") 
    3813                         { 
    3814                             $textDescPrint = ''; 
    3815                         } 
    3816                         elseif($fieldsToPrint == "1") 
    3817                         { 
    3818                             $textDescPrint = (!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 
    3819                         } 
    3820                         else 
    3821                         { 
    3822                             $textDescPrint = (!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 
    3823                             $textObservationsPrint = $event['observations']?"<br /><b>Observações:</b> ".$this->bo->get_short_field($event,$is_private,'observations'):''; 
    3824                         } 
    3825  
     3697                        $text = '<nobr>&nbsp;'.$time.'&nbsp;</nobr> '.$this->bo->get_short_field($event,$is_private,'title').$text. 
     3698 
     3699                        $texttime=$time; 
     3700                        $texttitle=$this->bo->get_short_field($event,$is_private,'title'); 
     3701                        $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 
    38263702                        // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set 
    3827                         $textLocationPrint = $event['location']?"<br /><b>Local:</b> ".$this->bo->get_short_field($event,$is_private,'location'):''; 
     3703                        $textlocation=$this->bo->get_short_field($event,$is_private,'location'); 
    38283704 
    38293705                        if ($viewable) 
     
    38323708                                $this->event_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); 
    38333709                                $this->event_tpl->set_var('lang_view',lang('View this entry')); 
    3834                                 $this->event_tpl->set_var('desc', $textDescPrint); 
    3835                                 $this->event_tpl->set_var('location', $textLocationPrint); 
    3836                                 $this->event_tpl->set_var('observations', $textObservationsPrint); 
     3710                                $this->event_tpl->set_var('desc', $textdesc); 
     3711                                $this->event_tpl->set_var('location', $textlocation); 
    38373712                                $this->event_tpl->parse('picture','link_event_open',True); 
    38383713                        } 
    3839  
    38403714                        if (!$is_private) 
    38413715                        { 
     
    39253799                                $this->output_template_array($this->event_tpl,'picture','event_pict',$var); 
    39263800                        } 
    3927  
    3928                         if ($textTitlePrint) 
     3801                        if ($texttitle) 
    39293802                        { 
    39303803                                $var = Array( 
    39313804                        //              'text' => $text, 
    3932                                         'time'=> $textTimePrint, 
    3933                                         'title'=> $textTitlePrint, 
     3805                                        'time'=> $texttime, 
     3806                                        'title'=> $texttitle, 
    39343807                                        'users_status'=>$textstatus, 
    3935                                         'desc'=> $textDescPrint, 
    3936                                         'location'=> $textLocationPrint, 
    3937                                         'observations'=> $textObservationsPrint 
     3808                                        'desc'=> $textdesc, 
     3809                                        'location'=> "<br><b>Local:</b> ".$textlocation 
    39383810                                ); 
    39393811                                $this->output_template_array($this->event_tpl,'picture','link_event_text',$var); 
     
    39673839                        { 
    39683840                                $overlapping_events = $params['o_events']; 
     3841 
     3842                                if( is_string( $overlapping_events )) 
     3843                                    $overlapping_events = explode( ';', $overlapping_events ); 
     3844 
    39693845                                $event = $params['this_event']; 
     3846 
     3847                                if( is_string( $event ) ) 
     3848                                    $event = $this->bo->read_entry( $event ); 
     3849 
     3850                                if( !$event ) 
     3851                                    $event = $this->bo->restore_from_appsession(); 
    39703852                        } 
    39713853 
     
    39863868                                        $overlap .= '<li>'.($conflict?'<b>':''). 
    39873869                                                $GLOBALS['phpgw']->common->grab_owner_name($id). 
    3988                                                 ($conflict?'</b> - '.lang('Scheduling conflict'):'')."</li>"; 
     3870                                                ($conflict?'</b> - '.lang('Scheduling conflict'):'').'</li>'; 
    39893871                                } 
    39903872                         if ($this->bo->prefs['calendar']['hide_event_conflict']) 
     
    39973879                                         '</b><br>'.lang('description').": ".lang("Hidden").'<br></span></ul><br>'; 
    39983880                         else 
    3999                                  $overlap .= '<ul>'.$this->link_to_entry($overlapped_event,$month,$mday,$year)."</ul><br>";      
     3881                                 $overlap .= '<ul>'.$this->link_to_entry($overlapped_event,$month,$mday,$year).'"</ul><br>';                   
    40003882                        } 
    40013883 
     
    40073889                        $GLOBALS['phpgw']->common->phpgw_header(); 
    40083890 
     3891                        $porig = $GLOBALS['phpgw']->template; 
     3892 
     3893                        $GLOBALS['phpgw']->template->root = $_SESSION['rootPath'].'/calendar/templates/'.$GLOBALS['phpgw_info']['server']['template_set'].'/'; 
     3894 
    40093895                        $p = $GLOBALS['phpgw']->template; 
    40103896                        $p->set_file( 
     
    40243910 
    40253911                        $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday); 
     3912 
     3913                        $var = Array( 
     3914                                'action_url_button'     => $GLOBALS['phpgw']->link('/index.php',array('menuaction' => 'calendar.uicalendar.index')), 
     3915                                'action_text_button'    => lang('Cancel'), 
     3916                                'action_confirm_button' => '', 
     3917                                'action_extra_field'    => '', 
     3918                                'button_id'             => 'cancel_button' 
     3919                        ); 
     3920                        $this->output_template_array($p,'cancel_button','form_button',$var); 
     3921 
    40263922                        $var = Array( 
    40273923                                'action_url_button'     => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.bocalendar.update','readsess'=>1)), 
     
    40333929                        $this->output_template_array($p,'resubmit_button','form_button',$var); 
    40343930 
     3931                        if( $event['owner'] == -2 || $event['id'] != 0 ) 
     3932                        { 
     3933                            $p->set_var( 'suggestion', $this->build_suggestion( $event , $params['this_account']) ); 
     3934 
     3935                            $var = Array( 
     3936                                'action_url_button'     => '', 
     3937                                'action_text_button'    => lang('Suggest new hour'), 
     3938                                'action_confirm_button' => 'onsubmit="javascript: return false;" onclick="javascript: return show_suggestion();"', 
     3939                                'action_extra_field'    => '', 
     3940                                'button_id'             => 'redit_button' 
     3941                            ); 
     3942                        } 
     3943                        else 
     3944                        { 
     3945                            $p->set_var( 'suggestion', '' ); 
     3946 
    40353947                        $var = Array( 
    40363948                                'action_url_button'     => $GLOBALS['phpgw']->link('/index.php',Array('menuaction'=>'calendar.uicalendar.edit','readsess'=>1,'date'=>$date)), 
     
    40403952                                'button_id'             => 'redit_button' 
    40413953                        ); 
     3954                        } 
    40423955                        $this->output_template_array($p,'reedit_button','form_button',$var); 
    40433956                        $p->pparse('out','overlap'); 
     3957                        //return 'OLA'; 
    40443958                } 
    40453959 
     
    43574271                                $month = (int)substr($date,4,2); 
    43584272                                $day   = (int)substr($date,6,2); 
    4359  
     4273                                $var   = Array( 
     4274                                        'column_data' => '', 
     4275                                        'extra' => '' 
     4276                                ); 
    43604277                                $p->set_var($var); 
    43614278                                if ($weekly || ($date >= $monthstart && $date <= $monthend)) 
     
    43664283                                        $id_aux = mktime(0,0,0,$month,$day,$year); 
    43674284                                        $month_identifier = substr(lang(strftime("%B",$id_aux)),0,3); 
    4368                                         $day_number = $dia_semana . ",  " . $day_num; 
     4285                                        $day_number = $month_identifier . " - " . $dia_semana . ",  " . $day_num; 
    43694286 
    43704287                                        $var = Array( 
    43714288                                                'extra'         => $day_params['extra'], 
    43724289                                                'new_event_link'=> $new_event_link, 
    4373                                                 'day_number'    => (isset($_GET['num_dias']) && ($_GET['num_dias'] > 1 || $_GET['num_dias'] == "")?$day_number:'') 
     4290                                                'day_number'    => $day_number 
    43744291                                        ); 
    43754292 
     
    43834300                                                ); 
    43844301                                                $p->set_var($var); 
    4385                                                 $eventsCached = $this->bo->cached_events[$date]; 
    4386  
    4387                                                 if($_GET['d'] == '1') 
    4388                                                 { 
    4389  
    4390                                                     for($i_events = 0; $i_events < count($eventsCached) ; $i_events++) 
     4302                                                $events = $this->bo->cached_events[$date]; 
     4303                                                foreach($events as $event) 
    43914304                                                        { 
    4392                                                         if ($eventsCached[$i_events]['users_status'] == 'R') 
    4393                                                         { 
    4394                                                                 continue;       // user does not want to see rejected events 
    4395                                                         } 
    4396                                                         $events[] = $eventsCached[$i_events]; 
    4397                                                     } 
    4398                                                     /*echo "<pre>"; 
    4399                                                         print_r($events1); 
    4400  
    4401                                                     echo "</pre>"; 
    4402                                                     exit();*/ 
    4403  
    4404                                                     $newEvents = Array(); 
    4405                                                     $eventAux = Array 
    4406                                                                 ( 
    4407                                                                     'owner' => '', 
    4408                                                                     'id' => '', 
    4409                                                                     'type' => '', 
    4410                                                                     'public' => '', 
    4411                                                                     'category' => '', 
    4412                                                                     'title' => '', 
    4413                                                                     'description' => '', 
    4414                                                                     'alter_by' => '', 
    4415                                                                     'observations' => '', 
    4416                                                                     'attachment' => '', 
    4417                                                                     'ex_participants' => '', 
    4418                                                                     'uid' => '', 
    4419                                                                     'location' => '', 
    4420                                                                     'reference' => '', 
    4421                                                                     'start' => Array 
    4422                                                                         ( 
    4423                                                                             'year' => '', 
    4424                                                                             'month' => '', 
    4425                                                                             'mday' => '', 
    4426                                                                             'hour' => '', 
    4427                                                                             'min' => '', 
    4428                                                                             'sec' => '', 
    4429                                                                             'alarm' => '', 
    4430                                                                         ), 
    4431  
    4432                                                                     'modtime' => Array 
    4433                                                                         ( 
    4434                                                                         ), 
    4435  
    4436                                                                     'end' => Array 
    4437                                                                         ( 
    4438                                                                             'year' => '', 
    4439                                                                             'month' => '', 
    4440                                                                             'mday' => '', 
    4441                                                                             'hour' => '', 
    4442                                                                             'min' => '', 
    4443                                                                             'sec' => '', 
    4444                                                                             'alarm' => '', 
    4445                                                                         ), 
    4446  
    4447                                                                     'priority' => '', 
    4448                                                                     'users_status' => '', 
    4449                                                                     'participants' => Array 
    4450                                                                         ( 
    4451                                                                         ), 
    4452  
    4453                                                                     'alarm' => Array 
    4454                                                                         ( 
    4455                                                                         ), 
    4456  
    4457                                                                 ); 
    4458  
    4459                                                     $delta = 60; //em segundos 
    4460                                                     for($i_events = 0; $i_events < count($events) ; $i_events++) 
    4461                                                     { 
    4462  
    4463                                                         $newEvents[] = $events[$i_events]; 
    4464  
    4465                                                         $hf_current = mktime($events[$i_events]['end']['hour'], 0, 0, $month, $day, $year); 
    4466                                                         $hi_prox = mktime($events[$i_events+1]['start']['hour'], 0, 0, $month, $day, $year); 
    4467  
    4468                                                         if($events[$i_events]['end']['min'] > 0) 
    4469                                                         { 
    4470                                                             $hf_current += 60*$delta; 
    4471                                                         } 
    4472  
    4473                                                         while($hi_prox > $hf_current) 
    4474                                                         { 
    4475  
    4476                                                             $aux1 = date('Y:m:d:H:i:s',$hf_current); 
    4477                                                             $aux2 = explode(':',$aux1); 
    4478                                                             $eventAux['start']['year'] = $aux2[0]; 
    4479                                                             $eventAux['start']['month'] = $aux2[1]; 
    4480                                                             $eventAux['start']['mday'] = $aux2[2]; 
    4481                                                             $eventAux['start']['hour'] = $aux2[3]; 
    4482                                                             $eventAux['start']['min'] = $aux2[4]; 
    4483                                                             $eventAux['start']['sec'] = $aux2[5]; 
    4484  
    4485                                                             //$aux3 = date('Y:m:d:H:i:s',$hf_current); 
    4486                                                             //$aux4 = explode(':',$aux3); 
    4487                                                             $eventAux['end']['year'] = $aux2[0]; 
    4488                                                             $eventAux['end']['month'] = $aux2[1]; 
    4489                                                             $eventAux['end']['mday'] = $aux2[2]; 
    4490                                                             $eventAux['end']['hour'] = $aux2[3]; 
    4491                                                             $eventAux['end']['min'] = $aux2[4]; 
    4492                                                             $eventAux['end']['sec'] = $aux2[5]; 
    4493  
    4494                                                             $eventAux['owner'] = $GLOBALS['phpgw_info']['user']['account_id']; 
    4495                                                             $eventAux['title'] = "\n\n\n"; 
    4496                                                             $eventAux['description'] = ''; 
    4497                                                             $eventAux['observations'] = ''; 
    4498                                                             $eventAux['location'] = ''; 
    4499  
    4500                                                             $newEvents[] = $eventAux; 
    4501                                                             $hf_current += 60*$delta; 
    4502  
    4503                                                         } 
    4504                                                     } 
    4505  
    4506                                                     foreach($newEvents as $event) 
    4507                                                     { 
    4508                                                         $p->set_var('day_events',$this->link_to_month_entry($event,$month,$day,$year)); 
    4509                                                         $p->parse('events','event',True); 
    4510                                                         $p->set_var('day_events',''); 
    4511                                                 } 
    4512                                         } 
    4513                                                 else 
    4514                                                 { 
    4515                                                     foreach($eventsCached as $event) 
    4516                                                     { 
    4517                                                         if ($this->bo->rejected_no_show($event) || $event['users_status'] == 'R') 
     4305                                                        if ($this->bo->rejected_no_show($event)) 
    45184306                                                        { 
    45194307                                                                continue;       // user does not want to see rejected events 
     
    45224310                                                        $p->parse('events','event',True); 
    45234311                                                        $p->set_var('day_events',''); 
    4524                                                     } 
    45254312                                                } 
    4526  
    4527                                                 /*echo "<pre>"; 
    4528                                                     print_r($newEvents); 
    4529  
    4530                                                 echo "</pre>"; 
    4531                                                 exit();*/ 
    45324313                                        } 
    45334314                                        $p->parse('daily_events','day_event',True); 
     
    45524333                        } 
    45534334 
     4335/*                      $this->bo->store_to_cache( 
     4336                                Array( 
     4337                                        'syear' => $year, 
     4338                                        'smonth'=> $month, 
     4339                                        'sday'  => 1 
     4340                                ) 
     4341                        ); 
     4342*/ 
    45544343                        $day_ini = $_GET['day_ini'];// dia do inicio da impressao; o padrao e o dia atual; 
    45554344                        $num_dias = $_GET['num_dias'];// quantidade de dias a partir do dia inicial; 
     
    45584347//                      $monthend   = (int)(date('Ymd',mktime(0,0,0,$month + 1,0,$year))); 
    45594348 
    4560                         if($num_dias != '') 
     4349                        if($num_dias != 0) 
    45614350                        { 
    45624351                                //se a qtde de dias for informada, a data final para impressao considera a soma $day_ini+$num_dias; 
     
    46094398 
    46104399                        $var = Array( 
    4611                                 'cols'      => 1 
    4612                                 //'day_events'=> '' 
    4613                         ); 
     4400                                'cols'      => 1, 
     4401                                'day_events'=> '' //$this->month_week_header($month,$year,False) 
     4402                        ); 
     4403//                      $this->output_template_array($p,'row','event',$var); 
    46144404 
    46154405                        $cellcolor = $this->theme['row_on']; 
     
    46294419/***************************************************************************************/ 
    46304420 
    4631                 function display_month($params) //($month,$year,$showyear,$owner=0) 
    4632                 { 
    4633                         $month = $params['month']; 
    4634                         $year = $params['year']; 
    4635                         $showyear = $params['showyear']; 
    4636                         $owner = $params['owner']; 
    4637  
     4421                function display_month($month,$year,$showyear,$owner=0) 
     4422                { 
    46384423                        if($this->debug) 
    46394424                        { 
     
    46784463 
    46794464                        $cellcolor = $this->theme['row_on']; 
    4680  
    4681                         $result_events_json = $this->print_events_to_show_json($params); 
    4682                         $p->set_var('date','Date(2011,1,1)'); 
    4683                         $p->set_var('hora_final',$result_events_json['hora_final']); 
    4684                         $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'); 
    4685  
    46864465 
    46874466                        for($i = (int)($start + $GLOBALS['phpgw']->datetime->tz_offset);(int)(date('Ymd',$i)) <= $monthend;$i += 604800) 
     
    47894568                        $p->set_block('view','hr','hr'); 
    47904569 
     4570                        include_once($_SESSION['rootPath'].'/calendar/inc/class.ex_participants.inc.php'); 
     4571                        $langp = array(); 
     4572                        $langp['ACCEPTED'] = lang('Accepted'); 
     4573                        $langp['DECLINED'] = lang('Declined'); 
     4574                        $langp['TENTATIVE'] = lang('Tentative'); 
     4575                        $langp['DELEGATED'] = lang('Delegated'); 
     4576                        $langp['NO ANSWER'] = lang('No answer'); 
     4577                        $exParticipants = new exParticipants($langp); 
     4578                        $exParticipants->setParticipantsBySerializable($event['ex_participants']); 
     4579                        $event['ex_participants'] = $exParticipants->getParticipantsView(); 
     4580 
    47914581                        $vars = $this->bo->event2array($event); 
    4792  
    4793                         if($vars['attachment']['data'] == "") 
    4794                             $vars['attachment']['data'] = lang('No Attachment'); 
    4795                         else{ 
    4796                             $vars['attachment']['data'] = lang('Has attachment(s)'); 
    4797                         } 
    47984582                         
    47994583                        $vars['title']['tr_color'] = $this->theme['th_bg']; 
     
    48044588                                { 
    48054589                                        $vars['participants']['data'][$user] = $parts[1].' (<a href="'.$this->page('edit_status','&cal_id='.$event['id'].'&owner='.$user).'">'.$parts[2].'</a>)'; 
    4806                                         $vars['participants']['data'][$user].='&nbsp;(<a href=\'index.php?menuaction=calendar.uicalendar.screen_delegate_event&id_event='.$event['id'].'&delegator='.$user.'&date='.$_REQUEST["date"].'&eventArray='.$event.'\'>'.lang("Delegate event").'</a>)'; 
    4807 //system('echo "event: '.$event['start'].'" >>/tmp/controle'); 
    48084590                                } 
    48094591                        } 
     
    50514833                        return $p->fp('out','day'); 
    50524834                }       // end function 
    5053  
    5054                 //função para exibição do calendário novo. 
    5055  
    5056                 function print_day_new($params){ 
    5057                         $this->bo->store_to_cache( 
    5058                         Array( 
    5059                                         'syear'  => $params['year'], 
    5060                                         'smonth' => $params['month'], 
    5061                                         'sday'   => $params['day'], 
    5062                                         'eyear'  => $params['year'], 
    5063                                         'emonth' => $params['month'], 
    5064                                         'eday'   => $params['day'] 
    5065                                 ) 
    5066                         ); 
    5067  
    5068                         $p = CreateObject('phpgwapi.Template',$this->template_dir); 
    5069                         $p->set_unknowns('keep'); 
    5070  
    5071                         $tpl = 'day_cal.tpl'; 
    5072                         //$new_component_tpl = 'new_component.tpl'; 
    5073  
    5074                         if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 && 
    5075                                 $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') 
    5076                         { 
    5077                                 $tpl = 'day_list.tpl'; 
    5078                         } 
    5079  
    5080                         $templates = Array( 
    5081                                 'day_cal'   => $tpl 
    5082                                 //'new_component_tpl' => $new_component_tpl 
    5083                         ); 
    5084  
    5085                         $templateSet = $GLOBALS['phpgw_info']['server']['template_set']; 
    5086  
    5087                         if(isset($_GET['date'])) 
    5088                         { 
    5089                             $dia = substr($_GET['date'],-2); 
    5090                         } 
    5091                         elseif(isset($_POST['day'])) 
    5092                         { 
    5093                             $dia = $_POST['day']; 
    5094                         } 
    5095                         else 
    5096                         { 
    5097                             $dia = $params['day']; 
    5098                         } 
    5099                          
    5100                         $print =  '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>'; 
    5101                         $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1'; 
    5102  
    5103                         $p->set_file($templates); 
    5104                         $p->set_block('day_cal','day','day'); 
    5105                         //$p->set_block('new_component_tpl','new_component','new_component'); 
    5106                         $params['period'] = 1; 
    5107                         $result_events_json = $this->print_events_to_show_json($params); 
    5108                         $p->set_var('date',$result_events_json['date_events_json']); 
    5109                         $p->set_var('templateSet',$templateSet); 
    5110                         $p->set_var('iprint',$print); 
    5111                         $p->set_var('param',$param); 
    5112                         $p->set_var('hora_final',$result_events_json['hora_final']); 
    5113                         $p->set_var('hora_inicial',$result_events_json['hora_inicial']); 
    5114                         $p->set_var('hour_size_px',$result_events_json['hour_size_px']); 
    5115  
    5116                         $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'); 
    5117                         return $p->fp('out','day'); 
    5118                 } 
    5119  
    5120                 function print_week_new($params){ 
    5121  
    5122                     $p = CreateObject('phpgwapi.Template',$this->template_dir); 
    5123                     $p->set_unknowns('keep'); 
    5124  
    5125                     $tpl = 'new_week.tpl'; 
    5126  
    5127                     if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 && 
    5128                     $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') 
    5129                     { 
    5130                         $tpl = 'day_list.tpl'; 
    5131                     } 
    5132  
    5133                     $minical_prev = $this->mini_calendar( 
    5134                         Array( 
    5135                             'day'               => 1, 
    5136                             'month'             => $this->bo->month, 
    5137                             'year'              => $this->bo->year, 
    5138                             'link'              => 'week', 
    5139                             'control'           => False, 
    5140                             'outside_month'     => False 
    5141                             ) 
    5142                     ); 
    5143  
    5144                     $minical_next1 = $this->mini_calendar( 
    5145                         Array( 
    5146                             'day'               => 1, 
    5147                             'month'             => $this->bo->month+2, 
    5148                             'year'              => $this->bo->year, 
    5149                             'link'              => 'week', 
    5150                             'control'           => False, 
    5151                             'outside_month'     => False 
    5152                         ) 
    5153                     ); 
    5154  
    5155                     $minical_next = $this->mini_calendar( 
    5156                         Array( 
    5157                             'day'               => 1, 
    5158                             'month'             => $this->bo->month+1, 
    5159                             'year'              => $this->bo->year, 
    5160                             'link'              => 'week', 
    5161                             'control'           => False, 
    5162                             'outside_month'     => False 
    5163                         ) 
    5164                     ); 
    5165                     $this->bo->read_holidays($params['year']); 
    5166                     $next = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 7,$this->bo->year); 
    5167                     $prev = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day - 7,$this->bo->year); 
    5168                     $prev_week_link = '<a href="'.$this->page('week','&date='.$prev['full']).'">&lt;&lt;</a>'; 
    5169                     $next_week_link = '<a href="'.$this->page('week','&date='.$next['full']).'">&gt;&gt;</a>'; 
    5170  
    5171                     $daily = $this->set_week_array($GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True); 
    5172                     foreach($daily as $key => $value) 
    5173                     { 
    5174                         $dates[] = $key; 
    5175                     } 
    5176  
    5177                     $day_ini = (int)substr($dates[0],6,2); 
    5178  
    5179                     $print =  '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>'; 
    5180  
    5181                     $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$day_ini.'&num_dias=7'; 
    5182  
    5183                     $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); 
    5184  
    5185                     $templates = Array( 
    5186                         'new_week'   => $tpl, 
    5187                     ); 
    5188                     $feriados_do_ano = Array(); 
    5189                     foreach ($this->bo->cached_holidays as $key => $value) 
    5190                         { 
    5191                             $feriados_do_ano[$key] = utf8_encode($this->bo->cached_holidays[$key][0]['name']); 
    5192                         } 
    5193                     $p->set_file($templates); 
    5194                     $p->set_block('new_week','day','day'); 
    5195                     $params['period'] = 2; 
    5196                     $result_events_json = $this->print_events_to_show_json($params); 
    5197                     $p->set_var('date',$result_events_json['date_events_json']); 
    5198                     $p->set_var('hora_final',$result_events_json['hora_final']); 
    5199                     $p->set_var('hora_inicial',$result_events_json['hora_inicial']); 
    5200                     $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1); 
    5201                     $p->set_var('iprint',$print); 
    5202                     $p->set_var('param',$param); 
    5203                     $p->set_var('title',$prev_week_link.'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::'.$this->bo->get_week_label().'::&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$next_week_link); 
    5204                     $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)); 
    5205                     $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'); 
    5206                     $p->set_var('holidays_json',json_encode($feriados_do_ano)?json_encode($feriados_do_ano):null); 
    5207                     return $p->fp('out','day'); 
    5208  
    5209                 } 
    5210  
    5211                 function print_month_new($params){ 
    5212  
    5213                         $p = CreateObject('phpgwapi.Template',$this->template_dir); 
    5214                         $p->set_unknowns('keep'); 
    5215                         $tpl = 'new_month.tpl'; 
    5216  
    5217                         if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 && 
    5218                                 $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') 
    5219                         { 
    5220                                 $tpl = 'day_list.tpl'; 
    5221                         } 
    5222  
    5223  
    5224  
    5225                         $templates = Array( 
    5226                                 'new_month'   => $tpl, 
    5227                         ); 
    5228  
    5229                         $minical_prev = $this->mini_calendar( 
    5230                                         Array( 
    5231                                                 'day'           => 1, 
    5232                                                 'month'         => $this->bo->month -1, 
    5233                                                 'year'          => $this->bo->year, 
    5234                                                 'link'          => 'day', 
    5235                                                 'control'       => False, 
    5236                                                 'outside_month' => False 
    5237                                         ) 
    5238                                 ); 
    5239  
    5240                         $minical_next1 = $this->mini_calendar( 
    5241                                         Array( 
    5242                                                 'day'           => 1, 
    5243                                                 'month'         => $this->bo->month + 2, 
    5244                                                 'year'          => $this->bo->year, 
    5245                                                 'link'          => 'day', 
    5246                                                 'control'       => False, 
    5247                                                 'outside_month' => False 
    5248                                         ) 
    5249                                 ); 
    5250  
    5251                         $minical_next = $this->mini_calendar( 
    5252                                         Array( 
    5253                                                 'day'           => 1, 
    5254                                                 'month'         => $this->bo->month + 1, 
    5255                                                 'year'          => $this->bo->year, 
    5256                                                 'link'          => 'day', 
    5257                                                 'control'       => False, 
    5258                                                 'outside_month' => False 
    5259                                         ) 
    5260                                 ); 
    5261                         $this->bo->read_holidays($params['year']); 
    5262                         $print =  '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>'; 
    5263  
    5264                         $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'; 
    5265  
    5266                         $next = $this->bo->month + 1; 
    5267                         $prev = $this->bo->month - 1; 
    5268                         $nextyear = $this->bo->year; 
    5269                         $prevyear = $this->bo->year; 
    5270                         if ($this->bo->month == 12) 
    5271                         { 
    5272                                 $next = 1; 
    5273                                 $nextyear = $nextyear + 1; 
    5274                         } 
    5275                         elseif ($this->bo->month == 1) 
    5276                         { 
    5277                                 $prev = 12; 
    5278                                 $prevyear = $prevyear - 1; 
    5279                         } 
    5280  
    5281                         $feriados_do_ano = Array(); 
    5282                         foreach ($this->bo->cached_holidays as $key => $value) 
    5283                         { 
    5284                             $feriados_do_ano[$key] = utf8_encode($this->bo->cached_holidays[$key][0]['name']); 
    5285                         } 
    5286                         $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); 
    5287                         $p->set_file($templates); 
    5288                         $p->set_block('new_month','day','day'); 
    5289                         $params['period'] = 3; 
    5290                         $result_events_json = $this->print_events_to_show_json($params); 
    5291                         $prev_month_link = '<a href="'.$this->page('month','&year='.$prevyear.'&month='.$prev.'&sday='.$sday).'">&lt;&lt;</a>'; 
    5292                         $next_month_link = '<a href="'.$this->page('month','&year='.$nextyear.'&month='.$next.'&sday='.$sday).'">&gt;&gt;</a>'; 
    5293                         $p->set_var('date',$result_events_json['date_events_json']); 
    5294                         $p->set_var('hora_final',$result_events_json['hora_final']); 
    5295                         $p->set_var('hora_inicial',$result_events_json['hora_inicial']); 
    5296                         $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1); 
    5297                         $p->set_var('iprint',$print); 
    5298                         $p->set_var('param',$param); 
    5299                         $p->set_var('title',$prev_month_link."&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;::".lang(strftime("%B",$m)).' '.$this->bo->year.'::&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$next_month_link); 
    5300                         $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)); 
    5301                         $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'); 
    5302                         $p->set_var('holidays_json',json_encode($feriados_do_ano)?json_encode($feriados_do_ano):null); 
    5303                         return $p->fp('out','day'); 
    5304                 } 
    5305  
    5306                 //função vai devolver os eventos do mês atual para exibição no novo componente da Agenda 
    5307                 function print_events_to_show_json($params) 
    5308                 { 
    5309  
    5310                         if( (!isset($this->bo->prefs['calendar']['interval'])) || ( (isset($this->bo->prefs['calendar']['interval'])) && ( ($this->bo->prefs['calendar']['interval'] != 42) && ($this->bo->prefs['calendar']['interval'] != 84) ) ) ) 
    5311                         { 
    5312                                 $this->bo->prefs['calendar']['interval'] = 42; 
    5313                                 $GLOBALS['phpgw']->preferences->add('calendar','interval',42); 
    5314                                 $GLOBALS['phpgw']->preferences->save_repository(); 
    5315                         } 
    5316  
    5317                         if(!is_array($params)) 
    5318                         { 
    5319                                 $this->index(); 
    5320                         } 
    5321  
    5322                         // $params['period'] pode ser 1 pra dia, 2 pra semana e 3 pra mes 
    5323  
    5324                         if(!$params['period'] || $params['period'] == '') 
    5325                             $period = 3; 
    5326                         else 
    5327                             $period = $params['period']; 
    5328                         $accounts = CreateObject('phpgwapi.accounts'); 
    5329                         $accountId = $accounts->name2id($account_name); 
    5330                         $date_to_eval = sprintf("%04d%02d%02d",$params['year'],$params['month'],$params['day']); 
    5331                         $dates = array(); 
    5332                         if($period == 1){ 
    5333                             $dates[] = $date_to_eval; 
    5334                             $this->bo->store_to_cache( 
    5335                                 Array( 
    5336                                         'smonth'=> $params['month'], 
    5337                                         'sday'  => $params['day'], 
    5338                                         'syear' => $params['year'] 
    5339                                 ) 
    5340                             ); 
    5341                         }else if($period == 2){ 
    5342                             $daily = $this->set_week_array($GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True); 
    5343  
    5344                             foreach($daily as $key => $value) 
    5345                                 $dates[] = $key; 
    5346  
    5347                              $this->bo->store_to_cache( 
    5348                                 Array( 
    5349                                         'smonth'=> (int)substr($dates[0],4,2), 
    5350                                         'sday'  => (int)substr($dates[0],6), 
    5351                                         'syear' => (int)substr($dates[0],0,4), 
    5352                                         'eyear' => 0, 
    5353                                         'emonth'=> 0, 
    5354                                         'eday'  => ((int)substr($dates[0],6))+6, 
    5355                                 ) 
    5356                             ); 
    5357                         }else{ 
    5358                              $month_tmp = substr($date_to_eval, 0, 6); 
    5359  
    5360                              $this->bo->store_to_cache( 
    5361                                 Array( 
    5362                                         'smonth'=> (int)substr($date_to_eval,4,2), 
    5363                                         'sday'  => 1, 
    5364                                         'syear' => (int)substr($date_to_eval,0,4), 
    5365                                         'eyear' => 0, 
    5366                                         'emonth'=> 0, 
    5367                                         'eday'  => ((int)substr($date_to_eval,6))+30, 
    5368                                 ) 
    5369                             ); 
    5370                              for( $i=1 ; $i<=31; $i++){ 
    5371                                  if($i<10) 
    5372                                      $day= $month_tmp."0".(string)$i; 
    5373                                  else 
    5374                                      $day=$month_tmp.(string)$i; 
    5375                                  $dates[] = $day; 
    5376  
    5377                              } 
    5378  
    5379                         } 
    5380  
    5381                         $prefs = CreateObject('phpgwapi.preferences', $accountId); 
    5382                         $account_prefs = $prefs->read(); 
    5383                         //print_debug('in print_day()'); 
    5384  
    5385                         $month = (string)((Int)$params['month']-1); 
    5386                         $date_events_json = 'Date('.$params['year'].','.$month.','.$params['day'].')'; 
    5387  
    5388                         print_debug('Date to Eval',$date_to_eval); 
    5389  
    5390                         $hora_inicial = $account_prefs['calendar']['workdaystarts']; 
    5391                         $hora_final = $account_prefs['calendar']['workdayends']; //18; 
    5392  
    5393                         $hour_size_px = $account_prefs['calendar']['interval'] ? $account_prefs['calendar']['interval'] : 42; 
    5394  
    5395                         $title_view = $account_prefs['calendar']['title_view']; 
    5396  
    5397                         $events_to_show_json = array(); 
    5398                         $templateSet = $GLOBALS['phpgw_info']['server']['template_set']; 
    5399                         foreach($dates as $day) 
    5400                         { 
    5401  
    5402                             $events = $this->bo->cached_events[$day]; 
    5403  
    5404                             foreach($events as $event) 
    5405                             { 
    5406                                 //$is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event); 
    5407                                 if($event['users_status'] == 'R' && $this->bo->prefs['calendar']['show_rejected'] == 0 && $event['owner']  != $GLOBALS['phpgw_info']['user']['account_id']) 
    5408                                         continue; 
    5409  
    5410                                 if($event['recur_type']){ 
    5411                                     $recur = $day; 
    5412                                     $event['start']['year'] = (int)substr($day,0,4); 
    5413                                     $event['start']['month'] = (int)substr($day,4,2); 
    5414                                     $event['start']['mday'] = (int)substr($day,6,2); 
    5415                                     $event['end']['year'] =  (int)substr($day,0,4); 
    5416                                     $event['end']['month'] = (int)substr($day,4,2); 
    5417                                     $event['end']['mday'] = (int)substr($day,6,2); 
    5418                                     $event['id'] = $event['id'].'rc'.$day; 
    5419                                 }else{ 
    5420                                     $recur = false; 
    5421                                 } 
    5422  
    5423                                 $isPublic = 1; 
    5424                                 if(($event['type'] == E && $event['public'] == 0)) 
    5425                                 { 
    5426                                     $isPublic = 0; 
    5427                                     $isPublicTitle = lang('restrict'); 
    5428                                 } 
    5429  
    5430                                 if(($event['type'] == P && $event['public'] == 0)) 
    5431                                 { 
    5432                                     $isPublic = 0; 
    5433                                     $isPublicTitle = lang('private'); 
    5434                                 } 
    5435  
    5436                                 $eventTime = ( (mktime($event['end']['hour'], $event['end']['min'], 0, $event['end']['month'], $event['end']['mday'], $event['end']['year'])-mktime($event['start']['hour'], $event['start']['min'], 0, $event['start']['month'], $event['start']['mday'], $event['start']['year']) )/60 ); 
    5437  
    5438                                 $participants = $this->planner_participants($event['participants']); 
    5439                                 $intersection = FALSE; 
    5440  
    5441                                 foreach($events as $ev) 
    5442                                 { 
    5443                                     if($ev['id'] == $event['id']) continue; 
    5444                                       if($ev['users_status'] == 'R') continue; 
    5445                                       $event_start = 60*$event['start']['hour']+$event['start']['min']; 
    5446                                       $event_end = 60*$event['end']['hour']+$event['end']['min']; 
    5447                                       $event_i_start = 60*$ev['start']['hour']+$ev['start']['min']; 
    5448                                       $event_i_end = 60*$ev['end']['hour']+$ev['end']['min']; 
    5449                                     if((($event_start >= $event_i_start) && ($event_start < $event_i_end))||(($event_start < $event_i_start) && ($event_i_start < $event_end))) 
    5450                                     { 
    5451                                         $intersection = TRUE; 
    5452                                         break; 
    5453                                     } 
    5454                                 } 
    5455                                 if($event['users_status'] == 'R') 
    5456                                 { 
    5457                                     $rejected = TRUE; 
    5458                                 } 
    5459                                 else 
    5460                                 { 
    5461                                     $rejected = FALSE; 
    5462                                 } 
    5463  
    5464                                 $evDescription = ''; 
    5465                                 if($title_view == 0) 
    5466                                 { 
    5467                                     $evDescription = " - ".$event['description']; 
    5468                                 } 
    5469  
    5470                                 if($_GET['menuaction'] ==  'calendar.uicalendar.day') 
    5471                                 { 
    5472                                     $text = $event['description']; 
    5473                                 } 
    5474                                 elseif($_GET['menuaction'] ==  'calendar.uicalendar.week') 
    5475                                 { 
    5476                                      
    5477                                     $text = ' - '.$event['end']['hour'].':'.$event['end']['min']; 
    5478  
    5479                                     //is recurrent? 
    5480                                     $text .= (isset($recur) && $recur != false) ? ' ' . '<img width="10px" height="10px" border="0" title="'.lang('recurring event').'" src="calendar/templates/'.$templateSet.'/images/recur.png"/>' : '' ; 
    5481  
    5482                                     //participants? 
    5483                                     if(count($event['participants']) > 1) 
    5484                                     { 
    5485                                         $text .= " " . '<img width="11px" height="10px" border="0" title="'.$participants.'" src="calendar/templates/'.$templateSet.'/images/multi_3.png"/>'; 
    5486                                     } 
    5487                                     else 
    5488                                     { 
    5489                                         $text .= " " . '<img width="11px" height="10px" border="0" title="'.$participants.'" src="calendar/templates/'.$templateSet.'/images/single.png"/>'; 
    5490                                     } 
    5491  
    5492                                     //has attachments? 
    5493                                     $text .= (isset($event['attachment']) && $event['attachment'] != '') ? ' ' . '<img width="10px" height="10px" border="0" title="'.lang('email notifications with attachments has been sent').'" src="calendar/templates/'.$templateSet.'/images/clip.png"/>' : '' ; 
    5494  
    5495                                     //is public? 
    5496                                     $text .= $isPublic == 0 ? ' ' . '<img width="11px" height="10px" border="0" title="'.$isPublicTitle.'" src="calendar/templates/'.$templateSet.'/images/private.png"/>' : '' ; 
    5497  
    5498                                     //has alarm? 
    5499                                     $text .= (isset($event['alarm']) && count($event['alarm']) >= 1) ? ' ' . '<img width="11px" height="10px" border="0" title="'.lang('alarm').'" src="calendar/templates/'.$templateSet.'/images/alarm.png"/>' : '' ; 
    5500  
    5501                                     $text .= ' - ' . $event['title'].$evDescription; 
    5502                                 } 
    5503                                 else 
    5504                                 { 
    5505                                     $text = ' - '.$event['end']['hour'].':'.$event['end']['min'] . ' - '. $event['title'].$evDescription; 
    5506                                 } 
    5507  
    5508                                 $events_to_show_json[] = array( 
    5509                                     start_date              => $event['start']['year'].'-'.$event['start']['month'].'-'.$event['start']['mday'].' '.$event['start']['hour'].':'.$event['start']['min'], 
    5510                                     end_date                => $event['end']['year'].'-'.$event['end']['month'].'-'.$event['end']['mday'].' '.$event['end']['hour'].':'.$event['end']['min'] . ' - ' . utf8_encode($event['title']), 
    5511                                     text                    => utf8_encode($text), 
    5512                                     textTitle               => utf8_encode($event['description']), //week and month tooltip 
    5513                                     descOnTitle             => ($eventTime <= 57) ? 1 : 0, 
    5514                                     title                   => utf8_encode($event['title']), 
    5515                                     observation             => utf8_encode($event['observations']), 
    5516                                     location                => utf8_encode($event['location']), 
    5517                                     id                      => $event['id'], 
    5518                                     participants            => (count($event['participants']) > 1) ? 1 : 0, 
    5519                                     participants_title      => $participants, 
    5520                                     attachments             => $event['attachment'] ? 1 : 0 , 
    5521                                     attachmentsTitle        => utf8_encode(lang('email notifications with attachments has been sent')), 
    5522                                     isPublic                => $isPublic, 
    5523                                     isPublicTitle           => utf8_encode($isPublicTitle), 
    5524                                     alarm                   => (isset($event['alarm']) && count($event['alarm']) >= 1) ? 1 : 0, 
    5525                                     alarmTitle              => utf8_encode(lang('alarm')), 
    5526                                     recur                   => $recur, 
    5527                                     recurTitle              => utf8_encode(lang('recurring event')), 
    5528                                     intersection            => $intersection, 
    5529                                     rejected                => $rejected, 
    5530                                     title_view              => $title_view 
    5531                                 ); 
    5532  
    5533                                 if($event['start']['hour'] < $hora_inicial) 
    5534                                 { 
    5535                                     $hora_inicial = $event['start']['hour']; 
    5536                                 } 
    5537  
    5538                                 if($event['end']['hour'] >= $hora_final) 
    5539                                 { 
    5540                                     $hora_final = $event['end']['hour'] + 1; 
    5541                                 } 
    5542                             } 
    5543                         } 
    5544  
    5545                         $result = Array( 
    5546                             'hora_inicial'          => $hora_inicial, 
    5547                             'hora_final'            => $hora_final, 
    5548                             'hour_size_px'          => $hour_size_px, 
    5549                             'date_events_json'      => $date_events_json, 
    5550                             'events_to_show_json'   => $events_to_show_json 
    5551                         ); 
    5552  
    5553                         return $result; 
    5554                 }       // end function 
    5555  
    5556  
    55574835 
    55584836                function timematrix($param) 
     
    56934971                        { 
    56944972                                $var = Array( 
    5695                                         'action_url_button'     => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param.'&user_id='.$this->bo->owner), 
     4973                                        'action_url_button'     => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param.'&user='.$this->bo->owner), 
    56964974                                        'action_text_button'    => '  '.$text.'  ', 
    56974975                                        'action_confirm_button' => '', 
     
    57255003                function edit_form($param) 
    57265004                { 
     5005                        $sHValue = '<option></option> 
     5006                                    <option value="07:00">07:00</option> 
     5007                                    <option value="07:30">07:30</option> 
     5008                                    <option value="08:00">08:00</option> 
     5009                                    <option value="08:30">08:30</option> 
     5010                                    <option value="09:00">09:00</option> 
     5011                                    <option value="09:30">09:30</option> 
     5012                                    <option value="10:00">10:00</option> 
     5013                                    <option value="10:30">10:30</option> 
     5014                                    <option value="11:00">11:00</option> 
     5015                                    <option value="11:30">11:30</option> 
     5016                                    <option value="12:00">12:00</option> 
     5017                                    <option value="12:30">12:30</option> 
     5018                                    <option value="13:00">13:00</option> 
     5019                                    <option value="13:30">13:30</option> 
     5020                                    <option value="14:00">14:00</option> 
     5021                                    <option value="14:30">14:30</option> 
     5022                                    <option value="15:00">15:00</option> 
     5023                                    <option value="15:30">15:30</option> 
     5024                                    <option value="16:00">16:00</option> 
     5025                                    <option value="16:30">16:30</option> 
     5026                                    <option value="17:00">17:00</option> 
     5027                                    <option value="17:30">17:30</option> 
     5028                                    <option value="18:00">18:00</option> 
     5029                                    <option value="18:30">18:30</option> 
     5030                                    <option value="19:00">19:00</option> 
     5031                                    <option value="19:30">19:30</option> 
     5032                                    <option value="20:00">20:00</option> 
     5033                                    <option value="20:30">20:30</option> 
     5034                                    <option value="21:00">21:00</option> 
     5035                                    <option value="21:30">21:30</option> 
     5036                                    <option value="22:00">22:00</option>'; 
     5037                     
    57275038                        if(!is_array($param)) 
    57285039                        { 
     
    57355046                        } 
    57365047                         
     5048                        include_once($_SESSION['rootPath'].'/calendar/inc/class.ex_participants.inc.php'); 
     5049                        $langp = array(); 
     5050                        $langp['ACCEPTED'] = lang('Accepted'); 
     5051                        $langp['DECLINED'] = lang('Declined'); 
     5052                        $langp['TENTATIVE'] = lang('Tentative'); 
     5053                        $langp['DELEGATED'] = lang('Delegated'); 
     5054                        $langp['NO ANSWER'] = lang('No answer'); 
     5055                        $exParticipants = new exParticipants($langp); 
     5056                        $exParticipants->setParticipantsBySerializable($event['ex_participants']); 
     5057                        $event['ex_participants'] = $exParticipants->getParticipantsMailsString(); 
    57375058                        $hourformat = substr($this->bo->users_timeformat,0,1); 
    5738                          
    57395059                        // $sb = CreateObject('phpgwapi.sbox'); 
    57405060                        $sb = CreateObject('phpgwapi.sbox2'); 
     
    57645084                        $p->set_block('edit','list','list'); 
    57655085                        $p->set_block('edit','hr','hr'); 
    5766                          
     5086                        $p->set_var('lang_set_participants', lang('set the participants')); 
    57675087                        $vars = Array( 
    57685088                                'font'                  => $this->theme['font'], 
     
    57715091                                'accounts_link'         => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.accounts_popup'), 
    57725092                                'common_hidden' => '<input type="hidden" name="cal[id]" value="'.$event['id'].'">'."\n" 
     5093                                        . '<input type="hidden" name="cal[date]" value="'.$param['date'].'">'."\n" 
    57735094                                        . '<input type="hidden" name="cal[owner]" value="'.$event['owner'].'">'."\n" 
    57745095                                        . '<input type="hidden" name="cal[uid]" value="'.$event['uid'].'">'."\n" 
     
    57865107                                'tr_color' => $this->theme['th_bg'], 
    57875108                                'field' => lang('Title'), 
    5788                                 'data'  => '<input name="cal[title]" size="103" maxlength="300" value="'.$event['title'].'">' 
     5109                                'data'  => '<input name="cal[title]" size="45" maxlength="80" value="'.$event['title'].'">' 
    57895110                        ); 
    57905111 
     
    57925113                        $var['description'] = Array( 
    57935114                                'field' => lang('Full Description'), 
    5794                                 'data'  => '<textarea name="cal[description]" rows="5" cols="88" wrap="virtual" maxlength="2048">'.$event['description'].'</textarea>' 
     5115                                'data'  => '<textarea name="cal[description]" rows="5" cols="40" wrap="virtual" maxlength="2048">'.$event['description'].'</textarea>' 
    57955116                        ); 
    57965117 
     
    58475168                        $var['starttime'] = Array( 
    58485169                                'field' => lang('Start Time'), 
    5849                                 'data'  => '<input name="start[hour]" id="start_hour" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($start,$hourformat).'" maxlength="2">:<input name="start[min]" id="start_minute" size="2" value="'.$GLOBALS['phpgw']->common->show_date($start,'i').'" maxlength="2">'."\n".$str 
     5170                                'data'  => '<input name="start[hour]" id="start_hour" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($start,$hourformat).'" maxlength="2">:<input name="start[min]" id="start_minute" size="2" value="'.$GLOBALS['phpgw']->common->show_date($start,'i').'" maxlength="2">&nbsp;<select name="sStartHour" onchange="javascript:sChangeHour(this);">'.$sHValue.'</select>'."\n".$str      
    58505171                        ); 
    58515172 
     
    58725193                        $var['endtime'] = Array( 
    58735194                                'field' => lang('End Time'), 
    5874                                 'data'  => '<input name="end[hour]" id="end_hour" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($end,$hourformat).'" maxlength="2">:<input name="end[min]" id="end_minute" size="2" value="'.$GLOBALS['phpgw']->common->show_date($end,'i').'" maxlength="2">'."\n".$str 
     5195                                'data'  => '<input name="end[hour]" id="end_hour" size="2" VALUE="'.$GLOBALS['phpgw']->common->show_date($end,$hourformat).'" maxlength="2">:<input name="end[min]" id="end_minute" size="2" value="'.$GLOBALS['phpgw']->common->show_date($end,'i').'" maxlength="2">&nbsp;<select name="sEndHour" onchange="javascript:sChangeHour(this);">'.$sHValue.'</select>'."\n".$str 
    58755196                        ); 
    58765197 
     
    58845205                        $var['access'] = Array( 
    58855206                        'field' => lang('Type'), 
    5886                         'data'  => '<select onchange="javascript:changeViewMode(this.value);" id="cal[type]" name="cal[type]" '.'><option value="normal" '.(($event['public'] && $event['type'] == 'E')?'SELECTED':'').' >'.lang('Normal').'</option><option value="private" '.((!$event['public'] && $event['type'] == 'E')?'SELECTED':'').' >'. lang('Restrict').'</option><option value="privateHiddenFields" '.($event['type']=='P'?'SELECTED':'').' >'. lang('Private').'</option><option value="hourAppointment" '.($event['type'] == 'H'?'SELECTED':'').' >'.lang('Hours Appointment').'</option></select>' 
     5207                        'data'  => '<select onchange="javascript:changeViewMode(this.value);" id="cal[type]" name="cal[type]" '.($event['type'] == 'H'?'DISABLED':'').'><option value="normal" '.(($event['public'] && $event['type'] == 'E')?'SELECTED':'').' >'.lang('Normal').'</option><option value="private" '.((!$event['public'] && $event['type'] == 'E')?'SELECTED':'').' >'. lang('Restrict').'</option><option value="privateHiddenFields" '.($event['type']=='P'?'SELECTED':'').' >'. lang('Private').'</option><option value="hourAppointment" '.($event['type'] == 'H'?'SELECTED':'').' >'.lang('Hours Appointment').'</option></select>' 
    58875208                        ); //event['public'] 
    58885209 
     
    58985219                                                        { 
    58995220                                                                $str .= '<option value="' . $id.$event['participants'][$id] . '"'.($event['participants'][$id]?' selected':'').'>('.$GLOBALS['phpgw']->accounts->get_type($id) 
    5900                                                                                 .') ' . $GLOBALS['phpgw']->common->grab_owner_name($id) . '</option>' . "\n"; 
     5221                                                                                .') ' . $GLOBALS['phpgw']->common->grab_owner_name($id) . ' ('. $id.')</option>' . "\n"; 
    59015222                                                        } 
    59025223                                                } 
     
    59595280                                                                                </tr> 
    59605281                                                                                </table> 
    5961                                                                                 <script src='calendar/js/edit.js' type='text/javascript'></script> 
    59625282                                                                        " 
    59635283                                                ); 
     
    59925312 
    59935313                                                                if ($GLOBALS['phpgw_info']['server']['cal_type_tree_participants'] == '3'){ 
     5314                                                                        $context = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$context); 
     5315                                                                        $context = utf8_decode($context); 
    59945316                                                                        $combo_org = '<option value='.$context.'>'.strtoupper($context).'</option>'; 
    59955317                                                                }else{ 
    59965318                                                                        $combo_org = $this->get_organizations(trim(strtolower($context)),$user_context, $recursive); 
     5319                                                                        $combo_org = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''",$combo_org); 
     5320                                                                        $combo_org = utf8_decode($combo_org); 
    59975321                                                                } 
    59985322 
     
    60075331                                                                } 
    60085332 
    6009                                                                 $edit_js_path = 'calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set']; 
    6010                                                                 if (!file_exists($GLOBALS['phpgw_info']['server']['webserver_url'].$edit_js_path.'/js/edit.js')) 
    6011                                                                         $edit_js_path = 'calendar'; 
    6012  
    60135333                                                                $var['participants'] = array 
    60145334                                                                ( 
    60155335                                                                        'field' => ' 
    6016                                                                         <script src="'.$edit_js_path.'/js/edit.js" type="text/javascript"></script><div id=\'disponibility\' style=\'display:none;position:absolute\' bgcolor=\'#FFFFFF\'> 
     5336                                                                        <script src="calendar/templates/'.$_SESSION['phpgw_info']['calendar']['user']['preferences']['common']['template_set'].'/js/edit.js" type="text/javascript"></script><div id=\'disponibility\' style=\'display:none;position:absolute\' bgcolor=\'#FFFFFF\'> 
    60175337        <iframe src=\'#\' id=\'frame_disponibility\' width=\'500\' marginHeight=\'0\' marginWidth=\'0\' height=\'200px\'></iframe> 
    6018 </div> 
     5338                                                                        </div> 
    60195339                                                                        '.lang('Participants'), 
    6020                                                                         'data'  => ' 
    6021                                                                                         <input type="hidden" id="txt_loading" value="'.lang("Loading").'">' . 
     5340                                                                        'data'  =>  
     5341                                                                                '<input type="hidden" id="txt_loading" value="'.lang("Loading").'">' .  
    60225342                                                                                        '<input type="hidden" id="txt_searching" value="'.lang("Searching").'">' . 
    60235343                                                                                        '<input type="hidden" id="txt_users" value="'.lang("Users").'">' .                                                       
    60245344                                                                                        '<input type="hidden" id="txt_groups" value="'.lang("Groups").'">' . 
     5345                                                                                        '<input type="hidden" id="txt_shared_accounts" value="'.lang("shared accounts").'">' . 
     5346                                                                                        '<input type="hidden" id="txt_min_search" value="'.lang("Your search argument must be longer than 4 characters.").'">' . 
     5347                                                                                        '<input type="hidden" id="txt_none_result" value="'.lang("None result was found.").'">' . 
     5348                                                                                        '<input type="hidden" id="txt_Select_a_name" value="'.lang("Select a name").'">' . 
     5349                                                                                        '<input type="hidden" id="txt_Close" value="'.lang("Close").'">' . 
     5350                                                                                        '<input type="hidden" id="txt_More_than_%1_results._Please,_try_to_refine_your_search" value="'.lang("More than %1 results. Please, try to refine your search",'%1').'">' . 
     5351                                                                                        '<input type="hidden" id="txt_The_results_were_found_in_the_Global_Catalog" value="'.lang("The results were found in the Global Catalog").'">' .  
    60255352                                                                                        '<table width="100%" border="0">'. 
    60265353                                                                                        '<tr>'. 
    6027                                                                                         '<td width="25%"><br><br>'. 
     5354                                                                                        '<td width="25%"><br>'.  
     5355                                                                                        '<button type="button" onClick="javascript:add_user();"><img src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/add.png" style="vertical-align: middle;" >&nbsp;'.lang("Add").'</button>'. 
     5356                                                                                        '&nbsp;&nbsp;<button type="button" onClick="javascript:remove_user();"><img src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/rem.png" style="vertical-align: middle;" >&nbsp;'.lang("Remove").'</button>'. 
    60285357                                                                                        '<br><br>&nbsp;&nbsp;<b>'.lang("Event's participants").'</b><br>'. 
    60295358                                                                                        '       <select id="user_list" name="participants[]" style="width: 300px" multiple size="13">'.$str.'</select>'. 
     
    60335362                                                                                        '<td valign="bottom">'. 
    60345363                                                                                        '       '.lang("Organization").': '. 
    6035                                                                                         '       <select name="org_context" id="combo_org" onchange="javascript:get_available_users(\''.$module_name.'\',this.value,\''.($recursive ? "" : "search").'\',\''.$GLOBALS['phpgw_info']['server']['auto_search'].'\');">'.$combo_org.'</select>'. 
     5364                                                                                        '       <select name="org_context" id="combo_org">'.$combo_org.'</select>'. 
    60365365                                                                                        '       <br>'. 
    60375366                                                                                        '       <font color="red"><span id="cal_span_searching">&nbsp;</span></font>'.                                                                   
    60385367                                                                                        '       <br>'.lang("Search for").':'. 
    6039                                                                                         '       <input value="" id="cal_input_searchUser" size="35" autocomplete="off" onkeyup="javascript:optionFinderTimeout(this,'.$GLOBALS['phpgw_info']['server']['min_num_characters'].',\''.($recursive ? "" : "search").'\',\''.$GLOBALS['phpgw_info']['server']['auto_search'].'\')"><br>'. 
     5368                                                                                        '       <input value="" id="cal_input_searchUser" size="35" autocomplete="off" onkeypress="return optionFinderTimeout(this,'.$GLOBALS['phpgw_info']['server']['min_num_characters'].',\''.($recursive ? "" : "search").'\',\''.$GLOBALS['phpgw_info']['server']['auto_search'].'\', event);"><br>'. 
    60405369                                                                                        '       <b>'.lang("Available users and groups").'</b><br>'. 
    60415370                                                                                        '       <select id="user_list_in" style="width: 300px" multiple size="13"></select>'. 
    60425371                                                                                        '</td>'. 
    60435372                                                                                        '</tr>'. 
    6044                                             '<tr>'. 
    6045                                             '<td width="25%">'. 
    6046                                             '<button type="button" id="time_map" onClick="javascript:show_disponibility();">'.lang("Disponibility map").'</button>'. 
    6047                                             '</td>'. 
    6048                                             '<td width="30px" valign="middle" align="center">&nbsp;'. 
    6049                                                                                         '</td>'. 
    6050                                             '<td valign="bottom">'. 
    6051                                             '<button type="button" onClick="javascript:add_user();"><img src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/add.png" style="vertical-align: middle;" >&nbsp;'.lang("Add").'</button>'. 
    6052                                                                                         '&nbsp;&nbsp;<button type="button" onClick="javascript:remove_user();"><img src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/rem.png" style="vertical-align: middle;" >&nbsp;'.lang("Remove").'</button>'. 
    6053                                             '</td>'. 
    6054                                                                                         '</tr>'. 
     5373                                                                                        '<tr>' . 
     5374                                                                                        '<td>' . 
     5375                                                                                        '<button onclick="javascript:show_disponibility();" id="time_map" type="button">Mapa de disponibilidade</button><br>' . 
     5376                                                                                        '<b>'.lang("Can have users and groups that doesn't appears on the map").'</b><br>' . 
     5377                                                                                        '<td>' . 
     5378                                                                                        '</tr>' . 
    60555379                                                                                        '</table>'.  
    60565380                                                                                        '<script type="text/javascript" src="phpgwapi/js/wz_dragdrop/wz_dragdrop.js"></script>'. 
    60575381                                                                                        '<script type="text/javascript" src="phpgwapi/js/dJSWin/dJSWin.js"></script>'.           
    6058                                                                                         "<script src='calendar/js/edit_exmail.js' type='text/javascript'></script>" . 
     5382                                                                                        "<script src='calendar/templates/".$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']."/js/finder.js' type='text/javascript'></script>" . 
     5383                                                                                        "<script src='calendar/templates/".$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set']."/js/edit_exmail.js' type='text/javascript'></script>" . 
    60595384                                                                                        $load_lang_vars.                                                                                                                                                         
    60605385                                                                                        "<script src='".$module_name."/js/connector.js' type='text/javascript'></script>". 
     
    60675392                                                }                                                
    60685393                                                 
    6069                                                 $var['participants']['data'] .= '<br /><a id="a_ext_participants" title="'.lang("It types below the email addresses, if you want to invite other people out" . 
     5394                                                $var['participants']['data'] .= '<a id="a_ext_participants" title="'.lang("It types below the email addresses, if you want to invite other people out" . 
    60705395                                                        " of this system").'" name="a_ext_participants" onClick="javascript:showExParticipants(this,\''.$module_name.'\')" href="#a_ext_participants"><b>'.lang("Inform").' '.lang("external participants").'</b>&nbsp;<img align="top" ' . 
    60715396                                                        'src="calendar/templates/'.$GLOBALS['phpgw_info']['user']['preferences']['common']['template_set'].'/images/sent.gif"></a><table id="tbl_ext_participants" width="100%" border="0" style="display:none">'. 
     
    60795404                                                        '<td>'.  
    60805405                                                        '&nbsp;&nbsp;>> '.lang("It types below the email addresses, if you want to invite other people out of this system").':'. 
    6081                                                         '&nbsp;&nbsp;<br><textarea name="ex_participants" id="ex_participants" cols="70" rows="2">'.$event['ex_participants'].'</textarea><br>&nbsp;&nbsp;'. 
    6082                                                         //$footer_ext_participantes. 
     5406                                                        '&nbsp;&nbsp;<br> <input type="hidden" name="h_exParticipants" id="h_exParticipants" value="'.$exParticipants->getParticipantsSerializable().'" /> 
     5407                                                        <textarea name="ex_participants" id="ex_participants" cols="70" rows="2">'.$event['ex_participants'].'</textarea><br>&nbsp;&nbsp;'. 
     5408                                                        $footer_ext_participantes. 
    60835409                                                        '</tr>'.                                                         
    60845410                                                        '</table>'; 
     
    61005426                        } 
    61015427 
    6102                         // Reminder 
     5428// Reminder 
    61035429                        // The user must use "Alarm Management" to change/modify an alarm 
    61045430                        // so only display the email reminder fields if this is a new event 
     
    61825508                                'data'  => '<select name="cal[recur_type]">'."\n".$str.'</select>'."\n" 
    61835509                        ); 
    6184  
    6185  
    6186                         $preferences = CreateObject('phpgwapi.preferences',(int)$this->owner); 
    6187                        $selected_creator = $selected_owner = ''; 
    6188                        if($event['notifications_owner'] == 1) 
    6189                            $selected_owner = ' selected'; 
    6190                        else 
    6191                            $selected_creator = ' selected'; 
    6192                        
    6193                        $option = '<option value="0" '.$selected_creator.' >'.$GLOBALS['phpgw']->common->grab_owner_name((int)$_SESSION['phpgw_session']['account_id']).'</option>'; 
    6194                        if($_SESSION['phpgw_session']['account_id'] != $event['owner']){ 
    6195                            $option .= '<option value="1" '.$selected_owner.' >'.$GLOBALS['phpgw']->common->grab_owner_name((int)$event['owner']).'</option>'; 
    6196                        } 
    6197  
    6198  
    6199                        $var['notifications_owner'] = Array( 
    6200                                 'field' => lang('Send notificatios as'), 
    6201                                 'data'  => '<select name="cal[notifications_owner]" >'.$option.'</select>' 
    6202                         ); 
    6203  
    62045510 
    62055511                        if($event['recur_enddate']['year'] != 0 && $event['recur_enddate']['month'] != 0 && $event['recur_enddate']['mday'] != 0) 
     
    62435549                        ); 
    62445550//                      $this->output_template_array($p,'row','list',Array('data' => '<script src="simple_show_hide.js" type="text/javascript"></script>')); 
    6245  
    6246 // Observations 
    6247                         $var['observations'] = Array( 
    6248                                 'field' => lang('Observations'), 
    6249                                 'data'  => '<textarea name="cal[observations]" rows="5" cols="88" wrap="virtual" maxlength="2048">'.$event['observations'].'</textarea>' 
    6250                         ); 
    6251  
    6252                         if ($event['attachment'] == '' || $event['attachment'] == 'ERROR' || is_array($event['attachment'])) 
    6253                             $data =  '<a onClick="javascript:addAttach()" href="#divFiles" >Anexos: adicionar+</a><div id="divFiles"></div>'; 
    6254                         else 
    6255                             $data = '<input type="hidden" name="cal[attachment]" value='.$event["attachment"].'>'.lang('Notification with attachments sent.').'<br><a onClick="javascript:addAttach()" href="#divFiles" >Anexos: adicionar+</a><div id="divFiles"</div>'; 
    6256  
    6257                         $var['attachment'] = Array( 
    6258                                 'field' => lang('Attachment'), 
    6259                                 //'data' => '<input  type="file" name="cal[attachment]" />' 
    6260                                 'data' => $data 
    6261                         ); 
    62625551 
    62635552                        if (!isset($this->fields)) 
Note: See TracChangeset for help on using the changeset viewer.