Index: branches/2.2.0.1/calendar/inc/class.uicalendar.inc.php
===================================================================
--- branches/2.2.0.1/calendar/inc/class.uicalendar.inc.php	(revision 4098)
+++ branches/2.2.0.1/calendar/inc/class.uicalendar.inc.php	(revision 4114)
@@ -506,8 +506,14 @@
 
                         }
-                        if($_GET['friendly']==1)
-                            echo $this->printer_friendly($this->get_month(),lang('Monthview'));
-                        else
-                            echo $this->printer_friendly($this->print_month_new($params),lang('Weekview'));
+
+			if($_GET['friendly']==1)
+			{
+			    echo $this->printer_friendly($this->get_month(),lang('Monthview'));
+			}
+			else
+			{
+			    echo $this->printer_friendly($this->print_month_new($params),lang('Monthview'));
+			}
+
 			$GLOBALS['phpgw']->common->phpgw_footer();
 		}
@@ -563,90 +569,54 @@
 	
 			}
-			
-			$hoje = date('Ymd',$GLOBALS['phpgw']->datetime->gmtnow);
-			$mes_hoje = (int)substr($hoje,4,2);
-			$sday = 1;
-			if($_POST['day']) {
-				$day_ini = (int)$_POST['day'];
-			} 
-			elseif($_GET['sday']){
-				if($_GET['month'] == $mes_hoje)
-				{
-					$day_ini = $this->bo->day;
-				} 
-				
-				else
-				{
-					$day_ini = (int)$_GET['sday'];
-				}
-			} 
-			elseif( ($_POST['dia_ini']) && ($_POST['dia_ini'] == $this->bo->day) )
-			{
-				$day_ini = (int)substr($hoje,6,2);
+
+			if (!$this->bo->printer_friendly)
+			{
+			    $account_name = $_POST['user'] ? $_POST['user'] : ($_GET['account_name'] ? $_GET['account_name'] : '');
+
+			    $accounts = CreateObject('phpgwapi.accounts');
+			    $accountId = $accounts->name2id($account_name);
+
+			    $prefs = CreateObject('phpgwapi.preferences', $accountId);
+			    $account_prefs = $prefs->read();
+
+			    $printer = '';
+			    $prev_month_link = '<a href="'.$this->page('month','&year='.$prevyear.'&month='.$prev.'&sday='.$sday).'">&lt;&lt;</a>';
+			    $next_month_link = '<a href="'.$this->page('month','&year='.$nextyear.'&month='.$next.'&sday='.$sday).'">&gt;&gt;</a>';
+			    $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$day_ini.'&num_dias='.$num_dias;
+			    //$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1';
+			    /*if($account_prefs['calendar']['type_month_print'] == '0')
+			    {
+			    $print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param).
+					    "','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '".
+					    lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
+			    }
+			    else
+			    {
+			    $print =  '<a href="javascript:void(0)" onclick="scheduler.toPDF('."'calendar/js/dhtmlx/server/generate.php'".')">['.lang('Printer Friendly').']</a>';
+			    }*/
+
+			    //linha abaixo foi adicionada para exibir a pagina do mes em tela
+			    //$month,$year,$showyear,$owner=0;
+			    $params = Array(
+				'month'	=> $this->bo->month,
+				'year'	=> $this->bo->year,
+				'showyear'	=> True,
+				'owner'	=> $this->bo->owner
+			    );
+			    $large_month = $this->display_month($params);
 			}
 			else
 			{
-				$day_ini = $this->bo->day;
-			}
-			if($_POST['qtd_dias'])
-			{
-				$num_dias = (int)$_POST['qtd_dias'];
-			} 
-			else
-			{
-				$num_dias = '';
-			}
-
-			if (!$this->bo->printer_friendly)
-			{
-                        $account_name = $_POST['user'] ?
-			        $_POST['user'] :
-					($_GET['account_name'] ?
-					 $_GET['account_name'] : '');
-
-			$accounts = CreateObject('phpgwapi.accounts');
-			$accountId = $accounts->name2id($account_name);
-
-			$prefs = CreateObject('phpgwapi.preferences', $accountId);
-			$account_prefs = $prefs->read();
-
-				$printer = '';
-				$prev_month_link = '<a href="'.$this->page('month','&year='.$prevyear.'&month='.$prev.'&sday='.$sday).'">&lt;&lt;</a>';
-				$next_month_link = '<a href="'.$this->page('month','&year='.$nextyear.'&month='.$next.'&sday='.$sday).'">&gt;&gt;</a>';
-				$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$day_ini.'&num_dias='.$num_dias;
-				//$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1';
-				if($account_prefs['calendar']['type_month_print'] == '0')
-                                {
-                                $print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param).
-						"','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '".
-						lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
-                                }
-                                else
-                                {
-                                $print =  '<a href="javascript:void(0)" onclick="scheduler.toPDF('."'calendar/js/dhtmlx/server/generate.php'".')">['.lang('Printer Friendly').']</a>';
-                                }
-				//linha abaixo foi adicionada para exibir a pagina do mes em tela
-				//$month,$year,$showyear,$owner=0;
-				$params = Array(
-				    'month'	=> $this->bo->month,
-				    'year'	=> $this->bo->year,
-				    'showyear'	=> True,
-				    'owner'	=> $this->bo->owner
-				);
-				$large_month = $this->display_month($params);
-			}
-			else
-			{
-				$printer = '<body bgcolor="'.$phpgw_info['theme']['bg_color'].'">';
-				$prev_month_link = '';
-				$next_month_link = '';
-				$print =	'';
-				$GLOBALS['phpgw_info']['flags']['nofooter'] = True;
-				//linha abaixo foi adicionada para exibir a pagina do mes para impressao
-
-				//if($_GET['classic_print']==1)
-				//	$large_month = $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner);
-				//else
-					$large_month = $this->display_month_print($this->bo->month,$this->bo->year,True,$this->bo->owner);
+			    $printer = '<body bgcolor="'.$phpgw_info['theme']['bg_color'].'">';
+			    $prev_month_link = '';
+			    $next_month_link = '';
+			    $print =	'';
+			    $GLOBALS['phpgw_info']['flags']['nofooter'] = True;
+			    //linha abaixo foi adicionada para exibir a pagina do mes para impressao
+
+			    //if($_GET['classic_print']==1)
+			    //	$large_month = $this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner);
+			    //else
+			    $large_month = $this->display_month_print($this->bo->month,$this->bo->year,True,$this->bo->owner);
 			}
 
@@ -670,10 +640,8 @@
 				'small_calendar_prev'	    => $minical_prev,
 				'prev_month_link'	    => $prev_month_link,
-				'month_identifier'	    => lang(strftime("%B",$m)).' '.$this->bo->year,
 				'month_identifier'	    => $aux_month_identifier,
 				'username'		    => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner),
 				'next_month_link'	    => $next_month_link,
 				'small_calendar_next'	    => $minical_next,
-				//'large_month'				=>	$this->display_month($this->bo->month,$this->bo->year,True,$this->bo->owner),
 				'large_month'		    => $large_month,
 				'print'			    => $print
@@ -717,4 +685,5 @@
 
 			echo $this->printer_friendly($this->print_week_new($params),lang('Weekview'));
+			
 			$GLOBALS['phpgw']->common->phpgw_footer();
 		}
@@ -771,8 +740,10 @@
 			if (!$this->bo->printer_friendly)
 			{
+
 				$printer = '';
 				$prev_week_link = '<a href="'.$this->page('week','&date='.$prev['full']).'">&lt;&lt;</a>';
 				$next_week_link = '<a href="'.$this->page('week','&date='.$next['full']).'">&gt;&gt;</a>';
 				$print = '<a href="javascript:void(0);" onclick="scheduler.toPDF('."'calendar/js/dhtmlx/server/generate.php'".')">['.lang('Printer Friendly').']</a>';
+				
                                 //$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>';
 			}
@@ -1829,8 +1800,8 @@
 				$prev_day_link = '<a href="'.$this->page('day','&date='.$prev['full']).'">&lt;&lt;</a>';
 				$next_day_link = '<a href="'.$this->page('day','&date='.$next['full']).'">&gt;&gt;</a>';
-				$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1';
-				$print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param).
-						"','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '".
-						lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
+				//$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1';
+				//$print = "<a href='javascript:void(0)' onClick=\"javascript:window.open('".$this->page('month'.$param).
+				//		"','','width=600,height=600,toolbar=no,scrollbars=yes,resizable=no');\" onMouseOver=\"window.status = '".
+				//		lang('Generate printer-friendly version')."'\">[".lang('Printer Friendly').']</a>';
 			}
 			else
@@ -1840,6 +1811,9 @@
 				$GLOBALS['phpgw_info']['flags']['nofooter'] = True;
 				$printer = '<body bgcolor="'.$this->theme['bg_color'].'">';
-				$print =	'';
-			}
+				//$print =	'';
+			}
+			$print =  '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>';
+
+			$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$dia.'&num_dias=1'.'&d=1';
 
 			$now	= $GLOBALS['phpgw']->datetime->makegmttime(0, 0, 0, $this->bo->month, $this->bo->day, $this->bo->year);
@@ -1857,21 +1831,22 @@
 			$todos = $this->get_todos($todo_label);
 			$var = Array(
-				'printer_friendly'	=> $printer,
-				'bg_text'			=> $this->theme['bg_text'],
-				'daily_events'		=> $this->print_day_new(
+				'printer_friendly'	    => $printer,
+				'bg_text'		    => $this->theme['bg_text'],
+				'daily_events'		    => $this->print_day_new(
 					Array(
-						'year'	=> $this->bo->year,
-						'month'	=> $this->bo->month,
-						'day'	=> $this->bo->day
+						'year'	    => $this->bo->year,
+						'month'	    => $this->bo->month,
+						'day'	    => $this->bo->day
 					)
 				),
-				'small_calendar'	=> $minical,
-				'date'				=> $this->bo->long_date($now) . $legend_holiday,
-				'username'			=> $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner),
-				'prev_day_link'		=> $prev_day_link,
-				'next_day_link'		=> $next_day_link,
-				'print'				=> $print,
-				'lang_todos'		=> $todo_label,
-				'todos'				=> $this->bo->printer_friendly ? $todos :
+				'small_calendar'	    => $minical,
+				'date'			    => $this->bo->long_date($now) . $legend_holiday,
+				'username'		    => $GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner),
+				'prev_day_link'		    => $prev_day_link,
+				'next_day_link'		    => $next_day_link,
+				'iprint'		    => $print,
+				'param'			    => $param,
+				'lang_todos'		    => $todo_label,
+				'todos'			    => $this->bo->printer_friendly ? $todos :
 
 					//NDEE: todo's layout
@@ -1881,5 +1856,5 @@
 			$p->set_var($var);
 			$p->parse('day_events','day_event');
-			print $this->printer_friendly($p->fp('out','day'),lang('Dayview'));
+			echo $this->printer_friendly($p->fp('out','day'),lang('Dayview'));
 			$GLOBALS['phpgw']->common->phpgw_footer();
 		}
@@ -3210,6 +3185,6 @@
 				Array(
 					'footer'	=> 'footer.tpl',
-					'form_button'	=> 'form_button_script.tpl',
-                                        'new_component'	=> 'new_component.tpl'
+					'form_button'	=> 'form_button_script.tpl'
+                                        //'new_component'	=> 'new_component.tpl'
 				)
 			);
