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


PHP sapp_Global::createDateRangeArray方法代码示例

本文整理汇总了PHP中sapp_Global::createDateRangeArray方法的典型用法代码示例。如果您正苦于以下问题:PHP sapp_Global::createDateRangeArray方法的具体用法?PHP sapp_Global::createDateRangeArray怎么用?PHP sapp_Global::createDateRangeArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sapp_Global的用法示例。


在下文中一共展示了sapp_Global::createDateRangeArray方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: checkweekdaysdatacron

 public function checkweekdaysdatacron($hidstartweek_date, $hidendweek_date, $hidemp, $emp_dept_id, $employeeGroupId, $empJoiningDate)
 {
     $messages = array();
     if ($hidemp != '' && $hidstartweek_date != '' && $hidendweek_date != '') {
         //To get days in the week/month
         $weekDatesArray = sapp_Global::createDateRangeArray($hidstartweek_date, $hidendweek_date);
         //echo
         //End
         $submittedtsdates = $holDates = $weekendDates = $leaveDates = array();
         $startdateObj = DateTime::createFromFormat("Y-m-d", $hidstartweek_date);
         $loopDate = $hidstartweek_date;
         $cal_weekArray = array();
         $yearCalWeekArray = array();
         while (strtotime($loopDate) <= strtotime($hidendweek_date)) {
             $calWeekVal = strftime('%U', strtotime($loopDate));
             $dateYearVal = strftime('%Y', strtotime($loopDate));
             if (!in_array($calWeekVal, $cal_weekArray)) {
                 $cal_weekArray[] = $calWeekVal;
                 $yearCalWeekArray[$calWeekVal][] = $dateYearVal;
             }
             if (!in_array($dateYearVal, $yearCalWeekArray[$calWeekVal])) {
                 $yearCalWeekArray[$calWeekVal][] = $dateYearVal;
             }
             $loopDate = date("Y-m-d", strtotime("+1 day", strtotime($loopDate)));
         }
         $startDateYear = $startdateObj->format("Y");
         /*submitted and approved status dates in a date range*/
         //To get dates of timesheet filled by user of the given duration
         $tsStatus_model = new Timemanagement_Model_Timesheetstatus();
         $resultData = $tsStatus_model->getEachDayTsDateCron($hidemp, $cal_weekArray, $yearCalWeekArray);
         $ts_filled_dates = array();
         if (!empty($resultData)) {
             foreach ($resultData as $resData) {
                 $ts_week_dates = $resData['ts_week_dates'];
                 $ts_weekArray = explode('$', $ts_week_dates);
                 if (count($ts_weekArray) > 0) {
                     foreach ($ts_weekArray as $ts_day) {
                         $ts_day_Array = explode('#', $ts_day);
                         if (in_array($ts_day_Array[0], $weekDatesArray)) {
                             if ($ts_day_Array[1] == 'submitted' || $ts_day_Array[1] == 'approved') {
                                 $submittedtsdates[] = $ts_day_Array[0];
                                 //$ts_day_Array[0] is ts status date
                             }
                         }
                     }
                 }
             }
             $submittedtsdates = array_unique($submittedtsdates);
         }
         /*End*/
         //To get Holidays for the given duration
         $holidayDatesArr = array();
         if (isset($employeeGroupId) && $employeeGroupId != '') {
             $holidaydatesmodel = new Default_Model_Holidaydates();
             $holidayDateslistArr = $holidaydatesmodel->getHolidayDatesListForGroup($employeeGroupId);
             if (!empty($holidayDateslistArr)) {
                 for ($i = 0; $i < sizeof($holidayDateslistArr); $i++) {
                     $holidayDatesArr[$i] = $holidayDateslistArr[$i]['holidaydate'];
                 }
             }
         }
         //End
         //To get Leaves applied by user for the given duration
         $empLeaves = $this->getEmpLeaves($hidemp, $hidstartweek_date, $hidendweek_date);
         if (!empty($empLeaves)) {
             $empleaveDatesArray = array();
             foreach ($empLeaves as $empLeaveRow) {
                 if ($empLeaveRow['leaveday'] == 1) {
                     $leaveDatesArray = sapp_Global::createDateRangeArray($empLeaveRow['from_date'], $empLeaveRow['to_date']);
                 }
                 $empleaveDatesArray = array_merge($empleaveDatesArray, $leaveDatesArray);
             }
         }
         //End
         //To get default not working days(saturday and sunday)
         if ($emp_dept_id != '' && $emp_dept_id != NULL) {
             $weekendDetailsArr = $this->getWeekend($hidstartweek_date, $hidendweek_date, $emp_dept_id);
         }
         //End
         if (isset($holidayDatesArr) && count($holidayDatesArr) > 0) {
             foreach ($holidayDatesArr as $holidayDate) {
                 if (in_array($holidayDate, $weekDatesArray)) {
                     $holDates[] = $holidayDate;
                 }
             }
         }
         if (isset($empleaveDatesArray) && count($empleaveDatesArray) > 0) {
             foreach ($empleaveDatesArray as $empleaveDate) {
                 if (in_array($empleaveDate, $weekDatesArray)) {
                     $leaveDates[] = $empleaveDate;
                 }
             }
         }
         if (isset($weekendDetailsArr) && count($weekendDetailsArr) > 0) {
             foreach ($weekendDetailsArr as $weekendDate) {
                 if (in_array($weekendDate, $weekDatesArray)) {
                     $weekendDates[] = $weekendDate;
                 }
             }
         }
//.........这里部分代码省略.........
开发者ID:lukkyrich,项目名称:sentrifugo,代码行数:101,代码来源:Users.php


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