User Manager Event Registration, Refs#1070
Showing
3 changed files
with
187 additions
and
7 deletions
| ... | @@ -603,3 +603,6 @@ div.tablesorterPager input { | ... | @@ -603,3 +603,6 @@ div.tablesorterPager input { |
| 603 | div.dataTables_paginate span.paginate_active { | 603 | div.dataTables_paginate span.paginate_active { |
| 604 | color: #DF3224; | 604 | color: #DF3224; |
| 605 | } | 605 | } |
| 606 | |||
| 607 | .small-table {} | ||
| 608 | .small-table td { font-size:11px; padding:3px; } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
| ... | @@ -943,6 +943,8 @@ class Actions { | ... | @@ -943,6 +943,8 @@ class Actions { |
| 943 | $reg_deadline = get_post_meta($event_id,'reg_deadline',true); | 943 | $reg_deadline = get_post_meta($event_id,'reg_deadline',true); |
| 944 | $event_date = get_post_meta($event_id,'event_date',true); | 944 | $event_date = get_post_meta($event_id,'event_date',true); |
| 945 | 945 | ||
| 946 | $give_earlybird_discount = isset($_POST['discount_earlybird']) ? true : false; | ||
| 947 | $give_member_discount = isset($_POST['discount_member']) ? true : false; | ||
| 946 | 948 | ||
| 947 | $event_term_slugs = array(); | 949 | $event_term_slugs = array(); |
| 948 | $terms = get_the_terms($event_id,'event_type'); | 950 | $terms = get_the_terms($event_id,'event_type'); |
| ... | @@ -958,7 +960,7 @@ class Actions { | ... | @@ -958,7 +960,7 @@ class Actions { |
| 958 | $new_cost = $cost; | 960 | $new_cost = $cost; |
| 959 | $total_discount = 0; | 961 | $total_discount = 0; |
| 960 | 962 | ||
| 961 | if ( ($user->getRole()=="member" || $user->getRole()=="student") && !empty($member_discount) ) { | 963 | if ( $give_member_discount && !empty($member_discount) ) { |
| 962 | $show_member_discount = true; | 964 | $show_member_discount = true; |
| 963 | 965 | ||
| 964 | $discounts[] = Array( | 966 | $discounts[] = Array( |
| ... | @@ -970,7 +972,7 @@ class Actions { | ... | @@ -970,7 +972,7 @@ class Actions { |
| 970 | $total_discount = ($total_discount + $member_discount); | 972 | $total_discount = ($total_discount + $member_discount); |
| 971 | 973 | ||
| 972 | } | 974 | } |
| 973 | if (!empty($early_bird_deadline) && $early_bird_deadline > time()) { | 975 | if ( $give_earlybird_discount && !empty($early_bird_discount) ) { |
| 974 | $show_early_discount = true; | 976 | $show_early_discount = true; |
| 975 | 977 | ||
| 976 | $discounts[] = Array( | 978 | $discounts[] = Array( |
| ... | @@ -1009,7 +1011,7 @@ class Actions { | ... | @@ -1009,7 +1011,7 @@ class Actions { |
| 1009 | $invoice_post = $_POST; | 1011 | $invoice_post = $_POST; |
| 1010 | 1012 | ||
| 1011 | 1013 | ||
| 1012 | $details = Array('dietary', | 1014 | $details = Array('dietary','event_notes', |
| 1013 | 'mealopt_one','mealopt_two','mealopt_three','mealopt_four','mealopt_five','mealopt_six','mealopt_seven','mealopt_eight','mealopt_nine','mealopt_ten', | 1015 | 'mealopt_one','mealopt_two','mealopt_three','mealopt_four','mealopt_five','mealopt_six','mealopt_seven','mealopt_eight','mealopt_nine','mealopt_ten', |
| 1014 | 'session_one','session_two','session_three','session_four','session_five','session_six','session_seven','session_eight','session_nine','session_ten'); | 1016 | 'session_one','session_two','session_three','session_four','session_five','session_six','session_seven','session_eight','session_nine','session_ten'); |
| 1015 | 1017 | ||
| ... | @@ -1072,7 +1074,12 @@ class Actions { | ... | @@ -1072,7 +1074,12 @@ class Actions { |
| 1072 | 1074 | ||
| 1073 | 1075 | ||
| 1074 | //create($items = array(), $invoice_type = 'event', $title = "Invoice", $user_id = 0, $status = 'pending', $reference = '', $publish = 'draft') | 1076 | //create($items = array(), $invoice_type = 'event', $title = "Invoice", $user_id = 0, $status = 'pending', $reference = '', $publish = 'draft') |
| 1075 | Invoice\create($invoice_data, 'event', 'Registration for Event via CBV Admin: '.$event->post_title, $user->ID, $status, 'publish',number_format(($new_cost + $taxes),2)); | 1077 | $invoice_id = Invoice\create($invoice_data, 'event', 'Registration for Event via CBV Admin: '.$event->post_title, $user->ID, $status, 'publish',number_format(($new_cost + $taxes),2)); |
| 1078 | $extras['invoice_id'] = $invoice_id; | ||
| 1079 | $extras['discounts'] = array( | ||
| 1080 | 'member' => ($give_member_discount) ? "Y" : "N" | ||
| 1081 | , 'earlybird' => ($give_earlybird_discount) ? "Y" : "N" | ||
| 1082 | ); | ||
| 1076 | 1083 | ||
| 1077 | Events\set_attending($user->ID,$event_id,'paid',md5(rand()),$extras); | 1084 | Events\set_attending($user->ID,$event_id,'paid',md5(rand()),$extras); |
| 1078 | 1085 | ||
| ... | @@ -1268,6 +1275,8 @@ class Actions { | ... | @@ -1268,6 +1275,8 @@ class Actions { |
| 1268 | $user_event_meta = Array(); | 1275 | $user_event_meta = Array(); |
| 1269 | } | 1276 | } |
| 1270 | 1277 | ||
| 1278 | //CBV\trace($user_event_meta); | ||
| 1279 | |||
| 1271 | $post = Events\get_event($_GET['event_id']); | 1280 | $post = Events\get_event($_GET['event_id']); |
| 1272 | 1281 | ||
| 1273 | $show_dietary = get_post_meta($post->ID, 'show_dietary', true); | 1282 | $show_dietary = get_post_meta($post->ID, 'show_dietary', true); |
| ... | @@ -1297,6 +1306,10 @@ class Actions { | ... | @@ -1297,6 +1306,10 @@ class Actions { |
| 1297 | $mealopt_nine = get_post_meta($post->ID, 'mealopt_nine', true); | 1306 | $mealopt_nine = get_post_meta($post->ID, 'mealopt_nine', true); |
| 1298 | $mealopt_ten = get_post_meta($post->ID, 'mealopt_ten', true); | 1307 | $mealopt_ten = get_post_meta($post->ID, 'mealopt_ten', true); |
| 1299 | 1308 | ||
| 1309 | $early_bird_deadline = get_post_meta($post->ID,'early_bird_deadline',true); | ||
| 1310 | $early_bird_discount = get_post_meta($post->ID,'early_bird_discount',true); | ||
| 1311 | $member_discount = get_post_meta($post->ID,'student_member_discount',true); | ||
| 1312 | |||
| 1300 | require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'edit_event.php'); | 1313 | require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'edit_event.php'); |
| 1301 | 1314 | ||
| 1302 | $content = ob_get_contents(); | 1315 | $content = ob_get_contents(); |
| ... | @@ -1536,7 +1549,7 @@ HTML; | ... | @@ -1536,7 +1549,7 @@ HTML; |
| 1536 | add_submenu_page('cbv_users','New User', 'New User',CAPABILITY,'cbv_users_create',__NAMESPACE__ . '\create_user'); | 1549 | add_submenu_page('cbv_users','New User', 'New User',CAPABILITY,'cbv_users_create',__NAMESPACE__ . '\create_user'); |
| 1537 | add_submenu_page('cbv_users','New User', 'Awaiting Validation',CAPABILITY,'cbv_users_signups',__NAMESPACE__ . '\signups'); | 1550 | add_submenu_page('cbv_users','New User', 'Awaiting Validation',CAPABILITY,'cbv_users_signups',__NAMESPACE__ . '\signups'); |
| 1538 | add_submenu_page('cbv_users', 'Merge Users', 'Merge Users', CAPABILITY, 'cbv_users_merge', __NAMESPACE__ . '\merge_users'); | 1551 | add_submenu_page('cbv_users', 'Merge Users', 'Merge Users', CAPABILITY, 'cbv_users_merge', __NAMESPACE__ . '\merge_users'); |
| 1539 | add_submenu_page('cbv_users', 'Fix Unpaid', 'Fix Unpaid', CAPABILITY, 'cbv_users_fix_unpaid', __NAMESPACE__ . '\fix_unpaid'); | 1552 | //add_submenu_page('cbv_users', 'Fix Unpaid', 'Fix Unpaid', CAPABILITY, 'cbv_users_fix_unpaid', __NAMESPACE__ . '\fix_unpaid'); |
| 1540 | } | 1553 | } |
| 1541 | 1554 | ||
| 1542 | public static function admin_init() { | 1555 | public static function admin_init() { | ... | ... |
| ... | @@ -34,10 +34,124 @@ | ... | @@ -34,10 +34,124 @@ |
| 34 | 34 | ||
| 35 | <body> | 35 | <body> |
| 36 | 36 | ||
| 37 | <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;"><?php echo $post->post_title;?></div> | 37 | <div style="width: 760px;"> |
| 38 | 38 | ||
| 39 | <div class="title-link" style="display:block;color:#f7bd55; font-size: 12px;font-weight: bold;text-align: left;line-height: 1.75em; background-color: #3b0d32; border: solid 1px #FFF; border-bottom: solid 1px #999; cursor: default; padding: 0em; padding:3px 10px 3px 10px; margin: 0em;">Admin Event Registration: <?php echo $post->post_title;?></div> | ||
| 39 | 40 | ||
| 40 | <div style="padding: 0px 0px 10px 0px;"> | 41 | <div style="padding: 10px 0px 10px 10px; width:350px; float:left;"> |
| 42 | <table class="small-table"> | ||
| 43 | |||
| 44 | <?php | ||
| 45 | // get categories.... | ||
| 46 | $event_term_slugs = array(); | ||
| 47 | $terms = get_the_terms($post->ID,'event_type'); | ||
| 48 | |||
| 49 | $external_only = false; | ||
| 50 | if (!empty($terms)) { | ||
| 51 | foreach($terms as $types) { | ||
| 52 | $event_term_slugs[$types->slug] = $types->name; | ||
| 53 | } | ||
| 54 | } | ||
| 55 | |||
| 56 | $location = get_post_meta($post->ID, 'location', true); | ||
| 57 | |||
| 58 | $cost = get_post_meta($post->ID,'cost',true); | ||
| 59 | |||
| 60 | if ( ($cost == "0" || $cost == "0.00" || strtolower($cost) == "free") && !$external_only ) { | ||
| 61 | $purchasable = false; | ||
| 62 | $cost = "FREE"; | ||
| 63 | } elseif ( (!empty($cost) && (int) $cost < 1) && !$external_only ) { | ||
| 64 | $purchasable = false; | ||
| 65 | $cost = $cost; | ||
| 66 | } elseif ( (empty($cost) && (int) $cost < 1) && !$external_only ) { | ||
| 67 | $purchasable = false; | ||
| 68 | $cost = $cost; | ||
| 69 | } elseif ($external_only) { | ||
| 70 | |||
| 71 | $purchasable = false; | ||
| 72 | |||
| 73 | } else { | ||
| 74 | $cost = (int) $cost; | ||
| 75 | $cost = str_replace(",","",$cost); | ||
| 76 | $purchasable = true; | ||
| 77 | } | ||
| 78 | |||
| 79 | ?> | ||
| 80 | |||
| 81 | <tr> | ||
| 82 | <td width="140"><strong>Event Type</strong></td> | ||
| 83 | <td> | ||
| 84 | <?php | ||
| 85 | foreach($terms as $term) { | ||
| 86 | echo $term->name.'<br />'; | ||
| 87 | } | ||
| 88 | ?> | ||
| 89 | </td> | ||
| 90 | </tr> | ||
| 91 | <?php if (!empty($location)):?> | ||
| 92 | <tr> | ||
| 93 | <td><strong>Location</strong></td> | ||
| 94 | <td><?php echo $location; ?></td> | ||
| 95 | </tr> | ||
| 96 | <?php endif; ?> | ||
| 97 | <tr> | ||
| 98 | <td><strong>When</strong></td> | ||
| 99 | <td> | ||
| 100 | <?php | ||
| 101 | |||
| 102 | $event_date = get_post_meta($post->ID, 'event_date', true); | ||
| 103 | $event_date_end = get_post_meta($post->ID, 'event_date_end', true); | ||
| 104 | |||
| 105 | if ( empty($event_date_end) ) { | ||
| 106 | echo date("M j, Y",$event_date); | ||
| 107 | } else { | ||
| 108 | $start_month = date("M", $event_date); | ||
| 109 | $start_day = date("d", $event_date); | ||
| 110 | $start_year = date("Y", $event_date); | ||
| 111 | |||
| 112 | $end_month = date("M", $event_date_end); | ||
| 113 | $end_day = date("d", $event_date_end); | ||
| 114 | $end_year = date("Y", $event_date_end); | ||
| 115 | |||
| 116 | // format: April 3-7, 2011 | ||
| 117 | if ($start_month == $end_month && $start_year == $end_year) { | ||
| 118 | echo $start_month." ".$start_day."-".$end_day.", ".$start_year; | ||
| 119 | } elseif ($start_month != $end_month && $start_year == $end_year) { | ||
| 120 | echo $start_month." ".$start_day." - ".$end_month." ".$end_day.", ".$start_year; | ||
| 121 | } else { | ||
| 122 | // format: April 3 - May 2, 2011 | ||
| 123 | echo $start_month." ".$start_day.", ".$start_year." - ".$end_month." ".$end_day.", ".$start_year; | ||
| 124 | } | ||
| 125 | |||
| 126 | |||
| 127 | } | ||
| 128 | |||
| 129 | ?> | ||
| 130 | </td> | ||
| 131 | </tr> | ||
| 132 | <tr> | ||
| 133 | <td><strong>Cost</strong></td> | ||
| 134 | <td><?php echo ($purchasable) ? "$".number_format($cost,2) : $cost; ?></td> | ||
| 135 | </tr> | ||
| 136 | <tr> | ||
| 137 | <td><strong>Stud./Mem. Discount</strong></td> | ||
| 138 | <td><?php echo (!empty($member_discount)) ? "$".number_format($member_discount,2) : "<em>None</em>";?></td> | ||
| 139 | </tr> | ||
| 140 | <tr> | ||
| 141 | <td><strong>Earlybird Discount</strong></td> | ||
| 142 | <td><?php echo (!empty($early_bird_discount)) ? "$".number_format($early_bird_discount,2) : "<em>None</em>";?></td> | ||
| 143 | </tr> | ||
| 144 | <?php if (!empty($early_bird_deadline) && !empty($early_bird_discount)): ?> | ||
| 145 | <tr> | ||
| 146 | <td><strong>Earlybird Deadline</strong></td> | ||
| 147 | <td><?php echo date("M d, Y",$early_bird_deadline); ?></td> | ||
| 148 | </tr> | ||
| 149 | <?php endif; ?> | ||
| 150 | |||
| 151 | </table> | ||
| 152 | </div> | ||
| 153 | |||
| 154 | <div style="padding: 0px 0px 10px 0px; width:380px; float:right;"> | ||
| 41 | <?php | 155 | <?php |
| 42 | $extras = $user_event_meta['extras']; | 156 | $extras = $user_event_meta['extras']; |
| 43 | ?> | 157 | ?> |
| ... | @@ -48,6 +162,7 @@ | ... | @@ -48,6 +162,7 @@ |
| 48 | <input type="hidden" name="event_id" value="<?php echo $post->ID; ?>" /> | 162 | <input type="hidden" name="event_id" value="<?php echo $post->ID; ?>" /> |
| 49 | <input type="hidden" name="type" value="<?php echo $action; ?>" /> | 163 | <input type="hidden" name="type" value="<?php echo $action; ?>" /> |
| 50 | 164 | ||
| 165 | <?php if ($action != "edit"): ?> | ||
| 51 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> | 166 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> |
| 52 | <div class="dashboard-section-title">HOW TO PROCESS THE REGISTRATION:</div> | 167 | <div class="dashboard-section-title">HOW TO PROCESS THE REGISTRATION:</div> |
| 53 | <div class="dashboard-section-links"></div> | 168 | <div class="dashboard-section-links"></div> |
| ... | @@ -63,6 +178,52 @@ | ... | @@ -63,6 +178,52 @@ |
| 63 | </div> | 178 | </div> |
| 64 | </div> | 179 | </div> |
| 65 | 180 | ||
| 181 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> | ||
| 182 | <div class="dashboard-section-title">ASSIGN DISCOUNTS:</div> | ||
| 183 | <div class="dashboard-section-links"></div> | ||
| 184 | <div class="dashboard-section-content small"> | ||
| 185 | |||
| 186 | <?php if ( empty($member_discount) && empty($early_bird_discount) ): ?> | ||
| 187 | <p style="color:#999;padding-top:0; margin-top:0;">In order to assign a discount, the discount must have a numeric value in the Event Admin.</p> | ||
| 188 | <?php else: ?> | ||
| 189 | |||
| 190 | |||
| 191 | <table> | ||
| 192 | <?php if (!empty($member_discount)): | ||
| 193 | |||
| 194 | $is_member = ($role=="member" OR $role=="student") ? true : false; | ||
| 195 | |||
| 196 | ?> | ||
| 197 | <tr> | ||
| 198 | <td width="20"><input type="checkbox" id="discount_member" name="discount_member" value="on" <?php echo ($is_member) ? "checked='checked'" : "";?> /></td> | ||
| 199 | <td><label for="discount_member">Student/Member Discount</label></td> | ||
| 200 | </tr> | ||
| 201 | <?php endif; ?> | ||
| 202 | |||
| 203 | <?php if (!empty($early_bird_discount)): | ||
| 204 | |||
| 205 | $is_eb_avail = (!empty($early_bird_deadline) && $early_bird_deadline > time()) ? true : false; | ||
| 206 | |||
| 207 | ?> | ||
| 208 | <tr> | ||
| 209 | <td width="20"><input type="checkbox" id="discount_earlybird" name="discount_earlybird" value="on" <?php echo ($is_eb_avail) ? "checked='checked'" : ""; ?> /></td> | ||
| 210 | <td><label for="discount_earlybird">Earlybird Discount</label></td> | ||
| 211 | </tr> | ||
| 212 | <?php endif; ?> | ||
| 213 | </table> | ||
| 214 | <?php endif; ?> | ||
| 215 | </div> | ||
| 216 | </div> | ||
| 217 | <?php endif; ?> | ||
| 218 | |||
| 219 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> | ||
| 220 | <div class="dashboard-section-title">ADDITIONAL NOTES</div> | ||
| 221 | <div class="dashboard-section-links"></div> | ||
| 222 | <div class="dashboard-section-content small"> | ||
| 223 | <textarea name="event_notes" class="input-field-css input-large" rows="3" style="width:350px;"><?php echo isset($extras['event_notes']) ? $extras['event_notes'] : ""; ?></textarea> | ||
| 224 | </div> | ||
| 225 | </div> | ||
| 226 | |||
| 66 | <?php | 227 | <?php |
| 67 | if (!empty($show_dietary)): ?> | 228 | if (!empty($show_dietary)): ?> |
| 68 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> | 229 | <div class="dashboard-section" style="margin-left:20px;margin-top:10px;"> |
| ... | @@ -256,5 +417,8 @@ | ... | @@ -256,5 +417,8 @@ |
| 256 | 417 | ||
| 257 | </form> | 418 | </form> |
| 258 | </div> | 419 | </div> |
| 420 | <div style="clear:both;"></div> | ||
| 421 | |||
| 422 | </div> | ||
| 259 | </body> | 423 | </body> |
| 260 | </html> | 424 | </html> |
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment