Skip to content

Commit

Permalink
Added Event calendar support and removed FT Calendar support
Browse files Browse the repository at this point in the history
  • Loading branch information
kdankov committed Apr 30, 2013
1 parent 70edb81 commit 9e8d984
Show file tree
Hide file tree
Showing 12 changed files with 301 additions and 86 deletions.
1 change: 1 addition & 0 deletions breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ function breadcrumbs() {
elseif ($l[0]=='Courses') { echo '<h2>&nbsp;/ <a href="'.$l[1].'">Курсове</a></h2>'; }
elseif ($l[0]=='News') { echo '<h2>&nbsp;/ <a href="'.$l[1].'">Новини</a></h2>'; }
elseif ($l[0]=='Labber') { echo '<h2>&nbsp;/ <a href="'.$l[1].'">Лаб`ъри</a></h2>'; }
elseif ($l[0]=='Tribe_events') { echo '<h2>&nbsp;/ <a href="'.$l[1].'">Събития</a></h2>'; }
else
{
echo '<h2>&nbsp;/ <a href="'.$l[1].'">'.$l[0].'</a></h2>';
Expand Down
18 changes: 18 additions & 0 deletions events/ecp-page-template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

// Don't load directly
if ( !defined('ABSPATH') ) { die('-1'); }

?>
<?php get_header(); ?>

<article class="page">
<header>
<h1><?php tribe_events_title(); ?></h1>
</header>
<div class="content">
<?php include(tribe_get_current_template()); ?>
</div>
</article>

<?php get_footer(); ?>
18 changes: 18 additions & 0 deletions events/ecp-single-template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php
// Don't load directly
if ( !defined('ABSPATH') ) { die('-1'); }
?>
<?php get_header(); ?>

<article class="page columns">
<header>
<h1><?php the_title(); ?></h1>
</header>
<?php the_post(); global $post; ?>
<?php include(tribe_get_current_template()); ?>
<?php if(tribe_get_option('showComments','no') == 'yes'){ comments_template(); } ?>
</article>

<?php get_footer(); ?>
<?php /* edit_post_link(__('Edit','tribe-events-calendar'), '<span class="edit-link">', '</span>');
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> */ ?>
60 changes: 60 additions & 0 deletions events/events-list-load-widget-display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* This is the template for the output of the events list widget.
* All the items are turned on and off through the widget admin.
* There is currently no default styling, which is highly needed.
*
* You can customize this view by putting a replacement file of the same name (events-list-load-widget-display.php) in the events/ directory of your theme.
*
* @return string
*/

// Vars set:
// '$event->AllDay',
// '$event->StartDate',
// '$event->EndDate',
// '$event->ShowMapLink',
// '$event->ShowMap',
// '$event->Cost',
// '$event->Phone',

// Don't load directly
if ( !defined('ABSPATH') ) { die('-1'); }

$event = array();
$tribe_ecp = TribeEvents::instance();
reset($tribe_ecp->metaTags); // Move pointer to beginning of array.
foreach($tribe_ecp->metaTags as $tag){
$var_name = str_replace('_Event','',$tag);
$event[$var_name] = tribe_get_event_meta( $post->ID, $tag, true );
}

$event = (object) $event; //Easier to work with.

ob_start();
if ( !isset($alt_text) ) { $alt_text = ''; }
post_class($alt_text,$post->ID);
$class = ob_get_contents();
ob_end_clean();
?>
<li <?php echo $class ?>>
<strong class="when">
<?php
$space = false;
$output = '';
echo tribe_get_start_date( $post->ID );

//if( tribe_is_multiday( $post->ID ) || !$event->AllDay ) {
//echo ' – <br/>'. tribe_get_end_date($post->ID);
//}

if( $event->AllDay ) {
echo ' <small><em>('.__('All Day','tribe-events-calendar').')</em></small>';
}
?>
</strong>
<div class="event">
<a href="<?php echo get_permalink($post->ID); ?>"><?php echo $post->post_title; ?></a>
</div>
</li>
<?php $alt_text = ( empty( $alt_text ) ) ? 'alt' : ''; ?>
Empty file added events/events.css
Empty file.
112 changes: 112 additions & 0 deletions events/single.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
<?php
/**
* A single event. This displays the event title, description, meta, and
* optionally, the Google map for the event.
*
* You can customize this view by putting a replacement file of the same name (single.php) in the events/ directory of your theme.
*/

// Don't load directly
if ( !defined('ABSPATH') ) { die('-1'); }
?>
<?php
$gmt_offset = (get_option('gmt_offset') >= '0' ) ? ' +' . get_option('gmt_offset') : " " . get_option('gmt_offset');
$gmt_offset = str_replace( array( '.25', '.5', '.75' ), array( ':15', ':30', ':45' ), $gmt_offset );
if (strtotime( tribe_get_end_date(get_the_ID(), false, 'Y-m-d G:i') . $gmt_offset ) <= time() ) { ?><div class="event-passed"><?php _e('This event has passed.', 'tribe-events-calendar'); ?></div><?php } ?>

<div class="content">
<?php
if ( function_exists('has_post_thumbnail') && has_post_thumbnail() ) {?>
<?php the_post_thumbnail(); ?>
<?php } ?>
<div class="summary"><?php the_content(); ?></div>
<?php if (function_exists('tribe_get_ticket_form') && tribe_get_ticket_form()) { tribe_get_ticket_form(); } ?>
</div>
<div class="sidebar" id="tribe-events-event-meta" itemscope itemtype="http://schema.org/Event">
<dl class="column">
<?php if (tribe_get_start_date() !== tribe_get_end_date() ) { ?>
<dt class="event-label event-label-start"><?php _e('Start:', 'tribe-events-calendar'); ?></dt>
<dd class="event-meta event-meta-start"><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_start_date(); ?></dd>
<dt class="event-label event-label-end"><?php _e('End:', 'tribe-events-calendar'); ?></dt>
<dd class="event-meta event-meta-end"><meta itemprop="endDate" content="<?php echo tribe_get_end_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_end_date(); ?></dd>
<?php } else { ?>
<dt class="event-label event-label-date"><?php _e('Date:', 'tribe-events-calendar'); ?></dt>
<dd class="event-meta event-meta-date"><meta itemprop="startDate" content="<?php echo tribe_get_start_date( null, false, 'Y-m-d-h:i:s' ); ?>"/><?php echo tribe_get_start_date(); ?></dd>
<?php } ?>
<?php if ( tribe_get_cost() ) : ?>
<dt class="event-label event-label-cost"><?php _e('Cost:', 'tribe-events-calendar'); ?></dt>
<dd itemprop="price" class="event-meta event-meta-cost"><?php echo tribe_get_cost(); ?></dd>
<?php endif; ?>
<?php tribe_meta_event_cats(); ?>
<?php if ( tribe_get_organizer_link( get_the_ID(), false, false ) ) : ?>
<dt class="event-label event-label-organizer"><?php _e('Organizer:', 'tribe-events-calendar'); ?></dt>
<dd class="vcard author event-meta event-meta-author"><span class="fn url"><?php echo tribe_get_organizer_link(); ?></span></dd>
<?php elseif (tribe_get_organizer()): ?>
<dt class="event-label event-label-organizer"><?php _e('Organizer:', 'tribe-events-calendar'); ?></dt>
<dd class="vcard author event-meta event-meta-author"><span class="fn url"><?php echo tribe_get_organizer(); ?></span></dd>
<?php endif; ?>
<?php if ( tribe_get_organizer_phone() ) : ?>
<dt class="event-label event-label-organizer-phone"><?php _e('Phone:', 'tribe-events-calendar'); ?></dt>
<dd itemprop="telephone" class="event-meta event-meta-phone"><?php echo tribe_get_organizer_phone(); ?></dd>
<?php endif; ?>
<?php if ( tribe_get_organizer_email() ) : ?>
<dt class="event-label event-label-email"><?php _e('Email:', 'tribe-events-calendar'); ?></dt>
<dd itemprop="email" class="event-meta event-meta-email"><a href="mailto:<?php echo tribe_get_organizer_email(); ?>"><?php echo tribe_get_organizer_email(); ?></a></dd>
<?php endif; ?>
<dt class="event-label event-label-updated"><?php _e('Updated:', 'tribe-events-calendar'); ?></dt>
<dd class="event-meta event-meta-updated"><span class="date updated"><?php the_date(); ?></span></dd>
<?php if ( class_exists('TribeEventsRecurrenceMeta') && function_exists('tribe_get_recurrence_text') && tribe_is_recurring_event() ) : ?>
<dt class="event-label event-label-schedule"><?php _e('Schedule:', 'tribe-events-calendar'); ?></dt>
<dd class="event-meta event-meta-schedule"><?php echo tribe_get_recurrence_text(); ?>
<?php if( class_exists('TribeEventsRecurrenceMeta') && function_exists('tribe_all_occurences_link')): ?>(<a href='<?php tribe_all_occurences_link(); ?>'>See all</a>)<?php endif; ?>
</dd>
<?php endif; ?>
</dl>
<dl class="column" itemprop="location" itemscope itemtype="http://schema.org/Place">
<?php if(tribe_get_venue()) : ?>
<dt class="event-label event-label-venue"><?php _e('Venue:', 'tribe-events-calendar'); ?></dt>
<dd itemprop="name" class="event-meta event-meta-venue">
<?php if( class_exists( 'TribeEventsPro' ) ): ?>
<?php tribe_get_venue_link( get_the_ID(), class_exists( 'TribeEventsPro' ) ); ?>
<?php else: ?>
<?php echo tribe_get_venue( get_the_ID() ); ?>
<?php endif; ?>
</dd>
<?php endif; ?>
<?php if(tribe_get_phone()) : ?>
<dt class="event-label event-label-venue-phone"><?php _e('Phone:', 'tribe-events-calendar'); ?></dt>
<dd itemprop="telephone" class="event-meta event-meta-venue-phone"><?php echo tribe_get_phone(); ?></dd>
<?php endif; ?>
<?php if( tribe_address_exists( get_the_ID() ) ) : ?>
<dt class="event-label event-label-address">
<?php _e('Address:', 'tribe-events-calendar') ?><br />
<?php if( tribe_show_google_map_link( get_the_ID() ) ) : ?>
<a class="gmap" itemprop="maps" href="<?php echo tribe_get_map_link(); ?>" title="<?php _e('Click to view a Google Map', 'tribe-events-calendar'); ?>" target="_blank"><?php _e('Google Map', 'tribe-events-calendar' ); ?></a>
<?php endif; ?>
</dt>
<dd class="event-meta event-meta-address">
<?php echo tribe_get_full_address( get_the_ID() ); ?>
</dd>
<?php endif; ?>
</dl>

<?php if( function_exists('tribe_the_custom_fields') && tribe_get_custom_fields( get_the_ID() ) ): ?>
<?php tribe_the_custom_fields( get_the_ID() ); ?>
<?php endif; ?>
</div>
<?php if( tribe_embed_google_map( get_the_ID() ) ) : ?>
<?php if( tribe_address_exists( get_the_ID() ) ) { echo tribe_get_embedded_map(); } ?>
<?php endif; ?>

<?php if( function_exists('tribe_get_single_ical_link') ): ?>
<a class="ical single" href="<?php echo tribe_get_single_ical_link(); ?>"><?php _e('iCal Import', 'tribe-events-calendar'); ?></a>
<?php endif; ?>
<?php if( function_exists('tribe_get_gcal_link') ): ?>
<a href="<?php echo tribe_get_gcal_link(); ?>" class="gcal-add" title="<?php _e('Add to Google Calendar', 'tribe-events-calendar'); ?>"><?php _e('+ Google Calendar', 'tribe-events-calendar'); ?></a>
<?php endif; ?>

<span class="back"><a href="<?php echo tribe_get_events_link(); ?>"><?php _e('&laquo; Back to Events', 'tribe-events-calendar'); ?></a></span>

<div class="navlink tribe-previous"><?php tribe_previous_event_link(); ?></div>
<div class="navlink tribe-next"><?php tribe_next_event_link(); ?></div>

11 changes: 11 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ function de($var, $debug=true)
'after_title' => '',
'after_widget' => ''
)
);

register_sidebar(
array(
'name' => 'Homepage - Row 3',
'description' => '',
'before_widget' => '<section class="upcoming-events">',
'before_title' => '<header><h3>',
'after_title' => '</h3></header>',
'after_widget' => '</section>'
)
);

register_sidebar(
Expand Down
11 changes: 1 addition & 10 deletions home.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@
<div class="row">
<?php dynamic_sidebar("Homepage - Row 1"); ?>
</div>
<?php /*
<div class="row" id="site-sections">
<?php dynamic_sidebar("Homepage - Row 2"); ?>
</div>
*/ ?>
<div class="row" >
<section class="messages" id="presence-wrapper">
<header>
Expand All @@ -23,14 +21,7 @@
</section>
</div>
<div class="row">
<section class="panel" id="calendar">
<header>
<h3>Предстоящи събития</h3>
</header>
<div class="content">
<?php echo do_shortcode("[ftcalendar calendars='events' types='off' legend='off' show_rss_feed='off' show_ical_feed='off']"); ?>
</div>
</section>
<?php dynamic_sidebar("Homepage - Row 3"); ?>
</div>
<div class="row">
<section class="messages" id="tweets-wrapper">
Expand Down
Loading

0 comments on commit 9e8d984

Please sign in to comment.