public function coupon_content($content) { global $wpdb, $post, $wtd_plugin, $wtd_connector, $wp_query; if (!is_singular('wtd_coupon') || !in_the_loop()) { return $content; } if ($post->post_type == 'wtd_coupon') { remove_filter('the_content', 'theme_formatter', 99); remove_filter('the_content', 'wpautop', 99); $query = "SELECT\n\t\t\t\t\t\t\t\tp.post_name\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\twp_posts p,\n\t\t\t\t\t\t\t\twp_postmeta pm\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tpm.post_id = p.ID\n\t\t\t\t\t\t\tAND pm.meta_value = 'coupons_page'\n\t\t\t\t\t\t\tAND\tp.post_type = 'page'"; $coupons_page = $wpdb->get_var($query); $coupons_page = site_url() . '/' . $wtd_plugin['url_prefix'] . '/' . $coupons_page . '/'; ob_start(); ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/coupon_print.css?wtd_version=' . WTD_VERSION; ?> " media="print"/> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_coupons_page.css?wtd_version=' . WTD_VERSION; ?> " media="screen"/> <div ng-app="couponApp" ng-controller="couponCtrl"> <div class="coupon-header" layout="row" layout-align="space-between start"> <a href="javascript: history.go(-1);">Back to Coupons List</a> <a href="javascript:sendEmail();">Email</a> <a href="javascript:window.print();">Print</a> </div> <div layout="row" layout-align="center center" ng-hide="progress == false" layout-padding> <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular> </div> <div id="wtd_coupon_sc_container" ng-hide="progress == true"> <div class="wtd_single_coupon_container" id="wtd_parse_content"></div> </div> </div><?php wtd_copyright(); $base_request = $wtd_connector->get_base_request(); $base_request['coupon_id'] = $wp_query->query['wtd_parse_id']; ?> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/parse_init.js"></script> <script> var wtd_base_request = <?php echo json_encode($base_request); ?> ; </script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/single_pages/coupon.js"></script><?php $content = ob_get_clean(); } return $content; }
public function content($res_id) { global $wtd_connector; ob_start(); ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_week_page.css?wtd_version=' . WTD_VERSION; ?> " media="screen"/><?php $wtd_base_request = $wtd_connector->get_base_request(); $start_date = new DateTime(); $start = date('c'); $end = date('c', time() + 7 * 24 * 60 * 60); $wtd_base_request['resorts'] = array($res_id); //$wtd_base_request['start'] = $start; //$wtd_base_request['end'] = $end; ?> <div ng-app="specialsWeekApp" ng-controller="specialsWeekCtrl"> <div layout="row" layout-align="space-between center" ng-hide="progress == true"> <md-button ng-click="get_last_week()">Last Week</md-button> <md-button ng-click="get_next_week()">Next Week</md-button> </div> <div layout="row" layout-align="center center" ng-hide="progress == false" layout-padding> <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular> </div> <div id="wtd_listing_sc_container" ng-hide="progress == true"></div> </div> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/parse_init.js"></script> <script> var wtd_base_request = <?php echo json_encode($wtd_base_request); ?> ; var start = new Date('<?php echo $start; ?> '); var end = new Date('<?php echo $end; ?> '); </script> <script src="<?php echo WTD_PLUGIN_URL; ?> assets/js/pages/special_week.js"></script><?php wtd_copyright(); $content = ob_get_clean(); return $content; }
public function dining_content($content) { global $wpdb, $post, $wtd_plugin, $wtd_connector, $wp_query; if (!is_singular('wtd_dining') || !in_the_loop()) { return $content; } if ($post->post_type == 'wtd_dining') { $query = "SELECT\n\t\t\t\t\t\t\t\tp.post_name\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\twp_posts p,\n\t\t\t\t\t\t\t\twp_postmeta pm\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\tpm.post_id = p.ID\n\t\t\t\t\t\t\tAND pm.meta_value = 'dining_page'\n\t\t\t\t\t\t\tAND\tp.post_type = 'page'"; $dining_page = $wpdb->get_var($query); $dining_page = site_url() . '/' . $wtd_plugin['url_prefix'] . '/' . $dining_page . '/'; ob_start(); $res_id = get_post_meta($post->ID, 'res_id', true); ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_dining_page.css?wtd_version=' . WTD_VERSION; ?> " media="screen"/> <div ng-app="diningApp" ng-controller="diningCtrl"> <div layout="row" layout-align="center center" ng-hide="progress == false" layout-padding> <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular> </div> <div class="wtd_single_listing_container" id="wtd_parse_content" ng-hide="progress == true"></div> </div><?php wtd_copyright(); $base_request = $wtd_connector->get_base_request(); $base_request['dining'] = true; $base_request['object_id'] = $wp_query->query['wtd_parse_id']; ?> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> assets/js/parse_init.js"></script> <script> var wtd_base_request = <?php echo json_encode($base_request); ?> ; var parent_page = '<?php echo $dining_page; ?> '; </script> <script type="text/javascript" src="<?php echo WTD_PLUGIN_URL; ?> assets/js/single_pages/dining.js"></script><?php $content = ob_get_clean(); } return $content; }
private function results($content, $res_id) { global $wtd_connector; ob_start(); ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_frontend.css?wtd_version=' . WTD_VERSION; ?> " media="screen"/> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_coupons_page.css?wtd_version=' . WTD_VERSION; ?> " media="screen"/> <div layout="row" layout-align="center center" ng-hide="progress == false" layout-padding> <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular> </div> <div id="wtd_coupon_sc_container" layout="column" layout-align="center center" ng-hide="progress == true"></div><?php $wtd_base_request = $wtd_connector->get_base_request(); $wtd_base_request['resorts'] = array($res_id); $wtd_base_request['page'] = 1; ?> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/parse_init.js"></script> <script> var wtd_base_request = <?php echo json_encode($wtd_base_request); ?> ; var wtd_parse_page = 1; </script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/pages/coupons.js"></script><?php wtd_copyright(); $content = ob_get_clean(); return $content; }
public function single_event($content) { global $wtd_plugin, $post, $wpdb, $wp_query, $wtd_connector; if (!is_singular('wtd_event') || !in_the_loop()) { return $content; } if ($post->post_type == 'wtd_event') { // todo hook up to resort id to call the correct page $query = "SELECT\n\t\t\t\t\t\t\tp.post_name\n\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\twp_posts p,\n\t\t\t\t\t\t\twp_postmeta pm\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tpm.post_id = p.ID\n\t\t\t\t\t\tAND pm.meta_value = 'calendar_page'\n\t\t\t\t\t\tAND\tp.post_type = 'page'"; $calendar_page = $wpdb->get_var($query); $calendar_page = site_url() . '/' . $wtd_plugin['url_prefix'] . '/' . $calendar_page . '/'; remove_filter('the_content', 'theme_formatter', 99); remove_filter('the_content', 'wpautop', 99); ob_start(); ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . '/assets/css/wtd_calendar_page.css?wtd_version=' . WTD_VERSION; ?> "/> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_activities_page.css?wtd_version=' . WTD_VERSION; ?> "/><?php $base_request = $wtd_connector->get_base_request(); $base_request['event_id'] = $wp_query->query['wtd_parse_id']; $iPod = stripos($_SERVER['HTTP_USER_AGENT'], "iPod"); $iPhone = stripos($_SERVER['HTTP_USER_AGENT'], "iPhone"); $iPad = stripos($_SERVER['HTTP_USER_AGENT'], "iPad"); $mac = stripos($_SERVER['HTTP_USER_AGENT'], "Mac"); //if($iPod || $iPhone || $iPad || $mac): ?> <form method="post" id="ical"> <input type="hidden" name="wtd_data" id="ical_wtd_data" value=""/> <input type="hidden" name="wtd_build_ical" value="1"/> <a href="javascript:jQuery('#ical').submit()" class="wtd_ical_button">Add to iCal</a> </form><?php //endif; ?> <div ng-app="eventApp" ng-controller="eventCtrl"> <div layout="row" layout-align="center center" ng-hide="progress == false" layout-padding> <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular> </div> <div id="wtd_event_sc_container" ng-hide="progress == true" ng-bind-html="content"></div> </div><?php wtd_copyright(); ?> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/parse_init.js"></script> <script> var wtd_base_request = <?php echo json_encode($base_request); ?> ; var return_page = '<?php echo $calendar_page; ?> '; </script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/single_pages/event.js"></script><?php $content = ob_get_clean(); } return $content; }
public function page_content($content) { global $wtd_connector, $post; if (!is_singular('page') || !in_the_loop()) { return $content; } $wtd_pages = get_option('wtd_pages'); $res_id = get_post_meta($post->ID, 'res_id', true); $page_type = get_post_meta($post->ID, 'wtd_page', true); if (!empty($wtd_pages['specials_pages'][$res_id]) && $page_type == 'specials_page') { if (in_array($post->ID, $wtd_pages['specials_pages'])) { ob_start(); $res_id = get_post_meta($post->ID, 'res_id', true); ?> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script><?php $step = 24 * 60 * 60; $start = strtotime(date('Y-m-1')); while (date('l', $start) != "Sunday") { $start = $start - $step; } $end = strtotime(date('Y-m-t')); while (date('l', $end) != "Sunday") { $end = $end + $step; } $start = date('c', $start); $end = date('c', $end); $wtd_base_request = $wtd_connector->get_base_request(); $wtd_base_request['resorts'] = array($res_id); ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . '/assets/css/wtd_calendar_page.css'; ?> "/> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/parse_init.js"></script> <script> var base_request = <?php echo json_encode($wtd_base_request); ?> ; var wtd_start_date = new Date('<?php echo $start; ?> '); var wtd_end_date = new Date('<?php echo $end; ?> '); var res_id = '<?php echo $res_id; ?> '; </script> <div ng-app="specialsCalendarApp" ng-controller="calendarCtrl"> <div flex="100" layout="row" layout-align="space-between center" layout-padding layout-margin style="font-weight:bold;" ng-hide="progress == true"> <a id="prev_month" ng-click="get_last_month()"> « Previous Month </a> <span id="current_month"></span> <a id="next_month" ng-click="get_next_month()"> Next Month » </a> </div> <div id="wtd_events" ng-hide="progress == true"> <div id="events_header" layout="row" layout-padding hide-sm style="font-weight: bold;"> <span flex>Sun</span> <span flex>Mon</span> <span flex>Tues</span> <span flex>Wed</span> <span flex>Thurs</span> <span flex>Fri</span> <span flex>Sat</span> </div> </div> <div id="dates" ng-hide="progress == true"></div> <div layout="row" layout-align="center center" ng-hide="progress == false" layout-padding> <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular> </div> </div> <script type="text/javascript" src="<?php echo WTD_PLUGIN_URL; ?> assets/js/pages/special.js"></script><?php wtd_copyright(); $content = ob_get_clean(); } } return $content; }
private function results($res_id, $cat_id, $subcat_id) { ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_activities_page.css?wtd_version=' . WTD_VERSION; ?> " media="screen"/> <!-- Angular Material Dependencies --> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_frontend.css?wtd_version=' . WTD_VERSION; ?> " media="screen"/> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-route.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-animate.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.9/angular-aria.min.js"></script> <script src="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.4/angular-material.min.js"></script> <link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/angular_material/1.0.4/angular-material.min.css"> <div ng-app="activitiesApp" ng-controller="activitiesCtrl"> <div layout="row" layout-sm="column" layout-padding><?php global $wp_query, $post, $wtd_plugin, $wtd_connector; $wtd_base_request = $wtd_connector->get_base_request(); $wtd_base_request['resorts'] = array($res_id); $wtd_base_request['page'] = 1; //$cat_id = $wp_query->query['wtdc']; $wtd_base_request['category_id'] = $cat_id; if (!empty($subcat_id)) { $wtd_base_request['category_id'] = $subcat_id; } else { $subcat_id = ''; } $wtd_excluded_cats = get_option('wtd_excluded_cats'); if (!empty($wtd_excluded_cats)) { $wtd_base_request['excluded_categories'] = json_decode($wtd_excluded_cats); } ?> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/parse_init.js"></script> <script> var wtd_categories = <?php echo json_encode($this->wtd_categories); ?> ; var wtd_base_request = <?php echo json_encode($wtd_base_request); ?> ; var cat_id = '<?php echo $cat_id; ?> '; var subcat_id = '<?php echo $subcat_id; ?> '; var wtd_parse_page = 1; var cur_category = '<?php echo $cat_id; ?> '; </script> <script src="<?php echo WTD_PLUGIN_URL; ?> assets/js/pages/activities.js"></script> </div> <div id="wtd_listing_sc_container" name="wtd_listing_sc_container">test</div><?php wtd_copyright(); ?> </div> <?php }
private function results() { global $wp_query, $post, $wtd_plugin, $wtd_connector; $res_id = get_post_meta($post->ID, 'res_id', true); $query = new ParseQuery("resort"); try { $resort = $query->get($res_id); // The object was retrieved successfully. } catch (ParseException $ex) { error_log($ex->getMessage()); } $cat_id = get_query_var('wtds'); if (empty($cat_id) && isset($_GET['wtds'])) { $cat_id = $_GET['wtds']; } // get parent category $query = new ParseQuery('resortParentCategories'); $query->equalTo('cat_class', 'D'); $query->equalTo('resortObjectId', $resort); $parent_cat = $query->find(); $parent_cat = $parent_cat[0]; // get category if its set if (!empty($cat_id)) { $query = new ParseQuery('resortCategory'); try { $cat = $query->get($cat_id); } catch (\Parse\ParseException $ex) { var_dump($ex); } } // parent restriction query $parent_cat_query = new ParseQuery('resortParentCategories'); $parent_cat_query->equalTo('objectId', $parent_cat->getObjectId()); // subcategory query $query = new ParseQuery('resortCategory'); $query->matchesQuery('parentResCatObjectId', $parent_cat_query); $query->greaterThan('diningCnt', 0); $query->ascending('name'); $categories = $query->find(); ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . 'assets/css/wtd_activities_page.css?wtd_version=' . WTD_VERSION; ?> " media="screen"/> <div ng-app="diningApp" ng-controller="diningCtrl"> <div layout="row" layout-sm="column" layout-padding><?php if ($wtd_plugin['dining_page_type'] == 3) { ?> <ul layout="column"><?php for ($i = 0; $i < count($categories); $i++) { $category = $categories[$i]; $category_url_name = strtolower($parent_cat->get('name')); $category_url_name = str_replace(' ', '-', $category_url_name); $category_url_name = str_replace('/', '-', $category_url_name); $subcategory_url_name = strtolower($category->get('name')); $subcategory_url_name = str_replace(' ', '-', $subcategory_url_name); $subcategory_url_name = str_replace(',', '', $subcategory_url_name); $subcategory_url_name = str_replace('/', '-', $subcategory_url_name); $url = site_url() . '/' . $post->post_name . '/whattodo/' . $category_url_name . '/' . $parent_cat->getObjectId() . '/' . $subcategory_url_name . '/' . $category->getObjectId() . '/'; ?> <li class="wtd_subcategory_menu_item <?php echo $category->getObjectId() == $wp_query->query['wtds'] ? 'active' : ''; ?> "> <a href="<?php echo $url; ?> "><?php echo $category->get('name'); ?> </a> </li><?php } ?> </ul><?php } if ($wtd_plugin['dining_page_type'] == 2) { $column_size = 100; } else { $column_size = 75; } ?> <div layout="row" layout-align="center start" ng-hide="progress == false" layout-padding flex="100"> <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular> </div> <div layout="column" flex="<?php echo $column_size; ?> " flex-sm="100" ng-hide="progress == true"> <div layout="row" style="margin-bottom: 5px;"> <a id="parent_<?php echo $post->ID; ?> _header" href="<?php echo get_post_permalink($post->ID); ?> " class="wtd_pull_left"><?php echo $post->post_title; ?> </a><?php if (!empty($parent_cat_id)) { $category_url_name = strtolower($parent_cat->get('name')); $category_url_name = str_replace(' ', '-', $category_url_name); $url = site_url() . '/' . $wtd_plugin['url_prefix'] . '/' . $post->post_name . '/whattodo/' . $category_url_name . '/' . $parent_cat->getObjectId() . '/'; ?> <span class="wtd_bread_separator">></span> <a id="parent_<?php echo $parent_cat->getObjectId(); ?> _header" class="wtd_pull_left" href="<?php echo $url; ?> "><?php echo $parent_cat->get('name'); ?> </a><?php } if ($wtd_plugin['dining_page_type'] == 2) { ?> <span class="wtd_bread_separator">></span> <select class="wtd_subcategory_navigator"> <option>Select Subcategory</option><?php for ($i = 0; $i < count($categories); $i++) { $category = $categories[$i]; $category_url_name = strtolower($parent_cat->get('name')); $category_url_name = str_replace(' ', '-', $category_url_name); $category_url_name = str_replace('/', '-', $category_url_name); $subcategory_url_name = strtolower($category->get('name')); $subcategory_url_name = str_replace(' ', '-', $subcategory_url_name); $subcategory_url_name = str_replace(',', '', $subcategory_url_name); $subcategory_url_name = str_replace('/', '-', $subcategory_url_name); $url = site_url() . '/' . $post->post_name . '/whattodo/' . $category_url_name . '/' . $parent_cat->getObjectId() . '/' . $subcategory_url_name . '/' . $category->getObjectId() . '/'; $selected = ''; if ($cat_id == $category->getObjectId()) { $selected = ' selected="selected"'; } echo '<option value="' . $url . '" ' . $selected . '>' . $category->get('name') . '</option>'; } ?> </select><?php } elseif (!empty($cat_id)) { ?> <span class="wtd_bread_separator">></span> <span class="wtd_current_cat"><?php echo $cat->name; ?> </span><?php } ?> </div> <script> jQuery('.wtd_subcategory_navigator').change(function(){ var val = jQuery('.wtd_subcategory_navigator option:selected').val(); if(val) window.location = val; }); </script> <div layout="row" layout-align="center center" ng-hide="progress == false" layout-padding> <md-progress-circular class="md-primary" md-mode="indeterminate"></md-progress-circular> </div> <div id="wtd_listing_sc_container" layout="column" layout-align="start start"></div> </div> </div> </div><?php $wtd_base_request = $wtd_connector->get_base_request(); $wtd_base_request['resorts'] = array($res_id); $wtd_base_request['page'] = 1; $subcat_id = ""; if (!empty($cat)) { $subcat_id = $cat->getObjectId(); } if (!empty($subcat_id)) { $wtd_base_request['category_id'] = $subcat_id; } ?> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/parse_init.js"></script> <script> var wtd_categories = <?php echo json_encode($this->wtd_categories); ?> ; var wtd_base_request = <?php echo json_encode($wtd_base_request); ?> ; var cat_id = '<?php echo $cat_id; ?> '; var subcat_id = '<?php echo $subcat_id; ?> '; var wtd_parse_page = 1; var cur_category = '<?php echo $cat_id; ?> '; </script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/pages/dining.js"></script><?php wtd_copyright(); }
public function page_content($content) { global $wtd_plugin, $wtd_connector, $post, $wpdb; if (!is_singular('page') || !in_the_loop()) { return $content; } $wtd_pages = get_option('wtd_pages'); if (!empty($wtd_pages['specials_pages'])) { if (in_array($post->ID, $wtd_pages['specials_pages'])) { ob_start(); $res_id = get_post_meta($post->ID, 'res_id', true); ?> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script><?php $step = 24 * 60 * 60; $first_day = date('Y-m-1'); $temp_arr = explode('-', $first_day); $first_timestamp = strtotime($first_day); if ($temp_arr[1] == 12) { $next_month = 1; $next_year = intval(date('Y')) + 1; $prev_month = 11; $prev_year = date('Y'); } elseif ($temp_arr[1] == 1) { $next_month = 2; $next_year = date('Y'); $prev_month = 12; $prev_year = intval(date('Y')) - 1; } else { $next_month = $temp_arr[1] + 1; $prev_month = $temp_arr[1] - 1; $prev_year = $next_year = date('Y'); } $next_month_name = date('F', strtotime($temp_arr[0] . '-' . $next_month . '-1')); $prev_month_name = date('F', strtotime($temp_arr[0] . '-' . $prev_month . '-1')); $current_day_week = date('l', $first_timestamp); $current_timestamp = $first_timestamp; $start = strtotime(date('Y-m-1')); while (date('l', $start) != "Sunday") { $start = $start - $step; } $end = strtotime(date('Y-m-t')); while (date('l', $end) != "Sunday") { $end = $end + $step; } $start = date('c', $start); $end = date('c', $end); //Next Month $next_start = strtotime(date($next_year . '-' . $next_month . '-1')); while (date('l', $next_start) != "Sunday") { $next_start = $next_start - $step; } $next_end = strtotime($next_year . '-' . $next_month . '-1'); $next_end = strtotime(date('Y-m-t', $next_end)); while (date('l', $next_end) != "Sunday") { $next_end = $next_end + $step; } $next_start = date('c', $next_start); $next_end = date('c', $next_end); //Previous Month $prev_start = strtotime(date($prev_year . '-' . $prev_month . '-1')); while (date('l', $prev_start) != "Sunday") { $prev_start = $prev_start - $step; } $prev_end = strtotime($prev_year . '-' . $prev_month . '-1'); $prev_end = strtotime(date('Y-m-t', $prev_end)); while (date('l', $prev_end) != "Sunday") { $prev_end = $prev_end + $step; } $prev_start = date('c', $prev_start); $prev_end = date('c', $prev_end); $wtd_base_request = $wtd_connector->get_base_request(); $resort = $wpdb->get_var($wpdb->prepare("SELECT wtd_term_id FROM {$wpdb->prefix}wtd_meta WHERE term_id = %s AND meta_key = 'res_id'", $res_id)); $wtd_base_request['resorts'] = array($resort); ?> <link rel="stylesheet" href="<?php echo WTD_PLUGIN_URL . '/assets/css/wtd_calendar_page.css'; ?> "/> <script src="//www.parsecdn.com/js/parse-1.3.5.min.js"></script> <script src="<?php echo WTD_PLUGIN_URL; ?> /assets/js/parse_init.js"></script> <script> var wtd_start_date = "<?php echo $start; ?> "; var wtd_end_date = "<?php echo $end; ?> "; var wtd_year = "<?php echo date('Y'); ?> "; var wtd_month = "<?php echo date('m'); ?> "; var win_width = jQuery(window).width(); function calendar_repair(){ if(jQuery('#dates .small-events').length > 0){ var max_height = 0; jQuery('#dates .small-events').each(function(){ var height = jQuery(this).height(); if(max_height < height) max_height = height; }); jQuery('#dates .day').height(1.5 * max_height); } var width = jQuery('#events_header span').first().width(); var relative = width / 5; relative = relative + 'px'; jQuery('#events_header span').attr('style', 'font-size:' + relative); var width = jQuery('#dates .day').first().width(); var relative = width / 8; relative = relative + 'px'; jQuery('.current_date').attr('style', 'font-size:' + relative); if(jQuery('.day.type1').length > 0){ jQuery('.day img').first().load(function(){ var imgwidth = jQuery(this).width(); jQuery('.day img').each(function(){ var height = jQuery(this).height(); if(imgwidth != height && height){ var diff = (imgwidth - height) / 2; jQuery(this).css({'margin': diff + "px 0px"}); } }); if(win_width > 768) jQuery('#dates .day').height(1.3 * imgwidth); else jQuery('#dates .day').height(1.3 * imgwidth); }); } if(jQuery('.day.type2').length > 0){ jQuery('.day img').first().load(function(){ var imgwidth = jQuery(this).width(); jQuery('.day img').each(function(){ var height = jQuery(this).height(); if(width != height && height){ var diff = (imgwidth - height) / 2; jQuery(this).css({'margin': diff + "px 0px"}); } }); if(win_width > 768) jQuery('#dates .day').height(3 * imgwidth); else jQuery('#dates .day').height(1.8 * imgwidth); }); } if(jQuery('#dates .small-events').length > 0){ var max_height = 0; jQuery('#dates .small-events').each(function(){ var height = jQuery(this).height(); if(max_height < height) max_height = height; }); jQuery('#dates .day').height(1.5 * max_height); } } function modal_repair(sel){ var img_height = 0; jQuery(sel + ' .contents a img').each(function(){ if(jQuery(this).height() > img_height) img_height = jQuery(this).height(); }); var img_width = jQuery(sel + ' .contents a img').first().width(); jQuery(sel + ' .contents a img').each(function(){ var height = jQuery(this).height(); if(img_width != height && height){ var diff = (img_width - height) / 2; jQuery(this).css({'margin': diff + "px 0px"}); } }); var relative = img_width / 10; var lheight = img_width / 7; relative = relative + 'px'; lheight = lheight + 'px'; jQuery('.wtd_events_modal .contents a span').css('font-size', relative); jQuery('.wtd_events_modal .contents a span').css('line-height', lheight); jQuery('.wtd_events_modal .contents a').height(1.65 * img_height); var max_height = 0; jQuery('.wtd_events_modal .contents a span').each(function(){ if(jQuery(this).height() >= max_height){ max_height = parseInt(jQuery(this).height()); } }); var top = img_width + 5; jQuery('.wtd_events_modal .contents a span').css('top', top); jQuery('.wtd_events_modal .contents a span').css('overflow', 'visible'); } function wtd_get_month(start, end, year, month){ var base_request = <?php echo json_encode($wtd_base_request); ?> ; base_request.start = start; base_request.end = end; jQuery('#modal_background').addClass('month_loader'); jQuery('#month_loader').show(); Parse.Cloud.run('specials_calendar_short', base_request, { success: function(result){ jQuery.ajax({ url: wtd_ajax_url, type: 'post', dataType: 'json', data: { action: 'wtd_build_specials_calendar', data: result, start: start, end: end, year: year, month: month }, success: function(data){ jQuery('#modal_background').removeClass('month_loader'); jQuery('#month_loader').hide(); jQuery('#dates').html(data.html); jQuery('#prev_month').attr('data-start', data.prev_start).html(data.prev_month_text).attr('data-end', data.prev_end).attr('data-month', data.prev_month).attr('data-year', data.prev_year); jQuery('#next_month').attr('data-start', data.next_start).html(data.next_month_text).attr('data-end', data.next_end).attr('data-month', data.next_month).attr('data-year', data.next_year); jQuery('#curent_month span').html(data.curent_month); calendar_repair(); } }); }, error: function(error){ console.log(error); } }); } jQuery(document).ready(function(){ jQuery(document).on('click', '#dates .day:not(.nomodal)', function(event){ if(event.target.nodeName != 'A'){ var i = jQuery(this).attr('data-i'); jQuery('#modal_' + i).fadeIn(); jQuery('#modal_background').show(); jQuery('html,body').css({'overflow': 'hidden'}); modal_repair('#modal_' + i); } }); jQuery(document).on('click', '.wtd_events_modal .control a', function(event){ jQuery(this).parent().parent().hide(); jQuery('#modal_background').hide(); jQuery('html,body').css({'overflow': 'auto'}); }); jQuery(document).on('click', '#modal_background', function(event){ jQuery(this).hide(); jQuery('.wtd_events_modal').hide(); jQuery('html,body').css({'overflow': 'auto'}); }); jQuery(window).resize(function(){ jQuery('.wtd_events_modal').each(function(){ if(jQuery(this).is(':visible')){ var id = '#' + jQuery(this).attr('id'); modal_repair(id); } }); win_width = jQuery(window).width(); if(win_width > 768){ calendar_repair(); }else{ jQuery('#dates .day').removeAttr('style'); jQuery('.current_date').removeAttr('style'); } if(jQuery('.day.type2').length > 0){ jQuery('.day img').each(function(){ var width = jQuery(this).width(); var height = jQuery(this).height(); if(imgwidth != height && height){ var diff = (width - height) / 2; jQuery(this).css({'margin': diff + "px 0px"}); } }); var imgwidth = jQuery('.day img').first().width(); if(win_width > 768) jQuery('#dates .day').height(3 * imgwidth); else jQuery('#dates .day').height(1.8 * imgwidth); } if(jQuery('.day.type1').length > 0){ var imgwidth = jQuery('.day img').first().width(); jQuery('.day img').each(function(){ var height = jQuery(this).height(); if(imgwidth != height && height){ var diff = (imgwidth - height) / 2; jQuery(this).css({'margin': diff + "px 0px"}); } }); if(win_width > 768) jQuery('#dates .day').height(1.3 * imgwidth); else jQuery('#dates .day').height(1.3 * imgwidth); } }); if(win_width > 768){ if(jQuery('#dates .small-events').length > 0) calendar_repair(); } jQuery(document).on('click', '.month_loader', function(event){ event.preventDefault(); }); jQuery('.get_month').click(function(event){ event.preventDefault(); var start = jQuery(this).attr('data-start'); var end = jQuery(this).attr('data-end'); var month = jQuery(this).attr('data-month'); var year = jQuery(this).attr('data-year'); wtd_get_month(start, end, year, month); }); wtd_get_month(wtd_start_date, wtd_end_date, wtd_year, wtd_month); }); </script> <div class="row" id="calendar_controller"> <a href="javascript:void(0);" id="prev_month" class="get_month" data-start="<?php echo $prev_start; ?> " data-end="<?php echo $prev_end; ?> " data-month="<?php echo $prev_month; ?> " data-year="<?php echo $prev_year; ?> ">« <?php echo $prev_month_name; ?> </a> <span id="curent_month"><span><?php echo date('F Y'); ?> </span></span> <a href="javascript:void(0);" id="next_month" class="get_month" data-start="<?php echo $next_start; ?> " data-end="<?php echo $next_end; ?> " data-month="<?php echo $next_month; ?> " data-end="<?php echo $next_month; ?> "><?php echo $next_month_name; ?> »</a> </div> <div id="wtd_events"> <div id="modal_background"></div> <div id="month_loader"> <img src="<?php echo WTD_PLUGIN_URL . '/assets/img/loader.gif'; ?> "/> <span>Loading</span> </div> <div id="events_header"> <span>Sun</span> <span>Mon</span> <span>Tues</span> <span>Wed</span> <span>Thurs</span> <span>Fri</span> <span>Sat</span> </div> <div id="dates"> <div class="wtd_row"><?php $start = strtotime($start); $end = strtotime($end); $i = 0; while ($start < $end) { ?> <div data-date="" class="day type1"> <span class="current_date"> </span> <span> </span> </div><?php $start += $step; $i++; if ($i % 7 == 0 && $i != 0) { echo '</div><div class="wtd_row">'; } } ?> </div> </div> </div><?php wtd_copyright(); $content = ob_get_clean(); } } return $content; }