@@ -3230,5 +3205,5 @@
 				{
 					$day = $this->bo->day;
-				} 
+				}
 				else
 				{
@@ -3260,12 +3235,12 @@
 			$display = '';
 			$display_view = '';
-                        if ($menuaction == 'calendar.uicalendar.month')
-			{
-                            $accounts = CreateObject('phpgwapi.accounts');
-                            $accountId = $accounts->name2id($account_name);
-                            $prefs = CreateObject('phpgwapi.preferences', $accountId);
-                            $account_prefs = $prefs->read();
-                        }
-			if ( ($menuaction == 'calendar.uicalendar.week') || ($menuaction == 'calendar.uicalendar.day') || $account_prefs['calendar']['type_month_print'] == '1')
+//                        if ($menuaction == 'calendar.uicalendar.month')
+//			{
+//                            $accounts = CreateObject('phpgwapi.accounts');
+//                            $accountId = $accounts->name2id($account_name);
+//                            $prefs = CreateObject('phpgwapi.preferences', $accountId);
+//                            $account_prefs = $prefs->read();
+//                        }
+			if ( ($menuaction == 'calendar.uicalendar.week') || ($menuaction == 'calendar.uicalendar.day') || ($menuaction == 'calendar.uicalendar.year') || ($menuaction == 'calendar.uicalendar.planner'))
 			{
 				$display = 'none';
@@ -3283,6 +3258,6 @@
 				'num_dias_label'	=> lang('quantity of days'),
 				'tip'			=> lang('empty prints from the start day chosen to the end of the current month'),
-				'day_ini_name'		=> 'day',
-				'num_dias_name'		=> 'qtd_dias',
+//				'day_ini_name'		=> 'day',
+//				'num_dias_name'		=> 'qtd_dias',
 				'row_ini'		=> $str_ini,
 				'row_qtd'		=> $str_qtd,
@@ -3319,5 +3294,5 @@
 				'form_onchange'	=> 'document.SelectMonth.submit()',
 				'row'		=> $str,
-				'dia_ini'	=> $dia_ini,
+//				'dia_ini'	=> $dia_ini,
 				'go'		=> lang('Go!')
 			);
@@ -3422,49 +3397,6 @@
 			);
 			$this->output_template_array($p,'b_row2','form_button',$var);
-//                        if ( $menuaction == 'calendar.uicalendar.week' || ($menuaction == 'calendar.uicalendar.month' && $account_prefs['calendar']['type_month_print'] == '1'))
-//                          {
-//                            $aux = explode('.',$menuaction);
-//                            $typeview = $aux[2];
-//                            if($typeview == 'week')
-//                                $params['period'] = 2;
-//                            else
-//                                $params['period'] = 3;
-//
-//                            if(isset($_GET['date']))
-//                                $date = $_GET['date'];
-//                            else
-//                                $date = $_POST['date'];
-//                            if($date)
-//                            {
-//                                $params['year'] = substr($date, 0,4);
-//                                $params['month'] = substr($date, 4,2);
-//                                $params['day'] = substr($date, 6,2);
-//                            }
-//                            else
-//                            {
-//                                $params['year'] = $_GET['year']?$_GET['year']:$_POST['year'];
-//                                $params['month'] = $_GET['month']?$_GET['month']:$_POST['month'];
-//                                if(!$params['month'])
-//                                {
-//                                    $params['month'] = $this->bo->month;
-//                                }
-//                                $params['day'] = $this->bo->day;
-//                            }
-//
-//                            $result_events_json = $this->print_events_to_show_json($params);
-//                            $var = Array(
-//                                    'typeview'                  => $typeview,
-//                                    'typeview_aux'              => $typeview,
-//                                    'date'			=> $result_events_json['date_events_json'],
-//                                    'hora_final'		=> $result_events_json['hora_final'],
-//                                    'hora_inicial'		=> $result_events_json['hora_inicial'],
-//                                    'events_json'		=> json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null'
-//                                    );
-//                            $this->output_template_array($p,'place_component','new_component',$var);
-//                          }
-//                       else
-//                          {
-                            $p->set_var('place_component','');
-//                          }
+
+			//$p->set_var('place_component','');
 			$p->parse('table_row','blank_row',True);
 			$p->pparse('out','footer_table');
@@ -4368,5 +4300,5 @@
 					$id_aux = mktime(0,0,0,$month,$day,$year);
 					$month_identifier = substr(lang(strftime("%B",$id_aux)),0,3);
-					$day_number = $month_identifier . " - " . $dia_semana . ",  " . $day_num;
+					$day_number = $dia_semana . ",  " . $day_num;
 
 					$var = Array(
@@ -5072,5 +5004,5 @@
 
 			$tpl = 'day_cal.tpl';
-			$new_component_tpl = 'new_component.tpl';
+			//$new_component_tpl = 'new_component.tpl';
 
 			if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 &&
@@ -5080,14 +5012,12 @@
 			}
 
-
-
 			$templates = Array(
-				'day_cal'   => $tpl,
-				'new_component_tpl' => $new_component_tpl
+				'day_cal'   => $tpl
+				//'new_component_tpl' => $new_component_tpl
 			);
 
 			$p->set_file($templates);
 			$p->set_block('day_cal','day','day');
-			$p->set_block('new_component_tpl','new_component','new_component');
+			//$p->set_block('new_component_tpl','new_component','new_component');
 			$params['period'] = 1;
                     	$result_events_json = $this->print_events_to_show_json($params);
@@ -5101,70 +5031,85 @@
                 }
 
