CODE STYLE class.calendar.php

This commit is contained in:
Fernando Ontiveros
2012-10-09 12:33:39 -04:00
parent 29e93052df
commit 280e882df7

View File

@@ -1,6 +1,7 @@
<?php <?php
/** /**
* class.calendar.php * class.calendar.php
*
* @package workflow.engine.classes * @package workflow.engine.classes
* *
* ProcessMaker Open Source Edition * ProcessMaker Open Source Edition
@@ -44,7 +45,9 @@
*/ */
class calendar extends CalendarDefinition class calendar extends CalendarDefinition
{ {
/** /**
*
* @param string(32) $userUid * @param string(32) $userUid
* @param string(32) $proUid * @param string(32) $proUid
* @param string(32) $tasUid * @param string(32) $tasUid
@@ -74,7 +77,8 @@ class calendar extends CalendarDefinition
/** /**
* setupCalendar is used to generate a valid instance of calendar using $userUid, $proUid and $tasUid * setupCalendar is used to generate a valid instance of calendar using $userUid, $proUid and $tasUid
* to find a valid calendar. If there is no valid calendar then use the Default * to find a valid calendar.
* If there is no valid calendar then use the Default
* *
* @name setupCalendar * @name setupCalendar
* @param string(32) $userUid * @param string(32) $userUid
@@ -88,9 +92,11 @@ class calendar extends CalendarDefinition
$this->calendarUid = $calendarDefinition['CALENDAR_UID']; $this->calendarUid = $calendarDefinition['CALENDAR_UID'];
$this->calendarDefinition = $calendarDefinition; $this->calendarDefinition = $calendarDefinition;
} }
/** /**
* getnextValidBusinessHoursrange is used recursivily to find a valid BusinessHour * getnextValidBusinessHoursrange is used recursivily to find a valid BusinessHour
* for the given $date and $time. This function use all the exeptions defined for * for the given $date and $time.
* This function use all the exeptions defined for
* Working days, Business Hours and Holidays. * Working days, Business Hours and Holidays.
* *
* @author Hugo Loza <hugo@colosa.com> * @author Hugo Loza <hugo@colosa.com>
@@ -120,12 +126,10 @@ class calendar extends CalendarDefinition
$weekDayLabel = date( "l", mktime( $hour, $minute, $second, $month, $day, $year ) ); $weekDayLabel = date( "l", mktime( $hour, $minute, $second, $month, $day, $year ) );
$dateInt = mktime( $hour, $minute, $second, $month, $day, $year ); $dateInt = mktime( $hour, $minute, $second, $month, $day, $year );
$this->addCalendarLog( "**** $weekDayLabel ($weekDay) * $date" ); $this->addCalendarLog( "**** $weekDayLabel ($weekDay) * $date" );
$sw_week_day = false; $sw_week_day = false;
$sw_not_holiday = true; $sw_not_holiday = true;
if (in_array( $weekDay, $this->calendarDefinition['CALENDAR_WORK_DAYS_A'] )) { if (in_array( $weekDay, $this->calendarDefinition['CALENDAR_WORK_DAYS_A'] )) {
$sw_week_day = true; $sw_week_day = true;
} }
@@ -134,10 +138,10 @@ class calendar extends CalendarDefinition
$this->addCalendarLog( "- Non working Day" ); $this->addCalendarLog( "- Non working Day" );
} }
foreach ($this->calendarDefinition['HOLIDAY'] as $key => $holiday) { foreach ($this->calendarDefinition['HOLIDAY'] as $key => $holiday) {
//Normalize Holiday date to SAME year of date //Normalize Holiday date to SAME year of date
$holidayStartA = explode( " ", $holiday['CALENDAR_HOLIDAY_START'] ); $holidayStartA = explode( " ", $holiday['CALENDAR_HOLIDAY_START'] );
$holidayStartA = explode( "-", $holidayStartA[0] ); $holidayStartA = explode( "-", $holidayStartA[0] );
@@ -165,7 +169,6 @@ class calendar extends CalendarDefinition
} else { } else {
$this->addCalendarLog( "FOUND VALID DATE -> $date" ); $this->addCalendarLog( "FOUND VALID DATE -> $date" );
//We got a valid day, now get the valid Business Hours //We got a valid day, now get the valid Business Hours
//Here Need to find a rule to get the most nea //Here Need to find a rule to get the most nea
$businessHoursA = array (); $businessHoursA = array ();
@@ -205,8 +208,6 @@ class calendar extends CalendarDefinition
$businessHoursA = $businessHours; $businessHoursA = $businessHours;
} }
} }
} }
} }
@@ -218,10 +219,8 @@ class calendar extends CalendarDefinition
$sw_valid_date = false; $sw_valid_date = false;
} }
} }
$return['DATE'] = $date; $return['DATE'] = $date;
$return['TIME'] = $time; $return['TIME'] = $time;
$return['BUSINESS_HOURS'] = $businessHoursA; $return['BUSINESS_HOURS'] = $businessHoursA;