function calendar_metabox($object, $box) { ?> <div id="unitCalendar" class="responsive-calendar"> <div class="controls"> <a class="pull-left" data-go="prev"><div class="btn"><i class="glyphicon glyphicon-chevron-left"></i></div></a> <h4><span data-head-year></span> <span data-head-month></span></h4> <a class="pull-right" data-go="next"><div class="btn"><i class="glyphicon glyphicon-chevron-right"></i></div></a> </div> <div class="day-headers"> <div class="day header">Mon</div> <div class="day header">Tue</div> <div class="day header">Wed</div> <div class="day header">Thu</div> <div class="day header">Fri</div> <div class="day header">Sat</div> <div class="day header">Sun</div> </div> <div class="days" data-group="days"> </div> </div> <script src="http://leasing.dmcihomes.com/wp-admin/js/responsive-calendar.js"></script> <?php $start = get_post_meta($object->ID, 'availability_start', true); $end = get_post_meta($object->ID, 'availability_end', true); $dates = getDatesFromRange($start, $end); $temp = getAllBookings($object->ID); $bookedDates = getDatesFromRange($temp['start'], $temp['end']); ?> <script type="text/javascript"> jQuery(document).ready(function() { jQuery('.responsive-calendar').responsiveCalendar({ activateNonCurrentMonths: true, allRows: false, events: { <?php foreach ($dates as $date) { echo "\"" . $date . "\": {},\n"; } ?> <?php foreach ($bookedDates as $bookedDate) { echo "\"" . $bookedDate . "\": {\"class\": \"active booked\"}, \n"; } ?> } }); }); </script> <?php }
<?php $location = get_post_meta(get_the_ID(), 'location', true); $propType = get_post_meta(get_the_ID(), 'property_type', true); $priceRange = get_post_meta(get_the_ID(), 'price_range', true); $calendar = get_post_meta(get_the_ID(), 'property_calendar', true); $start = get_post_meta($calendar['ID'], 'availability_start', true); $end = get_post_meta($calendar['ID'], 'availability_end', true); $dates = getDatesFromRange($start, $end); $galleryIds = get_post_meta(get_the_ID(), '_pods_property_unit_gallery', true); $features = get_post_meta(get_the_ID(), 'unit_features', true); $floorPlans = get_post_meta(get_the_ID(), '_pods_unit_floorplans', true); $leaseType = get_post_meta(get_the_ID(), '_pods_lease_type', true); $unitsLeft = get_post_meta(get_the_ID(), 'units_available', true); $temp = getAllBookings($calendar['ID']); $i = 0; foreach ($temp as $t) { $bookedDates[$i] = getDatesFromRange($t['start'], $t['end']); $i++; } $temp2 = array(); if ($bookedDates) { foreach ($bookedDates as $bd) { foreach ($bd as $b) { array_push($temp2, $b); } } } if ($temp2) { foreach (array_count_values($temp2) as $key => $val) { $temp3[$key] = $unitsLeft - $val;