Ignore:
Timestamp:
04/15/11 16:53:03 (13 years ago)
Author:
brunocosta
Message:

Ticket #1745 - Nova visão semanal e mensal da agenda.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2.2.0.1/calendar/inc/class.uicalendar.inc.php

    r4030 r4049  
    495495                function month() 
    496496                { 
    497                         echo $this->printer_friendly($this->get_month(),lang('Monthview')); 
     497                        if($_GET['month']||$_POST['month']){ 
     498                            $params['month'] = $_GET['month']?(int)$_GET['month']:(int)$_POST['month']; 
     499                            $params['year'] = $_GET['year']?(int)$_GET['year']:(int)$_POST['year']; 
     500                            $params['day'] = 1; 
     501 
     502                        }else{ 
     503                            $params['day'] = $_post['date']?(int)substr($_POST['date'] , 6, 2):(int)substr($_GET['date'] , 6, 2); 
     504                            $params['month'] = $_post['date']?(int)substr($_POST['date'] , 4, 2):(int)substr($_GET['date'] , 4, 2); 
     505                            $params['year'] = $_post['date']?(int)substr($_POST['date'] , 0, 4):(int)substr($_GET['date'] , 0, 4); 
     506 
     507                        } 
     508 
     509                        echo $this->printer_friendly($this->print_month_new($params),lang('Weekview')); 
    498510                        $GLOBALS['phpgw']->common->phpgw_footer(); 
    499511                } 
     
    689701                function week() 
    690702                { 
    691                         echo $this->printer_friendly($this->get_week(),lang('Weekview')); 
     703 
     704                        if($_GET['month']||$_POST['month']){ 
     705                            $params['month'] = $_GET['month']?(int)$_GET['month']:(int)$_POST['month']; 
     706                            $params['year'] = $_GET['year']?(int)$_GET['year']:(int)$_POST['year']; 
     707                            $params['day'] = 1; 
     708 
     709                        }else{ 
     710                            $params['day'] = $_post['date']?(int)substr($_POST['date'] , 6, 2):(int)substr($_GET['date'] , 6, 2); 
     711                            $params['month'] = $_post['date']?(int)substr($_POST['date'] , 4, 2):(int)substr($_GET['date'] , 4, 2); 
     712                            $params['year'] = $_post['date']?(int)substr($_POST['date'] , 0, 4):(int)substr($_GET['date'] , 0, 4); 
     713 
     714                        } 
     715 
     716                        echo $this->printer_friendly($this->print_week_new($params),lang('Weekview')); 
    692717                        $GLOBALS['phpgw']->common->phpgw_footer(); 
    693718                } 
     
    33953420                        ); 
    33963421                        $this->output_template_array($p,'b_row2','form_button',$var); 
    3397                         if ( $menuaction == 'calendar.uicalendar.week' || ($menuaction == 'calendar.uicalendar.month' && $account_prefs['calendar']['type_month_print'] == '1')) 
    3398                           { 
    3399                             $aux = explode('.',$menuaction); 
    3400                             $typeview = $aux[2]; 
    3401                             if($typeview == 'week') 
    3402                                 $params['period'] = 2; 
    3403                             else 
    3404                                 $params['period'] = 3; 
    3405                                          
    3406                             if(isset($_GET['date'])) 
    3407                                 $date = $_GET['date']; 
    3408                             else 
    3409                                 $date = $_POST['date']; 
    3410                             if($date) 
    3411                             { 
    3412                                 $params['year'] = substr($date, 0,4); 
    3413                                 $params['month'] = substr($date, 4,2); 
    3414                                 $params['day'] = substr($date, 6,2); 
    3415                             } 
    3416                             else 
    3417                             { 
    3418                                 $params['year'] = $_GET['year']?$_GET['year']:$_POST['year']; 
    3419                                 $params['month'] = $_GET['month']?$_GET['month']:$_POST['month']; 
    3420                                 if(!$params['month']) 
    3421                                 { 
    3422                                     $params['month'] = $this->bo->month; 
    3423                                 } 
    3424                                 $params['day'] = $this->bo->day; 
    3425                             } 
    3426  
    3427                             $result_events_json = $this->print_events_to_show_json($params); 
    3428                             $var = Array( 
    3429                                     'typeview'                  => $typeview, 
    3430                                     'typeview_aux'              => $typeview, 
    3431                                     'date'                      => $result_events_json['date_events_json'], 
    3432                                     'hora_final'                => $result_events_json['hora_final'], 
    3433                                     'hora_inicial'              => $result_events_json['hora_inicial'], 
    3434                                     'events_json'               => json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null' 
    3435                                     ); 
    3436                             $this->output_template_array($p,'place_component','new_component',$var); 
    3437                           } 
    3438                        else 
    3439                           { 
     3422//                        if ( $menuaction == 'calendar.uicalendar.week' || ($menuaction == 'calendar.uicalendar.month' && $account_prefs['calendar']['type_month_print'] == '1')) 
     3423//                          { 
     3424//                            $aux = explode('.',$menuaction); 
     3425//                            $typeview = $aux[2]; 
     3426//                            if($typeview == 'week') 
     3427//                                $params['period'] = 2; 
     3428//                            else 
     3429//                                $params['period'] = 3; 
     3430// 
     3431//                            if(isset($_GET['date'])) 
     3432//                                $date = $_GET['date']; 
     3433//                            else 
     3434//                                $date = $_POST['date']; 
     3435//                            if($date) 
     3436//                            { 
     3437//                                $params['year'] = substr($date, 0,4); 
     3438//                                $params['month'] = substr($date, 4,2); 
     3439//                                $params['day'] = substr($date, 6,2); 
     3440//                            } 
     3441//                            else 
     3442//                            { 
     3443//                                $params['year'] = $_GET['year']?$_GET['year']:$_POST['year']; 
     3444//                                $params['month'] = $_GET['month']?$_GET['month']:$_POST['month']; 
     3445//                                if(!$params['month']) 
     3446//                                { 
     3447//                                    $params['month'] = $this->bo->month; 
     3448//                                } 
     3449//                                $params['day'] = $this->bo->day; 
     3450//                            } 
     3451// 
     3452//                            $result_events_json = $this->print_events_to_show_json($params); 
     3453//                            $var = Array( 
     3454//                                    'typeview'                  => $typeview, 
     3455//                                    'typeview_aux'              => $typeview, 
     3456//                                    'date'                    => $result_events_json['date_events_json'], 
     3457//                                    'hora_final'              => $result_events_json['hora_final'], 
     3458//                                    'hora_inicial'            => $result_events_json['hora_inicial'], 
     3459//                                    'events_json'             => json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null' 
     3460//                                    ); 
     3461//                            $this->output_template_array($p,'place_component','new_component',$var); 
     3462//                          } 
     3463//                       else 
     3464//                          { 
    34403465                            $p->set_var('place_component',''); 
    3441                           } 
     3466//                          } 
    34423467                        $p->parse('table_row','blank_row',True); 
    34433468                        $p->pparse('out','footer_table'); 
     
    50745099                } 
    50755100 
     5101                      function print_week_new($params){ 
     5102 
     5103                        $p = CreateObject('phpgwapi.Template',$this->template_dir); 
     5104                        $p->set_unknowns('keep'); 
     5105 
     5106                        $tpl = 'new_week.tpl'; 
     5107 
     5108                        if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 && 
     5109                                $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') 
     5110                        { 
     5111                                $tpl = 'day_list.tpl'; 
     5112                        } 
     5113 
     5114                           $minical_prev = $this->mini_calendar( 
     5115                                        Array( 
     5116                                                'day'   => 1, 
     5117                                                'month' => $this->bo->month -1, 
     5118                                                'year'  => $this->bo->year, 
     5119                                                'link'  => 'week', 
     5120                                                'outside_month' => False 
     5121                                        ) 
     5122                                ); 
     5123 
     5124                        $minical_next1 = $this->mini_calendar( 
     5125                                        Array( 
     5126                                                'day'   => 1, 
     5127                                                'month' => $this->bo->month + 1, 
     5128                                                'year'  => $this->bo->year, 
     5129                                                'link'  => 'week', 
     5130                                                'outside_month' => False 
     5131                                        ) 
     5132                                ); 
     5133 
     5134                        $minical_next = $this->mini_calendar( 
     5135                                        Array( 
     5136                                                'day'   => 1, 
     5137                                                'month' => $this->bo->month, 
     5138                                                'year'  => $this->bo->year, 
     5139                                                'link'  => 'week', 
     5140                                                'outside_month' => False 
     5141                                        ) 
     5142                                ); 
     5143                        $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); 
     5144 
     5145                        $templates = Array( 
     5146                                'new_week'   => $tpl, 
     5147                        ); 
     5148 
     5149                        $p->set_file($templates); 
     5150                        $p->set_block('new_week','day','day'); 
     5151                        $params['period'] = 2; 
     5152                        $result_events_json = $this->print_events_to_show_json($params); 
     5153                        $p->set_var('date',$result_events_json['date_events_json']); 
     5154                        $p->set_var('hora_final',$result_events_json['hora_final']); 
     5155                        $p->set_var('hora_inicial',$result_events_json['hora_inicial']); 
     5156                          $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1); 
     5157                        $p->set_var('title',lang(strftime("%B",$m)).' '.$this->bo->year); 
     5158                        $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)); 
     5159                        $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'); 
     5160                        return $p->fp('out','day'); 
     5161                } 
     5162 
     5163                function print_month_new($params){ 
     5164 
     5165                        $p = CreateObject('phpgwapi.Template',$this->template_dir); 
     5166                        $p->set_unknowns('keep'); 
     5167 
     5168                        $tpl = 'new_month.tpl'; 
     5169 
     5170                        if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 && 
     5171                                $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home') 
     5172                        { 
     5173                                $tpl = 'day_list.tpl'; 
     5174                        } 
     5175 
     5176 
     5177 
     5178                        $templates = Array( 
     5179                                'new_month'   => $tpl, 
     5180                        ); 
     5181 
     5182                        $minical_prev = $this->mini_calendar( 
     5183                                        Array( 
     5184                                                'day'   => 1, 
     5185                                                'month' => $this->bo->month -1, 
     5186                                                'year'  => $this->bo->year, 
     5187                                                'link'  => 'week', 
     5188                                                'outside_month' => False 
     5189                                        ) 
     5190                                ); 
     5191 
     5192                        $minical_next1 = $this->mini_calendar( 
     5193                                        Array( 
     5194                                                'day'   => 1, 
     5195                                                'month' => $this->bo->month + 2, 
     5196                                                'year'  => $this->bo->year, 
     5197                                                'link'  => 'week', 
     5198                                                'outside_month' => False 
     5199                                        ) 
     5200                                ); 
     5201 
     5202                        $minical_next = $this->mini_calendar( 
     5203                                        Array( 
     5204                                                'day'   => 1, 
     5205                                                'month' => $this->bo->month + 1, 
     5206                                                'year'  => $this->bo->year, 
     5207                                                'link'  => 'week', 
     5208                                                'outside_month' => False 
     5209                                        ) 
     5210                                ); 
     5211                        $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year); 
     5212                        $p->set_file($templates); 
     5213                        $p->set_block('new_month','day','day'); 
     5214                        $params['period'] = 3; 
     5215                        $result_events_json = $this->print_events_to_show_json($params); 
     5216                        $p->set_var('date',$result_events_json['date_events_json']); 
     5217                        $p->set_var('hora_final',$result_events_json['hora_final']); 
     5218                        $p->set_var('hora_inicial',$result_events_json['hora_inicial']); 
     5219                        $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1); 
     5220                        $p->set_var('title',lang(strftime("%B",$m)).' '.$this->bo->year); 
     5221                        $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner)); 
     5222                        $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'); 
     5223                        return $p->fp('out','day'); 
     5224                } 
    50765225 
    50775226                //função vai devolver os eventos do mês atual para exibição no novo componente da Agenda 
     
    51885337                                else 
    51895338                                { 
    5190                                     $text = $event['title']; 
     5339                                    $text = $event['title']." - ".$event['description']; 
    51915340                                } 
    51925341 
     
    54105559                        { 
    54115560                                $var = Array( 
    5412                                         'action_url_button'     => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param), 
     5561                                        'action_url_button'     => $this->page('set_action','&cal_id='.$cal_id.'&action='.$param.'&user_id='.$this->bo->owner), 
    54135562                                        'action_text_button'    => '  '.$text.'  ', 
    54145563                                        'action_confirm_button' => '', 
Note: See TracChangeset for help on using the changeset viewer.