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
/**
* class.calendar.php
*
* @package workflow.engine.classes
*
* ProcessMaker Open Source Edition
@@ -44,7 +45,9 @@
*/
class calendar extends CalendarDefinition
{
/**
*
* @param string(32) $userUid
* @param string(32) $proUid
* @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
* 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
* @param string(32) $userUid
@@ -88,9 +92,11 @@ class calendar extends CalendarDefinition
$this->calendarUid = $calendarDefinition['CALENDAR_UID'];
$this->calendarDefinition = $calendarDefinition;
}
/**
* 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.
*
* @author Hugo Loza <hugo@colosa.com>
@@ -120,12 +126,10 @@ class calendar extends CalendarDefinition
$weekDayLabel = date( "l", mktime( $hour, $minute, $second, $month, $day, $year ) );
$dateInt = mktime( $hour, $minute, $second, $month, $day, $year );
$this->addCalendarLog( "**** $weekDayLabel ($weekDay) * $date" );
$sw_week_day = false;
$sw_not_holiday = true;
if (in_array( $weekDay, $this->calendarDefinition['CALENDAR_WORK_DAYS_A'] )) {
$sw_week_day = true;
}
@@ -134,10 +138,10 @@ class calendar extends CalendarDefinition
$this->addCalendarLog( "- Non working Day" );
}
foreach ($this->calendarDefinition['HOLIDAY'] as $key => $holiday) {
//Normalize Holiday date to SAME year of date
$holidayStartA = explode( " ", $holiday['CALENDAR_HOLIDAY_START'] );
$holidayStartA = explode( "-", $holidayStartA[0] );
@@ -165,7 +169,6 @@ class calendar extends CalendarDefinition
} else {
$this->addCalendarLog( "FOUND VALID DATE -> $date" );
//We got a valid day, now get the valid Business Hours
//Here Need to find a rule to get the most nea
$businessHoursA = array ();
@@ -205,8 +208,6 @@ class calendar extends CalendarDefinition
$businessHoursA = $businessHours;
}
}
}
}
@@ -218,10 +219,8 @@ class calendar extends CalendarDefinition
$sw_valid_date = false;
}
}
$return['DATE'] = $date;
$return['TIME'] = $time;
$return['BUSINESS_HOURS'] = $businessHoursA;