本文整理汇总了PHP中DateRange::setToDate方法的典型用法代码示例。如果您正苦于以下问题:PHP DateRange::setToDate方法的具体用法?PHP DateRange::setToDate怎么用?PHP DateRange::setToDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateRange
的用法示例。
在下文中一共展示了DateRange::setToDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyMoreThanAllowedForADay
/**
*
* @param sfForm $form
* @return boolean
*/
public function applyMoreThanAllowedForADay(LeaveParameterObject $leaveAssignmentData)
{
$fromTime = date('H:i:s', strtotime($leaveAssignmentData->getFromTime()));
$toTime = date('H:i:s', strtotime($leaveAssignmentData->getToTime()));
$totalDuration = 0;
if ($leaveAssignmentData->getFromDate() == $leaveAssignmentData->getToDate()) {
$totalDuration = $this->getLeaveRequestService()->getTotalLeaveDuration($leaveAssignmentData->getEmployeeNumber(), $leaveAssignmentData->getFromDate());
}
if ($totalDuration + $leaveAssignmentData->getLeaveTotalTime() > $this->getWorkShiftDurationForEmployee($leaveAssignmentData->getEmployeeNumber())) {
$dateRange = new DateRange();
$dateRange->setFromDate($leaveAssignmentData->getFromDate());
$dateRange->setToDate($leaveAssignmentData->getToDate());
$searchParameters['dateRange'] = $dateRange;
$searchParameters['employeeFilter'] = $leaveAssignmentData->getEmployeeNumber();
$parameter = new ParameterObject($searchParameters);
$leaveRequests = $this->getLeaveRequestService()->searchLeaveRequests($parameter);
if (count($leaveRequests['list']) > 0) {
foreach ($leaveRequests['list'] as $leaveRequest) {
$this->overlapLeaves[] = $leaveRequest->getLeave();
}
}
return true;
} else {
return false;
}
}
示例2: applyMoreThanAllowedForADay
/**
*
* @param sfForm $form
* @return boolean
*/
public function applyMoreThanAllowedForADay(LeaveParameterObject $leaveAssignmentData)
{
// $fromTime = date('H:i:s', strtotime($leaveAssignmentData->getFromTime()));
// $toTime = date('H:i:s', strtotime($leaveAssignmentData->getToTime()));
$totalDuration = 0;
$empNumber = $leaveAssignmentData->getEmployeeNumber();
$fromDate = $leaveAssignmentData->getFromDate();
$toDate = $leaveAssignmentData->getToDate();
$logger = $this->getLogger();
if ($fromDate == $toDate) {
$totalDuration = $this->getLeaveRequestService()->getTotalLeaveDuration($empNumber, $fromDate);
$workShiftLength = $this->getWorkShiftDurationForEmployee($empNumber);
$totalLeaveTime = $leaveAssignmentData->getLeaveTotalTime();
if ($logger->isDebugEnabled()) {
$logger->debug("fromDate={$fromDate}, toDate={$toDate}, totalDuration={$totalDuration}, " . "workShiftLength={$workShiftLength}, totalLeaveTime={$totalLeaveTime}");
}
// We only show workshift exceeded warning for partial leave days (length < workshift)
if ($totalDuration + $totalLeaveTime > $workShiftLength) {
if ($logger->isDebugEnabled()) {
$logger->debug('Workshift length exceeded!');
}
$dateRange = new DateRange();
$dateRange->setFromDate($fromDate);
$dateRange->setToDate($fromDate);
$searchParameters['dateRange'] = $dateRange;
$searchParameters['employeeFilter'] = $empNumber;
$parameter = new ParameterObject($searchParameters);
$leaveRequests = $this->getLeaveRequestService()->searchLeaveRequests($parameter);
if (count($leaveRequests['list']) > 0) {
$overlapLeave = array();
foreach ($leaveRequests['list'] as $leaveRequest) {
$overlapLeave = $leaveRequest->getLeave();
}
$this->setOverlapLeave($overlapLeave);
}
return true;
}
}
return false;
}