⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 check_availability.inc

📁 groupoffice
💻 INC
📖 第 1 页 / 共 2 页
字号:
<?php/*   Copyright SoftSys 2004   Author: Georg Lorenz <georg@lonux.de>   Version: 1.0 Release date: 29 October 2004   This program is free software; you can redistribute it and/or modify it   under the terms of the GNU General Public License as published by the   Free Software Foundation; either version 2 of the License, or (at your   option) any later version. */function set_availability($availability, $from_hour, $to_hour, $event='', $current_date_time=0){	if($event['all_day_event'] == '1')	{		for($hour=$from_hour;$hour<=$to_hour;$hour++)		{			for($min=0;$min<=45;$min+=15)			{				$availability[$hour][$min] = false;			}		}	}else	{		$date = getdate($current_date_time);				$timezone_offset = get_timezone_offset($event['start_time'])*3600;		$event['start_time'] += $timezone_offset;		$timezone_offset = get_timezone_offset($event['end_time'])*3600;		$event['end_time'] += $timezone_offset;				$event_start = getdate($event['start_time']);		$event_end = getdate($event['end_time']);		if($event_start['mday'] == $date['mday'] && $event_start['mon'] == $date['mon'] && $event_start['year'] == $date['year'])		{			if($event_start['mday'] == $event_end['mday'] && $event_start['mon'] == $event_end['mon'] && $event_start['year'] == $event_end['year'])			{				if($event_start['hours'] == $event_end['hours'])				{					for($min=0;$min<$event_end['minutes'];$min+=15)					{						if($event_start['minutes'] <= $min && $event_end['minutes'] >= $min)						{							$availability[$event_start['hours']][$min] = false;						}					}				}else				{					$go_on = true;					for($index=$event_start['hours'];$index<$event_end['hours'];$index++)					{						if($index > $to_hour)						{							$go_on = false;							break;						}						for($min=0;$min<=45;$min+=15)						{							if($event_start['hours'] == $index && $event_start['minutes'] <= $min)							{								$availability[$index][$min] = false;							}elseif($event_start['hours'] < $index)							{								$availability[$index][$min] = false;							}						}					}					if($go_on)					{						for($min=0;$min<$event_end['minutes'];$min+=15)						{							if($event_end['minutes'] >= $min)							{								$availability[$event_end['hours']][$min] = false;							}						}					}				}			}else			{				for($hour=$event_start['hours'];$hour<=$to_hour;$hour++)				{					for($min=0;$min<=45;$min+=15)					{						if($event_start['hours'] == $hour && $event_start['minutes'] <= $min)						{							$availability[$hour][$min] = false;						}elseif($event_start['hours'] < $hour)						{							$availability[$hour][$min] = false;						}					}				}			}		}elseif($event_end['mday'] == $date['mday'] && $event_end['mon'] == $date['mon'] &&	$event_end['year'] == $date['year'])		{			for($hour=$from_hour;$hour<=$event_end['hours'];$hour++)			{				for($min=0;$min<=45;$min+=15)				{					if($event_end['hours'] == $hour && $event_end['minutes'] > $min)					{						$availability[$hour][$min] = false;					}elseif($event_end['hours'] > $hour)					{						$availability[$hour][$min] = false;					}				}			}		}else		{			for($hour=$from_hour;$hour<$to_hour;$hour++)			{				for($min=0;$min<=45;$min+=15)				{					$availability[$hour][$min] = false;				}			}		}	}	return $availability;}//$return_to = isset($_REQUEST['return_to']) ? $_REQUEST['return_to'] : $_SERVER['HTTP_REFERER'];$participants = smart_stripslashes($event['to']);//$calendar_id = isset($event['calendars']) ? $event['calendars'][0] : $calendar_id;$choice['type'] = 'participants';$choice['value'] = $sc_participants;if(isset($_REQUEST['calendar_participants'])){	$choice = explode(':', $_REQUEST['calendar_participants']);	$choice['type'] = $choice[0];	$choice['value'] = $choice[1];	if($choice['type'] == 'calendar')	{		$calendar_id = $choice['value'];		$view_id = 0;	}elseif($choice['type'] == 'view')	{		$view_id = $choice['value'];		$calendar_id = 0;	}}//$period_offset = date_to_unixtime($start_date);$from_hour = 7;$to_hour = 20;$availability_cal = array();$availability_member = array();$availability_merged = array();$member_rows = '';$cal_row = '';if(isset($_POST['day'])){	$new_time = mktime(0, 0, 0,$_POST['month'], $_POST['day'], $_POST['year']);}else{	$new_time = date_to_unixtime($event['start_date']);	}$start_date = date($_SESSION['GO_SESSION']['date_format'], $new_time);$end_date = $start_date;$date_index = date('Ymd', $new_time);$date = getdate($new_time);$day = $date['mday'];$month = $date['mon'];$year = $date['year'];$interval_start_time = local_to_gmt_time(mktime(0,0,0,$date['mon'], $date['mday'], $date['year']));$interval_end_time = local_to_gmt_time(mktime(0,0,0,$date['mon'], $date['mday']+1, $date['year']));$availability_table = new table();$availability_table->set_attribute('class','availability');$availability_table->set_attribute('style','width:100%');$row = new table_row();$th = new table_heading('<h2>'.$sc_participants.'</h2>');$th->set_attribute('class','caption');$th->set_attribute('colspan','2');$row->add_cell($th);$availability_table->add_row($row);if($current_cal = $cal->get_calendar($calendar_id)){	$from_hour = $current_cal['start_hour'];	$to_hour = $current_cal['end_hour'];}for($hour=$from_hour;$hour<=$to_hour;$hour++){	for($min=0;$min<=45;$min+=15)	{		$availability_merged[$hour][$min] = true;	}}$user_profile = $GO_USERS->get_user($GO_SECURITY->user_id);$tmp_participants = empty($participants) ? $user_profile['email'] : $user_profile['email'].','.$participants;		$participants_array = $RFC822->explode_address_list($tmp_participants);for($i=0;$i<sizeof($participants_array);$i++){	if(!empty($participants_array[$i]))	{		$id = 0;    if($member_profile = $GO_USERS->get_user_by_email(smart_addslashes($participants_array[$i])))    {			$id = $member_profile["id"];			$member_events = false;			if($id)			{				$member_events = $cal->get_events_in_array(0, 0, $id, 							$interval_start_time, $interval_end_time);			}						$row = new table_row();						$img = new image('user_small');			$img->set_attribute('style','border:0px;height:16px;width:16px;margin-right:5px;');			$img->set_attribute('align','absmiddle');											if($i == 0)			{				$th = new table_heading($img->get_html().$cal_own_availability);			}else			{				$th = new table_heading($img->get_html().get_name_from_string(stripslashes($participants_array[$i])));			}			$th->set_attribute('class','caption');			$th->set_attribute('style','white-space:nowrap');			$row->add_cell($th);						$cell = new table_cell();			$cell->set_attribute('style','width:100%');			$subtable = new table();			$subtable->set_attribute('style','width:100%');						$subrow = new table_row();			for($hour=$from_hour;$hour<=$to_hour;$hour++)			{				for($min=0;$min<=45;$min+=15)				{					$availability_member[$hour][$min] = true;				}				$tooltip = $hour.':00';								$link = new hyperlink('javascript:goto_event(\''.$hour.'\',\''.($hour+1).'\',\'00\');', $hour);				$link->set_attribute('class','hour');								$subcell = new table_cell($link->get_html());				$subcell->set_attribute('class','hour');				$subcell->set_attribute('colspan','4');				$subcell->set_tooltip(new tooltip($tooltip, $current_cal['name'], 'WRAP'));								$subrow->add_cell($subcell);												}			$subtable->add_row($subrow);									while ($member_event = array_shift($member_events))			{				$availability_member = set_availability($availability_member, $from_hour, $to_hour,$member_event, $new_time);			}			$subrow = new table_row();								for($hour=$from_hour;$hour<=$to_hour;$hour++)			{				for($min=0;$min<=45;$min+=15)				{					$minute = strlen($min) == 1 ? '0'.$min : $min;					$tooltip = $hour.':'.$minute;										$subcell = new table_cell('&nbsp;');																		$subcell->set_tooltip(new tooltip($tooltip, $current_cal['name'], 'WRAP'));					if($availability_member[$hour][$min])					{						$subcell->set_attribute('class','available');												$link = new hyperlink('javascript:goto_event(\''.$hour.'\',\''.($hour+1).'\',\''.$min.'\');', '&nbsp;');						$link->set_attribute('class','hour');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -