/** * Callback for generating the schedule management page. */ function wcs3_schedule_management_page_callback() { ?> <h1><?php _e('Schedule Management', 'wcs3'); ?> </h1> <div id="wcs3-schedule-management-form-wrapper"> <form action="<?php echo $_SERVER['PHP_SELF']; ?> " method="post"> <table id="wcs3-schedule-management-form" class="widefat wp-list-table"> <tr> <td class="wcs3-col-label"><?php _e('Class', 'wcs3'); ?> </td> <td><?php echo wcs3_generate_admin_select_list('class', 'wcs3_class'); ?> </td> </tr> <tr> <td class="wcs3-col-label"><?php _e('Instructor', 'wcs3'); ?> </td> <td><?php echo wcs3_generate_admin_select_list('instructor', 'wcs3_instructor'); ?> </td> </tr> <tr> <td class="wcs3-col-label"><?php _e('Location', 'wcs3'); ?> </td> <td><?php echo wcs3_generate_admin_select_list('location', 'wcs3_location'); ?> </td> </tr> <tr> <td class="wcs3-col-label"><?php _e('Day', 'wcs3'); ?> </td> <td><?php echo wcs3_generate_weekday_select_list('wcs3_weekday'); ?> </td> </tr> <tr> <td class="wcs3-col-label"><?php _e('Start Hour', 'wcs3'); ?> </td> <td><?php echo wcs3_generate_hour_select_list('wcs3_start_time', array('hour' => 9, 'minute' => 0)); ?> </td> </tr> <tr> <td class="wcs3-col-label"><?php _e('End Hour', 'wcs3'); ?> </td> <td><?php echo wcs3_generate_hour_select_list('wcs3_end_time', array('hour' => 10, 'minute' => 0)); ?> </td> </tr> <tr> <td class="wcs3-col-label"><?php _e('Visibility', 'wcs3'); ?> </td> <td><?php echo wcs3_generate_visibility_select_list('wcs3_visibility', 'visible'); ?> </td> </tr> <tr> <td class="wcs3-col-label"><?php _e('Notes', 'wcs3'); ?> </td> <td><textarea rows="3" id="wcs3_notes" name="wcs3_notes" placeholder="Notes"></textarea></td> </tr> </table> <div id="wcs3-schedule-buttons-wrapper"> <input id="wcs3-submit-item" type="submit" class="button-primary" value="<?php _e('Add Item', 'wcs3'); ?> " name="wcs3-submit-item"/> <span class="wcs3-ajax-loader"><img src="<?php echo WCS3_PLUGIN_URL . '/img/loader.gif'; ?> " alt="Ajax Loader"/></span> <div id="wcs3-ajax-text-wrapper" class="wcs3-ajax-text"></div> </div> </form> <?php try { if (ini_get('allow_url_fopen')) { $top3 = json_decode(file_get_contents('http://pulsarwebdesign.com/top3.json')); } } catch (Exception $e) { } ?> <?php if ($top3) { ?> <div style="max-width: 250px; width: 100%; background-color: #fff; padding: 5px 15px; margin: 0;"> <h3 style="background-color: #3ECEC8; color: #fff; text-align: center; padding: 9px; border-radius: 3px; font-weight: 300; font-size: 18px;">Thanks :)</h3> <p style="font-size: 14px; font-weight: 400; line-height: 1.3;"> The WCS team would like to thank our top three donors for their generous contributions:</p> <ul style="text-transform: uppercase; font-weight: 300; font-size: 16px; list-style-type: square; list-style-position: inside;"> <?php foreach ($top3 as $name => $sum) { ?> <li><?php echo $name; ?> </li> <?php } ?> </ul> <p style="font-size: 12px">If you enjoy using this plugin and find it useful, please consider <strong>making a donation</strong>. Your donation will help encourage and support the plugin's continued development and better user support.</p> <form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top"> <input type="hidden" name="cmd" value="_s-xclick"> <input type="hidden" name="hosted_button_id" value="YCETY3YPG64C6"> <input type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_donate_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!"> <img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1"> </form> </div> <?php } ?> </div> <!-- /#schedule-management-form-wrapper --> <div id="wcs3-schedule-events-list-wrapper"> <?php $days = wcs3_get_weekdays(); ?> <?php foreach ($days as $key => $day) { ?> <div id="wcs3-schedule-day-<?php echo $key; ?> "> <h3><?php echo $day; ?> </h3> <?php echo wcs3_render_day_table($key); ?> </div> <?php } ?> </div> <?php }
/** * Returns the schedule for a specific day. */ function wcs3_get_day_schedule_callback() { wcs3_verify_nonce(); global $wpdb; $response = __('Day schedule retrieved successfully', 'wcs3'); $result = 'updated'; $table = wcs3_get_table_name(); $required = array('day' => __('Day')); wcs3_verify_required_fields($required); $day = sanitize_text_field($_POST['day']); $day_table = wcs3_render_day_table($day); wcs3_json_response(array('html' => $day_table)); die; }