Example #1
0
 public final function do_meta_box($post_id)
 {
     if (self::$done_metabox) {
         return;
     }
     $startMinuteOptions = TribeEventsViewHelpers::getMinuteOptions(null);
     $endMinuteOptions = TribeEventsViewHelpers::getMinuteOptions(null);
     $startHourOptions = TribeEventsViewHelpers::getHourOptions(null, true);
     $endHourOptions = TribeEventsViewHelpers::getHourOptions(null, false);
     $startMeridianOptions = TribeEventsViewHelpers::getMeridianOptions(null, true);
     $endMeridianOptions = TribeEventsViewHelpers::getMeridianOptions(null);
     $tickets = self::get_event_tickets($post_id);
     include $this->parentPath . 'admin-views/tickets-meta-box.php';
     self::$done_metabox = true;
 }
tribe_events_tab_index();
?>
" id="StateProvinceText" name="venue[Province]" type='text' name='' size='25' value='<?php 
echo isset($_VenueProvince) && $_VenueProvince != '' ? esc_attr($currentProvince) : esc_attr('');
?>
' />
		<select class="chosen" tabindex="<?php 
tribe_events_tab_index();
?>
" id="StateProvinceSelect" name="venue[State]">
			<option value=""><?php 
_e('Select a State:', 'tribe-events-calendar');
?>
</option>
			<?php 
foreach (TribeEventsViewHelpers::loadStates() as $abbr => $fullname) {
    echo '<option value="' . $abbr . '"';
    selected(($_VenueStateProvince != -1 ? $_VenueStateProvince : $currentState) == $abbr);
    echo '>' . esc_html($fullname) . '</option>';
}
?>
		</select>

	</td>
</tr>
<tr class="venue">
	<td><?php 
