Function Reference: geodir_getDays

Summary

This function has not been documented yet.

Source File

geodir_getDays() is located in geodir_event_manager/gdevents_functions.php [Line: 280]

Source Code

function geodir_getDays($year, $startMonth=1, $startDay=1, $dayOfWeek='', $week_e = '', $check_full_start_year='', $check_full_end_year='') {
	
	$start = new DateTime(
			sprintf('%04d-%02d-%02d', $year, $startMonth, $startDay)
	);
	$start->modify($dayOfWeek);
	$end   = new DateTime(
			sprintf('%04d-12-31', $year)
	);
	$end->modify( '+1 day' );
	
	$interval = new DateInterval('P1W');
	$period   = new DatePeriod($start, $interval, $end);
	
	$dates_array = array();
	
	foreach ($period as $dt) {
		
		$date_explode = explode('-', $dt->format("Y-m-d"));
		
		$get_year = $date_explode[0];
		$get_month = $date_explode[1];
		$get_date = $date_explode[2];
		
		$check_get_date = date_i18n('Y-m-d', strtotime($get_year.'-'.$get_month.'-'.$get_date));
		
		if($get_month <= $startMonth)
		{
			if($week_e == '')
			{
				if($check_get_date <= $check_full_end_year && $check_get_date >= $check_full_start_year)
					$dates_array[] = $dt->format("Y-m-d");
			}
			
			
			$monthName = date_i18n("F", mktime(0, 0, 0, $get_month, 10));
			
			if($week_e != '')
			{
				$date_check = date_i18n("Y-m-d", strtotime("$week_e $dayOfWeek of $monthName $get_year"));
				
				if($date_check <= $check_full_end_year && $date_check >= $check_full_start_year)
					$dates_array[] = $date_check;
				
			}
		}
	
	}
	
	return $result = array_unique($dates_array);
}