Skip to content

Commit

Permalink
Uploading first files
Browse files Browse the repository at this point in the history
  • Loading branch information
pippinsplugins committed Oct 5, 2012
0 parents commit d514ba0
Show file tree
Hide file tree
Showing 38 changed files with 4,663 additions and 0 deletions.
575 changes: 575 additions & 0 deletions assets/css/jquery-ui-classic.css

Large diffs are not rendered by default.

575 changes: 575 additions & 0 deletions assets/css/jquery-ui-fresh.css

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions assets/css/sc-events.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#sc_events_calendar:after { display: block; float: none; clear: both; height: 0; content: "."; text-indent: -9999px; }
#sc_calendar table { width: 100%; border-collapse: collapse; float:left; }
#sc_calendar th { width: 13.25%; background: #fdfdfd; border: 1px solid #ddd; text-align: center; text-transform: capitalize; padding: 3px 4px!important; }
#sc_calendar td { width: 13.25%; border: 1px solid #ddd; font-size: 11px; padding: 0!important; }
#sc_calendar td.calendar-day { background: #fbfbfb; height: 40px; }
#sc_calendar td.calendar-day-np { background: #f0f0f0; }
#sc_calendar td div.sc_day_div { padding: 8px; }
#sc_events_calendar_head { padding: 8px; height: 26px; background: #f0f0f0; border: 1px solid #ddd; border-bottom: none; }
#sc_event_select, #sc_event_nav_wrap, #sc_events_calendar_head h2 { width: 33%; float: left; margin: 0; clear:none; }
#sc_event_nav_wrap { text-align: right; }
#sc_event_nav_wrap form { display: inline; text-align: right; }
#sc_events_calendar_head h2 { text-align: center; line-height: 26px; }
#sc_events_calendar select, #sc_events_calendar input { margin: 0 5px 0 0; }
.sc_small #sc_event_nav_wrap { margin: 8px 0 0 0; }
.sc_small #sc_event_nav_wrap, .sc_small #sc_event_select { float: none; width: 100%; }
.sc_small #sc_calendar td div { padding: 1px; }
.sc_small #sc_event_nav_prev, .sc_small #sc_event_nav_next { display: block; width: 50%; float: left; }
.sc_small #sc_event_nav_prev { text-align: left; }
#sc_calendar td div.day-number { float: right; margin: -6px -4px 0 0; }
.sc_small #sc_calendar td div.day-number { float: none; text-align: right; padding: 0; margin: -3px 1px 0 0; }
.sc_event_details { margin: 0 0 15px; }
Binary file added assets/images/calendar.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/ui-icons_21759b_256x240.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/ui-icons_333333_256x240.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/ui-icons_999999_256x240.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/ui-icons_cc0000_256x240.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions assets/js/sc-admin.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
jQuery(document).ready(function($) {
if($('.sc_meta_box_row .sc_datepicker').length > 0 ) {
var dateFormat = 'mm/dd/yy';
$('.sc_datepicker').datepicker({dateFormat: dateFormat});
}
$('.sc_event_recurring').change(function() {
var selected = $(':selected', this).val();
if( selected != 'none' ) {
$('.sc_recurring_help').show();
} else {
$('.sc_recurring_help').hide();
}
});
});
15 changes: 15 additions & 0 deletions assets/js/sc-ajax.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
jQuery(document).ready(function($) {
$('body').on('submit', '.sc_events_form', function() {

document.body.style.cursor = 'wait';
var calendar = $(this).parent().parent().parent().attr('id');
var data = $(this).serialize();
$.post(sc_vars.ajaxurl, data, function (response) {
$('#' + calendar).html(response);
scResizeCal();
}).done(function() {
document.body.style.cursor = 'default';
});
return false;
});
});
19 changes: 19 additions & 0 deletions includes/ajax.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

function sc_load_calendar_via_ajax() {
if(isset($_POST['sc_nonce']) && wp_verify_nonce($_POST['sc_nonce'], 'sc_calendar_nonce')) {

$current_month = isset( $_POST['sc_current_month'] ) ? absint( $_POST['sc_current_month'] ) : 0;
$year = absint( $_POST['sc_year'] );

if( $current_month == 12 && $_POST['action_2'] == 'next_month' )
$year++;
elseif( $current_month == 1 && $_POST['action_2'] == 'prev_month' )
$year--;

die( sc_get_events_calendar( $year ) );
}
}
add_action('wp_ajax_sc_load_calendar', 'sc_load_calendar_via_ajax');
add_action('wp_ajax_nopriv_sc_load_calendar', 'sc_load_calendar_via_ajax');

