'.f_build_select("dayFrom", $days_in_month_array, $st_day, '', 'value')
.f_build_select("monthFrom", $month_name, $month_name[$st_mon-1], '', 'value').f_build_select("yearFrom", $years_array, $st_year, '', 'value').'
';
$output.=f_build_select("dayTo", $days_in_month_array, $end_day, '', 'value')
.f_build_select("monthTo", $month_name, $month_name[$end_mon-1], '', 'value').f_build_select("yearTo", $years_array, $end_year, '', 'value').'
'.'
';
return $output;
}
function viewtype_bar($action_id,$mon,$year,$selected_view=1) //calendar cal view type bar
{
global $s_path,$month_name,$years_array,$lg_;
$output='
';
return $output;
}
function navigation_bar($action_id_orig,$mon,$year,$type,$selected_view=1,$flag='external',$mode=null,$start_day=null) //calendar navigation
{
global $s_path,$month_name,$years_array,$lg_,$f_ct;
$output='';
$action_id=($action_id_orig=='showcaljs' || $action_id_orig=='showeventsjs')?'show':$action_id_orig;
$prev_mon=$mon-1; $prev_year=$year;
$next_mon=$mon+1; $next_year=$year;
if($mon==1 && $year>1950) { $prev_mon=12; $prev_year=$year-1; }
elseif($mon==1 && $year<=1950) { $prev_mon=1; $prev_year=1950; }
elseif($mon==12 && $year<2050) { $next_mon=1; $next_year=$year+1; }
elseif($mon==12 && $year>=2050) { $next_mon=12; $next_year=2050; }
if(($selected_view==6 || $selected_view==9) && $mon<=6) { $prev_mon=7; $prev_year=($year>1950? $year-1: 1950); $next_mon=7; $next_year=$year;}
if(($selected_view==6 || $selected_view==9) && $mon>6) { $prev_mon=1; $prev_year=$year; $next_mon=1; $next_year=($year<2050? $year+1: 2050);}
if($selected_view==12) { $prev_mon=1; $prev_year=($year>1950? $year-1: 1950); $next_mon=1; $next_year=($year<2050? $year+1: 2050);}
if($mode=='week')
{
$prev_ts=$start_day-7*24*60*60; $next_ts=$start_day+7*24*60*60;
$prev_mon=date('n', $prev_ts); $prev_year=date('Y', $prev_ts);
$next_mon=date('n', $next_ts); $next_year=date('Y', $next_ts);
}
if($mode=='month') { $mode_param_prev='&mode=month'; $mode_param_next='&mode=month'; }
elseif($mode=='week')
{
$mode_param_prev="&mode=week&startday=".date('j',$prev_ts);
$mode_param_next="&mode=week&startday=".date('j',$next_ts);
}
if($flag=='external') $output='
');
if($flag!='external')$output.=($type=='prev'?'<':'>').'';
return $output;
}
//BUILD CALENDAR TABLE
function build_calendar($events_raw,$mon,$year,$flag,$action_id_orig,$view_type,$internal_nav=false,$month_mode=false)
{
global $s_path,$cal_dir,$day_name,$month_name,$category_color,$f_day_ofweek,$f_lf,$lg_,$utf_fl,$css_desc,$css_date,$css_details,
$css_calurl,$css_day1,$css_day2,$css_day3,$css_currday,$css_mcurrday,$cal_size,$cal_cspacing,$css_calh1,$css_calh2,$f_br,$f_ct,$category_mark,
$category_mark_color,$css_mday1,$css_mday2,$css_mday3,$rel_path;
$cal_js=$action_id_orig=='showcaljs';
$cal_usermode=$flag=='user';
$action_id=($cal_js)?'show':$action_id_orig;
$excl_link_flag=($cal_js && isset($_GET['link']) && ($_GET['link']=='0'));
$days_in_curr_mon=f_days_in_month($mon,$year);
$fdaymonth_ts=mktime(0,0,0,$mon,1,$year);
$ldaymonth_ts=mktime(23,59,59,$mon,$days_in_curr_mon,$year);
$event_records=db_get_events($events_raw, $fdaymonth_ts, $ldaymonth_ts, $flag);
$bg_colors=define_colors($mon,$year,$event_records);
$events_per_period=define_events($mon,$year,$event_records,$month_mode);
$url_p=$lg_.'&mon='.$mon.'&year='.$year;
$month=$month_name[$mon-1];
$firstday_str = date('l',mktime(0,0,0,$mon,1,$year));
$month_icon=($month_mode)?$cal_dir.'calendar.png':$cal_dir.'calendar_view_month.png';
$week_icon = $cal_dir.'calendar_view_week.png';
// 'First day of week' check
if ($f_day_ofweek==1) $firstday=date('w',mktime(0,0,0,$mon,1,$year));
else
{
$day=date('w',mktime(0,0,0,$mon,1,$year));
$firstday=($day==0? 6: $day-1);
$temp=$day_name[0];
$day_name_rev=$day_name;
array_shift($day_name_rev); array_push($day_name_rev, $temp);
}
settype($firstday,'integer');
$cal_pointer=$firstday;
$row_counter=0;
$mode=($month_mode)?'month':null;
if($internal_nav)
{
$nav_prev=navigation_bar($action_id_orig,$mon,$year,'prev',$view_type,'internal',$mode);
$nav_next=navigation_bar($action_id_orig,$mon,$year,'next',$view_type,'internal',$mode);
}
$cal_html=(!$month_mode)?'
':'';
$cal_html.='
';
$cal_html.='';
if($excl_link_flag) $cal_html.=' '.$month.' '.$year.' ';
else
{
if($internal_nav)
{
$rp=($cal_usermode)?'18':'0';
$cal_html.=' ';
$cal_html.=(!$month_mode && $cal_size<3 ? f_my_substr($month,0,3,$utf_fl): $month).' ' .$year.' ';
$cal_html.=' '.$nav_prev.' ';
$cal_html.=' '.$nav_next.' ';
}
else
{
$rp=($cal_usermode)?'18':'0';
$cal_html.=' ';
$cal_html.=(!$month_mode && $cal_size<3 ? f_my_substr($month,0,3,$utf_fl): $month).' '.$year.' ';
}
if($cal_usermode)
{
$cal_html.=' ';
$cal_html.='  ';
}
}
$cal_html.=' |
';
// displaying weekday names
foreach (($f_day_ofweek==1?$day_name:$day_name_rev) as $k=>$v)
{
$cal_html.="| ".($month_mode?$v:f_my_substr($v,0,1,$utf_fl))." | ";
}
$cal_html.=($month_mode && !$excl_link_flag? ' | ':'')."
";
$cal_html.=''; // displaying last days from previous month
if($firstday!=0 || ($mon==2 && $days_in_curr_mon==28))
{
$days_prev_mon=($mon==1)?f_days_in_month(12,$year):f_days_in_month(($mon-1),$year);
if($firstday!=0)
{
$t=$days_prev_mon-$firstday+1;
for($i=0; $i<$firstday; $i++){$cal_html.="| $t | ";$t++;}
}
else
{
$t=$days_prev_mon-6;
for($i=0; $i<7; $i++){$cal_html.="$t | ";$t++;} $cal_html.='
';
}
if ($firstday==0 && $mon==2 && $days_in_curr_mon==28) $cal_html.='';
}
for($i=1;$i<=$days_in_curr_mon;$i++) // displaying days from selected month
{
if($cal_pointer>6)
{
$cal_pointer = 0;
if($month_mode && !($cal_js && isset($_GET['link']) && $_GET['link']=='0') )
$cal_html.=' | ';
$cal_html.='
';
$row_counter++;
}
if(array_key_exists(($i), $bg_colors))
{
$day_bgcolors=$bg_colors[$i];
$events_per_day=(isset($events_per_period[$i])? implode("",$events_per_period[$i]): "");
if(cur_day_check($i,$mon,$year)) $cal_html.="1) // visibility
{
if(season_check($day_bgcolors) && count(num_vis_category($day_bgcolors))==1) $clr=current(num_vis_category($day_bgcolors));
else $clr=$category_color[0];
}
else $clr=current($day_bgcolors);
$cal_html.=(!$month_mode?' style="background:'.$clr.'"':'').'>';
$overlib='';$hint_title=''; $hint_text='';
if($cal_usermode && !$month_mode)
{
if($events_per_day!='')
{
$hint_title=$month_name[date('n',mktime(0,0,0,$mon,$i,$year))-1].date(' j, Y',mktime(0,0,0, $mon,$i,$year));
if($cal_js)
{
$buff=str_replace(array('\\"','"',$f_lf,chr(13)), array('"','"',' ',' '), $events_per_day);
$hint_text=str_replace(array('\\"','"','\'','/',$f_lf,chr(13)),array('"','"','\\\\\\\'','\/',' ',' '),$buff);
$overlib=build_overlib($hint_text,$hint_title,true);
}
else
{
$buff=str_replace(array('\\"',$f_lf,chr(13)), array('"',' ',' '),$events_per_day);
$buff=str_replace(array('\'','\\\\'), array('\\\'','\\'),$buff);
$hint_text=htmlspecialchars($buff, ENT_QUOTES);
$overlib=build_overlib($hint_text,$hint_title);
}
}
}
$mark='';
if($count_bgcolors>=1)
{
$index=($count_bgcolors==1)?array_search($day_bgcolors[0],$category_color):0;
if(isset($category_mark[$index]) && $index!==false && $category_mark[$index]!='NA')
{
$loffset=($cal_size>2)?$cal_size-2:0;
$toffset=($cal_size>4)?$cal_size-4:0;
$sz='font-size:'.(14+ ($cal_size)).'px;line-height:'.(17 +$cal_size).'px;left:-'.$cal_size.'px;top:-'.$cal_size.'px;right:-'.$cal_size.'px;';
if(!$month_mode)$sz.='bottom:-'.$cal_size.'px;';
$sz.='vertical-align:middle;margin:0 auto;'; //xxx
if(!$cal_usermode) $sz.='cursor:pointer;';
$m_color=(isset($category_mark_color[$index]) && !empty($category_mark_color[$index])? $category_mark_color[$index]:'#ffffff');
$mark=' '
.$category_mark[$index].' ';
}
}
if($cal_usermode)
{
if($mark=='')$cal_html.=' ' .$i.'';
else $cal_html.=$mark.' '.$i." ";
}
else
{
$url=$s_path.'?action=addevent'.$url_p.'&mday='.$i.'&view='.$view_type;
if($mark!='') $cal_html.=str_replace(' '.$i."";
}
$cal_html.=($month_mode? $f_br.''.$events_per_day.'':'')." | ";
}
else
{
if(cur_day_check($i,$mon,$year)) $cal_html.="";
else $cal_html.=" | ";
if($flag=="admin")
{
$cal_html.="'.$i.'';
}
else $cal_html.=$i;
$cal_html.=' | ';
}
$cal_pointer++;
}
$next_month_days=1; // displaying first days from next month
while($cal_pointer<=6)
{
$cal_html.="$next_month_days | ";
$next_month_days++;
$cal_pointer++;
}
if($month_mode && !$excl_link_flag)
$cal_html.=' | ';
$cal_html.="
"; $row_counter++;
if($row_counter<6 && !$month_mode)
{
$cal_html.="";
$cal_pointer=0;
while($cal_pointer<=6)
{
$cal_html.="| $next_month_days | ";
$next_month_days++;
$cal_pointer++;
}
$cal_html.="
";
}
$cal_html.="
";
$cal_html.=(!$month_mode)?'
':'';
$pginroot=(isset($_GET['root']) && $_GET['root']=='1');
$calinroot=($rel_path=='');
if($cal_js)
{
if($pginroot && !$calinroot) $cal_html=str_replace(array('../','..\/'),'',$cal_html);
elseif(!$pginroot && $calinroot) $cal_html=str_replace(array('src="','src="'),array('src="../','src="..\/'),$cal_html);
}
if((!$cal_js || $pginroot) && $calinroot) $cal_html=str_replace(array('../','..\/'),'',$cal_html);
return $cal_html;
}
//BUILD CALENDAR WEEK TABLE
function build_week($events_raw,$action_id_orig,$mon,$year,$flag,$start_day)
{
global $s_path,$cal_dir,$time_format,$day_name,$month_name,$category_color,$f_day_ofweek,$f_lf,$lg_,$f_br,$f_ct,$cal_cspacing,$css_mday1,$css_day2,
$css_mday2,$css_mday3,$css_calh1,$css_calh2,$css_desc,$css_date,$css_details,$week_mode_wh_only,$utf_fl;
$action_id=($action_id_orig=='showcaljs')?'show':$action_id_orig;
$hours12_array=array('0:00am','1:00am','2:00am','3:00am','4:00am','5:00am','6:00am','7:00am','8:00am','9:00am','10:00am','11:00am','12:00pm', '1:00pm','2:00pm','3:00pm','4:00pm','5:00pm','6:00pm','7:00pm','8:00pm','9:00pm','10:00pm','11:00pm');
$hours_array=array('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23');
$h_array=($time_format==12)?$hours12_array:$hours_array;
$mode='week';
$url_p=$lg_.'&mon='.$mon.'&year='.$year;
settype($start_day,'integer');
$fdaymonth_ts=mktime(0,0,0,$mon,$start_day,$year);
if(($start_day+6)>f_days_in_month($mon,$year))
{
$start_day_fixed=$start_day+6-f_days_in_month($mon,$year);
$ldaymonth_ts=($mon==12)?mktime(23,59,59,1,$start_day_fixed,$year+1):mktime(23,59,59,$mon+1,$start_day_fixed,$year);
}
else $ldaymonth_ts=mktime(23,59,59,$mon,$start_day+6,$year);
$event_records=db_get_events($events_raw,$fdaymonth_ts,$ldaymonth_ts,$flag);
$events_per_period=define_events_by_hours($event_records,$fdaymonth_ts,$ldaymonth_ts,$start_day);
$bg_colors=define_events_by_hours($event_records,$fdaymonth_ts,$ldaymonth_ts,$start_day,'color');
if($f_day_ofweek==2)
{
$temp=$day_name[0];
$day_name_rev=$day_name;
array_shift($day_name_rev);
array_push($day_name_rev,$temp);
}
$cal_html='
';
$cal_html.='| ';
if($action_id_orig=='showcaljs' && isset($_GET['link']) && $_GET['link']=='0')
{ $cal_html.=' '.format_date($fdaymonth_ts).' - '.format_date($ldaymonth_ts).' '; }
else
{
$cal_html.=''.navigation_bar($action_id,$mon,$year,'prev',1,'internal',$mode,$fdaymonth_ts) .' ';
$cal_html.=''.format_date($fdaymonth_ts).' - ' .format_date($ldaymonth_ts).' ';
$cal_html.=''.navigation_bar($action_id,$mon,$year,'next',1,'internal',$mode, $fdaymonth_ts).' ';
$cal_html.='';
}
$cal_html.=' |
';
$cal_html.="| | "; // displaying weekday names
foreach(($f_day_ofweek==1?$day_name:$day_name_rev) as $k=>$v)
{
$temp_ts = $fdaymonth_ts + 24*60*60*$k;
$cal_html.="".f_my_substr($month_name[date('n',$temp_ts)-1], 0, 3, $utf_fl).' '.date('j',$temp_ts).$f_br.$v." | ";
}
$cal_html.="
";
foreach($h_array as $hour=>$val)
{
if($week_mode_wh_only==false || $hour>=9 && $hour<=18)
{
$cal_html.='| $val | ";
for($d=$start_day; $d<=($start_day+6); $d++)
{
if(isset($bg_colors[$d][$hour]))
{
$h_bgcolors = $bg_colors[$d][$hour];
$events_per_day = (isset($events_per_period[$d][$hour])?implode (" ", $events_per_period[$d][$hour]):"");
$buff=$events_per_day;
$cal_html.="';
if(isset($events_per_period[$d][$hour])) $cal_html.=''.$buff.' | ';
else $cal_html.=' ';
}
else $cal_html.=" | ";
}
$cal_html.="
";
}
}
$cal_html.="
";
return $cal_html;
}
//BUILD EVENTS TABLE
function view_events($events_raw,$fdayperiod_ts,$ldayperiod_ts,$flag,$view_type,$_mon,$_year,$event_id='',$old_reg_info='',$f_mail_type='', $all_users=array(),$send_to_list=array(),$send_to_group=array(),$short_form=false)
{
global $rel_path,$s_path,$page_id,$db_events_fname,$cal_dir,$doc_dir,$category_color,$day_name,$month_name,$lang_l,$lg_,$f_lf,$f_br,$f_ct, $time_format,$location_label,$f_db_last_line,$f_max_chars,$category_vis,$hide_expired,$include_hide_button,$read_access,$css_desc,$css_date,$css_details,$css_calurl,$em_enabled,$hint_settings,$em_show_participants,$cal_cspacing,$f_xhtml_on;
$events_html=''; $records=array(); $registered=array();
$recur_flag=($flag=='admin')?false:true;
$embed_form=($event_id!='')?true:false;
$cal_js=(isset($_GET['action'])) && $_GET['action']=='showeventsjs';
$reg_href_url=$s_path;
$pginroot=(isset($_GET['root']) && $_GET['root']=='1');
$calinroot=($rel_path=='');
if($cal_js)
{
if(!$calinroot && $pginroot) $reg_href_url=str_replace('../','',$s_path);
elseif($calinroot && !$pginroot) $reg_href_url='../'.$s_path;
}
if($embed_form==false) $records=db_get_events($events_raw,$fdayperiod_ts,$ldayperiod_ts,$flag);
else $records[]=db_get_specific_event($db_events_fname,$event_id);
$url_p=$lg_.'&mon='.$_mon.'&year='.$_year;
$icon_st=' style="background:transparent;text-decoration:none"';
if(!empty($records))
{
foreach ($records as $key=>$row) {$name[$key]=$row['Start_date'];} // sorting event records by start_date
array_multisort($name,SORT_ASC,$records);
if(!$embed_form && $include_hide_button && !$cal_js) //event manager
{
$hidepast=(isset($_GET['hidepast']) && ($_GET['hidepast']=='true' || $_GET['hidepast']=='1')? $_GET['hidepast']: 'false');
$events_html.='
| '
.' |
";
}
$use_icons=file_exists($cal_dir.'calendar_edit.png');
foreach($records as $k=> $v)
{
if(strpos(urldecode($v['Short_description']),'%%TEMPLATE1%%')===false)
{
if($category_vis[get_cat_index($v['Category'])]==true || $flag=="admin") // visibility
{
$font_color=get_category_info($v['Category'],'color'); //category change
$events_html.="
";
if($flag=="admin") // if admin screen - Edit/Del options
{
$events_html.='';
$events_html.=' ';
else $events_html.='>['.ucfirst($lang_l['edit']).']';
$events_html.=' ';
else $events_html.='>['.ucfirst($lang_l['delete']).']';
$events_html.=' | ';
}
else $events_html.=' | ';
$events_html.=''.format_date($v['Start_date']);
if(date('n j, Y',$v['Start_date'])==date('n j, Y',$v['End_date'])) $events_html.=' | ' ; // one-day event
else $events_html.=' - '.format_date($v['End_date']).''; //multiple-days event
if ($time_format==12) { $t_format='g:i A';$pattern='12:00 AM'; }
else {$t_format='G:i'; $pattern='0:00'; }
if(date($t_format,$v['Start_date'])==date($t_format,$v['End_date']) && date($t_format,$v['Start_date'])==$pattern) //no time
{
$events_html.=' | ';
}
else
{
$events_html.=''.date($t_format, $v['Start_date']);
if(date($t_format,$v['Start_date'])!=date($t_format,$v['End_date'])) $events_html.=" - ".date($t_format, $v['End_date']);
$events_html.=' | ';
}
$em_use=($em_enabled && isset($v['DEADLINE']) && !empty($v['DEADLINE']));
if($em_enabled && ($flag=="admin" || $category_vis[get_cat_index($v['Category'])]==true))
{
$events_html.='';
$events_html.=($em_use? ucfirst($lang_l['deadline']).': '.format_date($v['DEADLINE']): " ").' | ';
}
$events_html.='
';
$events_html.="
| ['.$lang_l['mailing'].']';
$events_html.=' ['.$lang_l['duplicate'].']';
$events_html.=' | ';
}
else $events_html.='> ';
$loc_value=f_sth(urldecode($v['Location']));
$desc_field_value=f_sth(urldecode($v['Short_description']));
$desc_field_value=str_replace('%%TEMPLATE1%%','',$desc_field_value);
$details_fiels_value=f_sth_2(urldecode($v['Details']));
if($f_xhtml_on) $details_fiels_value=str_replace("
","
",$details_fiels_value);
if($cal_js)
{
$desc_field_value=str_replace(array('\\"','"','/'),array('"','"','\/'), $desc_field_value);
$details_fiels_value=str_replace(array('\\"','"','/'),array('"','"','\/'),$details_fiels_value);
}
$events_html.=''.$desc_field_value.' | ';
$events_html.=''.($loc_value!=""? $location_label.': '.$loc_value: " ").' | ';
if($em_enabled) //event manager
{
$events_html.='';
$em_html=' ';
if($em_use && !isset($v['recurType']) && ($flag=="user" || $category_vis[get_cat_index($v['Category'])]==true) )
{
$mktime=my_mktime();
$today_ts=mktime(0,0,0,date("n",$mktime),date("j",$mktime),date("Y",$mktime));
$em_html=ucfirst($lang_l['status']).': ';
if($v['Start_date']<=$today_ts) $em_html.=ucfirst($lang_l['expired']);
elseif($v['DEADLINE']>=$today_ts)
{
$em_html.=ucfirst($lang_l['open']);
if((!$embed_form || isset($_GET['event_id'])) && $flag=="user") { $em_html.=' ['.$lang_l['register'].']';}
}
else $em_html.=ucfirst($lang_l['closed']);
if((!$embed_form || isset($_GET['event_id'])) && $flag=="admin") $em_html.=' ['.$lang_l['register'].']';
}
$events_html.=$em_html.' | ';
}
$events_html.='
';
$events_html.='
';
if(isset($v['USER']) && !empty($v['USER']) && $flag=="admin")
{ $events_html.=ucfirst($lang_l['author']).' ['.f_sth(urldecode($v['USER'])).']'; }
elseif($flag=="admin") { $events_html.=ucfirst($lang_l['author']).' [admin]'; }
$det=f_sth_2(urldecode($v['Details'])); if($f_xhtml_on) $det=str_replace(" "," ",$det);
$events_html.=' | '.$det;
if($flag=="admin" && isset($v['HIDDEN'])) $events_html.=$f_br.f_sth_2($v['HIDDEN']);
$events_html.=' | ';
if($em_enabled) //event manager
{
$events_html.='';
if($em_use && !isset($v['recurType']) && ($flag=="user" || $category_vis[get_cat_index($v['Category'])]==true))
{
$users=f_get_all_users($rel_path,true);
$attendee_list=array();
$registered=db_get_registered();
$events_html.=ucfirst($lang_l['total attendee']).': ';
if(!empty($registered) && isset($registered[$v['Id']]))
{
$events_html.=count($registered[$v['Id']]).' ';
if($flag=="user" && (!$embed_form || isset($_GET['event_id'])) && $v['Start_date']>$today_ts)
$events_html.=$f_br.'['.$lang_l['edit'].'] ['.$lang_l['cancel'].'] '.$lang_l['my registration'].''.$f_br;
$events_html.=$f_br;
if(count($registered[$v['Id']])>5 && !isset($_GET['event_id']))
{ $registered_cut=array_slice($registered[$v['Id']],0,5); }
else { $registered_cut=$registered[$v['Id']]; }
if($flag=="admin")
{
foreach($registered_cut as $m=>$n)
{
$curr_user=$m; $buffer='';
if(isset($users[$curr_user]))
{
$user_details=$users[$curr_user]['details'];
$attendee_list[$curr_user]=f_un_esc(ucfirst($user_details['name']).' '.$user_details['sirname']);
$buffer=f_un_esc($user_details['name'].' '.$user_details['sirname'].$f_br.$user_details['email']);
$notes_value=f_sth(urldecode($registered[$v['Id']][$curr_user]['notes']));
if(!empty($notes_value)) {$buffer.=$f_br.''.f_sth(ucfirst($lang_l['notes'])).':'.$f_br.$notes_value; }
}
$events_html.='::'.$curr_user.'';
$events_html.=' ['.$lang_l['unregister'].']'.$f_br;
}
}
elseif($read_access || $em_show_participants)
{
foreach($registered_cut as $m=>$n)
{
$curr_user=$m;
if(isset($users[$curr_user]))
{
$user_details=$users[$curr_user]['details'];
$events_html.='::'.f_un_esc($user_details['name'].' '.$user_details['sirname']).' '.$f_br;
}
else { $events_html.=':: undefined'.$f_br; }
}
}
if(count($registered[$v['Id']])>5 && !isset($_GET['event_id']))
{
$events_html.='['.$lang_l['click here'].']';
}
}
else { $events_html.='0'; }
}
$events_html.=' | ';
}
$events_html.='
';
}
}
}
if($em_enabled && $embed_form && $f_mail_type=='' && !isset($_GET['event_id'])) //event manager
{
$events_html.="
| ';
if($embed_form)
{
$events_html.=ucfirst($lang_l['notes']).$f_br.' '
.(empty($old_reg_info)?'': ' |
';
}
elseif($em_enabled && $embed_form && $f_mail_type!='' && !isset($_GET['event_id'])) //event manager
{
$mail_settings=get_mailing_settings($f_mail_type);
$def_subject=$mail_settings[$f_mail_type.'_subject'];
$def_message=str_replace(array('
','
'), array($f_lf,$f_lf), $mail_settings[$f_mail_type.'_message']);
$events_html.="
| ' .mailing_form($f_mail_type,$def_subject,$def_message,$send_to_group,$send_to_list,$all_users,$v['Category'],$event_id, $short_form).' |
';
}
elseif($em_enabled) { $events_html.="
| |
'; }
else { $events_html.="
| |
'; }
}
else
{
$events_html.='
|
';
$events_html.="
| '.ucfirst($lang_l['no events']).' |
';
$events_html.="
| |
';
}
$events_html='
';
if($cal_js)
{
$events_html=str_replace(array('\''),array('\\\''),$events_html);
if($pginroot && !$calinroot) $events_html=str_replace(array('../','..\/'),'',$events_html);
elseif(!$pginroot && $calinroot) $events_html=str_replace(array('src="','src="'),array('src="../','src="..\/'),$events_html);
}
if((!$cal_js || $pginroot) && $calinroot) $events_html=str_replace(array('../','..\/'),'',$events_html);
return $events_html;
}
// BUILD ADD/EDIT EVENT forms
function add_event_form($mon,$mday,$year,$view_type)
{
global $page_id,$s_path,$category_name,$category_color,$month_name,$time_format,$lang_l,$lg_,$f_lf,$f_br,$f_ct,$days_in_month_array, $location_label,$em_enabled,$use_editor,$innova_def,$js_innova,$f_fmt_hidden, $ampm_array,$hours_array,$hours12_array, $min_array,$years_array, $repeatPeriod_list,$rel_path,$f_fmt_star,$f_fmt_input_p,$marks_array;
$hidden_value=''; $t_data=get_event_template();
if($time_format==12) $h_array=$hours12_array; else$h_array=$hours_array;
if(!empty($t_data))
{
$location_value=f_sth(urldecode($t_data['Location']));
$hidden_value=(isset($t_data['HIDDEN'])? urldecode($t_data['HIDDEN']): '');
$hidden_value=str_replace($f_br,$f_lf,$hidden_value);
$desc_value=f_sth(urldecode($t_data['Short_description']));
$desc_value=str_replace('%%TEMPLATE1%%','',$desc_value);
$details_value= str_replace($f_br, $f_lf, f_sth_2(urldecode($t_data['Details'])));
}
$output='