当前位置: 首页>>代码示例>>PHP>>正文


PHP DateRange::setFromDate方法代码示例

本文整理汇总了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;
     }
 }
开发者ID:rabbitdigital,项目名称:HRM,代码行数:31,代码来源:AbstractLeaveAllocationService.php

示例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;
 }
开发者ID:abdocmd,项目名称:spmillen,代码行数:45,代码来源:AbstractLeaveAllocationService.php


注:本文中的DateRange::setFromDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。