120 changes: 120 additions & 0 deletions includes/calendar.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?php

/**
* Sets up the HTML, including forms, around the calendar
*
*/

function sc_get_events_calendar( $year_override = null ) {
ob_start();

do_action('sc_before_calendar');
?>
<div id="sc_events_calendar_<?php echo uniqid(); ?>" class="sc_events_calendar">
<div id="sc_events_calendar_head">
<?php
$time = current_time('timestamp');

// default month and year
$today_month = date('n', $time);
$today_year = date('Y', $time);

// check for posted month/year
if( isset( $_POST['sc_nonce'] ) && wp_verify_nonce( $_POST['sc_nonce'], 'sc_calendar_nonce' ) ) {
$today_month = absint( $_POST['sc_month'] );
$today_year = absint( $_POST['sc_year'] );
$current_month = absint( $_POST['sc_current_month'] );
if( isset( $_POST['sc_prev'] ) ) {
$today_year = $current_month == 1 ? $today_year - 1 : $today_year;
} elseif( isset( $_POST['sc_next'] ) ) {
$today_year = $current_month == 12 ? $today_year + 1 : $today_year;
}
}

if( !is_null( $year_override ) )
$today_year = absint( $year_override );

$months = array(
1 => sc_month_num_to_name(1),
2 => sc_month_num_to_name(2),
3 => sc_month_num_to_name(3),
4 => sc_month_num_to_name(4),
5 => sc_month_num_to_name(5),
6 => sc_month_num_to_name(6),
7 => sc_month_num_to_name(7),
8 => sc_month_num_to_name(8),
9 => sc_month_num_to_name(9),
10 => sc_month_num_to_name(10),
11 => sc_month_num_to_name(11),
12 => sc_month_num_to_name(12)
);
?>

<form id="sc_event_select" class="sc_events_form" method="POST" action="#sc_events_calendar_<?php echo uniqid(); ?>">
<select name="sc_month">
<?php
foreach( $months as $key => $month ) {
echo '<option value="' . absint( $key ) . '" ' . selected( $key, $today_month, false ) . '>'. esc_attr( $month ) .'</option>';
}
?>
</select>
<select name="sc_year">
<?php
$start_year = date('Y') - 1;
$end_year = $start_year + 5;
$years = range($start_year, $end_year, 1);
foreach( $years as $year ) {
echo '<option value="'. absint( $year ) .'" '. selected( $year, $today_year, false ) .'>'. esc_attr( $year ) .'</option>';
}
?>
</select>
<input id="sc_submit" type="submit" class="sc_calendar_submit" value="<?php _e('Go', 'pippin_sc'); ?>"/>
<input type="hidden" name="action" value="sc_load_calendar"/>
<input name="sc_nonce" type="hidden" value="<?php echo wp_create_nonce('sc_calendar_nonce') ?>" />
</form>

<h2 id="sc_calendar_title"><?php echo esc_html( $months[$today_month] . ' ' . $today_year ); ?></h2>
<?php echo sc_calendar_next_prev( $today_month, $today_year ); ?>
</div><!--end #sc_events_calendar_head-->
<div id="sc_calendar">
<?php echo sc_draw_calendar( $today_month, $today_year ); ?>
</div>
</div><!-- end #sc_events_calendar -->
<?php
do_action('sc_after_calendar');
return ob_get_clean();
}