_e('Postal Code:', 'tribe-events-calendar');
?>
</td>
	<td>
 /**
  * Adds a style chooser to the write post page
  *
  * @return void
  */
 public function EventsChooserBox($event = null)
 {
     $saved = false;
     if (!$event) {
         global $post;
         if (isset($_GET['post']) && $_GET['post']) {
             $saved = true;
         }
     } else {
         $post = $event;
         //echo $post->ID;
         if ($post->ID) {
             $saved = true;
         } else {
             $saved = false;
         }
     }
     $options = '';
     $style = '';
     if (isset($post->ID)) {
         $postId = $post->ID;
     } else {
         $postId = 0;
     }
     foreach ($this->metaTags as $tag) {
         if ($postId && $saved) {
             //if there is a post AND the post has been saved at least once.
             // Sort the meta to make sure it is correct for recurring events
             $meta = get_post_meta($postId, $tag);
             sort($meta);
             if (isset($meta[0])) {
                 ${$tag} = $meta[0];
             }
         } else {
             $cleaned_tag = str_replace('_Event', '', $tag);
             //allow posted data to override default data
             if (isset($_POST['Event' . $cleaned_tag])) {
                 ${$tag} = stripslashes_deep($_POST['Event' . $cleaned_tag]);
             } else {
                 ${$tag} = class_exists('TribeEventsPro') && $this->defaultValueReplaceEnabled() ? tribe_get_option('eventsDefault' . $cleaned_tag) : "";
             }
         }
     }
     if (isset($_EventOrganizerID) && $_EventOrganizerID) {
         foreach ($this->organizerTags as $tag) {
             ${$tag} = get_post_meta($_EventOrganizerID, $tag, true);
         }
     } else {
         foreach ($this->organizerTags as $tag) {
             $cleaned_tag = str_replace('_Organizer', '', $tag);
             if (isset($_POST['organizer'][$cleaned_tag])) {
                 ${$tag} = stripslashes_deep($_POST['organizer'][$cleaned_tag]);
             }
         }
     }
     if (isset($_EventVenueID) && $_EventVenueID) {
         foreach ($this->venueTags as $tag) {
             ${$tag} = get_post_meta($_EventVenueID, $tag, true);
         }
     } else {
         $defaults = $this->venueTags;
         $defaults[] = '_VenueState';
         $defaults[] = '_VenueProvince';
         foreach ($defaults as $tag) {
             $cleaned_tag = str_replace('_Venue', '', $tag);
             //echo $tag.' | '.$cleaned_tag.'<BR>';
             $var_name = '_Venue' . $cleaned_tag;
             if ($cleaned_tag != 'Cost') {
                 ${$var_name} = class_exists('TribeEventsPro') && $this->defaultValueReplaceEnabled() ? tribe_get_option('eventsDefault' . $cleaned_tag) : "";
             }
             if (isset($_POST['venue'][$cleaned_tag])) {
                 ${$var_name} = stripslashes_deep($_POST['venue'][$cleaned_tag]);
             }
         }
         if (isset($_VenueState) && !empty($_VenueState)) {
             $_VenueStateProvince = $_VenueState;
         } elseif (isset($_VenueProvince)) {
             $_VenueStateProvince = $_VenueProvince;
         } else {
             $_VenueStateProvince = null;
         }
         if (isset($_POST['venue']['Country'])) {
             if ($_POST['venue']['Country'] == 'United States') {
                 $_VenueStateProvince = stripslashes_deep($_POST['venue']['State']);
             } else {
                 $_VenueStateProvince = stripslashes_deep($_POST['venue']['Province']);
             }
         }
     }
     $_EventStartDate = isset($_EventStartDate) ? $_EventStartDate : null;
     $_EventEndDate = isset($_EventEndDate) ? $_EventEndDate : null;
     $_EventAllDay = isset($_EventAllDay) ? $_EventAllDay : false;
     $isEventAllDay = $_EventAllDay == 'yes' || !TribeDateUtils::dateOnly($_EventStartDate) ? 'checked="checked"' : '';
     // default is all day for new posts
     $startMonthOptions = TribeEventsViewHelpers::getMonthOptions($_EventStartDate);
     $endMonthOptions = TribeEventsViewHelpers::getMonthOptions($_EventEndDate);
     $startYearOptions = TribeEventsViewHelpers::getYearOptions($_EventStartDate);
     $endYearOptions = TribeEventsViewHelpers::getYearOptions($_EventEndDate);
     $startMinuteOptions = TribeEventsViewHelpers::getMinuteOptions($_EventStartDate, true);
     $endMinuteOptions = TribeEventsViewHelpers::getMinuteOptions($_EventEndDate);
     $startHourOptions = TribeEventsViewHelpers::getHourOptions($_EventAllDay == 'yes' ? null : $_EventStartDate, true);
     $endHourOptions = TribeEventsViewHelpers::getHourOptions($_EventAllDay == 'yes' ? null : $_EventEndDate);
     $startMeridianOptions = TribeEventsViewHelpers::getMeridianOptions($_EventStartDate, true);
     $endMeridianOptions = TribeEventsViewHelpers::getMeridianOptions($_EventEndDate);
     if ($_EventStartDate) {
         $start = TribeDateUtils::dateOnly($_EventStartDate);
     }
     $EventStartDate = isset($start) && $start ? $start : date('Y-m-d');
     if (!empty($_REQUEST['eventDate'])) {
         $EventStartDate = $_REQUEST['eventDate'];
     }
     if ($_EventEndDate) {
         $end = TribeDateUtils::dateOnly($_EventEndDate);
     }
     $EventEndDate = isset($end) && $end ? $end : date('Y-m-d');
     $recStart = isset($_REQUEST['event_start']) ? $_REQUEST['event_start'] : null;
     $recPost = isset($_REQUEST['post']) ? $_REQUEST['post'] : null;
     if (!empty($_REQUEST['eventDate'])) {
         $duration = get_post_meta($postId, '_EventDuration', true);
         $EventEndDate = TribeDateUtils::dateOnly(strtotime($EventStartDate) + $duration, true);
     }
     $events_meta_box_template = $this->pluginPath . 'admin-views/events-meta-box.php';
     $events_meta_box_template = apply_filters('tribe_events_meta_box_template', $events_meta_box_template);
     include $events_meta_box_template;
 }
 /**
  * Adds a style chooser to the write post page
  *
  * @param WP_Post $event
  * @return void
  */
 public function EventsChooserBox($event = null)
 {
     $saved = false;
     if (!$event) {
         global $post;
         if (isset($_GET['post']) && $_GET['post']) {
             $saved = true;
         }
     } else {
         $post = $event;
         //echo $post->ID;
         if ($post->ID) {
             $saved = true;
         } else {
             $saved = false;
         }
     }
     $options = '';
     $style = '';
     if (isset($post->ID)) {
         $postId = $post->ID;
     } else {
         $postId = 0;
     }
     foreach ($this->metaTags as $tag) {
         if ($postId && $saved) {
             //if there is a post AND the post has been saved at least once.
             // Sort the meta to make sure it is correct for recurring events
             $meta = get_post_meta($postId, $tag);
             sort($meta);
             if (isset($meta[0])) {
                 ${$tag} = $meta[0];
             }
         } else {
             $cleaned_tag = str_replace('_Event', '', $tag);
             //allow posted data to override default data
             if (isset($_POST['Event' . $cleaned_tag])) {
                 ${$tag} = stripslashes_deep($_POST['Event' . $cleaned_tag]);
             } else {
                 ${$tag} = class_exists('TribeEventsPro') && $this->defaultValueReplaceEnabled() ? tribe_get_option('eventsDefault' . $cleaned_tag) : "";
             }
         }
     }
     if (isset($_EventOrganizerID) && $_EventOrganizerID) {
         foreach ($this->organizerTags as $tag) {
             ${$tag} = get_post_meta($_EventOrganizerID, $tag, true);
         }
     } else {
         foreach ($this->organizerTags as $tag) {
             $cleaned_tag = str_replace('_Organizer', '', $tag);
             if (isset($_POST['organizer'][$cleaned_tag])) {
                 ${$tag} = stripslashes_deep($_POST['organizer'][$cleaned_tag]);
             }
         }
     }
     if (isset($_EventVenueID) && $_EventVenueID) {
         foreach ($this->venueTags as $tag) {
             ${$tag} = get_post_meta($_EventVenueID, $tag, true);
         }
     } else {
         $defaults = $this->venueTags;
         $defaults[] = '_VenueState';
         $defaults[] = '_VenueProvince';
         foreach ($defaults as $tag) {
             $cleaned_tag = str_replace('_Venue', '', $tag);
             //echo $tag.' | '.$cleaned_tag.'<BR>';
             $var_name = '_Venue' . $cleaned_tag;
             if ($cleaned_tag != 'Cost') {
                 ${$var_name} = class_exists('TribeEventsPro') && $this->defaultValueReplaceEnabled() ? tribe_get_option('eventsDefault' . $cleaned_tag) : "";
             }
             if (isset($_POST['venue'][$cleaned_tag])) {
                 ${$var_name} = stripslashes_deep($_POST['venue'][$cleaned_tag]);
             }
         }
         if (isset($_VenueState) && !empty($_VenueState)) {
             $_VenueStateProvince = $_VenueState;
         } elseif (isset($_VenueProvince)) {
             $_VenueStateProvince = $_VenueProvince;
         } else {
             $_VenueStateProvince = null;
         }
         if (isset($_POST['venue']['Country'])) {
             if ($_POST['venue']['Country'] == 'United States') {
                 $_VenueStateProvince = stripslashes_deep($_POST['venue']['State']);
             } else {
                 $_VenueStateProvince = stripslashes_deep($_POST['venue']['Province']);
             }
         }
     }
     $_EventAllDay = isset($_EventAllDay) ? $_EventAllDay : false;
     $_EventStartDate = isset($_EventStartDate) ? $_EventStartDate : null;
     if (isset($_EventEndDate)) {
         if ($_EventAllDay && TribeDateUtils::timeOnly($_EventEndDate) != '23:59:59' && TribeDateUtils::timeOnly(tribe_event_end_of_day()) != '23:59:59') {
             // If it's an all day event and the EOD cutoff is later than midnight
             // set the end date to be the previous day so it displays correctly in the datepicker
             // so the datepickers will match. we'll set the correct end time upon saving
             // @todo: remove this once we're allowed to have all day events without a start/end time
             $_EventEndDate = date_create($_EventEndDate);
             $_EventEndDate->modify('-1 day');
             $_EventEndDate = $_EventEndDate->format(TribeDateUtils::DBDATETIMEFORMAT);
         }
     } else {
         $_EventEndDate = null;
     }
     $isEventAllDay = $_EventAllDay == 'yes' || !TribeDateUtils::dateOnly($_EventStartDate) ? 'checked="checked"' : '';
     // default is all day for new posts
     $startMonthOptions = TribeEventsViewHelpers::getMonthOptions($_EventStartDate);
     $endMonthOptions = TribeEventsViewHelpers::getMonthOptions($_EventEndDate);
     $startYearOptions = TribeEventsViewHelpers::getYearOptions($_EventStartDate);
     $endYearOptions = TribeEventsViewHelpers::getYearOptions($_EventEndDate);
     $startMinuteOptions = TribeEventsViewHelpers::getMinuteOptions($_EventStartDate, true);
     $endMinuteOptions = TribeEventsViewHelpers::getMinuteOptions($_EventEndDate);
     $startHourOptions = TribeEventsViewHelpers::getHourOptions($_EventAllDay == 'yes' ? null : $_EventStartDate, true);
     $endHourOptions = TribeEventsViewHelpers::getHourOptions($_EventAllDay == 'yes' ? null : $_EventEndDate);
     $startMeridianOptions = TribeEventsViewHelpers::getMeridianOptions($_EventStartDate, true);
     $endMeridianOptions = TribeEventsViewHelpers::getMeridianOptions($_EventEndDate);
     if ($_EventStartDate) {
         $start = TribeDateUtils::dateOnly($_EventStartDate);
     }
     $EventStartDate = isset($start) && $start ? $start : date('Y-m-d');
     if (!empty($_REQUEST['eventDate'])) {
         $EventStartDate = esc_attr($_REQUEST['eventDate']);
     }
     if ($_EventEndDate) {
         $end = TribeDateUtils::dateOnly($_EventEndDate);
     }
     $EventEndDate = isset($end) && $end ? $end : date('Y-m-d');
     $recStart = isset($_REQUEST['event_start']) ? esc_attr($_REQUEST['event_start']) : null;
     $recPost = isset($_REQUEST['post']) ? absint($_REQUEST['post']) : null;
     if (!empty($_REQUEST['eventDate'])) {
         $duration = get_post_meta($postId, '_EventDuration', true);
         $start_time = isset($_EventStartDate) ? TribeDateUtils::timeOnly($_EventStartDate) : TribeDateUtils::timeOnly(tribe_get_start_date($post->ID));
         $EventEndDate = TribeDateUtils::dateOnly(strtotime($_REQUEST['eventDate'] . ' ' . $start_time) + $duration, true);
     }
     $events_meta_box_template = $this->pluginPath . 'admin-views/events-meta-box.php';
     $events_meta_box_template = apply_filters('tribe_events_meta_box_template', $events_meta_box_template);
     include $events_meta_box_template;
 }
 /**
  * Builds a set of options for displaying a year chooser
  * @param string the current date (optional)
  * @return string a set of HTML options with adjacent years (current year selected)
  */
 public static function getYearOptions($date = "")
 {
     $years = TribeEventsViewHelpers::years();
     $options = '';
     if (empty($date)) {
         $year = date_i18n('Y');
         if (date_i18n('n') == 12 && date_i18n('j') == 31) {
             $year++;
         }
     } else {
         $year = date('Y', strtotime($date));
     }
     foreach ($years as $yearText) {
         if ($year == $yearText) {
             $selected = 'selected="selected"';
         } else {
             $selected = '';
         }
         $options .= "<option value='{$yearText}' {$selected}>{$yearText}</option>\n";
     }
     return $options;
 }
?>
" name="EventEndHour">
						<?php 
echo $endHourOptions;
?>
					</select>
					<select tabindex="<?php 
tribe_events_tab_index();
?>
" name="EventEndMinute">
						<?php 
echo $endMinuteOptions;
?>
					</select>
					<?php 
if (!TribeEventsViewHelpers::is_24hr_format()) {
    ?>
						<select tabindex="<?php 
    tribe_events_tab_index();
    ?>
" name="EventEndMeridian">
							<?php 
    echo $endMeridianOptions;
    ?>
						</select>
					<?php 
}
?>
				</span>
						</td>
					</tr>
Example #7
0
 /**
  * Includes the tickets metabox inside the Event edit screen
  *
  * @param $post_id
  */
 public function do_meta_box($post_id)
 {
     $startMinuteOptions = TribeEventsViewHelpers::getMinuteOptions(null);
     $endMinuteOptions = TribeEventsViewHelpers::getMinuteOptions(null);
     $startHourOptions = TribeEventsViewHelpers::getHourOptions(null, true);
     $endHourOptions = TribeEventsViewHelpers::getHourOptions(null, false);
     $startMeridianOptions = TribeEventsViewHelpers::getMeridianOptions(null, true);
     $endMeridianOptions = TribeEventsViewHelpers::getMeridianOptions(null);
     $tickets = TribeEventsTickets::get_event_tickets($post_id);
     include $this->path . 'admin-views/tickets/meta-box.php';
 }
Example #8
0
				</label><br /><?php 
printf(__('The current default value is <strong>%s</strong>', 'tribe-events-calendar-pro'), tribe_get_option('eventsDefaultZip'));
?>
			</fieldset>
		</td>
	</tr>

	<tr class="venue-default-info">
		<th scope="row"><?php 
_e('Default Country for Events', 'tribe-events-calendar-pro');
?>
</th>
		<td>
			<select class="chosen" name="defaultCountry" id="defaultCountry">
				<?php 
$countries = TribeEventsViewHelpers::constructCountries();
$defaultCountry = tribe_get_option('defaultCountry');
foreach ($countries as $abbr => $fullname) {
    print "<option value=\"{$fullname}\" ";
    if (isset($defaultCountry[1]) && $defaultCountry[1] == $fullname) {
        print 'selected="selected" ';
    }
    print ">{$fullname}</option>\n";
}
?>
			</select>
		</td>
	</tr>
	<tr class="venue-default-info">
		<th scope="row"><?php 
_e('Default Phone', 'tribe-events-calendar-pro');
 /**
  * Month / Year Dropdown Selector (Display)
  *
  * Display the year & month dropdowns. JavaScript in the resources/events-admin.js file will autosubmit on the change event. 
  *
  * @param string $prefix A prefix to add to the ID of the calendar elements.  This allows you to reuse the calendar on the same page.
  * @since 2.0
  */
 function tribe_month_year_dropdowns($prefix = '')
 {
     global $wp_query;
     if (isset($wp_query->query_vars['eventDate'])) {
         $date = $wp_query->query_vars['eventDate'] . "-01";
     } else {
         $date = date_i18n(TribeDateUtils::DBDATEFORMAT);
     }
     $monthOptions = TribeEventsViewHelpers::getMonthOptions($date);
     $yearOptions = TribeEventsViewHelpers::getYearOptions($date);
     include TribeEvents::instance()->pluginPath . 'admin-views/datepicker.php';
 }
Example #10
0
$postId = get_the_ID();
$address_out = array();
?>
<span class="adr">

<?php 
// Get our street address
if (tribe_get_address($postId)) {
    $address_out[] = '<span class="street-address">' . tribe_get_address($postId) . '</span>';
    if (!tribe_is_venue()) {
        $address_out[] = '<span class="delimiter">,</span> ';
    }
}
// Get our full region
$our_province = tribe_get_event_meta($postId, '_VenueStateProvince', true);
$our_states = TribeEventsViewHelpers::loadStates();
$our_full_region = isset($our_states[$our_province]) ? $our_states[$our_province] : $our_province;
// Get our city
if (tribe_get_city($postId)) {
    $address_out[] = ' <span class="locality">' . tribe_get_city($postId) . '</span>';
    $address_out[] = '<span class="delimiter">,</span> ';
}
// Get our region
if (tribe_get_region($postId)) {
    if (count($address_out)) {
        $address_out[] = ' <abbr class="region tribe-events-abbr" title="' . $our_full_region . '">' . tribe_get_region($postId) . '</abbr>';
    }
}
// Get our postal code
if (tribe_get_zip($postId)) {
    $address_out[] = ' <span class="postal-code">' . tribe_get_zip($postId) . '</span>';
/**
 * Return form select fields for event end time.
 *
 * @param null|int $event_id
 * @return string time select HTML
 * @author Peter Chester
 * @since 3.1
 */
function tribe_community_events_form_end_time_selector($event_id = null)
{
    $event_id = TribeEvents::postIdHelper($event_id);
    $is_all_day = tribe_event_is_all_day($event_id);
    $end_date = tribe_get_end_date($event_id);
    $end_minutes = TribeEventsViewHelpers::getMinuteOptions($end_date);
    $end_hours = TribeEventsViewHelpers::getHourOptions($is_all_day == 'yes' ? null : $end_date);
    $end_meridian = TribeEventsViewHelpers::getMeridianOptions($end_date);
    $output = '';
    $output .= sprintf('<select name="EventEndHour">%s</select>', $end_hours);
    $output .= sprintf('<select name="EventEndMinute">%s</select>', $end_minutes);
    if (!strstr(get_option('time_format', TribeDateUtils::TIMEFORMAT), 'H')) {
        $output .= sprintf('<select name="EventEndMeridian">%s</select>', $end_meridian);
    }
    return apply_filters('tribe_community_events_form_end_time_selector', $output, $event_id);
}