コード例 #1
0
 public function widget($args, $instance)
 {
     global $wp_query, $eme_timezone;
     //extract($args);
     //$title = apply_filters('widget_title', empty( $instance['title'] ) ? __( 'Calendar','eme' ) : $instance['title'], $instance, $this->id_base);
     //$title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base);
     $title = apply_filters('widget_title', $instance['title']);
     $long_events = isset($instance['long_events']) ? $instance['long_events'] : false;
     $category = empty($instance['category']) ? '' : $instance['category'];
     $notcategory = empty($instance['notcategory']) ? '' : $instance['notcategory'];
     if ($instance['authorid'] == -1) {
         $author = '';
     } else {
         $authinfo = get_userdata($instance['authorid']);
         $author = $authinfo->user_login;
     }
     if (is_array($category)) {
         $category = implode(',', $category);
     }
     if (is_array($notcategory)) {
         $notcategory = implode(',', $notcategory);
     }
     $options = array();
     $options['title'] = $title;
     $options['long_events'] = $long_events;
     $options['category'] = $category;
     $options['notcategory'] = $notcategory;
     // the month shown depends on the calendar day clicked
     if (get_query_var('calendar_day')) {
         $eme_date_obj = new ExpressiveDate(get_query_var('calendar_day'), $eme_timezone);
     } else {
         $eme_date_obj = new ExpressiveDate(null, $eme_timezone);
     }
     $options['month'] = $eme_date_obj->format('m');
     $options['year'] = $eme_date_obj->format('Y');
     $options['author'] = $author;
     echo $args['before_widget'];
     if ($title) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     eme_get_calendar($options);
     echo $args['after_widget'];
 }
コード例 #2
0
function eme_filter_calendar_ajax()
{
    isset($_POST['full']) && $_POST['full'] ? $full = 1 : ($full = 0);
    isset($_POST['long_events']) && $_POST['long_events'] ? $long_events = 1 : ($long_events = 0);
    isset($_POST['category']) ? $category = $_POST['category'] : ($category = 0);
    isset($_POST['notcategory']) ? $notcategory = $_POST['notcategory'] : ($notcategory = 0);
    isset($_POST['calmonth']) ? $month = eme_sanitize_request($_POST['calmonth']) : ($month = '');
    isset($_POST['calyear']) ? $year = eme_sanitize_request($_POST['calyear']) : ($year = '');
    isset($_POST['author']) ? $author = eme_sanitize_request($_POST['author']) : ($author = '');
    isset($_POST['contact_person']) ? $contact_person = eme_sanitize_request($_POST['contact_person']) : ($contact_person = '');
    isset($_POST['location_id']) ? $location_id = eme_sanitize_request($_POST['location_id']) : ($location_id = '');
    isset($_POST['template_id']) ? $template_id = eme_sanitize_request($_POST['template_id']) : ($template_id = '');
    $echo = 1;
    eme_get_calendar("full={$full}&month={$month}&year={$year}&echo={$echo}&long_events={$long_events}&category={$category}&author={$author}&contact_person={$contact_person}&location_id={$location_id}&notcategory={$notcategory}&template_id={$template_id}");
}
コード例 #3
0
ファイル: eme_events.php プロジェクト: johnmanlove/Bridgeland
function eme_events_page_content()
{
    global $wpdb;
    $format_header = get_option('eme_event_list_item_format_header');
    if (empty($format_header)) {
        $format_header = DEFAULT_EVENT_LIST_HEADER_FORMAT;
    }
    $format_footer = get_option('eme_event_list_item_format_footer');
    if (empty($format_footer)) {
        $format_footer = DEFAULT_EVENT_LIST_FOOTER_FORMAT;
    }
    if (isset($_REQUEST['eme_cancel_booking'])) {
        // GET for cancel links, POST for the cancel form
        $payment_randomid = eme_strip_tags($_REQUEST['eme_cancel_booking']);
        return eme_cancel_confirm_form($payment_randomid);
    } elseif (isset($_POST['eme_confirm_cancel_booking']) && isset($_POST['eme_pmt_rndid'])) {
        $payment_randomid = eme_strip_tags($_POST['eme_pmt_rndid']);
        $payment = eme_get_payment(0, $payment_randomid);
        $booking_ids = eme_get_payment_booking_ids($payment['id']);
        if (isset($_POST['eme_rsvp_nonce']) && wp_verify_nonce($_POST['eme_rsvp_nonce'], "cancel booking {$payment_randomid}")) {
            foreach ($booking_ids as $booking_id) {
                $booking = eme_get_booking($booking_id);
                // delete the booking before the mail is sent, so free spaces are correct
                eme_delete_booking($booking_id);
                eme_email_rsvp_booking($booking, "cancelRegistration");
                // delete the booking answers after the mail is sent, so the answers can still be used in the mail
                eme_delete_answers($booking_id);
            }
            eme_delete_payment($payment['id']);
        }
        return "<div class='eme-rsvp-message'>" . __("The bookings have been cancelled", 'eme') . "</div>";
    } elseif (get_query_var('eme_pmt_result') && get_option('eme_payment_show_custom_return_page')) {
        // show the result of a payment, but not for a multi-booking payment result
        $result = get_query_var('eme_pmt_result');
        if ($result == 'succes') {
            $format = get_option('eme_payment_succes_format');
        } else {
            $format = get_option('eme_payment_fail_format');
        }
        if (get_option('eme_payment_add_bookingid_to_return') && get_query_var('eme_pmt_id') && get_query_var('event_id')) {
            $event = eme_get_event(intval(get_query_var('event_id')));
            $payment_id = intval(get_query_var('eme_pmt_id'));
            $booking_ids = eme_get_payment_booking_ids($payment_id);
            if ($booking_ids) {
                // since each booking is for a different event, we can't know which one to show
                // so we show only the first one
                $booking = eme_get_booking($booking_ids[0]);
                return eme_replace_booking_placeholders($format, $event, $booking);
            } else {
                return;
            }
        } elseif (get_query_var('event_id')) {
            $event = eme_get_event(intval(get_query_var('event_id')));
            return eme_replace_placeholders($format, $event);
        } else {
            return $format;
        }
    } elseif (get_query_var('eme_pmt_id')) {
        $payment_id = intval(get_query_var('eme_pmt_id'));
        $booking_ids = eme_get_payment_booking_ids($payment_id);
        if (count($booking_ids) == 1) {
            $page_body = eme_payment_form("", $payment_id);
        } else {
            $page_body = eme_multipayment_form($payment_id);
        }
        return $page_body;
    }
    if (get_query_var('eme_town')) {
        $eme_town = eme_sanitize_request(get_query_var('eme_town'));
        $location_ids = join(',', eme_get_town_location_ids($eme_town));
        $stored_format = get_option('eme_event_list_item_format');
        if (count($location_ids) > 0) {
            $format_header = get_option('eme_location_list_item_format_header');
            if (empty($format_header)) {
                $format_header = DEFAULT_EVENT_LIST_HEADER_FORMAT;
            }
            $format_footer = get_option('eme_location_list_item_format_footer');
            if (empty($format_footer)) {
                $format_footer = DEFAULT_EVENT_LIST_FOOTER_FORMAT;
            }
            $page_body = eme_get_events_list(get_option('eme_event_list_number_items'), "future", "ASC", $stored_format, $format_header, $format_footer, 0, '', '', 0, '', '', 0, $location_ids);
        } else {
            $page_body = "<div id='events-no-events'>" . get_option('eme_no_events_message') . "</div>";
        }
        return $page_body;
    }
    if (get_query_var('location_id')) {
        $location = eme_get_location(intval(get_query_var('location_id')));
        $single_location_format = get_option('eme_single_location_format');
        $page_body = eme_replace_locations_placeholders($single_location_format, $location);
        return $page_body;
    }
    if (!get_query_var('calendar_day') && get_query_var('eme_event_cat')) {
        $format_header = get_option('eme_cat_event_list_item_format_header');
        if (empty($format_header)) {
            $format_header = DEFAULT_CAT_EVENT_LIST_HEADER_FORMAT;
        }
        $format_footer = get_option('eme_cat_event_list_item_format_footer');
        if (empty($format_footer)) {
            $format_footer = DEFAULT_CAT_EVENT_LIST_FOOTER_FORMAT;
        }
        $eme_event_cat = eme_sanitize_request(get_query_var('eme_event_cat'));
        $cat_ids = join(',', eme_get_category_ids($eme_event_cat));
        $stored_format = get_option('eme_event_list_item_format');
        if (!empty($cat_ids)) {
            $page_body = eme_get_events_list(get_option('eme_event_list_number_items'), "future", "ASC", $stored_format, $format_header, $format_footer, 0, $cat_ids);
        } else {
            $page_body = "<div id='events-no-events'>" . get_option('eme_no_events_message') . "</div>";
        }
        return $page_body;
    }
    //if (isset ( $_REQUEST['event_id'] ) && $_REQUEST['event_id'] != '') {
    if (eme_is_single_event_page()) {
        // single event page
        $event_id = intval(get_query_var('event_id'));
        return eme_display_single_event($event_id);
    } elseif (get_query_var('calendar_day')) {
        $scope = eme_sanitize_request(get_query_var('calendar_day'));
        $location_id = isset($_GET['location_id']) ? urldecode($_GET['location_id']) : '';
        $category = isset($_GET['category']) ? urldecode($_GET['category']) : '';
        $notcategory = isset($_GET['notcategory']) ? urldecode($_GET['notcategory']) : '';
        $author = isset($_GET['author']) ? urldecode($_GET['author']) : '';
        $contact_person = isset($_GET['contact_person']) ? urldecode($_GET['contact_person']) : '';
        $event_list_item_format = get_option('eme_event_list_item_format');
        $show_single_event = 1;
        $page_body = eme_get_events_list(0, $scope, "ASC", $event_list_item_format, $format_header, $format_footer, $location_id, $category, '', 0, $author, $contact_person, 0, '', 0, 1, 0, $notcategory, 0, 0, 0, 0, "", $show_single_event);
        return $page_body;
    } else {
        // Multiple events page
        isset($_GET['scope']) ? $scope = eme_sanitize_request($_GET['scope']) : ($scope = "future");
        $stored_format = get_option('eme_event_list_item_format');
        if (get_option('eme_display_calendar_in_events_page')) {
            $page_body = eme_get_calendar('full=1');
        } else {
            $page_body = eme_get_events_list(get_option('eme_event_list_number_items'), $scope, "ASC", $stored_format, $format_header, $format_footer, 0);
        }
        return $page_body;
    }
}
コード例 #4
0

	<div id="primary" class="content-area">
		<main id="main" class="site-main" role="main">
		<div class="container">
		<div class="section">
		<div class="col span_12_of_12 remove-bot-marg">
		<h1><?php 
    the_title();
    ?>
</h1>
		</div>
		</div>
		<div class="section">
		<div class="col span_12_of_12 remove-top-marg calendar">
			<ul class="pill-nav"><li><a href="/calendar" class="main_border">Weekly View</a></li></ul>
		<?php 
    eme_get_calendar("full=1");
    ?>
		</div>
		

		</div>
		</div>
				<div class="divider bar main_bkgd"></div>
		</main><!-- #main -->
	</div><!-- #primary -->
<?php 
}
get_sidebar();
get_footer();