Function Reference: geodir_event_display_calendar

Summary

This function has not been documented yet.

Filters

‘geodir_event_cal_single_day_sunday’ [Line: 1581]

‘geodir_event_cal_single_day_monday’ [Line: 1581]

‘geodir_event_cal_single_day_tuesday’ [Line: 1581]

‘geodir_event_cal_single_day_wednesday’ [Line: 1581]

‘geodir_event_cal_single_day_thursday’ [Line: 1581]

‘geodir_event_cal_single_day_friday’ [Line: 1581]

‘geodir_event_cal_single_day_saturday’ [Line: 1581]

‘geodir_event_cal_single_day_sunday’ [Line: 1581]

Source File

geodir_event_display_calendar() is located in geodir_event_manager/gdevents_template_functions.php [Line: 1474]

Source Code

function geodir_event_display_calendar(){
	$day = $_REQUEST["sday"];
	$monthNames = Array(__("January", GEODIREVENTS_TEXTDOMAIN), __("February", GEODIREVENTS_TEXTDOMAIN), __("March", GEODIREVENTS_TEXTDOMAIN), __("April", GEODIREVENTS_TEXTDOMAIN), __("May", GEODIREVENTS_TEXTDOMAIN), __("June", GEODIREVENTS_TEXTDOMAIN), __("July", GEODIREVENTS_TEXTDOMAIN), __("August", GEODIREVENTS_TEXTDOMAIN), __("September", GEODIREVENTS_TEXTDOMAIN), __("October", GEODIREVENTS_TEXTDOMAIN), __("November", GEODIREVENTS_TEXTDOMAIN), __("December", GEODIREVENTS_TEXTDOMAIN));
	
	if (!isset($_REQUEST["mnth"])) $_REQUEST["mnth"] = date_i18n("n");
	if (!isset($_REQUEST["yr"])) $_REQUEST["yr"] = date_i18n("Y");
	
	$cMonth = $_REQUEST["mnth"];
	$cYear = $_REQUEST["yr"];
	
	$prev_year = $cYear;
	$next_year = $cYear;
	$prev_month = $cMonth-1;
	$next_month = $cMonth+1;
	
	if ($prev_month == 0 ) {
		$prev_month = 12;
		$prev_year = $cYear - 1;
	}
	if ($next_month == 13 ) {
		$next_month = 1;
		$next_year = $cYear + 1;
	}
	$mainlink = $_SERVER['REQUEST_URI'];
	if(strstr($_SERVER['REQUEST_URI'],'?mnth') && strstr($_SERVER['REQUEST_URI'],'&yr'))
	{
		$replacestr = "?mnth=".$_REQUEST['mnth'].'&yr='.$_REQUEST['yr'];
		$mainlink = str_replace($replacestr,'',$mainlink);
	}elseif(strstr($_SERVER['REQUEST_URI'],'&mnth') && strstr($_SERVER['REQUEST_URI'],'&yr'))
	{
		$replacestr = "&mnth=".$_REQUEST['mnth'].'&yr='.$_REQUEST['yr'];
		$mainlink = str_replace($replacestr,'',$mainlink);
	}
	if(strstr($_SERVER['REQUEST_URI'],'?') && !strstr($_SERVER['REQUEST_URI'],'?mnth'))
	{
		$pre_link = $mainlink."&mnth=". $prev_month . "&yr=" . $prev_year;
		$next_link = $mainlink."&mnth=". $next_month . "&yr=" . $next_year;
	}else
	{
		$pre_link = $mainlink."?mnth=". $prev_month . "&yr=" . $prev_year;	
		$next_link = $mainlink."?mnth=". $next_month . "&yr=" . $next_year;
	}
	
	$add_location_filter = '';
	$query_args = array(
						'geodir_event_date_calendar' => strtotime($cYear.'-'.$cMonth),
						'is_geodir_loop' => true,
						'gd_location' => ($add_location_filter) ? true : false,
						'post_type' => 'gd_event',
						'posts_per_page' => -1 // All posts
					);
					
	$all_events = query_posts( $query_args );
	
	$all_event_dates = array();
	if ( !empty( $all_events ) ) {
		foreach ( $all_events as $event ) {
			if ( $event->event_dates != '' ) {
				$all_event_dates = geodir_event_parse_schedule_dates( $event->event_dates, $all_event_dates );
			}
		}
	}
	
	$week_day_format = isset( $_REQUEST['wday'] ) ? (int)$_REQUEST['wday'] : 0;
	
	switch ( $week_day_format ) {
		case 1:
			$day_mon = __( 'Mo', GEODIREVENTS_TEXTDOMAIN );
			$day_tue = __( 'Tu', GEODIREVENTS_TEXTDOMAIN );
			$day_wed = __( 'We', GEODIREVENTS_TEXTDOMAIN );
			$day_thu = __( 'Th', GEODIREVENTS_TEXTDOMAIN );
			$day_fri = __( 'Fr', GEODIREVENTS_TEXTDOMAIN );
			$day_sat = __( 'Sa', GEODIREVENTS_TEXTDOMAIN );
			$day_sun = __( 'Su', GEODIREVENTS_TEXTDOMAIN );
		break;
		case 2:
			$day_mon = __( 'Mon', GEODIREVENTS_TEXTDOMAIN );
			$day_tue = __( 'Tue', GEODIREVENTS_TEXTDOMAIN );
			$day_wed = __( 'Wed', GEODIREVENTS_TEXTDOMAIN );
			$day_thu = __( 'Thu', GEODIREVENTS_TEXTDOMAIN );
			$day_fri = __( 'Fri', GEODIREVENTS_TEXTDOMAIN );
			$day_sat = __( 'Sat', GEODIREVENTS_TEXTDOMAIN );
			$day_sun = __( 'Sun', GEODIREVENTS_TEXTDOMAIN );
		break;
		case 3:
			$day_mon = __( 'Monday', GEODIREVENTS_TEXTDOMAIN );
			$day_tue = __( 'Tuesday', GEODIREVENTS_TEXTDOMAIN );
			$day_wed = __( 'Wednesday', GEODIREVENTS_TEXTDOMAIN );
			$day_thu = __( 'Thursday', GEODIREVENTS_TEXTDOMAIN );
			$day_fri = __( 'Friday', GEODIREVENTS_TEXTDOMAIN );
			$day_sat = __( 'Saturday', GEODIREVENTS_TEXTDOMAIN );
			$day_sun = __( 'Sunday', GEODIREVENTS_TEXTDOMAIN );
		break;
		case 0:
		default:
			$day_mon = __( 'M', GEODIREVENTS_TEXTDOMAIN );
			$day_tue = __( 'T', GEODIREVENTS_TEXTDOMAIN );
			$day_wed = __( 'W', GEODIREVENTS_TEXTDOMAIN );
			$day_thu = __( 'T', GEODIREVENTS_TEXTDOMAIN );
			$day_fri = __( 'F', GEODIREVENTS_TEXTDOMAIN );
			$day_sat = __( 'S', GEODIREVENTS_TEXTDOMAIN );
			$day_sun = __( 'S', GEODIREVENTS_TEXTDOMAIN );
		break;
	}
	
	wp_reset_query();	
?>
n";
		if ( $i < $startday ) {
			echo "";
		} else {
			$cal_date = $i - $startday + 1;
			
			$calday = $cal_date;
			if ( strlen( $cal_date ) == 1 ) {
				$calday = "0" . $cal_date;
			}
			
			$cMonth1 = $cMonth;
			if ( strlen( $cMonth ) == 1 ) {
				$cMonth1 = "0" . $cMonth;
			}
			
			$urlddate = "$cYear$cMonth1$calday";
			
			$thelink = home_url() . "/?geodir_search=1&etype=all&stype=gd_event&s=+&near=&event_calendar=$urlddate";
			
			$the_cal_date = $cal_date;
			if(strlen($the_cal_date)==1){$the_cal_date = '0'.$the_cal_date;}
			$todaydate = "$cYear-$cMonth1-$the_cal_date";
			
			$condition_date = $cYear.'-'.$cMonth1.'-'.$calday;
			
			$event_date = date_i18n('Y-m-d',strtotime($condition_date));
			
			echo "n";
			
		
		}
		if(($i % 7) == 6 ) echo "n";
	}
	?>
 "; if(in_array($event_date, $all_event_dates)){ echo "". ($cal_date) . ""; }else{ echo "". ($cal_date) . ""; } echo "