Skip to content

Instantly share code, notes, and snippets.

@ddemuth
Created December 27, 2016 20:23
Show Gist options
  • Save ddemuth/02a51026c7fce7cb5b34d5eb1cef31d9 to your computer and use it in GitHub Desktop.
Save ddemuth/02a51026c7fce7cb5b34d5eb1cef31d9 to your computer and use it in GitHub Desktop.
archive-fka_registrations
<?php get_template_part('coach/header', 'coach');?>
<?php
if ( !is_user_logged_in() ) {
auth_redirect();
}
?>
<div class="page-wrap">
<div id="content-container" class="container-fluid">
<div id="roster-filter" class="row search-filter">
<div class="col-sm-12">
<form id="dropdown-search" class="registration-search fka-search" method="get" action="" >
<?php do_action( 'fka_roster_list_dropdown' ); ?>
<input class="btn" type="submit" value="Filter" />
</form>
</div>
</div>
<?php if (have_posts() ) : ?>
<div class="row wp-loop">
<div class="col-sm-12">
<section class="roster">
<div class="table-responsive">
<table id="registrations" class="classes table">
<thead>
<tr class="headers">
<!-- <th class="id">ID</th>
<th class="order-number">Order Number</th> -->
<th class="name">Student Name</th>
<th class="activity">Activity</th>
<th class="school">School</th>
<th class="day">Day</th>
<th class="time">Time</th>
<th class="session">Session</th>
<th class="session-dates">Dates</th>
<th class="school">Location</th>
<th class="grade">Grade</th>
<th class="teacher">Teacher</th>
<th class="parent-name">Parent Name</th>
<th class="parent-number">Parent Number</th>
<th class="parent-email">Parent Email</th>
<th class="return-to-care">Return to Care</th>
<th class="notes">Pickup Notes</th>
<th class="status">Status</th>
<th class="class-total">Total</th>
<th class="type">Type</th>
<th class="type">Coupon</th>
<th class="type">Admin</th>
</tr>
</thead>
<tbody>
<?php while ( have_posts() ) : the_post();
$meta = get_post_meta($post);
$class_activity = get_field('activity');
$activity_name = $class_activity->post_title;
$activity_id = $class_activity->ID;
$school_obj = get_field('school');
if ($school_obj) {
$school_name = $school_obj->post_title;
$school_id = $school_obj->ID;
}
$session_obj = get_field('session');
$session_name = $session_obj->name;
$session_id = $session_obj->term_id;
$product_info = get_page_by_title($school_name .' '. $activity_name, OBJECT, 'product');
if ($product_info) {
$fka_product_id = $product_info->ID;
}
$location = get_field('location_to_meet_coach', $fka_product_id);
$class_day = get_field('class_day', $fka_product_id);
$class_start_time = get_field('class_start_time', $fka_product_id);
$class_end_time = get_field('class_end_time', $fka_product_id);
$class_sessions = get_field('sessions', $fka_product_id);
$name = get_the_title();
$array_key = fka_search_array($session_id, $class_sessions, $name);
// echo '<pre>';print_r($array_key);exit;
if ($array_key || $array_key == '0') {
$session_start_date = $class_sessions[$array_key]['session_start_date'];
$session_start_date = new DateTime($session_start_date);
$session_end_date = $class_sessions[$array_key]['session_end_date'];
$session_end_date = new DateTime($session_end_date);
}
$reg_post_status = get_post_status( $post);
if ($reg_post_status == 'publish') {
$reg_post_status = 'Paid';
}
?>
<tr class="roster">
<!-- <td class="id"><?php echo $post->ID; ?></td>
<td class="order-number"><?php ?></td> -->
<td class="name"><?php echo get_the_title(); ?></td>
<td class="activity"><?php echo $activity_name; ?></td>
<td class="school"><?php echo $school_name; ?></td>
<td class="day"><?php echo $class_day; ?></td>
<td class="time"><?php echo $class_start_time .' - '. $class_end_time; ?></td>
<td class="session"><?php echo $session_name; ?></td>
<td class="session-dates"><?php echo $session_start_date->format('m/d/Y') .' - '. $session_end_date->format('m/d/Y'); ?></td>
<td class="location"><?php echo $location; ?></td>
<td class="grade"><?php echo the_field('grade'); ?></td>
<td class="teacher"><?php echo the_field('teacher'); ?></td>
<td class="parent-name"><?php echo the_field('parent_name'); ?></td>
<td class="parent-number"><?php echo the_field('parent_phone'); ?></td>
<td class="parent-email"><?php echo the_field('parent_email'); ?></td>
<td class="return-to-care"><?php echo the_field('return_to_child_care'); ?></td>
<td class="pickup-notes"><?php echo the_field('sign_out_notes'); ?></td>
<td class="status"><?php echo ucwords($reg_post_status); ?></td>
<td class="class-total"><?php echo the_field('class_total'); ?></td>
<td class="type"><?php echo the_field('payment_type'); ?></td>
<td class="type"><?php echo the_field('coupons_used'); ?></td>
<td class="type"><?php echo the_field('admin_notes'); ?></td>
</tr>
<?php endwhile; ?>
</tbody>
</table>
</div>
</section>
</div>
</div><!--/.row-->
<?php endif; ?>
<?php wp_reset_postdata(); ?>
</div> <!-- End Content Container -->
</div>
<script>
jQuery(document).ready( function ($) {
$('#registrations').DataTable({
"lengthMenu": [ [ 10, 25, 50, 100, -1], [10, 25, 50, 100, "All"] ],
"pageLength": 100,
"searching": false,
"deferRender": true,
dom: "<'row'<'col-sm-12'<'meta-wrap clearfix'<'col-sm-6'l><'col-sm-6'B>>>>" +
"<'row'<'col-sm-12'tr>>" +
"<'row paging'<'col-sm-5'i><'col-sm-7'p>>",
buttons: [ 'copy', 'pdf', 'csv', 'print' ]
});
} );
</script>
<?php get_template_part('coach/footer', 'coach');?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment