true, 'init_schedule' => true, 'add_participants' => true, 'add_participant' => true, 'edit' => true, 'update' =>true, 'overlap' => true, 'index' => true ); function ui_mobilecalendar() { $this->bo = CreateObject('calendar.bocalendar',1); $this->cat = &$this->bo->cat; $GLOBALS['phpgw']->nextmatchs = CreateObject('phpgwapi.nextmatchs'); $this->link_tpl = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); $this->link_tpl->set_unknowns('remove'); $this->link_tpl->set_file( Array( 'link_picture' => 'link_pict.tpl' ) ); $this->link_tpl->set_block('link_picture','link_pict','link_pict'); $this->link_tpl->set_block('link_picture','pict','pict'); $this->link_tpl->set_block('link_picture','link_open','link_open'); $this->link_tpl->set_block('link_picture','link_close','link_close'); $this->link_tpl->set_block('link_picture','link_text','link_text'); } function index() { $accountId = $GLOBALS['phpgw_info']['user']['account_id']; $uicalendar = CreateObject("calendar.uicalendar"); $daysofWeek = array(lang('Sunday'), lang('Monday'),lang('Tuesday'),lang('Wednesday'),lang('Thursday'),lang('Friday'),lang('Saturday')); $year = $uicalendar->bo->year; $month = $uicalendar->bo->month; $day = $uicalendar->bo->day; $start = $GLOBALS['phpgw']->datetime->get_weekday_start($year, $month, $day) + $GLOBALS['phpgw']->datetime->tz_offset; $tstart = $start - $GLOBALS['phpgw']->datetime->tz_offset; $tstop = $tstart + 604800; $uicalendar->bo->so->owner = $accountId; $uicalendar->bo->so->open_box($accountId); $uicalendar->bo->store_to_cache( Array( 'syear' => date('Y',$tstart), 'owner' => $accountId, 'smonth' => date('m',$tstart), 'sday' => date('d',$tstart), 'eyear' => date('Y',$tstop), 'emonth' => date('m',$tstop), 'eday' => date('d',$tstop) ) ); $daily = $uicalendar->bo->cached_events; $p = CreateObject('phpgwapi.Template', "../mobile/templates/".$GLOBALS['phpgw_info']['server']['template_set']); $p->set_file(Array('view' => 'calendar.tpl')); $data[] = array(); @ksort($daily); $p->set_block("view","body"); if($daily){ $p->set_block('view','view_event'); foreach($daily as $date => $day_params) { $year = (int)substr($date,0,4); $month = (int)substr($date,4,2); $day = (int)substr($date,6,2); $day_of_week = $daysofWeek[$GLOBALS['phpgw']->datetime->day_of_week($year,$month,$day)]; $p->set_var("header_date",$day_of_week." - ".$day."/".$month."/".$year); for($i = 0; $i < count($day_params);$i++) { //Verifica se o usuario conectado é o dono do agendamento, se for não serão exibidos os links //Aceitar e Rejeitar $display = ""; if($accountId == $day_params[$i]['owner']) { $display = "none"; } $vars = $uicalendar->bo->event2array($day_params[$i]); $data = array ( "title_field" => $vars['title']['field'], "title_data" => $vars['title']['data'], "location_field" => $vars['location']['field'], "location_data" => $vars['location']['data'] ? $vars['location']['data'] : " ", "startdate_field" => $vars['startdate']['field'], "startdate_data" => substr($vars['startdate']['data'],13, 17), "enddate_field" => $vars['enddate']['field'], "enddate_data" => substr($vars['enddate']['data'],13, 17), "description_field" => $vars['description']['field'], "description_data" => $vars['description']['data'] ? $vars['description']['data'] : " ", //Links Aceitar e Rejeitar o compromisso "accept_title" => lang("Accept"), "accept_data" => "index.php?menuaction=mobile.ui_mobilemail.set_action&cal_id=" . $day_params[$i]['id'] . "&action=3", "reject_title" => lang("Reject"), "reject_data" => "index.php?menuaction=mobile.ui_mobilemail.set_action&cal_id=" . $day_params[$i]['id'] . "&action=0", "display" => $display ); // print_r($vars); $p->set_var($data); $p->parse('views','view_event',True); } } $p->parse('events','views'); //$p->pfp('out','views'); } else { $p->set_block('view','no_event'); $syear = date('Y',$tstart); $smonth = date('m',$tstart); $sday = date('d',$tstart); $eyear = date('Y',$tstop); $emonth = date('m',$tstop); $eday = date('d',$tstop); $p->set_var("start_date",$sday."/".$smonth."/".$syear); $p->set_var("end_date", $eday."/".$emonth."/".$eyear); $p->parse('events','no_event'); // $p->pfp('out','no_event'); } $p->set_var("lang_schedule",lang("schedule")); //$p->pfp('out','body'); $GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out','body')); } function page($_page='',$params='') { if($_page == '') { $page_ = explode('.',$this->bo->prefs['calendar']['defaultcalendar']); $_page = $page_[0]; if ($_page=='planner_cat' || $_page=='planner_user') { $_page = 'planner'; } elseif ($_page=='index' || ($_page != 'day' && $_page != 'week' && $_page != 'month' && $_page != 'year' && $_page != 'planner')) { $_page = 'month'; $GLOBALS['phpgw']->preferences->add('calendar','defaultcalendar','month'); $GLOBALS['phpgw']->preferences->save_repository(); } } if($GLOBALS['phpgw_info']['flags']['currentapp'] == 'home' || strstr($GLOBALS['phpgw_info']['flags']['currentapp'],'mail')) // email, felamimail, ... { $page_app = 'calendar'; } else { $page_app = $GLOBALS['phpgw_info']['flags']['currentapp']; } if (is_array($params)) { $params['menuaction'] = $page_app.'.ui'.$page_app.'.'.$_page; } else { $params = 'menuaction='.$page_app.'.ui'.$page_app.'.'.$_page.$params; } return $GLOBALS['phpgw']->link('/index.php',$params); } function init_schedule() { $_SESSION['mobile_calendar'] = NULL; $this->add_participants(); } function add_participants() { $ui_cc = CreateObject('mobile.ui_mobilecc'); $ui_cc->contacts_list(true); } function add_participant() { $participants = $_SESSION["mobile_calendar"]; if(!is_array($participants)) $participants = array(); $participants[$_GET['user']] = $_GET['cn']; $_SESSION["mobile_calendar"] = $participants; $p = CreateObject('phpgwapi.Template',PHPGW_APP_TPL); $p->set_file(Array('continue' => 'keep_add_participants.tpl')); $p->set_block('continue','body'); $p->set_var('lang_add_participants',lang('keep add participants')); $p->set_var('lang_continue',lang('continue scheduling')); //$p->pfp('out','body'); $GLOBALS['phpgw_info']['mobiletemplate']->set_content($p->fp('out','body')); } function add($cd=0,$readsess=0) { if(!$this->bo->check_perms(PHPGW_ACL_ADD)) { $this->index(); } if($readsess) { $event = $this->bo->restore_from_appsession; if(!$event['owner']) { $this->bo->add_attribute('owner',$this->bo->owner); } $can_edit = True; } else { $this->bo->event_init(); $this->bo->add_attribute('id',0); $can_edit = True; $participants = (string)(get_var('participants',array('GET'),FALSE)); $starthour = (int)(get_var('hour',array('GET'),$this->bo->prefs['calendar']['workdaystarts'])); $startmin = (int)(get_var('minute',array('GET'),0)); $endmin = $startmin + (int)$this->bo->prefs['calendar']['defaultlength']; $endhour = $starthour + $this->bo->normalizeminutes($endmin); $subject = (string)(get_var('title',array('GET'),0)); if ($subject != '0') { $description = (string)(get_var('description',array('GET'),0)); $location = (string)(get_var('location',array('GET'),0)); } else unset($subject); $this->bo->set_start($this->bo->year,$this->bo->month,$this->bo->day,$starthour,$startmin,0); $this->bo->set_end($this->bo->year,$this->bo->month,$this->bo->day,$endhour,$endmin,0); $this->bo->set_title($subject); $this->bo->set_description($description); $this->bo->add_attribute('location',$location); $this->bo->set_ex_participants(''); $this->bo->add_attribute('uid',''); $this->bo->add_attribute('priority',2); if(@$this->bo->prefs['calendar']['default_private']) { $this->bo->set_class(False); } else { $this->bo->set_class(True); } $this->bo->add_attribute('participants','A',$this->bo->owner); $this->bo->set_recur_none(); $event = $this->bo->get_cached_event(); } $this->edit_form( Array( 'event' => $event, 'cd' => $cd ) ); //$GLOBALS['phpgw']->common->phpgw_footer(); } function edit($params='') { if($this->debug) { echo ''."\n"; echo ''."\n"; } if(isset($_GET['readsess'])) { $params['readsess'] = $_GET['readsess']; $params['cd'] = 0; } if($this->debug) { echo ''."\n"; echo ''."\n"; } if($params != '' && @is_array($params) && @isset($params['readsess'])) { $can_edit = True; $this->edit_form( Array( 'event' => $this->bo->restore_from_appsession(), 'cd' => $params['cd'] ) ); } elseif(isset($_GET['cal_id'])) { $cal_id = (int)$_GET['cal_id']; $event = $this->bo->read_entry($cal_id); if(!$this->bo->check_perms(PHPGW_ACL_EDIT,$event)) { Header('Location: '.$this->page('view','&cal_id='.$cal_id)); $GLOBALS['phpgw']->common->phpgw_exit(); } if(@isset($_POST['edit_type']) && $_POST['edit_type'] == 'single') { $event['id'] = 0; $this->bo->set_recur_date($event,$_POST['date']); $event['recur_type'] = MCAL_RECUR_NONE; $event['recur_interval'] = 0; $event['recur_data'] = 0; $event['recur_enddate']['month'] = 0; $event['recur_enddate']['mday'] = 0; $event['recur_enddate']['year'] = 0; $event['recur_exception'] = array(); } $this->edit_form( Array( 'event' => $event, 'cd' => $cd ) ); } } function update() { $params = array(); $params['from_mobile'] = true; $this->bo->update($params); } function edit_form($param) { if(!is_array($param)) { $this->index(); } if(isset($param['event'])) { $event = $param['event']; } $hourformat = substr($this->bo->users_timeformat,0,1); // $sb = CreateObject('phpgwapi.sbox'); $sb = CreateObject('phpgwapi.sbox2'); $jscal = CreateObject('phpgwapi.jscalendar'); // before phpgw_header() !!! unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw_info']['flags']['noappheader'] = True; $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; $GLOBALS['phpgw_info']['flags']['app_header'] = $event['id'] ? lang('Editing event') : lang('Adding event'); //$GLOBALS['phpgw']->common->phpgw_header(); $p = &$GLOBALS['phpgw']->template; $p->set_file( Array( 'edit' => 'edit.tpl', 'form_button' => 'form_button_script.tpl' ) ); $p->set_block('edit','edit_entry','edit_entry'); $p->set_block('edit','list','list'); $p->set_block('edit','hr','hr'); $vars = Array( 'font' => $this->theme['font'], 'bg_color' => $this->theme['bg_text'], 'action_url' => $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.update')), 'accounts_link' => $GLOBALS['phpgw']->link('/index.php','menuaction=calendar.uicalendar.accounts_popup'), 'common_hidden' => ''."\n" . ''."\n" . ''."\n" . ($_GET['cal_id'] && $event['id'] == 0?''."\n": (@isset($event['reference'])?''."\n":'')) . (@isset($GLOBALS['phpgw_info']['server']['deny_user_grants_access']) && $GLOBALS['phpgw_info']['server']['deny_user_grants_access']? ''."\n":''), 'errormsg' => ($param['cd']?$GLOBALS['phpgw']->common->check_code($param['cd']):''), 'row_owner' => '' ); $p->set_var($vars); // Brief Description $var['title'] = Array( 'tr_color' => $this->theme['th_bg'], 'field' => lang('Title'), 'data' => '' ); // Location $var['location'] = Array( 'field' => lang('Location'), 'data' => '' ); // Date $start = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; $var['startdate'] = Array( 'field' => lang('Start Date'), 'data' => $GLOBALS['phpgw']->common->dateformatorder( $sb->getYears('start[year]',(int)$GLOBALS['phpgw']->common->show_date($start,'Y')), $sb->getMonths('start[month]',(int)$GLOBALS['phpgw']->common->show_date($start,'n')), $sb->getDays('start[mday]',(int)$GLOBALS['phpgw']->common->show_date($start,'d')), true ) // 'data' => $jscal->input('start[str]',$start) ); // Time if ($this->bo->prefs['common']['timeformat'] == '12') { $str .= '= 12?'':' checked').'>am'."\n" . '= 12?' checked':'').'>pm'."\n"; } $var['starttime'] = Array( 'field' => lang('Start Time'), 'data' => ':'."\n".$str ); // End Date $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; $var['enddate'] = Array( 'field' => lang('End Date'), 'data' => $GLOBALS['phpgw']->common->dateformatorder( $sb->getYears('end[year]',(int)$GLOBALS['phpgw']->common->show_date($end,'Y')), $sb->getMonths('end[month]',(int)$GLOBALS['phpgw']->common->show_date($end,'n')), $sb->getDays('end[mday]',(int)$GLOBALS['phpgw']->common->show_date($end,'d')),true ) // 'data' => $jscal->input('end[str]',$end) ); // End Time if ($this->bo->prefs['common']['timeformat'] == '12') { $str = '= 12?'':' checked').'>am'."\n" . '= 12?' checked':'').'>pm'."\n"; } $var['endtime'] = Array( 'field' => lang('End Time'), 'data' => ':'."\n".$str ); $participants = $_SESSION['mobile_calendar']; $str = " "; foreach($participants as $id => $nome) { $str.=""; } $var['participants'] = array ( 'field' => lang('Participants'), 'data' => " " ); /*$var['owner'] = Array( 'field' => $GLOBALS['phpgw']->common->grab_owner_name($event['owner']).' '.lang('Participates'), 'data' => '' );*/ if (!isset($this->fields)) { $this->custom_fields = CreateObject('calendar.bocustom_fields'); $this->fields = &$this->custom_fields->fields; $this->stock_fields = &$this->custom_fields->stock_fields; } $preserved = False; foreach($this->fields as $field => $data) { /*if($field=='owner') $p->set_var('display',"visibility:hidden"); else $p->set_var('display'," ");*/ if (!$data['disabled']) { if (isset($var[$field])) { switch($field) { case 'startdate': $this->output_template_array($p,'row','list',$var['startdate']); $this->output_template_array($p,'row','list',$var['starttime']); break; case 'enddate': $this->output_template_array($p,'row','list',$var['enddate']); $this->output_template_array($p,'row','list',$var['endtime']); break; default: $this->output_template_array($p,'row','list',$var[$field]); } } elseif (!isset($this->stock_fields[$field])) // Custom field { $lang = lang($name = substr($field,1)); $size = 'SIZE='.($data['shown'] ? $data['shown'] : ($data['length'] ? $data['length'] : 30)). ' MAXLENGTH='.($data['length'] ? $data['length'] : 255); $v = array( 'field' => $lang == $name.'*' ? $name : $lang, 'data' => '' ); if ($data['title']) { $v['tr_color'] = $this->theme['th_bg']; } if (!$data['length'] && $data['title']) { $p->set_var('tr_color',$this->theme['th_bg']); $p->set_var('hr_text','
'.$v['field'].'
'); $p->parse('row','hr',True); } else { $this->output_template_array($p,'row','list',$v); } } } else // preserve disabled fields { switch ($field) { case 'owner': $preserved[$field] = $event['id'] ? $event['participants'][$event['owner']] : 'A'; break; case 'recure_type': foreach(array('recur_type','recur_enddate','recur_data','recur_interval') as $field) { $preserved[$field] = $event[$field]; } break; case 'startdate': case 'enddate': $field = substr($field,0,-4); default: $preserved[$field] = $event[$field]; } } } unset($var); if (is_array($preserved)) { //echo "preserving
"; print_r($preserved); echo "
\n"; $p->set_var('common_hidden',$p->get_var('common_hidden').''."\n"); } $p->set_var('submit_button',lang('Save')); $delete_button = $cancel_button = ''; if ($event['id'] > 0) { $var = Array( 'action_url_button' => $this->page('delete','&cal_id='.$event['id']), 'action_text_button' => lang('Delete'), 'action_confirm_button' => "onClick=\"return confirm('".lang('Are you sure want to delete this entry?\\nThis will delete this entry for all users.')."')\"", 'action_extra_field' => '' ); $p->set_var($var); $delete_button = $p->fp('out','form_button'); } $p->set_var('delete_button',$delete_button); if ($this->bo->return_to) { $var = Array( 'action_url_button' => $GLOBALS['phpgw']->link('/index.php','menuaction='.$this->bo->return_to), 'action_text_button' => lang('Cancel'), 'action_confirm_button' => '', 'action_extra_field' => '' ); $p->set_var($var); $cancel_button = $p->fp('out','form_button'); } $p->set_var('lang_add_participants',lang("keep add participants")); $p->set_var('cancel_button',$cancel_button); $p->pparse('out','edit_entry'); } function get_organizations($context, $selected='', $recursive = false) { $s = CreateObject('phpgwapi.sector_search_ldap'); return ($recursive ? $s->get_organizations($context, $selected, false ,false) : $s->get_sectors($selected, false, false)); } function output_template_array(&$p,$row,$list,$var) { if (!isset($var['hidden_vars'])) { $var['hidden_vars'] = ''; } if (!isset($var['tr_color'])) { $var['tr_color'] = $GLOBALS['phpgw']->nextmatchs->alternate_row_color(); } $p->set_var($var); $p->parse($row,$list,True); } function overlap($params) { ini_set("display_errors","1"); if(!is_array($params)) { } else { $overlapping_events = $params['o_events']; $event = $params['this_event']; } $month = $event['start']['month']; $mday = $event['start']['mday']; $year = $event['start']['year']; $start = mktime($event['start']['hour'],$event['start']['min'],$event['start']['sec'],$month,$mday,$year) - $GLOBALS['phpgw']->datetime->tz_offset; $end = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; $overlap = ''; for($i=0;$ibo->read_entry($overlapping_events[$i],True); $overlap .= '
  • '.$this->link_to_entry($overlapped_event,$month,$mday,$year); $overlap .= '\n"; } unset($GLOBALS['phpgw_info']['flags']['noheader']); unset($GLOBALS['phpgw_info']['flags']['nonavbar']); $GLOBALS['phpgw_info']['flags']['noappheader'] = True; $GLOBALS['phpgw_info']['flags']['noappfooter'] = True; $GLOBALS['phpgw_info']['flags']['app_header'] = $GLOBALS['phpgw_info']['apps']['calendar']['title'].' - '.lang('Scheduling Conflict'); //$GLOBALS['phpgw']->common->phpgw_header(); $p = $GLOBALS['phpgw']->template; $p->set_file( Array( 'overlap' => 'overlap.tpl', 'form_button' => 'form_button_script.tpl' ) ); $var = Array( 'color' => $this->theme['bg_text'], 'overlap_title' => lang('Scheduling Conflict'), 'overlap_text' => lang('Your suggested time of %1 - %2 conflicts with the following existing calendar entries:',$GLOBALS['phpgw']->common->show_date($start),$GLOBALS['phpgw']->common->show_date($end)), 'overlap_list' => $overlap ); $p->set_var($var); $date = sprintf("%04d%02d%02d",$this->bo->year,$this->bo->month,$this->bo->mday); $var = Array( 'action_url_button' => $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.update','readsess'=>1)), 'action_text_button' => lang('Ignore Conflict'), 'action_confirm_button' => '', 'action_extra_field' => '' ); $this->output_template_array($p,'resubmit_button','form_button',$var); $var = Array( 'action_url_button' => $GLOBALS['phpgw']->link('/mobile/index.php',Array('menuaction'=>'mobile.ui_mobilecalendar.edit','readsess'=>1,'date'=>$date)), 'action_text_button' => lang('Re-Edit Event'), 'action_confirm_button' => '', 'action_extra_field' => '' ); $this->output_template_array($p,'reedit_button','form_button',$var); $p->pparse('out','overlap'); } function link_to_entry($event,$month,$day,$year) { $str = ''; $is_private = !$event['public'] && !$this->bo->check_perms(PHPGW_ACL_READ,$event); $viewable = !$this->bo->printer_friendly && $this->bo->check_perms(PHPGW_ACL_READ,$event); $starttime = $this->bo->maketime($event['start']) - $GLOBALS['phpgw']->datetime->tz_offset; $endtime = $this->bo->maketime($event['end']) - $GLOBALS['phpgw']->datetime->tz_offset; $rawdate = mktime(0,0,0,$month,$day,$year); $rawdate_offset = $rawdate - $GLOBALS['phpgw']->datetime->tz_offset; $nextday = mktime(0,0,0,$month,$day + 1,$year) - $GLOBALS['phpgw']->datetime->tz_offset; if ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') && $starttime == $endtime) { $time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); } elseif ($starttime <= $rawdate_offset && $endtime >= $nextday - 60) { $time = '[ '.lang('All Day').' ]'; } elseif ((int)$GLOBALS['phpgw']->common->show_date($starttime,'Hi') || $starttime != $endtime) { if($starttime < $rawdate_offset && $event['recur_type'] == MCAL_RECUR_NONE) { $start_time = $GLOBALS['phpgw']->common->show_date($rawdate_offset,$this->bo->users_timeformat); } else { $start_time = $GLOBALS['phpgw']->common->show_date($starttime,$this->bo->users_timeformat); } if($endtime >= ($rawdate_offset + 86400)) { $end_time = $GLOBALS['phpgw']->common->show_date(mktime(23,59,59,$month,$day,$year) - $GLOBALS['phpgw']->datetime->tz_offset,$this->bo->users_timeformat); } else { $end_time = $GLOBALS['phpgw']->common->show_date($endtime,$this->bo->users_timeformat); } $time = $start_time.'-'.$end_time; } else { $time = ''; } $texttitle = $texttime = $textdesc = $textlocation = $textstatus = ''; if(!$is_private) { //$text .= $this->bo->display_status($event['users_status']); // split text for better display by templates, also see $texttime $texttitle $textdesc $textlocation $textstatus=$this->bo->display_status($event['users_status']); } /* $text = ' '.$time.'  '.$this->bo->get_short_field($event,$is_private,'title').$text. (!$is_private && $event['description'] ? ': '.$this->bo->get_short_field($event,$is_private,'description').'':''). $GLOBALS['phpgw']->browser->br; */ $texttime=$time; $texttitle=$this->bo->get_short_field($event,$is_private,'title'); $textdesc=(!$is_private && $event['description'] ? $this->bo->get_short_field($event,$is_private,'description'):''); // added $textlocation but this must be activated in the actual pict_link.tpl file of the used template set $textlocation=$this->bo->get_short_field($event,$is_private,'location'); if ($viewable) { $date = sprintf('%04d%02d%02d',$year,$month,$day); $this->link_tpl->set_var('link_link',$this->page('view','&cal_id='.$event['id'].'&date='.$date)); $this->link_tpl->set_var('lang_view',lang('View this entry')); $this->link_tpl->set_var('desc', $textdesc); $this->link_tpl->set_var('location', $textlocation); $this->link_tpl->parse('picture','link_open',True); } if (!$is_private) { if($event['priority'] == 3) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','high'), 'width' => 16, 'height'=> 16, 'title' => lang('high priority') ); } if($event['recur_type'] == MCAL_RECUR_NONE) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','circle'), 'width' => 9, 'height'=> 9, 'title' => lang('single event') ); } else { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','recur'), 'width' => 12, 'height'=> 12, 'title' => lang('recurring event') ); } } $participants = $this->planner_participants($event['participants']); if(count($event['participants']) > 1) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','multi_3'), 'width' => 14, 'height'=> 14, 'title' => $participants ); } else { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','single'), 'width' => 14, 'height'=> 14, 'title' => $participants ); } if($event['public'] == 0) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','private'), 'width' => 13, 'height'=> 13, 'title' => lang('private') ); } if(@isset($event['alarm']) && count($event['alarm']) >= 1 && !$is_private) { // if the alarm is to go off the day before the event // the icon does not show up because of 'alarm_today' // - TOM if($this->bo->alarm_today($event,$rawdate_offset,$starttime)) { $picture[] = Array( 'pict' => $GLOBALS['phpgw']->common->image('calendar','alarm'), 'width' => 13, 'height'=> 13, 'title' => lang('alarm') ); } } $description = $this->bo->get_short_field($event,$is_private,'description'); for($i=0;$i $picture[$i]['pict'], 'width' => $picture[$i]['width'], 'height' => $picture[$i]['height'], 'title' => $picture[$i]['title'] ); $this->output_template_array($this->link_tpl,'picture','pict',$var); } if ($texttitle) { $var = Array( // 'text' => $text, 'time'=> $texttime, 'title'=> $texttitle, 'users_status'=>$textstatus, 'desc'=> $textdesc, 'location'=> "
    Local: ".$textlocation ); $this->output_template_array($this->link_tpl,'picture','link_text',$var); } if ($viewable) { $this->link_tpl->parse('picture','link_close',True); } $str = $this->link_tpl->fp('out','link_pict'); $this->link_tpl->set_var('picture',''); $this->link_tpl->set_var('out',''); // unset($p); return $str; } function planner_participants($parts) { static $id2lid; $names = ''; while (list($id,$status) = each($parts)) { $status = substr($this->bo->get_long_status($status),0,1); if (!isset($id2lid[$id])) { $id2lid[$id] = $GLOBALS['phpgw']->common->grab_owner_name($id); } if (strlen($names)) { $names .= ",\n"; } $names .= $id2lid[$id]." ($status)"; } if($this->debug) { echo ''."\n"; } return $names; } } ?>