<?php
//--------------------------------------------------------------------------------------------------
// Utilities for our event-fetching scripts.
//
// Requires PHP 5.2.0 or higher.
//--------------------------------------------------------------------------------------------------
// PHP will fatal error if we attempt to use the DateTime class without this being set.
date_default_timezone_set('UTC');
class Event {
// Tests whether the given ISO8601 string has a time-of-day or not
const ALL_DAY_REGEX = '/^\d{4}-\d\d-\d\d$/'; // matches strings like "2013-12-29"
public $title;
public $allDay; // a boolean
public $start; // a DateTime
public $end; // a DateTime, or null
public $properties = array(); // an array of other misc properties
// Constructs an Event object from the given array of key=>values.
// You can optionally force the timeZone of the parsed dates.
public function __construct($array, $timeZone=null) {
$this->title = $array['title'];
if (isset($array['allDay'])) {
// allDay has been explicitly specified
$this->allDay = (bool)$array['allDay'];
}
else {
// Guess allDay based off of ISO8601 date strings
$this->allDay = preg_match(self::ALL_DAY_REGEX, $array['start']) &&
(!isset($array['end']) || preg_match(self::ALL_DAY_REGEX, $array['end']));
}
if ($this->allDay) {
// If dates are allDay, we want to parse them in UTC to avoid DST issues.
$timeZone = null;
}
// Parse dates
$this->start = parseDateTime($array['start'], $timeZone);
$this->end = isset($array['end']) ? parseDateTime($array['end'], $timeZone) : null;
// Record misc properties
foreach ($array as $name => $value) {
if (!in_array($name, array('title', 'allDay', 'start', 'end'))) {
$this->properties[$name] = $value;
}
}
}
// Returns whether the date range of our event intersects with the given all-day range.
// $rangeStart and $rangeEnd are assumed to be dates in UTC with 00:00:00 time.
public function isWithinDayRange($rangeStart, $rangeEnd) {
// Normalize our event's dates for comparison with the all-day range.
$eventStart = stripTime($this->start);
if (isset($this->end)) {
$eventEnd = stripTime($this->end); // normalize
}
else {
$eventEnd = $eventStart; // consider this a zero-duration event
}
// Check if the two whole-day ranges intersect.
return $eventStart < $rangeEnd && $eventEnd >= $rangeStart;
}
// Converts this Event object back to a plain data array, to be used for generating JSON
public function toArray() {
// Start with the misc properties (don't worry, PHP won't affect the original array)
$array = $this->properties;
$array['title'] = $this->title;
// Figure out the date format. This essentially encodes allDay into the date string.
if ($this->allDay) {
$format = 'Y-m-d'; // output like "2013-12-29"
}
else {
$format = 'c'; // full ISO8601 output, like "2013-12-29T09:00:00+08:00"
}
// Serialize dates into strings
$array['start'] = $this->start->format($format);
if (isset($this->end)) {
$array['end'] = $this->end->format($format);
}
return $array;
}
}
// Date Utilities
//----------------------------------------------------------------------------------------------
// Parses a string into a DateTime object, optionally forced into the given timeZone.
function parseDateTime($string, $timeZone=null) {
$date = new DateTime(
$string,
$timeZone ? $timeZone : new DateTimeZone('UTC')
// Used only when the string is ambiguous.
// Ignored if string has a timeZone offset in it.
);
if ($timeZone) {
// If our timeZone was ignored above, force it.
$date->setTimezone($timeZone);
}
return $date;
}
// Takes the year/month/date values of the given DateTime and converts them to a new DateTime,
// but in UTC.
function stripTime($datetime) {
return new DateTime($datetime->format('Y-m-d'));
}
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
基于ASP.NET的办公自动化OA系统项目源码(毕业设计).zip 已获高分通过的毕业设计项目源码,毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。 基于ASP.NET的办公自动化OA系统项目源码(毕业设计).zip 已获高分通过的毕业设计项目源码,毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。基于ASP.NET的办公自动化OA系统项目源码(毕业设计).zip 已获高分通过的毕业设计项目源码,毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。基于ASP.NET的办公自动化OA系统项目源码(毕业设计).zip 已获高分通过的毕业设计项目源码,毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。基于ASP.NET的办公自动化OA系统项目源码(毕业设计).zip 已获高分通过的毕业设计项目源码,毕业设计、期末大作业、课程设计、高分必看,下载下来,简单部署,就可以使用。基于ASP.NET的办公自动化OA系统项目源码(毕业设计).zip 已获高分通过的毕业设计项目源码,毕业设计、期末大作业、
资源推荐
资源详情
资源评论
收起资源包目录
基于ASP.NET的办公自动化OA系统项目源码(毕业设计).zip (1018个子文件)
Global.asax 2KB
MicroForm.ascx 4KB
CreateMicroDataTable.ashx 94KB
CtrlOvertimeForm.ashx 53KB
UsersList.ashx 53KB
CtrlOnDutyFormList.ashx 45KB
Flow.ashx 30KB
MicroDataTable.ashx 26KB
UserOnDuty.ashx 25KB
GetUserPublicInfoForXmSelect.ashx 21KB
CodeTools.ashx 21KB
GetTableAttributes.ashx 19KB
AddMicroDataTableColumn.ashx 19KB
List.ashx 19KB
MicroPublicFormList.ashx 18KB
Control.ashx 18KB
UserOvertime.ashx 18KB
Users.ashx 18KB
CtrlPublicGenService.ashx 18KB
JobTitlePerms.ashx 15KB
RolePerms.ashx 15KB
UserPublicInfoChange.ashx 14KB
MicroDataTableList.ashx 14KB
MicroFormAccept.ashx 14KB
GetSiteData.ashx 12KB
UsersPublicInfoChange.ashx 12KB
MicroFormWithdrawal.ashx 12KB
CtrlMicroForm.ashx 11KB
Message.ashx 11KB
MicroFormApproval.ashx 11KB
General.ashx 9KB
ControlList.ashx 9KB
OnDutyTpl.ashx 8KB
Calendar.ashx 8KB
GetPublicTableList.ashx 8KB
FlowList.ashx 7KB
UserBasicInfo.ashx 7KB
CtrlOvertimeFormList.ashx 7KB
GetParSubLevel.ashx 7KB
CtrlPublicTableField.ashx 7KB
Navigation.ashx 7KB
SyncDomainUsers.ashx 6KB
CheckLogin.ashx 6KB
WorkFlowList.ashx 6KB
WorkFlow.ashx 6KB
UserPassword.ashx 5KB
ModulePerms.ashx 5KB
GetParSubTextValue.ashx 5KB
Register.ashx 5KB
GetMicroFormCode.ashx 5KB
GetLeaveDateTime.ashx 5KB
UserState.ashx 5KB
GetPublicTextValue.ashx 4KB
OnDutyFormList.ashx 3KB
BeforeBatchApprovalCheck.ashx 3KB
OvertimeFormList.ashx 3KB
GetLeaveTips.ashx 3KB
GetPublicXmSelect.ashx 3KB
CtrlPublicBatchOperationKey.ashx 2KB
GetOvertime.ashx 2KB
GetLeaveOvertimeDate.ashx 2KB
FormsUpload.ashx 2KB
Upload.ashx 2KB
GetPublicValue.ashx 2KB
CheckUser.ashx 2KB
MicroFormCheckApproval.ashx 2KB
OnDutyUpload.ashx 2KB
GetDiffTwoDate.ashx 2KB
ChangeApproval.ashx 2KB
UploadAvatar.ashx 2KB
GetFormLinkAddress.ashx 2KB
UploadMultiImage.ashx 2KB
UploadImage.ashx 2KB
HomePage.ashx 2KB
GetOvertimeMax.ashx 2KB
WebSiteTestMail.ashx 2KB
GetFormApplicationTypeTips.ashx 1KB
GetOTStartTime.ashx 1KB
GetLeaveMax.ashx 1KB
VerifyPWD.ashx 987B
Control.aspx 51KB
Console.aspx 23KB
AddMicroDataTableColumn.aspx 18KB
Flow.aspx 14KB
MicroDataTable.aspx 12KB
OnDutyFormList.aspx 10KB
OvertimeFormList.aspx 10KB
Default.aspx 10KB
UserBasicInfo.aspx 9KB
CreateMicroDataTable.aspx 8KB
HomePage.aspx 7KB
GetTime.aspx 7KB
Forms.aspx 7KB
Users.aspx 7KB
Users.aspx 6KB
UserOvertime.aspx 6KB
General.aspx 6KB
MicroFormList.aspx 5KB
CodeTools.aspx 5KB
Message.aspx 5KB
共 1018 条
- 1
- 2
- 3
- 4
- 5
- 6
- 11
资源评论
不安分的小女孩
- 粉丝: 9187
- 资源: 1976
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功