Created
January 13, 2012 20:00
-
-
Save amit/1608409 to your computer and use it in GitHub Desktop.
weekly-class-schedule support for upcoming classes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--git a/css/wcs_style.css b/css/wcs_style.css | |
index ad4c85f..ec2d248 100644 | |
--- a/css/wcs_style.css | |
+++ b/css/wcs_style.css | |
@@ -1,6 +1,21 @@ | |
#content .wcs-schedule-table { | |
font-size: 12px; | |
} | |
+ | |
+#content .wcs-upcoming-schedule-table { | |
+ width: 100%; | |
+} | |
+#content .wcs-upcoming-schedule-table tr.separator { | |
+ height: 30px; line-height:30px; | |
+} | |
+#content .wcs-upcoming-schedule-table th { | |
+ background-color: #E80 !important; | |
+ color: black !important; | |
+} | |
+#content .wcs-upcoming-schedule-table td, | |
+#content .wcs-upcoming-schedule-table th { | |
+ text-align: center; | |
+} | |
#content .wcs-schedule-table td, | |
#content .wcs-schedule-table th { | |
width: 12.5%; | |
@@ -11,7 +26,7 @@ | |
padding-left: 10px; | |
} | |
#content .wcs-schedule-table tr:nth-child(even) { | |
- background: #eee; | |
+ background: #43112E; | |
} | |
#content .class-box { | |
min-height: 40px; | |
@@ -22,7 +37,7 @@ | |
display: none; | |
z-index: 500; | |
position: absolute; | |
- background: #fdd; | |
+ background: #3C4F14; | |
padding: 6px 10px; | |
border: 1px solid #ddd; | |
margin: -1px 0 0 -1px; | |
@@ -43,7 +58,7 @@ | |
.widget_wcs_day_widget a, | |
#content .class-info a { | |
cursor: pointer; | |
- color: #1982D1; | |
+ color: #fff; | |
text-decoration: none; | |
} | |
td.hour-label { | |
@@ -53,7 +68,7 @@ td.hour-label { | |
text-align: center; | |
} | |
#content .active-box { | |
- background: #dfd; | |
+ background: #590034; | |
} | |
.notes { | |
font-size: 11px; | |
@@ -70,4 +85,4 @@ td.hour-label { | |
.saturday-column .ie-container .active-box-container .class-info { | |
left: 0; | |
margin: -1px -1px 0 0; | |
-} | |
\ No newline at end of file | |
+} | |
diff --git a/wcs.php b/wcs.php | |
index d547320..91ff83d 100644 | |
--- a/wcs.php | |
+++ b/wcs.php | |
@@ -44,7 +44,7 @@ add_action('wp_enqueue_scripts', 'load_cdn_jquery'); | |
// Load scripts and styles for the entire website | |
function load_wcs_scripts_and_style() { | |
- wp_register_style( 'wcs_admin', WCS_PLUGIN_URL . '/css/wcs_admin.css' ); | |
+ wp_register_style( 'wcs_admin', WCS_PLUGIN_URL . 'css/wcs_admin.css' ); | |
wp_enqueue_style( 'wcs_admin' ); | |
wp_enqueue_script( 'jquery' ); | |
} | |
@@ -54,7 +54,7 @@ add_action('init', 'load_wcs_scripts_and_style'); | |
// Load scripts and styles for admin area | |
function load_wcs_admin_scripts_and_styles() { | |
if ( is_admin() ) { | |
- wp_register_script( 'options_page_script', WCS_PLUGIN_URL . '/js/options_page.min.js'); | |
+ wp_register_script( 'options_page_script', WCS_PLUGIN_URL . 'js/options_page.min.js'); | |
wp_enqueue_script( 'options_page_script' ); | |
} | |
} | |
@@ -64,17 +64,17 @@ add_action('admin_init', 'load_wcs_admin_scripts_and_styles'); | |
// Load scripts and styles for website (no admin area support) | |
function load_wcs_website_scripts_and_styles() { | |
if ( ! is_admin() ) { | |
- wp_register_style( 'wcs_style', WCS_PLUGIN_URL . '/css/wcs_style.css' ); | |
+ wp_register_style( 'wcs_style', WCS_PLUGIN_URL . 'css/wcs_style.css' ); | |
wp_enqueue_style( 'wcs_style' ); | |
- wp_register_script( 'qtip_script', WCS_PLUGIN_URL . '/qtip/jquery.qtip.min.js'); | |
+ wp_register_script( 'qtip_script', WCS_PLUGIN_URL . 'qtip/jquery.qtip.min.js'); | |
wp_enqueue_script( 'qtip_script' ); | |
- wp_register_style( 'qtip_style', WCS_PLUGIN_URL . '/qtip/jquery.qtip.min.css' ); | |
+ wp_register_style( 'qtip_style', WCS_PLUGIN_URL . 'qtip/jquery.qtip.min.css' ); | |
wp_enqueue_style( 'qtip_style' ); | |
- wp_register_script( 'hoverIntent_script', WCS_PLUGIN_URL . '/hoverIntent/jquery.hoverIntent.minified.js'); | |
+ wp_register_script( 'hoverIntent_script', WCS_PLUGIN_URL . 'hoverIntent/jquery.hoverIntent.minified.js'); | |
wp_enqueue_script( 'hoverIntent_script' ); | |
- wp_register_script( 'wcs_script', WCS_PLUGIN_URL . '/js/wcs.min.js'); | |
+ wp_register_script( 'wcs_script', WCS_PLUGIN_URL . 'js/wcs.min.js'); | |
wp_enqueue_script( 'wcs_script' ); | |
- wp_register_script( 'apply_qtip', WCS_PLUGIN_URL . '/qtip/apply.qtip.min.js'); | |
+ wp_register_script( 'apply_qtip', WCS_PLUGIN_URL . 'qtip/apply.qtip.min.js'); | |
wp_enqueue_script( 'apply_qtip' ); | |
} | |
} | |
@@ -322,4 +322,10 @@ function wcs_shortcode_callback( $atts ) { | |
include_once( 'wcs_page.php' ); | |
return print_page_output( $atts ); | |
} | |
-add_shortcode( 'wcs', 'wcs_shortcode_callback' ); | |
\ No newline at end of file | |
+ | |
+function wcs_shortcode2_callback($atts) { | |
+ include_once ('wcs_upcoming.php'); | |
+ return print_upcoming_page_output($atts); | |
+} | |
+add_shortcode( 'wcs', 'wcs_shortcode_callback' ); | |
+add_shortcode( 'wcsupcoming', 'wcs_shortcode2_callback' ); | |
diff --git a/wcs_upcoming.php b/wcs_upcoming.php | |
new file mode 100644 | |
index 0000000..d0587d9 | |
--- /dev/null | |
+++ b/wcs_upcoming.php | |
@@ -0,0 +1,79 @@ | |
+<?php | |
+function print_upcoming_page_output( $atts ) { | |
+ global $wpdb; | |
+ global $schedule_obj; | |
+ date_default_timezone_set('America/Los_Angeles'); | |
+ $page_output = ""; | |
+ $table_name = $schedule_obj->table_name; | |
+ $week_days_array=array(); | |
+ for($i=0;$i<7;$i++){ | |
+ $key = date('l',time()+$i*24*60*60); | |
+ $val = date('D M j, Y', time()+$i*24*60*60); | |
+ $week_days_array[$key] = $val; | |
+ } | |
+ | |
+ $enable_24h = get_option( 'enable_24h' ); | |
+ $enable_timezones = get_option( 'enable_timezones' ); | |
+ $enable_classrooms = get_option( 'enable_classrooms' ); | |
+ | |
+ $page_output .= '<div id="wcs-container">'; | |
+ $page_output .= "<table class='wcs-upcoming-schedule-table'><tbody>"; | |
+ | |
+ $sql = "SELECT * FROM " . $table_name . " WHERE visible = '1' "; | |
+ foreach($week_days_array as $key=>$week_day){ | |
+ $newsql = $sql . " AND week_day = '" . $key . "' ORDER BY start_hour ASC "; | |
+ $results = $wpdb->get_results( $newsql, ARRAY_A); | |
+ if( $results ) { | |
+ $page_output .= "<tr class='weekday-column'>"; | |
+ // $page_output .= "<th colspan='2'>$week_day</th>"; | |
+ // Uncomment the previous line and comment out the next one to show day and the date | |
+ $page_output .= "<th colspan='2'>$key</th>"; | |
+ $page_output .= "<th>Class</th>"; | |
+ $page_output .= "<th>Instructor</th>"; | |
+ if ( $enable_classrooms == "on" ) { | |
+ $page_output .= "<th>Location</th>"; | |
+ } | |
+ $page_output .= "</tr>"; | |
+ } | |
+ foreach ( $results as $dayrow ) { | |
+ $page_output .= "\n<tr>"; | |
+ $page_output .= "<td class='hour-label' colspan='2'>"; | |
+ if ( $enable_24h == "on" ) { | |
+ $page_output .= clean_time_format( $dayrow["start_hour"] ); | |
+ } else { | |
+ $page_output .= convert_to_am_pm( $dayrow["start_hour"] ); | |
+ } | |
+ | |
+ | |
+ $page_output .= " - "; | |
+ if ( $enable_24h == "on" ) { | |
+ $page_output .= clean_time_format( $dayrow["end_hour"] ); | |
+ } else { | |
+ $page_output .= convert_to_am_pm( $dayrow["end_hour"] ); | |
+ } | |
+ | |
+ | |
+ $page_output .= "</td>"; | |
+ | |
+ $page_output .= "<td>"; | |
+ $page_output .= esc_html( stripslashes($dayrow['class'])); | |
+ $page_output .= "</td>"; | |
+ | |
+ $page_output .= "<td>"; | |
+ $page_output .= esc_html( stripslashes($dayrow['instructor'])); | |
+ $page_output .= "</td>"; | |
+ | |
+ if ( $enable_classrooms == "on" ) { | |
+ $page_output .= "<td>"; | |
+ $page_output .= esc_html( stripslashes($dayrow['classroom'])); | |
+ $page_output .= "</td>"; | |
+ } | |
+ $page_output .= "</tr>"; | |
+ } | |
+ if( $results ) { | |
+ $page_output .= "<tr class=\"separator\"></tr>"; | |
+ } | |
+ } | |
+ $page_output .= "</tbody></table>"; | |
+ return $page_output; | |
+} | |
+?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment