\n";
//----------------------------------------------------------------
//------------- FOR EACH CHILD CALENDAR EVENT - process it
//-----------------------------------------------------------------
foreach ($xml->children() as $event) {
$bdate = strtotime($event->OccurrenceStartTime);
$edate = strtotime($event->OccurrenceEndTime);
//$event_count++;
//-------------------------------------------------------------------------------------
//---------------------- CALC EVENT HEIGHT ESTIMATE -----------------------
//------------------------------------------------------------------------------------
//calculate estimated height of this current event child - BEST GUESS ONLY
//** calc $pxHeightEstimate
$pxHeightEstimate = 0;
//estimate title lines
if (strlen($event->Name) > 25) {
//possible 2 line title
$pxHeightEstimate = $pxHeightEstimate + (2 * $eventH1px);
} else {
//possible 1 line title
$pxHeightEstimate = $pxHeightEstimate + $eventH1px;
}
//always a line for time
$pxHeightEstimate = $pxHeightEstimate + $eventTextpx;
//estimate location lines
if (strlen($event->ResourceList) > 45) {
//possible 2 lines of location
$pxHeightEstimate = $pxHeightEstimate + (2 * $eventTextpx);
} elseif (strlen($event->ResourceList) > 0){
//possible 1 line of location
$pxHeightEstimate = $pxHeightEstimate + $eventTextpx;
}
//if location is zero, which is often, no height added
//add in margin - first slide has 30 px at top but rest have 20px
//$pxHeightEstimate = $pxHeightEstimate + 20;
//$$$$debug
//echo "
";
//echo "-------------------------------------";
//echo "Event: ".$event->Name;
//echo "
";
//echo "
";
//echo "pxHeightEstimate: ".$pxHeightEstimate;
//echo "
";
//echo "pxHeightRemaining: ".$pxHeightRemaining;
//echo "
";
//echo "slide Num: ".$numSlides;
//$$$$$$$$$$$$$ Debug
echo '';
echo "";
echo '';
echo "";
echo '';
echo "";
echo '';
echo "";
//-------------------------------------------------------------------------------------
//---------------------- PROCESS THE EVENT -----------------------
//------------------------------------------------------------------------------------
if ($pxHeightEstimate < $pxHeightRemaining) {
//there is enough room for event on current slide
//just add the event to the slide
echo "
\n"
. "
$event->Name
\n"
. "
".date("g:i a",$bdate)." - ".date("g:i a",$edate)."
\n"
. "
$event->ResourceList
\n"
."
\n";
//update remaining px available and subtract 20 px margin
$pxHeightRemaining = $pxHeightRemaining - $pxHeightEstimate - 20;
} else {
//not enough room for event on current slide
//first slide needs to be ACTIVE
if ($numSlides == 0) {
//FIRST EVENT FIRST SLIDE
//create a slide and make it ACTIVE
echo "
\n";
//add event to slide
echo "
\n"
. "
$event->Name
\n"
. "
".date("g:i a",$bdate)." - ".date("g:i a",$edate)."
\n"
. "
$event->ResourceList
\n"
."
\n";
//update remaining px available and subtract 30 margin first event of slide
$pxHeightRemaining = $eventWrapperHeight - $pxHeightEstimate - 38;
//update slide counter - used for indicators
$numSlides++;
} else {
//need a new slide - not the first slide
//first end current slide and start new slide NOT ACTIVE
echo "
\n"
. "
\n";
//add event to slide
echo "
\n"
. "
$event->Name
\n"
. "
".date("g:i a",$bdate)." - ".date("g:i a",$edate)."
\n"
. "
$event->ResourceList
\n"
."
\n";
//update remaining px available and subtract 30px margin first event of slide
$pxHeightRemaining = $eventWrapperHeight - $pxHeightEstimate - 38;
//update slide counter - used for indicators
$numSlides++;
}
}
//$$$$debug
//echo "
";
//echo "pxHeightRemaining After Actual: ".$pxHeightRemaining;
//$$$$$$$$$$$$$ Debug
echo '';
echo "";
//---------------- END OF FOREACH CHILD EVENT
}
//----------------------------------------------------------------
//-----------------FINISH UP CAROUSEL DIVS
//must include closing div for carousel-item
echo "
\n";
//must include closing div inner carousel
echo "
\n";
//-------------------------------------------------------------------------------------
//---------------------- set up the carousel indicators -----------------------
//------------------------------------------------------------------------------------
//set up slide indicators
echo "