function sc_calendar_next_prev( $today_month, $today_year ) {
?>
<div id="sc_event_nav_wrap">
<?php
$next_month = $today_month + 1;
$next_month = $next_month > 12 ? 1 : $next_month;
$next_year = $next_month > 12 ? $today_year + 1 : $today_year;

$prev_month = $today_month - 1;
$prev_month = $prev_month < 1 ? 12 : $prev_month;
$prev_year = $prev_month < 1 ? $today_year - 1 : $today_year;
?>
<form id="sc_event_nav_prev" class="sc_events_form" method="POST" action="#sc_events_calendar_<?php echo uniqid(); ?>">
<input type="hidden" name="sc_month" value="<?php echo absint( $prev_month ); ?>">
<input type="hidden" name="sc_year" value="<?php echo absint( $prev_year ); ?>">
<input type="hidden" name="sc_current_month" value="<?php echo absint( $today_month ); ?>">
<input type="submit" class="sc_calendar_submit" name="sc_prev" value="<?php _e('Previous', 'pippin_sc'); ?>"/>
<input type="hidden" name="sc_nonce" value="<?php echo wp_create_nonce( 'sc_calendar_nonce' ) ?>" />
<input type="hidden" name="action" value="sc_load_calendar"/>
<input type="hidden" name="action_2" value="prev_month"/>
</form>
<form id="sc_event_nav_next" class="sc_events_form" method="POST" action="#sc_events_calendar_<?php echo uniqid(); ?>">
<input type="hidden" name="sc_month" class="month" value="<?php echo absint( $next_month ); ?>">
<input type="hidden" name="sc_year" class="year" value="<?php echo absint( $next_year ); ?>">
<input type="hidden" name="sc_current_month" value="<?php echo absint( $today_month ); ?>">
<input type="submit" class="sc_calendar_submit" name="sc_next" value="<?php _e( 'Next', 'pippin_sc' ); ?>"/>
<input type="hidden" name="sc_nonce" value="<?php echo wp_create_nonce( 'sc_calendar_nonce' ) ?>" />
<input type="hidden" name="action" value="sc_load_calendar"/>
<input type="hidden" name="action_2" value="next_month"/>
</form>
</div>
<?php
}
45 changes: 45 additions & 0 deletions includes/event-display.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* Before / After Event Content
*
* Adds an action to the start and end of event post content
* that can be hooked to by other functions
*
* @access private
* @since 1.0
* @param $content string the the_content field of the post object
* @return $content string the content with any additional data attached
*/

function sc_event_content_hooks($content) {
global $post;
if($post->post_type == 'sc_event' && is_singular() && is_main_query()) {
ob_start();
do_action('sc_before_event_content', $post->ID);
echo $content;
do_action('sc_after_event_content', $post->ID);
$content = ob_get_clean();
}
return $content;
}
add_filter('the_content', 'sc_event_content_hooks');

function sc_add_event_details($event_id) {
ob_start(); ?>

<div class="sc_event_details" id="sc_event_details_<?php echo $event_id; ?>">
<div class="sc_event_details_inner">
<div class="sc_event_date"><?php echo __('Date:', 'pippin_sc') . ' ' . sc_get_event_date($event_id); ?></div>
<div class="sc_event_time">
<span class="sc_event_start_time"><?php echo __('Time:', 'pippin_sc') . ' ' . sc_get_event_start_time($event_id); ?></span>
<span class="sc_event_time_sep">&nbsp;<?php _e('to', 'pippin_sc'); ?>&nbsp;</span>
<span class="sc_event_end_time"><?php echo sc_get_event_end_time($event_id); ?></span>
</div><!--end .sc_event_time-->
</div><!--end .sc_event_details_inner-->
</div><!--end .sc_event_details-->

<?php
echo ob_get_clean();
}
add_action('sc_before_event_content', 'sc_add_event_details');
45 changes: 45 additions & 0 deletions includes/events-list.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

function sc_get_events_list($display = 'all', $category = null, $number = 5) {

$event_args = array(
'post_type' => 'sc_event',
'posts_per_page' => $number,
'meta_key' => 'sc_event_date_time',
'orderby' => 'meta_value_num',
'order' => 'asc',
'post_status' => 'publish'
);

if($display == 'past') {
$event_args['meta_compare'] = '<';
$event_args['order'] = 'desc';
} else if($display == 'upcoming') {
$event_args['meta_compare'] = '>=';
}

if($display != 'all')
$event_args['meta_value'] = time();

if( !is_null($category) )
$event_args['sc_event_category'] = $category;

$events = get_posts( apply_filters('sc_event_list_query', $event_args) );

ob_start();

if( $events ) {
echo '<ul class="sc_events_list">';
foreach( $events as $event ) {
echo '<li class="' . str_replace('hentry', '', implode(' ', get_post_class('sc_event', $event->ID) ) ) . '">';
do_action( 'sc_before_event_list_item', $event->ID );
echo '<a href="' . get_permalink($event->ID) . '" class="sc_event_link">';
echo '<span class="sc_event_title">' . get_the_title($event->ID) . '</span>';
echo '</a>';
do_action( 'sc_after_event_list_item', $event->ID );
echo '</li>';
}
echo '</ul>';
}
return ob_get_clean();
}
Loading

0 comments on commit d514ba0

Please sign in to comment.