本文整理匯總了PHP中DateRange::setFromDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateRange::setFromDate方法的具體用法?PHP DateRange::setFromDate怎麽用?PHP DateRange::setFromDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類DateRange
的用法示例。
在下文中一共展示了DateRange::setFromDate方法的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;
}