本文整理匯總了PHP中DateTimeValue::setMinute方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateTimeValue::setMinute方法的具體用法?PHP DateTimeValue::setMinute怎麽用?PHP DateTimeValue::setMinute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DateTimeValue
的用法示例。
在下文中一共展示了DateTimeValue::setMinute方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getEventLimits
function getEventLimits($event, $date, &$event_start, &$event_duration, &$end_modified)
{
$end_modified = false;
if ($event instanceof ProjectEvent) {
$event_start = new DateTimeValue($event->getStart()->getTimestamp() + 3600 * logged_user()->getTimezone());
$event_duration = new DateTimeValue($event->getDuration()->getTimestamp() + 3600 * logged_user()->getTimezone());
} else {
if ($event instanceof ProjectTask) {
/* @var $event ProjectTask */
$work_day_start = new DateTimeValue($date->getTimestamp());
$wsd = user_config_option('work_day_start_time');
$work_day_start->setHour(substr($wsd, 0, strpos($wsd, ':')));
$work_day_start->setMinute(substr($wsd, strpos($wsd, ':') + 1));
if ($event->getStartDate() instanceof DateTimeValue) {
$event_start = new DateTimeValue($event->getStartDate()->getTimestamp() + 3600 * logged_user()->getTimezone());
} else {
if ($event->getTimeEstimate() > 0 && $event->getDueDate() instanceof DateTimeValue) {
$event_start = new DateTimeValue($event->getDueDate()->getTimestamp() + 3600 * logged_user()->getTimezone());
$event_start->advance($event->getTimeEstimate() * -60);
} else {
$event_start = $work_day_start;
}
}
$work_day_end = new DateTimeValue($date->getTimestamp());
$wed = user_config_option('work_day_end_time');
$work_day_end->setHour(substr($wed, 0, strpos($wed, ':')));
$work_day_end->setMinute(substr($wed, strpos($wed, ':') + 1));
if ($event->getDueDate() instanceof DateTimeValue) {
$event_duration = new DateTimeValue($event->getDueDate()->getTimestamp() + 3600 * logged_user()->getTimezone());
} else {
if ($event->getTimeEstimate() > 0 && $event->getStartDate() instanceof DateTimeValue) {
$event_duration = new DateTimeValue($event_start->getTimestamp());
$event_duration->advance($event->getTimeEstimate() * 60);
} else {
$event_duration = $work_day_end;
}
}
}
}
$tomorrow = new DateTimeValue($date->getTimestamp());
$tomorrow->add('d', 1);
if ($event_duration->getTimestamp() > $tomorrow->getTimestamp()) {
$event_duration = new DateTimeValue($tomorrow->getTimestamp());
$end_modified = true;
}
if ($event_start->getTimestamp() < $date->getTimestamp()) {
if (!$event->isRepetitive()) {
$event_start = new DateTimeValue($date->getTimestamp());
} else {
$event_start->setDay($date->getDay());
$event_start->setMonth($date->getMonth());
$event_start->setYear($date->getYear());
}
}
}