a584bd38 by Kevin Burton

User Manager Event Registration, Refs#1070

1 parent 209c88fc
......@@ -603,3 +603,6 @@ div.tablesorterPager input {
div.dataTables_paginate span.paginate_active {
color: #DF3224;
}
.small-table {}
.small-table td { font-size:11px; padding:3px; }
\ No newline at end of file
......
......@@ -943,6 +943,8 @@ class Actions {
$reg_deadline = get_post_meta($event_id,'reg_deadline',true);
$event_date = get_post_meta($event_id,'event_date',true);
$give_earlybird_discount = isset($_POST['discount_earlybird']) ? true : false;
$give_member_discount = isset($_POST['discount_member']) ? true : false;
$event_term_slugs = array();
$terms = get_the_terms($event_id,'event_type');
......@@ -958,7 +960,7 @@ class Actions {
$new_cost = $cost;
$total_discount = 0;
if ( ($user->getRole()=="member" || $user->getRole()=="student") && !empty($member_discount) ) {
if ( $give_member_discount && !empty($member_discount) ) {
$show_member_discount = true;
$discounts[] = Array(
......@@ -970,7 +972,7 @@ class Actions {
$total_discount = ($total_discount + $member_discount);
}
if (!empty($early_bird_deadline) && $early_bird_deadline > time()) {
if ( $give_earlybird_discount && !empty($early_bird_discount) ) {
$show_early_discount = true;
$discounts[] = Array(
......@@ -1009,7 +1011,7 @@ class Actions {
$invoice_post = $_POST;
$details = Array('dietary',
$details = Array('dietary','event_notes',
'mealopt_one','mealopt_two','mealopt_three','mealopt_four','mealopt_five','mealopt_six','mealopt_seven','mealopt_eight','mealopt_nine','mealopt_ten',
'session_one','session_two','session_three','session_four','session_five','session_six','session_seven','session_eight','session_nine','session_ten');
......@@ -1072,7 +1074,12 @@ class Actions {
//create($items = array(), $invoice_type = 'event', $title = "Invoice", $user_id = 0, $status = 'pending', $reference = '', $publish = 'draft')
Invoice\create($invoice_data, 'event', 'Registration for Event via CBV Admin: '.$event->post_title, $user->ID, $status, 'publish',number_format(($new_cost + $taxes),2));
$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));
$extras['invoice_id'] = $invoice_id;
$extras['discounts'] = array(
'member' => ($give_member_discount) ? "Y" : "N"
, 'earlybird' => ($give_earlybird_discount) ? "Y" : "N"
);
Events\set_attending($user->ID,$event_id,'paid',md5(rand()),$extras);
......@@ -1268,6 +1275,8 @@ class Actions {
$user_event_meta = Array();
}
//CBV\trace($user_event_meta);
$post = Events\get_event($_GET['event_id']);
$show_dietary = get_post_meta($post->ID, 'show_dietary', true);
......@@ -1297,6 +1306,10 @@ class Actions {
$mealopt_nine = get_post_meta($post->ID, 'mealopt_nine', true);
$mealopt_ten = get_post_meta($post->ID, 'mealopt_ten', true);
$early_bird_deadline = get_post_meta($post->ID,'early_bird_deadline',true);
$early_bird_discount = get_post_meta($post->ID,'early_bird_discount',true);
$member_discount = get_post_meta($post->ID,'student_member_discount',true);
require_once(__DIR__ . DIRECTORY_SEPARATOR . 'views' . DIRECTORY_SEPARATOR . 'partials' . DIRECTORY_SEPARATOR . 'edit_event.php');
$content = ob_get_contents();
......@@ -1536,7 +1549,7 @@ HTML;
add_submenu_page('cbv_users','New User', 'New User',CAPABILITY,'cbv_users_create',__NAMESPACE__ . '\create_user');
add_submenu_page('cbv_users','New User', 'Awaiting Validation',CAPABILITY,'cbv_users_signups',__NAMESPACE__ . '\signups');
add_submenu_page('cbv_users', 'Merge Users', 'Merge Users', CAPABILITY, 'cbv_users_merge', __NAMESPACE__ . '\merge_users');
add_submenu_page('cbv_users', 'Fix Unpaid', 'Fix Unpaid', CAPABILITY, 'cbv_users_fix_unpaid', __NAMESPACE__ . '\fix_unpaid');
//add_submenu_page('cbv_users', 'Fix Unpaid', 'Fix Unpaid', CAPABILITY, 'cbv_users_fix_unpaid', __NAMESPACE__ . '\fix_unpaid');
}
public static function admin_init() {
......
......@@ -34,10 +34,124 @@
<body>
<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>
<div style="width: 760px;">
<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>
<div style="padding: 0px 0px 10px 0px;">
<div style="padding: 10px 0px 10px 10px; width:350px; float:left;">
<table class="small-table">
<?php
// get categories....
$event_term_slugs = array();
$terms = get_the_terms($post->ID,'event_type');
$external_only = false;
if (!empty($terms)) {
foreach($terms as $types) {
$event_term_slugs[$types->slug] = $types->name;
}
}
$location = get_post_meta($post->ID, 'location', true);
$cost = get_post_meta($post->ID,'cost',true);
if ( ($cost == "0" || $cost == "0.00" || strtolower($cost) == "free") && !$external_only ) {
$purchasable = false;
$cost = "FREE";
} elseif ( (!empty($cost) && (int) $cost < 1) && !$external_only ) {
$purchasable = false;
$cost = $cost;
} elseif ( (empty($cost) && (int) $cost < 1) && !$external_only ) {
$purchasable = false;
$cost = $cost;
} elseif ($external_only) {
$purchasable = false;
} else {
$cost = (int) $cost;
$cost = str_replace(",","",$cost);
$purchasable = true;
}
?>
<tr>
<td width="140"><strong>Event Type</strong></td>
<td>
<?php
foreach($terms as $term) {
echo $term->name.'<br />';
}
?>
</td>
</tr>
<?php if (!empty($location)):?>
<tr>
<td><strong>Location</strong></td>
<td><?php echo $location; ?></td>
</tr>
<?php endif; ?>
<tr>
<td><strong>When</strong></td>
<td>
<?php
$event_date = get_post_meta($post->ID, 'event_date', true);
$event_date_end = get_post_meta($post->ID, 'event_date_end', true);
if ( empty($event_date_end) ) {
echo date("M j, Y",$event_date);
} else {
$start_month = date("M", $event_date);
$start_day = date("d", $event_date);
$start_year = date("Y", $event_date);
$end_month = date("M", $event_date_end);
$end_day = date("d", $event_date_end);
$end_year = date("Y", $event_date_end);
// format: April 3-7, 2011
if ($start_month == $end_month && $start_year == $end_year) {
echo $start_month." ".$start_day."-".$end_day.", ".$start_year;
} elseif ($start_month != $end_month && $start_year == $end_year) {
echo $start_month." ".$start_day." - ".$end_month." ".$end_day.", ".$start_year;
} else {
// format: April 3 - May 2, 2011
echo $start_month." ".$start_day.", ".$start_year." - ".$end_month." ".$end_day.", ".$start_year;
}
}
?>
</td>
</tr>
<tr>
<td><strong>Cost</strong></td>
<td><?php echo ($purchasable) ? "$".number_format($cost,2) : $cost; ?></td>
</tr>
<tr>
<td><strong>Stud./Mem. Discount</strong></td>
<td><?php echo (!empty($member_discount)) ? "$".number_format($member_discount,2) : "<em>None</em>";?></td>
</tr>
<tr>
<td><strong>Earlybird Discount</strong></td>
<td><?php echo (!empty($early_bird_discount)) ? "$".number_format($early_bird_discount,2) : "<em>None</em>";?></td>
</tr>
<?php if (!empty($early_bird_deadline) && !empty($early_bird_discount)): ?>
<tr>
<td><strong>Earlybird Deadline</strong></td>
<td><?php echo date("M d, Y",$early_bird_deadline); ?></td>
</tr>
<?php endif; ?>
</table>
</div>
<div style="padding: 0px 0px 10px 0px; width:380px; float:right;">
<?php
$extras = $user_event_meta['extras'];
?>
......@@ -48,6 +162,7 @@
<input type="hidden" name="event_id" value="<?php echo $post->ID; ?>" />
<input type="hidden" name="type" value="<?php echo $action; ?>" />
<?php if ($action != "edit"): ?>
<div class="dashboard-section" style="margin-left:20px;margin-top:10px;">
<div class="dashboard-section-title">HOW TO PROCESS THE REGISTRATION:</div>
<div class="dashboard-section-links"></div>
......@@ -63,6 +178,52 @@
</div>
</div>
<div class="dashboard-section" style="margin-left:20px;margin-top:10px;">
<div class="dashboard-section-title">ASSIGN DISCOUNTS:</div>
<div class="dashboard-section-links"></div>
<div class="dashboard-section-content small">
<?php if ( empty($member_discount) && empty($early_bird_discount) ): ?>
<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>
<?php else: ?>
<table>
<?php if (!empty($member_discount)):
$is_member = ($role=="member" OR $role=="student") ? true : false;
?>
<tr>
<td width="20"><input type="checkbox" id="discount_member" name="discount_member" value="on" <?php echo ($is_member) ? "checked='checked'" : "";?> /></td>
<td><label for="discount_member">Student/Member Discount</label></td>
</tr>
<?php endif; ?>
<?php if (!empty($early_bird_discount)):
$is_eb_avail = (!empty($early_bird_deadline) && $early_bird_deadline > time()) ? true : false;
?>
<tr>
<td width="20"><input type="checkbox" id="discount_earlybird" name="discount_earlybird" value="on" <?php echo ($is_eb_avail) ? "checked='checked'" : ""; ?> /></td>
<td><label for="discount_earlybird">Earlybird Discount</label></td>
</tr>
<?php endif; ?>
</table>
<?php endif; ?>
</div>
</div>
<?php endif; ?>
<div class="dashboard-section" style="margin-left:20px;margin-top:10px;">
<div class="dashboard-section-title">ADDITIONAL NOTES</div>
<div class="dashboard-section-links"></div>
<div class="dashboard-section-content small">
<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>
</div>
</div>
<?php
if (!empty($show_dietary)): ?>
<div class="dashboard-section" style="margin-left:20px;margin-top:10px;">
......@@ -256,5 +417,8 @@
</form>
</div>
<div style="clear:both;"></div>
</div>
</body>
</html>
\ No newline at end of file
......