Location: PHPKode > projects > Content*Builder > contentbuilder/plugins/events/calendar.inc.php
<?php
/*
* oft gebrauchte globale Variablen ans Template senden
*/
$eventData['calendar']['currentMonth']   = Date_Calc::getMonthFullname($calendarDate->getMonth());
$eventData['calendar']['currentMonthNr'] = $calendarDate->getMonth();
$eventData['calendar']['currentYear']    = $calendarYear;

$calendarMonthArray = Date_Calc::getCalendarMonth($calendarDate->getMonth(), $calendarDate->getYear());
$daysInMonth        = Date_Calc::daysInMonth($calendarDate->getMonth(), $calendarDate->getYear());

/* 
* Durchlaufen aller Tage eines Monats
*/
$weekDayNumber = array();
$dayNumber = array();
$daySet    = array();
$dayEvent  = array();

/*
* Sonntag ist bei getDayOfWeek 0 ... ändern auf 7, damit Berechnungen einfacher werden
*/
$thisWeekDayNumber = $calendarDate->getDayOfWeek();
if($thisWeekDayNumber == 0) {
	$thisWeekDayNumber = 7;
}

/*
* Tages Array mit den Tagen der ersten Woche auffüllen, die nicht
* im Zielmonat liegen
*/

if($thisWeekDayNumber > 1) {
	for($z = 1; $z < $thisWeekDayNumber; $z++) {
		$nextID = count($eventData['day']) + 1;
		$eventData['day'][$nextID]['inWeek'] = $z;
		$eventData['day'][$nextID]['number'] = "";
		$eventData['day'][$nextID]['event']  = "";
		$eventData['day'][$nextID]['set']    = 0;
	}
}

/*
* Tage und Events des Zielmonats in die Array's eintragen
*/
for($y = 1; $y <= $daysInMonth; $y++) {
	$nextID = count($eventData['day']) + 1;
	
	if(strlen($y) < 2) {
		$thisDayNumber = "0".$y;
	} else {
		$thisDayNumber = $y;
	}
	
	$calendarDate->setDay($thisDayNumber);
	
	$eventData['day'][$nextID]['inWeek'] = $calendarDate->getDayOfWeek();
	$eventData['day'][$nextID]['number'] = $thisDayNumber;
	$eventData['day'][$nextID]['event']  = $calendarEvents[$thisDayNumber];
	$eventData['day'][$nextID]['set']    = 1;
}

/*
* Auffüllen des Array mit den Tagen der letzten Woche, die im
* nächsten Monat liegen
*/
if($calendarDate->getDayOfWeek() != 0) {
	for($z = ($calendarDate->getDayOfWeek() + 1); $z <= 7; $z++) {
		$nextID = count($eventData['day']) + 1;
		
		if($z == 7) {
			$eventData['day'][$nextID]['inWeek'] = 0;
		} else {
			$eventData['day'][$nextID]['inWeek'] = $z;
		}
		
		$eventData['day'][$nextID]['number'] = "";
		$eventData['day'][$nextID]['event']  = "";
		$eventData['day'][$nextID]['set']    = 0;
	}
}
?>
Return current item: Content*Builder