-                      function print_week_new($params){
-
-			$p = CreateObject('phpgwapi.Template',$this->template_dir);
-			$p->set_unknowns('keep');
-
-			$tpl = 'new_week.tpl';
-
-			if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 &&
-				$GLOBALS['phpgw_info']['flags']['currentapp'] == 'home')
-			{
-				$tpl = 'day_list.tpl';
-			}
-
-                           $minical_prev = $this->mini_calendar(
-					Array(
-						'day'	=> 1,
-						'month'	=> $this->bo->month -1,
-						'year'	=> $this->bo->year,
-						'link'	=> 'week',
-						'outside_month'	=> False
-					)
-				);
-
-                        $minical_next1 = $this->mini_calendar(
-					Array(
-						'day'	=> 1,
-						'month'	=> $this->bo->month + 1,
-						'year'	=> $this->bo->year,
-						'link'	=> 'week',
-						'outside_month'	=> False
-					)
-				);
-
-			$minical_next = $this->mini_calendar(
-					Array(
-						'day'	=> 1,
-						'month'	=> $this->bo->month,
-						'year'	=> $this->bo->year,
-						'link'	=> 'week',
-						'outside_month'	=> False
-					)
-				);
-                        $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);
-
-                        $next = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 7,$this->bo->year);
-			$prev = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day - 7,$this->bo->year);
-			$prev_week_link = '<a href="'.$this->page('week','&date='.$prev['full']).'">&lt;&lt;</a>';
-			$next_week_link = '<a href="'.$this->page('week','&date='.$next['full']).'">&gt;&gt;</a>';
-
-
-			$templates = Array(
-				'new_week'   => $tpl,
-			);
-
-			$p->set_file($templates);
-			$p->set_block('new_week','day','day');
-			$params['period'] = 2;
-                    	$result_events_json = $this->print_events_to_show_json($params);
-			$p->set_var('date',$result_events_json['date_events_json']);
-			$p->set_var('hora_final',$result_events_json['hora_final']);
-			$p->set_var('hora_inicial',$result_events_json['hora_inicial']);
-                        $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1);
-                        $p->set_var('title',$this->bo->get_week_label());
-                        $p->set_var('user',$prev_week_link.' '.$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner).' '.$next_week_link);
-			$p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null');
-                        return $p->fp('out','day');
+		function print_week_new($params){
+
+		    $p = CreateObject('phpgwapi.Template',$this->template_dir);
+		    $p->set_unknowns('keep');
+
+		    $tpl = 'new_week.tpl';
+
+		    if((int)($GLOBALS['phpgw_info']['user']['preferences']['calendar']['mainscreen_showevents'])==2 &&
+		    $GLOBALS['phpgw_info']['flags']['currentapp'] == 'home')
+		    {
+			$tpl = 'day_list.tpl';
+		    }
+
+		    $minical_prev = $this->mini_calendar(
+			Array(
+			    'day'		=> 1,
+			    'month'		=> $this->bo->month -1,
+			    'year'		=> $this->bo->year,
+			    'link'		=> 'week',
+			    'outside_month'	=> False
+			    )
+		    );
+
+		    $minical_next1 = $this->mini_calendar(
+			Array(
+			    'day'		=> 1,
+			    'month'		=> $this->bo->month + 1,
+			    'year'		=> $this->bo->year,
+			    'link'		=> 'week',
+			    'outside_month'	=> False
+			)
+		    );
+
+		    $minical_next = $this->mini_calendar(
+			Array(
+			    'day'		=> 1,
+			    'month'		=> $this->bo->month,
+			    'year'		=> $this->bo->year,
+			    'link'		=> 'week',
+			    'outside_month'	=> False
+			)
+		    );
+
+		    $next = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day + 7,$this->bo->year);
+		    $prev = $GLOBALS['phpgw']->datetime->makegmttime(0,0,0,$this->bo->month,$this->bo->day - 7,$this->bo->year);
+		    $prev_week_link = '<a href="'.$this->page('week','&date='.$prev['full']).'">&lt;&lt;</a>';
+		    $next_week_link = '<a href="'.$this->page('week','&date='.$next['full']).'">&gt;&gt;</a>';
+
+		    $daily = $this->set_week_array($GLOBALS['phpgw']->datetime->get_weekday_start($params['year'],$params['month'],$params['day']),$this->theme['row_on'],True);
+		    foreach($daily as $key => $value)
+		    {
+			$dates[] = $key;
+		    }
+
+		    $day_ini = (int)substr($dates[0],6,2);
+
+		    $print =  '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>';
+
+		    $param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1'.'&day_ini='.$day_ini.'&num_dias=7';
+
+		    $m = mktime(0,0,0,$this->bo->month,1,$this->bo->year);
+
+		    $templates = Array(
+			'new_week'   => $tpl,
+		    );
+
+		    $p->set_file($templates);
+		    $p->set_block('new_week','day','day');
+		    $params['period'] = 2;
+		    $result_events_json = $this->print_events_to_show_json($params);
+		    $p->set_var('date',$result_events_json['date_events_json']);
+		    $p->set_var('hora_final',$result_events_json['hora_final']);
+		    $p->set_var('hora_inicial',$result_events_json['hora_inicial']);
+		    $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1);
+		    $p->set_var('iprint',$print);
+		    $p->set_var('param',$param);
+		    $p->set_var('title',$this->bo->get_week_label());
+		    $p->set_var('user',$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner));
+		    $p->set_var('events_json',json_encode($result_events_json['events_to_show_json'])?json_encode($result_events_json['events_to_show_json']):'null');
+		    return $p->fp('out','day');
+
                 }
 
@@ -5217,4 +5162,8 @@
 					)
 				);
+
+			$print =  '<a href="javascript:void(0)" id="printFriendly">['.lang('Printer Friendly').']</a>';
+
+			$param = '&year='.$this->bo->year.'&month='.$this->bo->month.'&friendly=1';
 
                         $next = $this->bo->month + 1;
@@ -5244,4 +5193,6 @@
 			$p->set_var('hora_inicial',$result_events_json['hora_inicial']);
                         $p->set_var('minical',$minical_prev.'<br>'.$minical_next.'<br>'.$minical_next1);
+			$p->set_var('iprint',$print);
+			$p->set_var('param',$param);
                         $p->set_var('title',lang(strftime("%B",$m)).' '.$this->bo->year);
                         $p->set_var('user',$prev_month_link." ".$GLOBALS['phpgw']->common->grab_owner_name($this->bo->owner).' '.$next_month_link);
