Exemplo n.º 1
0
    function widget($args, $instance)
    {
        global $post, $framework, $apartments;
        $apartment_list = $apartments->get_apartment_dropwdown_list();
        if (!empty($apartment_list)) {
            if ($instance['autodetect'] == 'yes' and is_singular('tvr_apartment')) {
                $apartment_id = $post->ID;
            } elseif (!empty($instance['apartment_id'])) {
                $apartment_id = $instance['apartment_id'];
            } else {
                $apartment_id = current($apartment_list);
            }
            $apartment = new TVR_Apartment($apartment_id);
            $unavailable_dates = json_encode($apartment->get_unavailable_dates());
            $maximum_guests = $apartment->maximum_guests;
            $hidden_selector = ($instance['autodetect'] == 'yes' and is_singular('tvr_apartment')) ? 'hidden' : '';
            ob_start();
            ?>


		<?php 
            echo $args['before_widget'];
            ?>
			<div class='widget-container tvr_widget_booking' data-apartment_id='<?php 
            echo $post->ID;
            ?>
' id='<?php 
            echo $args['widget_id'];
            ?>
'><div class='full-loader'></div>
				<?php 
            if (!empty($instance['title'])) {
                echo $args['before_title'] . $instance['title'] . $args['after_title'];
            }
            ?>


				<style type='text/css'>
					<?php 
            $styler = new EB_Styler();
            ?>

					.ui-datepicker-<?php 
            echo $post->ID;
            ?>
 table td.available .ui-state-default {
						background: <?php 
            echo $instance['availability_background_color'];
            ?>
;
						border:1px solid <?php 
            echo $styler->lightness($instance['availability_background_color'], '-', '15');
            ?>
;
						color: <?php 
            echo $instance['availability_text_color'];
            ?>
 !important;
					}
					.ui-datepicker-<?php 
            echo $post->ID;
            ?>
 table td.available .ui-state-default:hover {
						background:  <?php 
            echo $styler->lightness($instance['availability_background_color'], '+', '11');
            ?>
;
						border:1px solid <?php 
            echo $instance['availability_background_color'];
            ?>
;
					}

					.ui-datepicker-<?php 
            echo $post->ID;
            ?>
 table td.unavailable .ui-state-default {
						background: <?php 
            echo $instance['unavailability_background_color'];
            ?>
;
						border:1px solid <?php 
            echo $styler->lightness($instance['unavailability_background_color'], '-', '15');
            ?>
;
						color: <?php 
            echo $instance['unavailability_text_color'];
            ?>
 !important;
					}

					.ui-datepicker-<?php 
            echo $post->ID;
            ?>
 table td.past .ui-state-default {
						background: <?php 
            echo $instance['past_background_color'];
            ?>
;
						border:1px solid <?php 
            echo $styler->lightness($instance['past_background_color'], '-', '15');
            ?>
;
						color: <?php 
            echo $instance['past_text_color'];
            ?>
 !important;
					}

					.ui-datepicker-<?php 
            echo $post->ID;
            ?>
 table .ui-datepicker-unselectable.available .ui-state-default {
						background: <?php 
            echo $instance['past_background_color'];
            ?>
 !important;
						border:1px solid <?php 
            echo $styler->lightness($instance['past_background_color'], '-', '15');
            ?>
;
						color: <?php 
            echo $instance['past_text_color'];
            ?>
 !important;
					}

				</style>



				<div class='widget-content'>
					<form class='booking-widget' method='get' action='<?php 
            echo get_permalink($instance['book_now_page']);
            ?>
'>
						<div class='loader'></div>

					<div class='hidden unavailable'><?php 
            echo $unavailable_dates;
            ?>
</div>
					<div class='hidden maximum_guests'><?php 
            echo $maximum_guests;
            ?>
</div>

					<div class='row apartment-selector <?php 
            echo $hidden_selector;
            ?>
'>
						<select class='apartment_id' name='apartment_id'>
							<?php 
            foreach ($apartment_list as $name => $id) {
                $current = $id == $apartment_id ? 'selected="selected"' : '';
                ?>
								<option <?php 
                echo $current;
                ?>
 value='<?php 
                echo $id;
                ?>
'><?php 
                echo $name;
                ?>
</option>
							<?php 
            }
            ?>
						</select>
					</div>



					<div class='section-price' data-price='<?php 
            echo $apartment->default_price;
            ?>
'>
						from <?php 
            echo $framework->get_price_format($apartment->default_price, 'price-' . $post->ID);
            ?>

						<div class='per_time_select'>
						<select class='per_time'>
							<option value='1'>per day</option>
							<option value='7'>per week</option>
							<option value='30'>per month</option>
						</select>
						</div>
					</div>



					<div class='row'>
						<div class='date-col'>
							<label>Check In</label>
							<p>
							<input name='checkin' type='text' data-id='<?php 
            echo $post->ID;
            ?>
'>
							</p>
						</div>

						<div class='date-col'>
							<label>Check Out</label>
							<p>
							<input name='checkout' type='text' data-id='<?php 
            echo $post->ID;
            ?>
'>
							</p>
						</div>
						<div class='guest-col'>
							<label>Guests</label>
							<p>
							<select class='guests' name='guests'>
								<?php 
            for ($i = 1; $i <= $apartment->maximum_guests; $i++) {
                ?>
									<option value='<?php 
                echo $i;
                ?>
'><?php 
                echo $i;
                ?>
</option>
								<?php 
            }
            ?>
							</select>
							</p>
						</div>
					</div>

					<?php 
            $price_display = $framework->get_price_format(0, 'price-' . $post->ID);
            ?>
					<div class='section-total'>
						total: <?php 
            echo $price_display;
            ?>
					</div>

					<?php 
            $permalink_structure = get_option('permalink_structure');
            if (empty($permalink_structure)) {
                ?>
						<input type='hidden' name='p' value='<?php 
                echo $instance['book_now_page'];
                ?>
 '>
					<?php 
            }
            ?>


						<?php 
            echo do_shortcode('[button margin="0px" background="secondary" text="<input type=\'submit\' value=\'Book Now\'>"]');
            ?>

					</form>

				</div>

			</div>
				<?php 
            echo $args['after_widget'];
            ?>

			<?php 
            $output = ob_get_clean();
            echo $output;
        }
    }
Exemplo n.º 2
0
<?php

global $framework;
$styler = new EB_Styler();
$primary_color = $framework->options['primary_color'];
$secondary_color = $framework->options['secondary_color'];
// Determine Images Used More Than Once
$site_content_background_image = $framework->options['site_content_background_image'];
if (!empty($site_content_background_image)) {
    $site_content_background_image = is_numeric($site_content_background_image) ? wp_get_attachment_image_src($site_content_background_image) : array($site_content_background_image);
}
$site_footer_background_image = $framework->options['site_footer_background_image'];
if (!empty($site_footer_background_image)) {
    $site_footer_background_image = is_numeric($site_footer_background_image) ? wp_get_attachment_image_src($site_footer_background_image) : array($site_footer_background_image);
}
?>
html {
	font-family: <?php 
echo $framework->get_font_display('body_font');
?>
;
	background-color: <?php 
echo $framework->options['site_footer_background_color'];
?>
;
	<?php 
if (!empty($site_footer_background_image[0])) {
    ?>
	background-image: url( <?php 
    echo $site_footer_background_image[0];
    ?>