Changeset 360
- Timestamp:
- 07/18/08 17:36:28 (16 years ago)
- Location:
- trunk/calendar
- Files:
-
- 5 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/calendar/inc/class.uicalendar.inc.php
r212 r360 118 118 $this->link_tpl->set_block('link_picture','link_close','link_close'); 119 119 $this->link_tpl->set_block('link_picture','link_text','link_text'); 120 121 /*************** EVENTO **************************/ 122 /* Este bloco de codigo foi adicionado pois os eventos de agendamento (exibicao do mes) para impressao serao tratados em outro template 123 (event_link.tpl) */ 124 125 $this->event_tpl = CreateObject('phpgwapi.Template',$this->template_dir); 126 $this->event_tpl = CreateObject('phpgwapi.Template',$this->template_dir); 127 $this->event_tpl->set_unknowns('remove'); 128 $this->event_tpl->set_file( 129 Array( 130 'link_event' => 'event_link.tpl' 131 ) 132 ); 133 $this->event_tpl->set_block('link_event','link_event_pict','link_event_pict'); 134 $this->event_tpl->set_block('link_event','event_pict','event_pict'); 135 $this->event_tpl->set_block('link_event','link_event_open','link_event_open'); 136 $this->event_tpl->set_block('link_event','link_event_close','link_event_close'); 137 $this->event_tpl->set_block('link_event','link_event_text','link_event_text'); 138 139 140 /*************************************************/ 120 141 121 142 if($this->bo->use_session) … … 435 456 $print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param). 436 457 "','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '". 437 lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 458 lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>'; 459 //linha abaixo foi adicionada para exibir a pagina do mes em tela 460 $large_month = $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner); 438 461 } 439 462 else … … 444 467 $print = ''; 445 468 $GLOBALS['phpgw_info']['flags']['nofooter'] = True; 469 //linha abaixo foi adicionada para exibir a pagina do mes para impressao 470 $large_month = $this->display_month_print($this->bo->month,$this->bo->year,True,$this->bo->owner); 446 471 } 447 472 … … 457 482 'next_month_link' => $next_month_link, 458 483 'small_calendar_next' => $minical_next, 459 'large_month' => $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner), 484 //'large_month' => $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner), 485 'large_month' => $large_month, 460 486 'print' => $print 461 487 ); … … 463 489 $p = CreateObject('phpgwapi.Template',$this->template_dir); 464 490 $p->set_unknowns('remove'); 465 $p->set_file( 466 Array( 467 'index_t' => 'index.tpl' 468 ) 469 ); 491 // Alteracao que desvincula o template para tela do template de impressao do mes (month_print teve que ser criado); 492 if($print != '') 493 { 494 $p->set_file( 495 Array( 496 'index_t' => 'index.tpl' 497 ) 498 ); 499 }else { 500 $p->set_file( 501 Array( 502 'index_t' => 'month_print.tpl' 503 ) 504 ); 505 } 470 506 $p->set_var($var); 471 507 return $p->fp('out','index_t'); … … 2936 2972 return $str; 2937 2973 } 2974 2975 /*****************************************************************************************/ 2976 /*Funcao foi duplicada e alterada para tratar os eventos de agendamento (exibicao do mes) para impressao; 2977 utiliza o template event_lik.tpl*/ 2978 2979 function link_to_month_entry($event,$month,$day,$year) 2980 { 2981 $str = ''; 2982 $is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event); 2983 $viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event); 2984 2985 $starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; 2986 $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; 2987 $rawdate = mktime(0,0,0,$month,$day,$year); 2988 $rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetime->tz_offset; 2989 $nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetime->tz_offset; 2990 if ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') && $starttime == $endtime) 2991 { 2992 $time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); 2993 } 2994 elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60) 2995 { 2996 $time = '[ '.lang('All Day').' ]'; 2997 } 2998 elseif ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') || $starttime != $endtime) 2999 { 3000 if($starttime < $rawdate_offset && $event['recur_type'] == MCAL_RECUR_NONE) 3001 { 3002 $start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat); 3003 } 3004 else 3005 { 3006 $start_time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); 3007 } 3008 3009 if($endtime >= ($rawdate_offset + 86400)) 3010 { 3011 $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat); 3012 } 3013 else 3014 { 3015 $end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat); 3016 } 3017 $time = $start_time.' - '.$end_time; 3018 } 3019 else 3020 { 3021 $time = ''; 3022 } 3023 3024 $texttitle = $texttime = $textdesc = $textlocation = $textstatus = ''; 3025 3026 3027 3028 if(!$is_private) 3029 { 3030 //$text .= $this->bo->display_status($event['users_status']); 3031 3032 // split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation 3033 $textstatus=$this->bo->display_status($event['users_status']); 3034 3035 } 3036 3037 $text = '<nobr> '.$time.' </nobr> '.$this->bo->get_short_field($event,$is_private,'title').$text. 3038 3039 $texttime=$time; 3040 $texttitle=$this->bo->get_short_field($event,$is_private,'title'); 3041 $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); 3042 // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set 3043 $textlocation=$this->bo->get_short_field($event,$is_private,'location'); 3044 3045 if ($viewable) 3046 { 3047 $date = sprintf('%04d%02d%02d',$year,$month,$day); 3048 $this->event_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); 3049 $this->event_tpl->set_var('lang_view',lang('View this entry')); 3050 $this->event_tpl->set_var('desc', $textdesc); 3051 $this->event_tpl->set_var('location', $textlocation); 3052 $this->event_tpl->parse('picture','link_event_open',True); 3053 } 3054 if (!$is_private) 3055 { 3056 if($event['priority'] == 3) 3057 { 3058 $picture[] = Array( 3059 'pict' => $GLOBALS['phpgw']->common->image('calendar','high'), 3060 'width' => 16, 3061 'height'=> 16, 3062 'title' => lang('high priority') 3063 ); 3064 } 3065 if($event['recur_type'] == MCAL_RECUR_NONE) 3066 { 3067 $picture[] = Array( 3068 'pict' => $GLOBALS['phpgw']->common->image('calendar','circle'), 3069 'width' => 9, 3070 'height'=> 9, 3071 'title' => lang('single event') 3072 ); 3073 } 3074 else 3075 { 3076 $picture[] = Array( 3077 'pict' => $GLOBALS['phpgw']->common->image('calendar','recur'), 3078 'width' => 12, 3079 'height'=> 12, 3080 'title' => lang('recurring event') 3081 ); 3082 } 3083 } 3084 $participants = $this->planner_participants($event['participants']); 3085 if(count($event['participants']) > 1) 3086 { 3087 $picture[] = Array( 3088 'pict' => $GLOBALS['phpgw']->common->image('calendar','multi_3'), 3089 'width' => 14, 3090 'height'=> 14, 3091 'title' => $participants 3092 ); 3093 } 3094 else 3095 { 3096 $picture[] = Array( 3097 'pict' => $GLOBALS['phpgw']->common->image('calendar','single'), 3098 'width' => 14, 3099 'height'=> 14, 3100 'title' => $participants 3101 ); 3102 } 3103 if($event['public'] == 0) 3104 { 3105 $picture[] = Array( 3106 'pict' => $GLOBALS['phpgw']->common->image('calendar','private'), 3107 'width' => 13, 3108 'height'=> 13, 3109 'title' => lang('private') 3110 ); 3111 } 3112 if(@isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) 3113 { 3114 // if the alarm is to go off the day before the event 3115 // the icon does not show up because of 'alarm_today' 3116 // - TOM 3117 if($this->bo->alarm_today($event,$rawdate_offset,$starttime)) 3118 { 3119 $picture[] = Array( 3120 'pict' => $GLOBALS['phpgw']->common->image('calendar','alarm'), 3121 'width' => 13, 3122 'height'=> 13, 3123 'title' => lang('alarm') 3124 ); 3125 } 3126 } 3127 3128 $description = $this->bo->get_short_field($event,$is_private,'description'); 3129 for($i=0;$i<count($picture);$i++) 3130 { 3131 $var = Array( 3132 'pic_image' => $picture[$i]['pict'], 3133 'width' => $picture[$i]['width'], 3134 'height' => $picture[$i]['height'], 3135 'title' => $picture[$i]['title'] 3136 ); 3137 $this->output_template_array($this->event_tpl,'picture','event_pict',$var); 3138 } 3139 if ($texttitle) 3140 { 3141 $var = Array( 3142 // 'text' => $text, 3143 'time'=> $texttime, 3144 'title'=> $texttitle, 3145 'users_status'=>$textstatus, 3146 'desc'=> $textdesc, 3147 'location'=> "<br><b>Local:</b> ".$textlocation 3148 ); 3149 $this->output_template_array($this->event_tpl,'picture','link_event_text',$var); 3150 } 3151 3152 if ($viewable) 3153 { 3154 $this->event_tpl->parse('picture','link_event_close',True); 3155 } 3156 $str = $this->event_tpl->fp('out','link_event_pict'); 3157 $this->event_tpl->set_var('picture',''); 3158 $this->event_tpl->set_var('out',''); 3159 // unset($p); 3160 return $str; 3161 } 3162 3163 /*****************************************************************************************/ 2938 3164 2939 3165 function overlap($params) … … 3239 3465 } 3240 3466 3241 function display_month($month,$year,$showyear,$owner=0) 3467 /***************************************************************************************/ 3468 /*As funcoes abaixo 3469 month_week_header() 3470 month_display_week() 3471 display_month_print() 3472 month_day_of_week() - esta foi criada mas parte do codigo e de outra funcao da API (day_of_week()); 3473 3474 foram duplicadas e modificadas para atender aas modificacoes do layout de impressao mensal da agenda de eventos; 3475 TODO: otimizar o codigo 3476 3477 Rommel Cysne 3478 */ 3479 3480 function month_week_header($month,$year,$display_name = False) 3481 { 3482 $this->weekstarttime = $GLOBALS['phpgw']->datetime->get_weekday_start($year,$month,1); 3483 3484 // $p = CreateObject('phpgwapi.Template',$this->template_dir); 3485 $p->set_unknowns('remove'); 3486 // $p->set_file( 3487 // Array ( 3488 // 'month_header' => 'month_header_print.tpl' 3489 // ) 3490 // ); 3491 // $p->set_block('month_header','monthly_header','monthly_header'); 3492 // $p->set_block('month_header','column_title','column_title'); 3493 3494 /* $var = Array( 3495 'bgcolor' => $this->theme['th_bg'], 3496 'font_color' => $this->theme['th_text'] 3497 ); 3498 /*if($this->bo->printer_friendly && @$this->bo->prefs['calendar']['print_black_white']) 3499 { 3500 $var = Array( 3501 'bgcolor' => '', 3502 'font_color' => '' 3503 ); 3504 }*/ 3505 /* $p->set_var($var); 3506 3507 $p->set_var('col_width','14'); 3508 /* if($display_name == True) 3509 { 3510 $p->set_var('col_title',lang('name')); 3511 $p->parse('column_header','column_title',True); 3512 $p->set_var('col_width','12'); 3513 } 3514 */ 3515 //for($i=0;$i<7;$i++) 3516 //{ 3517 // $p->set_var('col_title',lang($GLOBALS['phpgw']->datetime->days[$i])); 3518 // $p->parse('column_header','column_title',True); 3519 //} 3520 // return $p->fp('out','monthly_header'); 3521 } 3522 3523 3524 function month_day_of_week($year,$month,$day) 3525 { 3526 $dia = Array( 3527 0 => 'Domingo', 3528 1 => 'Segunda', 3529 2 => 'Terça', 3530 3 => 'Quarta', 3531 4 => 'Quinta', 3532 5 => 'Sexta', 3533 6 => 'Sábado' 3534 ); 3535 3536 if($month > 2) 3537 { 3538 $month -= 2; 3539 } 3540 else 3541 { 3542 $month += 10; 3543 $year--; 3544 } 3545 $day = (floor((13 * $month - 1) / 5) + $day + ($year % 100) + floor(($year % 100) / 4) + floor(($year / 100) / 4) - 2 * floor($year / 100) + 77); 3546 3547 $month_day = ($day - 7 * floor($day / 7)); //retorna o numero do dia da semana (Ex: domingo eh dia 0, terca eh 2); 3548 $weekday = $dia[$month_day]; //retorna o nome do dia da semana de acordo com seu numero; 3549 3550 return ($weekday); 3551 3552 } 3553 3554 function month_display_week($startdate,$weekly,$cellcolor,$display_name = False,$owner=0,$monthstart=0,$monthend=0) 3555 { 3556 if($owner == 0) 3557 { 3558 $owner = $GLOBALS['phpgw_info']['user']['account_id']; 3559 } 3560 3561 $temp_owner = $this->bo->owner; 3562 3563 $str = ''; 3564 $p = CreateObject('phpgwapi.Template',$this->template_dir); 3565 $p->set_unknowns('keep'); 3566 3567 $p->set_file( 3568 Array( 3569 'month_header' => 'month_header_print.tpl', 3570 'month_day' => 'month_day_print.tpl' 3571 ) 3572 ); 3573 $p->set_block('month_header','monthly_header','monthly_header'); 3574 $p->set_block('month_header','month_column','month_column'); 3575 $p->set_block('month_day','month_daily','month_daily'); 3576 $p->set_block('month_day','day_event','day_event'); 3577 $p->set_block('month_day','event','event'); 3578 3579 $p->set_var('extra',''); 3580 $p->set_var('col_width','14'); 3581 /* if($display_name) 3582 { 3583 $p->set_var('column_data',$GLOBALS['phpgw']->common->grab_owner_name($owner)); 3584 $p->parse('column_header','month_column',True); 3585 $p->set_var('col_width','12'); 3586 }*/ 3587 $today = date('Ymd',$GLOBALS['phpgw']->datetime->users_localtime); 3588 $daily = $this->set_week_array($startdate - $GLOBALS['phpgw']->datetime->tz_offset,$cellcolor,$weekly); 3589 foreach($daily as $date => $day_params) 3590 { 3591 $year = (int)substr($date,0,4); 3592 $month = (int)substr($date,4,2); 3593 $day = (int)substr($date,6,2); 3594 $var = Array( 3595 'column_data' => '', 3596 'extra' => '' 3597 ); 3598 $p->set_var($var); 3599 if ($weekly || ($date >= $monthstart && $date <= $monthend)) 3600 { 3601 //if ($day_params['new_event']) 3602 //{ 3603 // $new_event_link = ' <a href="'.$this->page('add','&date='.$date).'">' 3604 // . '<img src="'.$GLOBALS['phpgw']->common->image('calendar','new3').'" width="10" height="10" title="'.lang('New Entry').'" border="0" align="center">' 3605 // . '</a>'; 3606 // $day_number = '<a href="'.$this->page('day','&date='.$date).'">'.$day.'</a>'; 3607 //} 3608 //else 3609 //{ 3610 $new_event_link = ''; 3611 $day_num = $day; 3612 $dia_semana = $this->month_day_of_week($year,$month,$day_num); 3613 $day_number = $dia_semana . ", " . $day_num; 3614 //} 3615 3616 $var = Array( 3617 'extra' => $day_params['extra'], 3618 'new_event_link'=> $new_event_link, 3619 'day_number' => $day_number 3620 ); 3621 /* if($day_params['week']) 3622 { 3623 3624 //NDEE: style! m_w_table in month_day.tpl 3625 // week-hilite 3626 //$var['new_event_link'] .= '<font size="-2"> '. 3627 // $var['new_event_link'] .= ' '. 3628 // (!$this->bo->printer_friendly?'<a href="'.$this->page('week','&date='.$date).'"><span id="calendar_weekinfo" class="calendar_weekinfo">' .$day_params['week'].'</span></a>' : '<span id="calendar_weekinfo" class="calendar_weekinfo">'.$day_params['week'].'</span>'); 3629 } 3630 */ 3631 3632 3633 $p->set_var($var); 3634 3635 /* if(@$day_params['holidays']) 3636 { 3637 foreach($day_params['holidays'] as $key => $value) 3638 { 3639 $var = Array( 3640 'day_events' => '<font face="'.$this->theme['font'].'" size="-1">'.$value.'</font>'.$GLOBALS['phpgw']->browser->br 3641 ); 3642 $this->output_template_array($p,'daily_events','event',$var); 3643 3644 } 3645 */ 3646 3647 if($day_params['appts']) 3648 { 3649 $var = Array( 3650 'week_day_font_size' => '2', 3651 'events' => '' 3652 ); 3653 $p->set_var($var); 3654 $events = $this->bo->cached_events[$date]; 3655 //eventos 3656 //print_r($events); 3657 foreach($events as $event) 3658 { 3659 if ($this->bo->rejected_no_show($event)) 3660 { 3661 continue; // user does not want to see rejected events 3662 } 3663 $p->set_var('day_events',$this->link_to_month_entry($event,$month,$day,$year)); 3664 $p->parse('events','event',True); 3665 $p->set_var('day_events',''); 3666 } 3667 } 3668 $p->parse('daily_events','day_event',True); 3669 $p->parse('column_data','month_daily',True); 3670 $p->set_var('daily_events',''); 3671 $p->set_var('events',''); 3672 } 3673 $p->parse('column_header','month_column',True); 3674 $p->set_var('column_data',''); 3675 } 3676 $this->bo->owner = $temp_owner; 3677 return $p->fp('out','monthly_header'); 3678 3679 } 3680 3681 function display_month_print($month,$year,$showyear,$owner=0) 3242 3682 { 3243 3683 if($this->debug) … … 3259 3699 $start = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, 1); 3260 3700 3701 $p = CreateObject('phpgwapi.Template',$this->template_dir); 3702 $p->set_unknowns('keep'); 3703 3704 $p->set_file( 3705 Array( 3706 'week' => 'month_day_print.tpl' 3707 ) 3708 ); 3709 $p->set_block('week','m_w_table','m_w_table'); 3710 $p->set_block('week','event','event'); 3711 3712 $var = Array( 3713 'cols' => 1, 3714 'day_events'=> '' //$this->month_week_header($month,$year,False) 3715 ); 3716 // $this->output_template_array($p,'row','event',$var); 3717 3718 $cellcolor = $this->theme['row_on']; 3719 3720 for($i = (int)($start + $GLOBALS['phpgw']->datetime->tz_offset);(int)(date('Ymd',$i)) <= $monthend;$i += 604800) 3721 { 3722 $cellcolor = $GLOBALS['phpgw']->nextmatchs->alternate_row_color($cellcolor); 3723 $var = Array( 3724 'day_events' => $this->month_display_week($i,False,$cellcolor,False,$owner,$monthstart,$monthend) 3725 ); 3726 $this->output_template_array($p,'row','event',$var); 3727 } 3728 return $p->fp('out','m_w_table'); 3729 } 3730 3731 3732 /***************************************************************************************/ 3733 3734 function display_month($month,$year,$showyear,$owner=0) 3735 { 3736 if($this->debug) 3737 { 3738 echo '<!-- datetime:gmtdate = '.$GLOBALS['phpgw']->datetime->cv_gmtdate.' -->'."\n"; 3739 } 3740 3741 $this->bo->store_to_cache( 3742 Array( 3743 'syear' => $year, 3744 'smonth'=> $month, 3745 'sday' => 1 3746 ) 3747 ); 3748 3749 $monthstart = (int)(date('Ymd',mktime(0,0,0,$month ,1,$year))); 3750 $monthend = (int)(date('Ymd',mktime(0,0,0,$month + 1,0,$year))); 3751 3752 $start = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, 1); 3753 3261 3754 if($this->debug) 3262 3755 { … … 3277 3770 3278 3771 $var = Array( 3279 'cols' => 7,3772 'cols' => 1, 3280 3773 'day_events'=> $this->week_header($month,$year,False) 3281 3774 ); … … 4584 5077 function set_week_array($startdate,$cellcolor,$weekly) 4585 5078 { 5079 $data = date("m"); 4586 5080 for ($j=0,$datetime=$startdate;$j<7;$j++,$datetime += 86400) 4587 5081 { -
trunk/calendar/templates/default/app.css
r2 r360 1 1 /* CSS Document */ 2 2 .calendar_print_main { 3 text-align:center; 4 font-family: Verdana, Arial, Helvetica, sans-serif; 5 font-size: 8px; 6 color: #000066; 7 background-color: #F7F7F7; 8 /* border: 1px solid #CCCCCC;*/ 9 margin: 5px; 10 padding: 5px; 11 height: 116px; 12 width: 480px; 13 } 14 15 .button 16 { 17 font-family: Verdana, Arial, Helvetica, sans-serif; 18 font-size: 14px; 19 color: #006699; 20 background-color: #D4D0C8; 21 border: 2px solid #666666; 22 } 3 23 .to_continue 4 24 { … … 121 141 } 122 142 123 / /Mini Calendar143 /*Mini Calendar*/ 124 144 125 145 .calendar_minical_table … … 148 168 .calendar_dropbuttons 149 169 { 150 align: center;151 170 text-align: center; 152 171 vertical-align: bottom; … … 256 275 font-style: italic; 257 276 } 277 278 .calendar_index_table 279 { 280 background-color: #dddddd; 281 border-bottom-style: double; 282 border-bottom-width: medium; 283 284 } 285 286 .calendar_index_table 287 { 288 background-color: #dddddd; 289 border-bottom-style: double; 290 border-bottom-width: medium; 291 292 } -
trunk/calendar/templates/default/month_day.tpl
r2 r360 3 3 4 4 <table id="calendar_m_w_table" class="calendar_m_w_table"> 5 <! from month_header.tpl -->5 <!-- from month_header.tpl --> 6 6 {row} 7 7 </table>
Note: See TracChangeset
for help on using the changeset viewer.