<?php global $event_details; ?> <div class="event_wrapper clearfix"> <div class="col_left"> <div class="event_description clearfix"> <?php setup_event_details(); ########## DO NOT USE the_content() ############# echo $content; ?> </div> <div class ="event_dates"> <span class=""><?php epl_e('Dates'); ?> </span> <?php $alt_text = epl_get_element('_epl_dates_alt_text', $event_details, ''); if ($alt_text == '') { ?> <?php echo get_the_event_dates();
function epl_do_messages($events_in_cart = null) { if (EPL_IS_ADMIN) { return; } global $event_details; $events_in_cart = $events_in_cart ? $events_in_cart : (array) EPL_registration_model::get_instance()->get_events_in_cart(); if (empty($events_in_cart)) { return; } global $epl_current_action, $epl_current_message, $epl_current_message_type; foreach ($events_in_cart as $_event_id => $data) { if (!empty($event_id) && $event_id != $_event_id) { continue; } setup_event_details($_event_id); $messages = epl_get_element('_epl_message', $event_details); foreach ((array) $messages as $k => $message) { if (isset($event_details['_epl_message_location']) && epl_get_element($k, $event_details['_epl_message_location']) != '') { $epl_current_action = $event_details['_epl_message_location'][$k]; $epl_current_message = $message; $epl_current_message_type = $event_details['_epl_message_type'][$k]; epl_display_message($epl_current_action); add_action($event_details['_epl_message_location'][$k], 'epl_display_message'); } } } }
} ?> <h3><?php epl_e('All Purchases'); ?> </h3> <?php global $event_details, $session_signed_in_counts, $user_session_signed_in_counts, $user_ticket_use_counts; $erptm = EPL_report_model::get_instance(); $avail_fields = epl_get_list_of_available_fields(); $default_row = array_fill_keys(array_keys($avail_fields), null); $tmpl = array('table_open' => '<table border="1" cellpadding="0" cellspacing="0" class="epl_standard_table" id="epl_daily_session_registrants">'); $this->epl->epl_table->set_template($tmpl); $header = array(epl__('Regis ID'), epl__('Status'), epl__('Purchase'), epl__('Package'), epl__('Use Count')); foreach ($registrants as $row) { setup_event_details($row->event_id); $time_optional = epl_is_time_optonal(); $time_id = $time_optional ? '' : $row->time_id; $session_time_id = $time_optional ? epl_get_element('time_id', $_POST, '') : $row->time_id; $_r = array(); $_r['regis_key'] = epl_anchor(admin_url('post.php?post=' . $row->regis_id . '&action=edit'), $row->regis_key); $_r['status'] = get_the_regis_status($row->status); $_r['ticket'] = $event_details['_epl_price_name'][$row->price_id]; $_r['package'] = '-'; $user_ticket_use_count_key = "{$row->regis_id}-{$row->event_id}-{$row->date_id}-{$time_id}-{$row->price_id}-{$row->user_id}"; $_r['use_count'] = epl_get_element($user_ticket_use_count_key, $user_ticket_use_counts, 0); $user_session_use_count_key = "{$row->regis_id}-{$row->event_id}-{$row->date_id}-{$_POST['date_ts']}-{$_POST['time_id']}-{$row->price_id}-{$row->user_id}"; $user_alredy_checked_in = epl_get_element($user_session_use_count_key, $user_session_signed_in_counts, false); if (epl_is_pack_regis()) { $pack_size = epl_get_element_m($row->price_id, '_epl_price_pack_size', $event_details, 1); $exp = '';
$default_row = array_fill_keys(array_keys($avail_fields), null); $limited = false; //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($forms, true). "</pre>"; //$epl_fields_inside_form = array_flip( $forms['epl_form_fields'] ); //get the field ids inside the form //when creating a form in form manager, the user may rearrange fields. Find their desired order //$epl_fields_to_display = $this->epl->epl_util->sort_array_by_array( $available_fields, $epl_fields_inside_form ); if (!epl_is_empty_array($show_only)) { $default_row = $show_only; $limited = true; } $tmp_regis_id = ''; //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($list, true). "</pre>"; //using while so we can move internal pointer //while ( list($key, $row) = each( $list ) ) { foreach ($list as $row) { setup_event_details($row->event_id, true); $_combned = array(); $_p = array(); $_a = array(); $_combned['regis_key'] = epl_anchor(admin_url('post.php?post=' . $row->regis_id . '&action=edit'), $row->regis_key); $_combned['regis_date'] = date('m/d/Y', strtotime($row->regis_date)); $_combned['status'] = get_the_regis_status($row->status); $_p['event_name'] = ''; $_p['ticket'] = ''; $_p['discount_code'] = $row->discount_code; $_p['price'] = $row->grand_total; $_p['paid'] = $row->payment_amount == 0 ? 0 : $row->payment_amount > $row->event_total ? $row->event_total : $row->payment_amount; $_p['date'] = ''; $_p['time'] = ''; $_a['event_name'] = $event_details['post_title']; $_a['ticket'] = $event_details['_epl_price_name'][$row->price_id] . ' ' . $row->price;
function get_list_of_registrants($query_only = false) { global $wpdb, $event_details; $r = ''; $WHERE = ''; $GROUP_BY = ''; if ($_POST) { setup_event_details($_POST['event_id']); $WHERE = " AND rd.event_id = " . $wpdb->escape($_POST['event_id']); $WHERE .= " AND rd.date_id = '" . $wpdb->escape($_POST['date_id']) . "'"; if (epl_has_attendee_forms()) { $WHERE .= " AND rf.form_no > 0"; } else { $WHERE .= " AND rf.form_no = 0"; } if (!epl_is_time_optonal()) { $WHERE .= " AND rd.time_id = '" . $wpdb->escape($_POST['time_id']) . "'"; } $GROUP_BY = " GROUP BY regis_data_id, rf.form_no"; } $limit = array('event_id', 'date_id', 'time_id', 'status'); $data['registrants'] = $this->erptm->get_all_data(null, $limit); if ($query_only) { return $data['registrants']; } $this->setup_checked_in_counts(); $data['checked_in_users'] = $this->get_list_of_checked_in_users(); $r .= $this->epl->load_view('admin/user-regis-manager/daily-checkin-registrants', $data, true); return $r; }
function view_names() { global $event_details, $wpdb; $filters = array('event_id' => $_REQUEST['event_id'], 'date_id' => epl_get_element('date_id', $_REQUEST, null), 'time_id' => epl_get_element('time_id', $_REQUEST, null), 'names_only' => epl_get_element('names_only', $_REQUEST, 0), 'combined' => epl_get_element('combined', $_REQUEST, 0)); setup_event_details($filters['event_id']); $show_second_to_last = apply_filters('epl_erpt__view_names__show_second_to_last', true); $data['pack_regis'] = epl_get_element('_epl_pack_regis', $event_details, 0) == 10; $data['pack_consecutive'] = epl_get_element('_epl_pack_regis_consecutive', $event_details, 0) == 10; $_filter = array(); $attendance_dates = array(); //if this is a pack class if ($data['pack_regis']) { //find all the registrations for this event //for each one, find out if package //for each one that is pack, find the pack * X days //contstruct array $event_date_keys = array_keys($event_details['_epl_start_date']); $pack_counts = epl_get_element('_epl_price_pack_size', $event_details, array()); $registrations = $wpdb->get_results("\n SELECT rd.* \n FROM {$wpdb->epl_regis_data} rd\n INNER JOIN {$wpdb->epl_registration} r\n ON r.regis_id=rd.regis_id\n WHERE 1=1 AND (r.status = 2 OR r.status = 5)\n AND event_id = " . intval($event_details['ID'])); if ($registrations) { foreach ($registrations as $regis) { $regis_weekday = date('N', $event_details['_epl_start_date'][$regis->date_id]); if (isset($pack_counts[$regis->price_id])) { $pack_counter = epl_get_element($regis->price_id, $pack_counts, 1); $start = false; foreach ($event_details['_epl_start_date'] as $date_id => $date) { if (!$start && $date_id != $regis->date_id) { continue; } $start = true; $_weekday = date('N', $date); if ($regis_weekday != $_weekday || $pack_counter == 0) { continue; } $pack_counter--; $attendance_dates[$regis->id][$date_id] = $date; $_filter[$regis->id] = $regis->id; } if ($filters['date_id'] && !isset($attendance_dates[$regis->id][$filters['date_id']]) || $filters['time_id'] && $filters['time_id'] != $regis->time_id) { unset($_filter[$regis->id]); unset($attendance_dates[$regis->id]); } //$offset = array_search( $regis->date_id, $event_date_keys ); //$attendance_dates[$regis->id] = array_slice( $event_details['_epl_start_date'], $offset, $pack_counts[$regis->price_id] ); } } } } if (!epl_is_empty_array($_filter)) { $_filter = implode(',', $_filter); $_filter = " AND rd.id IN ({$_filter})"; } if ($filters['names_only'] == 1) { $data['list'] = $this->erptm->attendee_form_data($_filter); } else { $data['list'] = $this->erptm->get_all_data_2($_filter); } $data['fields'] = $this->erptm->get_form_fields(); $data['attendance_dates'] = $attendance_dates; $data['event_title'] = $event_details['post_title']; $data['event_date'] = isset($_REQUEST['date_id']) ? epl_formatted_date(epl_get_element_m($_REQUEST['date_id'], '_epl_start_date', $event_details), "D, M j") : ''; $data['event_time'] = isset($_REQUEST['time_id']) ? epl_get_element_m($_REQUEST['time_id'], '_epl_start_time', $event_details) : ''; $url = admin_url("edit.php?post_type=epl_event&epl_action=view_names&table_view=1&epl_controller=epl_report_manager&print=1"); $url = add_query_arg($filters, $url); $data['print_icon'] = !isset($_REQUEST['print']) ? '<div><a href="' . $url . '" target="_blank"><img src="' . EPL_FULL_URL . 'images/printer.png" /></a></div>' : ''; $data['filters'] = $filters; if ($filters['names_only'] == 1) { $r = $this->epl->load_view('admin/reports/view-names', $data, true); } elseif ($filters['combined'] == 1) { $r = $this->epl->load_view('admin/reports/view-full-combined', $data, true); } else { $r = $this->epl->load_view('admin/reports/view-full-data', $data, true); } if ($GLOBALS['epl_ajax']) { return $r; } if (isset($_REQUEST['print'])) { $data['content'] = $r; $this->epl->load_view('admin/template', $data); return; } echo $r; }
echo $css_class; ?> "> <?php echo $title; ?> <?php if (!empty($events)) { global $event_details; ?> <ul class="epl_upcoming_event_list"> <?php foreach ($events as $event) { setup_event_details($event['event_id']); $link_type = $event['register_link_type']; $link_class = $link_type == 0 ? 'epl_register_button' : ''; ?> <li class="epl_list_row <?php echo $enable_tooltip; ?> " id="epl_<?php echo $event['event_id']; ?> "> <div class="epl-ue-widget-calendar "> <span class="month"><?php echo date_i18n('M', epl_get_date_timestamp($event['date']));
function wildcard_lookup($lookup, $limit = 5) { global $wpdb, $regis_details; $lookup = $wpdb->escape($lookup); $s_key = explode('-', epl_get_element('s_key', $_REQUEST, false)); $filter_event_id = $s_key[0]; $q = $wpdb->get_results("SELECT p.ID, p.post_title,p.post_date, pm.meta_key, pm.meta_value \n FROM {$wpdb->postmeta} pm \n JOIN {$wpdb->posts} p \n ON p.ID = pm.post_id \n WHERE meta_key='__epl' \n AND p.post_status ='publish' \n AND meta_value like '%{$lookup}%' \n ORDER BY meta_id DESC LIMIT {$limit}"); $_r = array(); $data = array(); $r = ''; $available_fields = $this->get_list_of_available_fields(); foreach ($q as $row) { setup_regis_details($row->ID); $regis_data = maybe_unserialize($row->meta_value); $regis_id = $regis_data['_regis_id']; if ($filter_event_id && !isset($regis_data[$regis_id]['_events'][$filter_event_id])) { continue; } $event_id = $filter_event_id; setup_event_details($filter_event_id); $form_data = maybe_unserialize($regis_data[$regis_id]['_attendee_info']); $first_name = $this->get_attendee_form_value('ticket_buyer', 'first_name', $form_data, true); $last_name = $this->get_attendee_form_value('ticket_buyer', 'last_name', $form_data); $email = $this->get_attendee_form_value('ticket_buyer', 'email', $form_data); $found = false; switch ($lookup) { case stripos($first_name, $lookup) !== false: $found = true; break; case stripos($last_name, $lookup) !== false: $found = true; break; case stripos($email, $lookup) !== false: $found = true; break; } //if (!$found) continue; $t = $this->get_purchased_tickets($regis_id, $event_id); $data['r'] = array('regis_date' => $row->post_date, 'regis_post_id' => $row->ID, 'event_id' => $event_id, 'regis_id' => $regis_id, 'first_name' => $first_name, 'last_name' => $last_name, 'email' => $email, 'form_data' => $form_data, 'available_fields' => $available_fields, 'tickets' => $t, 'regis_status' => get_the_regis_status(), 'regis_user_id' => $regis_details['_epl_regis_user_id']); $r .= $this->epl->load_view('admin/user-regis-manager/regis-name-lookup-result-rows', $data, true); } $data['r'] = $r; $r = $this->epl->load_view('admin/user-regis-manager/regis-name-lookup-result-response', $data, true); return $r; return $this->epl_util->epl_response(array('html' => $r)); }
<?php global $event_details; $epl = EPL_Base::get_instance(); //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($list, true). "</pre>"; foreach ($list as $k => $v) { setup_event_details($v->event_id); $arr = array($v->regis_key, get_the_regis_status($v->status), $event_details['post_title'], epl_formatted_date($event_details['_epl_start_date'][$v->date_id]), $event_details['_epl_start_time'][$v->time_id], $event_details['_epl_price_name'][$v->price_id], $v->quantity); $epl->epl_table->add_row($arr); } echo $epl->epl_table->generate();
function column_data($column_name, $post_ID) { global $epl_fields, $event_details, $regis_details; $this->regis_meta = $this->ecm->setup_regis_details($post_ID); $regis_id = $this->regis_meta['__epl']['_regis_id']; $event_id = ''; $event_name = ''; $num_attendees = ''; if (isset($this->regis_meta['_epl_events']) && !empty($this->regis_meta['_epl_events'])) { $event_id = key($this->regis_meta['_epl_events']); $this->ecm->setup_event_details($event_id); //$event_name = get_post( $event_id )->post_title; $event_name = $event_details['post_title']; $href = add_query_arg(array('epl_action' => 'epl_attendee_list', 'epl_download_trigger' => 1, 'event_id' => $event_id), epl_get_url()); $xl_href = add_query_arg(array('epl_action' => 'epl_excel_attendee_list', 'epl_download_trigger' => 1, 'post_ID' => $post_ID, 'event_id' => $event_id), epl_get_url()); //$event_name = '<a href="' . $href . '"><img src="' . EPL_FULL_URL . 'images/doc_excel_csv.png" /></a> <a data-post_id = "' . $post_ID . '" data-event_id="' . $event_id . '" class="epl_event_snapshot" href="#"><img id = "' . $event_id . '" src="' . EPL_FULL_URL . 'images/application_view_list.png" /> </a><span class="">' . $event_name . '</span>'; //$xevent_name = '<a href="' . $xl_href . '"><img src="' . EPL_FULL_URL . 'images/doc_excel_csv.png" /></a>'; //$event_name = $xevent_name . '<a href="' . $href . '"><img src="' . EPL_FULL_URL . 'images/doc_excel_csv.png" /></a><span class="event_name">' . $event_name . '</span>'; $xevent_name = '<span class="event_name1">' . $event_name . '</span><br />'; //<a href="' . $xl_href . '">Excel</a>, '; $event_name = $xevent_name . '<a href="' . $href . '">CSV</a>'; } switch ($column_name) { case 'attendees': if (is_array($this->regis_meta['__epl'][$regis_id]['_attendee_info']) && is_array($this->personal_field_ids)) { $d = array_intersect_key($this->regis_meta['__epl'][$regis_id]['_attendee_info'], $this->personal_field_ids); $r = array(); $fn = epl_array_flatten(current($d)); $ln = epl_array_flatten(next($d)); foreach ((array) $fn as $k => $v) { $r[] = $v . ' ' . stripslashes_deep(html_entity_decode(htmlspecialchars_decode(epl_get_element($k, $ln)), ENT_QUOTES, 'UTF-8')); } echo implode('<br>', array_unique($r)); } break; case 'id': echo $post_ID; break; case 'event': //TODO move to view $data = array(); echo '<table class="epl_regis_list_regis_details">'; foreach ((array) $this->regis_meta['__epl'][$regis_id]['_events'] as $event_id => $totals) { setup_event_details($event_id); $data['event_name'] = $event_details['post_title']; $data['quantity'] = epl_get_element($event_id, epl_get_element_m('total', '_att_quantity', $totals), 0); if ($data['quantity'] == 0) { //1.3 fix foreach ($this->regis_meta['__epl'][$regis_id]['_dates']['_att_quantity'][$event_id] as $pr => $q) { $data['quantity'] += array_sum($q); } } $link = epl_anchor(admin_url('post.php?post=' . $event_details['ID'] . '&action=edit'), $event_details['post_title']); echo "<tr><td>{$link}</td><td class='qty'>{$data['quantity']}</td></tr>"; } echo '</table>'; break; case 'num_attendees': /* $this->get_values( $post_ID ); $data['event_id'] = $event_id; //events, dates, times, prices, quantities $data['cart_data'] = $this->earm->__in( $this->event_meta + $this->regis_meta )->show_cart(); echo $this->epl->load_view( 'admin/registration/regis-list-cart-section', $data, true ); */ $num_attendees = $this->regis_meta['_total_att_' . $event_id]; if (epl_is_waitlist_record()) { foreach ($this->regis_meta as $key => $value) { if (strpos($key, "_total_waitlist_att_") !== false) { $num_attendees = $value . ' (' . epl__('waitlist') . ')'; break; } } } echo "<span class='num_attendees'>{$num_attendees}</span> "; if ($num_attendees > 0) { $href = add_query_arg(array('epl_action' => 'epl_regis_snapshot', 'post_ID' => $post_ID, 'event_id' => $event_id), epl_get_url()); echo ' <a data-post_id = "' . $post_ID . '" data-event_id="' . $event_id . '" class="epl_regis_snapshot" href="#"><img src="' . EPL_FULL_URL . 'images/application_view_list.png" /> </a>'; } echo epl_get_send_email_button($post_ID, $event_id, true); break; case 'payment_status': $payment_info = $this->payment_info_box($post_ID); echo $payment_info; $notes = epl_get_element('_epl_regis_note', $this->regis_meta, null); if ($notes) { $notes = get_post_meta($post_ID, '_epl_regis_note', false); foreach ($notes as $note) { $d = date_i18n('Y-m-d H:i', $note['timestamp']); echo "<p>{$note['action']}<span style='float:right'>{$d}</span></p>"; } } break; case 'payment': echo "Payment Info"; break; default: break; } // end switch }
function attendee_form_data($filter = null, $event_id = null) { global $wpdb, $event_details; $event_id = $event_id ? $event_id : epl_get_element('event_id', $_REQUEST, null); $filter = is_array($filter) ? null : $filter; if (($_event_id = $event_id) !== null) { $this->WHERE .= ' AND rd.event_id =' . $wpdb->escape($_event_id); } if (!$filter && ($_date_id = epl_get_element('date_id', $_REQUEST, false)) !== false) { $this->WHERE .= ' AND rd.date_id ="' . $wpdb->escape($_date_id) . '"'; } if (!$filter && ($_time_id = epl_get_element('time_id', $_REQUEST, false)) !== false) { $this->WHERE .= ' AND rd.time_id ="' . $wpdb->escape($_time_id) . '"'; } $status_filter = " AND (r.status >= 2 AND r.status <= 5)"; if (($status = epl_get_element('status', $_REQUEST, false)) !== false) { $status_filter = " AND (r.status = {$status})"; } setup_event_details($event_id); $q = $wpdb->get_results("SELECT\r\n r.*,\r\n rd.id as rd_id, rd.event_id,rd.date_id,rd.time_id,rd.price_id,rd.price,rd.quantity,rd.total_quantity,\r\n sum(rp.payment_amount) as payment_amount,rp.payment_method_id,\r\n re.grand_total as event_total,\r\n re.num_dates\r\n FROM {$wpdb->epl_regis_data} rd\r\n INNER JOIN {$wpdb->epl_registration} r\r\n ON r.regis_id = rd.regis_id\r\n INNER JOIN {$wpdb->epl_regis_events} re\r\n ON (r.regis_id = re.regis_id AND rd.event_id = re.event_id)\r\n LEFT JOIN {$wpdb->epl_regis_payment} rp\r\n ON r.regis_id = rp.regis_id\r\n WHERE 1=1 \r\n {$status_filter}\r\n {$this->WHERE} {$filter}\r\n GROUP BY rd.id\r\n ORDER BY r.regis_date, rd.id\r\n "); //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r( $wpdb->last_query, true ) . "</pre>"; return $q; }
function get_event_form_setup($event_id) { global $event_details; setup_event_details($event_id); $attendee_form = false; $one_form = false; //if sc and sc forms if (version_compare(epl_regis_plugin_version(), '1.4', '>=') && epl_sc_is_enabled() && epl_get_setting('epl_sc_options', 'epl_sc_forms_to_use') == 1) { $attendee_form = epl_get_setting('epl_sc_options', 'epl_sc_addit_regis_forms', false); if ($af) { $attendee_form = true; } return $attendee_form; } $price_form = !epl_is_empty_array(epl_get_element('_epl_price_forms', $event_details, array())); if ($price_form) { $attendee_form = true; //epl_is_empty_array(epl_get_element('_epl_price_forms_per', $event_details, array())) } if (!$attendee_form && !epl_is_empty_array(epl_get_element('_epl_addit_regis_forms', $event_details, array()))) { $attendee_form = true; } return $attendee_form; }
</p> </div> <?php global $event_list; global $event_details, $event_fields, $current_att_count; $_from_date = epl_get_date_timestamp(epl_get_element('_epl_from_date', $_POST)); $_to_date = epl_get_date_timestamp(epl_get_element('_epl_to_date', $_POST)); $table_row = array(); $base_url = admin_url('edit.php?post_type=epl_event'); $event_dates = array(); /* custom event list loop */ if ($event_list->have_posts()) { while ($event_list->have_posts()) { $event_list->the_post(); $event_id = get_the_ID(); setup_event_details($event_id, false, true); $no_date = false; if (epl_is_empty_array($event_details['_epl_start_date'])) { $event_details['_epl_start_date'] = array(EPL_DATE); $no_date = true; } $ecm->get_current_att_count($event_id); $counts = $erptm->get_attendee_counts($event_id, true); $money_totals = $erptm->get_event_money_totals($event_id); $event_edit_link = ''; if (epl_user_is_admin()) { $event_edit_link = epl_anchor(admin_url("post.php?post=" . get_the_ID() . "&action=edit"), get_the_title()); } $date_specifc_time = epl_get_element('_epl_date_specific_time', $event_details, array()); $_status = epl_get_event_status(true); $status_id = key($_status);
function adjust_discountable_amounts($for = 'category', $args = null) { global $event_totals; static $adjusted = false; if (epl_is_empty_array($event_totals)) { return false; } $num_events = count($event_totals); $pay_profile_ok = 1; if ($for == 'pay_profiles') { $selected_pay_id = EPL_registration_model::get_instance()->get_payment_profile_id(); $pay_profile_ok = $selected_pay_id && in_array($selected_pay_id, $args); } foreach ($event_totals as $event_id => $totals) { setup_event_details($event_id); //if the taxonomy in question is not assigned to this event //then adjust the totals to exclude this event numbers from the discount processes //same applies to pay profiles if ($for == 'category' && !has_term($args, 'epl_event_categories', $event_id) || !$pay_profile_ok) { $this->totals['money_totals']['discountable_total'] -= epl_get_element_m('discountable_total', 'money_totals', $totals, 0); $this->totals['money_totals']['non_discountable_total'] += epl_get_element_m('grand_total', 'money_totals', $totals, 0); $this->totals['money_totals']['num_discountable_events_in_cart'] -= 1; } } $adjusted = true; //return $totals; }
function populate_db_tables($post_ID = null, $event_id = null) { //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r( (memory_get_usage( true ) / 1048576 ), true ) . "</pre>"; if (!$post_ID) { set_time_limit(300); @ini_set('memory_limit', '1024M'); } EPL_registration_model::get_instance()->assign_incremental_id($post_ID); global $event_details, $regis_details, $post, $wpdb; $this->debug = false; $regis_list = $this->get_the_data_new($post_ID); $csv_row = ''; $form_data_array = array(); $form_data_array_header = array(); $main_table = array_flip($this->tables('wp_epl_registration')); $payment_table = array_flip($this->tables('wp_epl_regis_payment')); if (is_null($regis_list)) { exit('no records found'); } //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r( epl_memory_get_usage(), true ) . "</pre>"; foreach ($regis_list as $regis) { $regis_id = $regis->ID; //if ( $regis_id == 12973 ) // $this->debug = true; $this->ecm->setup_regis_details($regis_id); $_regis_key = $regis_details['__epl']['_regis_id']; $regis_event_data = $regis_details['__epl'][$_regis_key]; $user_id = $this->find_user_id_for_regis($regis_id); if ($this->debug) { echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r($regis_details, true) . "</pre>"; } ################# # insert main table data ################# $ins = array(); if (isset($regis_event_data['cart_totals'])) { $ins = array_intersect_key($regis_event_data['cart_totals']['money_totals'], $main_table); } else { foreach ($main_table as $k => $v) { $ins[$k] = epl_get_element('_epl_' . $k, $regis_details); } } $ins['regis_id'] = $regis_id; $ins['regis_key'] = $_regis_key; $ins['status'] = $regis_details['_epl_regis_status']; $ins['regis_date'] = $regis_details['post_date']; $ins['user_id'] = $user_id; $regis_data = $this->epl->epl_util->get_the_regis_dates_times_prices($regis_id, true); $ins['num_events'] = count($regis_data); $wpdb->insert($wpdb->epl_registration, $ins); $epl_registration_id = $wpdb->insert_id; $total_tickets = 0; ################# # insert payment data, added the $payment_data as of 2.0 ################# $payment_data = epl_get_element('_epl_payment_data', $regis_details, array()); if (empty($payment_data)) { $payment_data[] = $regis_details; } foreach ($payment_data as $k => $p) { $ins = array('regis_id' => $regis_id, 'payment_amount' => $p['_epl_payment_amount'], 'payment_date' => !empty($p['_epl_payment_date']) ? date('Y-m-d H:i:s', epl_get_date_timestamp($p['_epl_payment_date'])) : null, 'payment_method_id' => epl_get_element('_epl_payment_method', $p, 0), 'transaction_id' => $p['_epl_transaction_id'], 'note' => $p['note']); $wpdb->insert($wpdb->epl_regis_payment, $ins); } $this->primary_pulled = false; foreach ($regis_data as $event_id => $date_data) { $this->form_no = 0; setup_event_details($event_id); ################# # insert event specific totals ################# $event_totals = (array) $regis_event_data['_events'][$event_id]['money_totals']; $event_counts = (array) $regis_event_data['_events'][$event_id]['_att_quantity']; $num_dates = $event_details['_epl_event_type'] != 7 ? count($regis_data[$event_id]) : 1; $ins = array('regis_id' => $regis_id, 'event_id' => $event_id, 'num_dates' => $num_dates, 'subtotal' => epl_get_element('subtotal', $event_totals, 0), 'surcharge' => epl_get_element('surcharge', $event_totals, 0), 'discountable_total' => epl_get_element('discountable_total', $event_totals, 0), 'non_discountable_total' => epl_get_element('non_discountable_total', $event_totals, 0), 'pre_discount_total' => epl_get_element('pre_discount_total', $event_totals, 0), 'discount_amount' => epl_get_element('discount_amount', $event_totals, 0), 'discount_code' => epl_get_element('discount_code', $event_totals), 'grand_total' => epl_get_element('grand_total', $event_totals, 0)); $wpdb->insert($wpdb->epl_regis_events, $ins); $pack_regis = epl_get_element('_epl_pack_regis', $event_details) == 10; $purchased_tickets = (array) $regis_event_data['_dates']['_att_quantity'][$event_id]; $tickets_to_show = array_intersect_key($purchased_tickets, $event_details['_epl_price_name']); ################# # insert form data ################# $this->form_data($regis_id, $_regis_key, $event_id, $tickets_to_show); /* * */ foreach ($date_data as $date_id => $data) { $times = $data['time']; foreach ($times as $time_id => $time_data) { if ($time_id == 'total_tickets') { continue; } $prices = $time_data['price']; foreach ($prices as $price_id => $price_data) { $price_per_att = $event_totals[$price_id] / $price_data['qty']; if ($price_data['qty'] > 0) { for ($i = 1; $i <= $price_data['qty']; $i++) { /* if ( $pack_regis ) { $attendance_dates = epl_get_element( "_pack_attendance_dates_{$event_id}_{$price_id}_" . $i, $regis_details, null ); echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r( $attendance_dates, true ) . "</pre>"; $pack_count = count( $attendance_dates ); $attendance_date_number = array_search( $date_id, array_keys( $attendance_dates ) ) + 1; } */ $ins = array('regis_id' => $regis_id, 'event_id' => $event_id, 'date_id' => $date_id, 'time_id' => $time_id, 'price_id' => $price_id, 'price' => $price_data['raw_price'], 'quantity' => 1, 'total_quantity' => $price_data['qty']); if ($event_details['_epl_event_type'] != 7) { $total_tickets++; } else { $total_tickets = 1; } $wpdb->insert($wpdb->epl_regis_data, $ins); $new_id = $wpdb->insert_id; $this->update_attendance_regis_data_ids($new_id, $ins); } } } } } } $wpdb->update($wpdb->epl_registration, array('total_tickets' => $total_tickets == 0 ? 1 : $total_tickets), array('id' => $epl_registration_id)); if ($this->debug) { exit; } //$wpdb->print_error(); } //exit; //echo "<pre class='prettyprint'>" . __LINE__ . "> " . print_r( epl_memory_get_usage(), true ) . "</pre>"; }
/** * This function will create a global variable called $event_snapshot, which holds all the following information about the event * -Availability for each date, each time inside each date, each price inside each date and time. * -Availability errors * * Uses global vars $event_details, $current_att_count * * @since 1.0.0 * @param event_id * @param refresh * @return Sets the global $event_snapshot variable */ function event_snapshot($event_id = null, $refresh = false) { global $event_details, $capacity, $current_att_count, $event_snapshot, $epl_error, $event_totals; $event_id = is_null($event_id) ? $this->get_current_event_id() : $event_id; setup_event_details($event_id); $meta = $this->current_data[$this->regis_id]; $cart_selected_dates = epl_get_element($event_id, epl_get_element('_epl_start_date', $this->get_cart_values('_dates'))); $cart_selected_times = (array) epl_get_element($event_id, epl_get_element('_epl_start_time', $this->get_cart_values('_dates'))); $cart_selected_quantities = (array) epl_get_element($event_id, epl_get_element('_att_quantity', $this->get_cart_values('_dates'))); static $_cache = array(); $_is_cached = epl_get_element($event_id, $_cache); if ($_is_cached) { return $_cache[$event_id]; } if (empty($cart_selected_dates) && epl_get_element('cart_action', $_REQUEST) != 'add') { $epl_error[] = array('', epl__('Please select at least one date.')); } $current_att_count = EPL_report_model::get_instance()->get_attendee_counts($event_id, true); $sold_out_text = apply_filters('merm__event_snapshot__sold_out_text', epl__('Sold Out.')); //get the attendee and money totals //$_totals = $this->calculate_cart_totals(); setup_event_details($event_id); $grand_total = epl_get_element_m('grand_total', 'money_totals', $event_totals); $grand_total_key = "_grand_total"; //this will hold the snapshot $event_snapshot = array(); $qty_meta_key = "_total_att_" . $event_id; //$total_att = array_sum( ( array ) $meta[$this->regis_id]['_dates']['_att_quantity'][$event_details['ID']] ); $total_att = epl_get_element_m($event_id, 'total', epl_get_element('_att_quantity', $event_totals)); //event dates, times and prices $dates = epl_get_element('_epl_start_date', $event_details); $times = epl_get_element('_epl_start_time', $event_details); $prices = epl_get_element('_epl_price_name', $event_details); $rolling_regis = epl_get_element('_epl_rolling_regis', $event_details) == 10; if (epl_is_empty_array($dates)) { return; } //foreach event date foreach ($dates as $_date_key => $date_timestamp) { $date_timestamp = epl_get_date_timestamp($date_timestamp); //number registered for the date $date_total_att = 0; $_date = epl_formatted_date($event_details['_epl_start_date'][$_date_key], 'Y-m-d', 'date'); //the date to display $_displ_date = epl_formatted_date($_date); $qty_meta_key = "_total_att_" . $event_details['ID'] . '_date_' . $_date_key; //find the capacity for this date. $cap = $event_details['_epl_date_capacity'][$_date_key]; //find the number of people regitered for this date $num_att = epl_get_element($qty_meta_key, $current_att_count, 0); //find the available spcaes. If there is no capacity, always available $date_avail = $this->avail_spaces($cap, $num_att); $_past = epl_compare_dates(EPL_TIME, $_date . ' 23:59:59', ">"); $_date_avail_display = epl_is_ok_to_register($event_details, $_date_key); $_date_avail_display = $_date_avail_display === true ? epl__('Available') : $_date_avail_display; //snapshot template $_t = array('timestamp' => $date_timestamp, 'disp' => $_displ_date, 'avail' => $date_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'cart' => 0, 'past' => $_past, 'hide' => $date_avail != '' && $date_avail <= 0); //Set the snapshot for this date $event_snapshot[$event_id][$_date_key]['date'] = $_t; $rolling_regis_time_avail = 0; //foreach time available for the event foreach ($times as $_time_key => $_time_id) { $time_total_att = 0; $_time = $event_details['_epl_start_time'][$_time_key]; $qty_meta_key = "_total_att_" . $event_details['ID'] . '_time_' . $_date_key . '_' . $_time_key; //$cap = $capacity['time'][$_time_key]; $cap = epl_get_element($_time_key, epl_get_element('_epl_time_capacity', $event_details), ''); if ($rolling_regis && $cap == '') { $cap = epl_get_element_m($_date_key, '_epl_date_per_time_capacity', $event_details); } $num_att = epl_nz(epl_get_element($qty_meta_key, $current_att_count), 0); $time_avail = $this->avail_spaces($cap, $num_att); $rolling_regis_time_avail += $cap == '' ? 999 : epl_nz($time_avail, 0); $_comp_time = epl_get_element($_time_key, $event_details['_epl_regis_endtime']); $_comp_time = !$_comp_time ? $_time : $_comp_time; //Is this time for this date in the past and not available any more? $_past = epl_compare_dates(EPL_TIME, $_date . ' ' . $_comp_time, ">"); if ($rolling_regis && $_past) { $event_snapshot[$event_id][$_date_key]['date']['hide'] = true; } $_t = array('timestamp' => strtotime($times[$_time_key], $date_timestamp), 'disp' => $times[$_time_key], 'avail' => $time_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'past' => $_past); //Set the snapsot for this time for this date $event_snapshot[$event_id][$_date_key]['time'][$_time_key] = $_t; foreach ($prices as $_price_key => $_price_id) { $_price = $event_details['_epl_price_name'][$_price_key]; $price_avail = 0; $do_count = true; $price_att = 0; $price_type = epl_get_element($_price_key, epl_get_element('_epl_price_type', $event_details), 'att'); if (isset($meta['_dates']['_att_quantity'][$event_details['ID']])) { if (is_array(epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']]))) { $price_att = array_sum((array) epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']])); } else { $price_att = epl_get_element($_price_key, $meta['_dates']['_att_quantity'][$event_details['ID']]); } } $qty_meta_key = "_total_att_" . $event_details['ID'] . '_price_' . $_date_key . '_' . $_time_key . '_' . $_price_key; if (epl_is_date_level_price()) { $price_att = epl_get_element_m($_date_key, $_price_key, $cart_selected_quantities); } $cap = epl_get_element($_price_key, epl_get_element('_epl_price_capacity', $event_details), ''); $num_att = epl_nz(epl_get_element($qty_meta_key, $current_att_count), 0); $price_avail = $this->avail_spaces($cap, $num_att); if (!epl_is_empty_array($offset = $this->is_offsetter_price($_price_key)) && $cap !== '' && $price_avail > 0) { //check to make sure users are not using the price as offset against itself if ($offset['offset_key'] != $_price_key) { // see if available count of the offseter is > capacity for this price $offset_avail = $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$offset['offset_key']]['avail']; $offset_count = $offset['offset_count']; if ((int) $offset_count > (int) $offset_avail) { $price_avail = 0; } elseif ($offset_avail >= $offset_count) { $price_avail = intval($offset_avail / $offset_count); } } } //echo "<pre class='prettyprint'>" . __LINE__ . "> $event_id >>>> " . print_r($price_avail, true). "</pre>"; $time_total_att += $price_att; $_t = array('disp' => $prices[$_price_key], 'avail' => $price_avail, 'avail_display' => $_date_avail_display, 'regis' => $num_att, 'db_key' => $qty_meta_key, 'cart' => $price_att, 'past' => $_past); $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key] = $_t; if (epl_is_date_level_time() && epl_get_element($_date_key, $cart_selected_times) != $_time_key) { $do_count = false; } if (epl_is_date_level_price() && !in_array($_date_key, (array) $cart_selected_dates)) { //if ( $_date_key != $_price_key ) { $do_count = false; //} } if (epl_is_time_specific_price($_price_key)) { if ($event_details['_epl_price_parent_time_id'][$_price_key] != $_time_key) { unset($event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]); $do_count = false; } } if (!epl_is_time_optonal() && !in_array($_time_key, $cart_selected_times) || !in_array($_date_key, (array) $cart_selected_dates)) { $do_count = false; } if (!$do_count || $price_type != 'att') { $time_total_att -= $price_att; if (isset($event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['cart'])) { $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['cart'] = 0; } } else { //check for a price availability for each date/time if ($price_att > 0 && $price_avail !== '') { $_error = array(); if ($price_avail === 0 || $price_avail < 0) { $_error = array($_displ_date . '<br />' . $_time . '<br />' . $_price, $sold_out_text); } elseif ($price_att > epl_nz($price_avail, 1000)) { $_error = array($_displ_date . '<br />' . $_time . '<br />' . $_price, sprintf(epl__(' Only %d spaces left.'), $price_avail)); } if (!empty($_error)) { $epl_error[] = $_error; $event_snapshot[$event_id]['error'][] = $_error; } $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['price'][$_price_key]['avail_display'] = epl_get_element(1, $_error); } } /* if( $price_type != 'att' ) $time_total_att -= $price_att; */ } $date_total_att += $time_total_att; $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['cart'] = $time_total_att; //echo "<pre class='prettyprint'>" . __LINE__ . "> $_date " . print_r($time_total_att, true). "</pre>"; //check for time availablility for each date if ($this->flow_mode == 'n' && !epl_is_time_optonal() && $time_total_att > 0 && ($time_avail !== '' || $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['past'] === true)) { $_error = array(); if (!epl_is_ongoing_event() && $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['past'] == 1) { $_error = array($_displ_date . '<br />' . $_time, epl__('This time has passed.')); } if ($time_avail === 0 || $time_avail < 0) { $_error = array($_displ_date . '<br />' . $_time, $sold_out_text); } elseif ($time_total_att > epl_nz($time_avail, 1000)) { $_error = array($_displ_date . '<br />' . $_time, sprintf(epl__('Only %d spaces left.'), $time_avail)); } if (!empty($_error)) { $epl_error[] = $_error; $event_snapshot[$event_id]['error'][] = $_error; } $event_snapshot[$event_id][$_date_key]['time'][$_time_key]['avail_display'] = epl_get_element(1, $_error); } } if ($rolling_regis && $rolling_regis_time_avail == 0 && $event_snapshot[$event_id][$_date_key]['date'] == '') { $event_snapshot[$event_id][$_date_key]['date']['hide'] = true; } //check for the date availability $event_snapshot[$event_id][$_date_key]['date']['cart'] = $date_total_att; if ($date_total_att > 0 && ($date_avail !== '' || $event_snapshot[$event_id][$_date_key]['date']['past'] === true) && (!epl_is_waitlist_approved() && !epl_is_waitlist_session_approved())) { $_error = array(); if ($this->flow_mode == 'n' && ($date_avail === 0 || $date_avail < 0)) { $_error = array($_displ_date, $sold_out_text); if (epl_is_ok_for_waitlist() && ($wl_spaces_left = epl_waitlist_spaces_open()) !== false) { $_error[1] .= '<br />' . epl__('If you would like to be added to the waiting list, please click on the button below. You will not be charged at this time.'); if ($wl_spaces_left !== true) { $_error[1] .= '<br />' . sprintf('Spaces available on the waiting list: %d', $wl_spaces_left); } if (epl_waitlist_enough_spaces($event_id) == false) { $_error[1] .= '<br />' . sprintf('To continue, please select only %d.', $wl_spaces_left); } else { $_error[1] .= '<br />' . epl_anchor('#', epl__('Click here to add your name to the waitlist'), null, " class='open_add_to_waitlist_form epl_button' data-event_id='{$event_id}'"); } $this->epl->epl_util->set_response_param('waitlist_form', ''); } } elseif ($this->flow_mode == 'n' && !epl_is_ongoing_event() && $event_snapshot[$event_id][$_date_key]['date']['past'] == 1) { $_error = array($_displ_date, epl__('This date has passed.')); } elseif ($this->flow_mode == 'n' && $date_total_att > epl_nz($date_avail, 1000)) { $_error = array($_displ_date, sprintf(epl__('Only %d spaces left.'), $date_avail)); } $event_snapshot[$event_id][$_date_key]['date']['avail_display'] = epl_get_element(1, $_error); if (!empty($_error)) { $event_snapshot[$event_id]['error'][] = $_error; $epl_error[] = $_error; } } //$this->epl_table->add_row( '', $event_details['_epl_start_date'][$_date_key], $avail ); } $_cache[$event_id] = $event_snapshot; return $event_snapshot; }
<?php global $event_details; foreach ($table_data as $event_id => $date_data) { setup_event_details($event_id); ?> <table class="epl_dates_times_prices_table" > <tr class=""> <td><h2><?php echo epl_format_string($event_details['post_title']); ?> </h2></td> <td class="epl_w200"> <?php if (!epl_is_multi_location() && epl_get_event_property('_epl_event_location', true) > 0) { ?> <div class=""> <?php echo get_the_location_name(); ?> <br /> <?php echo get_the_location_address(); ?> <?php echo get_the_location_address2(); ?> <br /> <?php
function get_days_for_fc($args = array()) { global $post; //page specific caching if (!epl_user_is_admin() && epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_enable_cache', 10) == 10 && false !== ($fc_dates = get_transient('epl_transient__get_days_for_fc__' . $post->ID))) { // return $fc_dates; } $show_att_counts = intval(epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_show_att_count', 0)); if ($show_att_counts === 0) { $show_att_counts = epl_get_element('show_att_counts', $args) === true ? true : $show_att_counts; } if ($show_att_counts === 1 && !epl_user_is_admin()) { $show_att_counts = false; } if ($show_att_counts === 2 && !is_user_logged_in()) { $show_att_counts = false; } global $event_details; $events = $this->get_days_for_widget(3, $args); $show_first_date_only = apply_filters('epl__get_days_for_fc__', false); $event_bcg_color = epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_tax_bcg_color'); $event_font_color = epl_get_setting('epl_fullcalendar_options', 'epl_fullcalendar_tax_font_color'); $r = array(); $counter = 0; $date_sel_mode = false; //(epl_get_element( 'date_selector', $args, 0 ) == 1); foreach ($events as $date => $event_data) { $data['_event'] = $event_data; setup_event_details($event_data['event_id']); $c = $this->epl->load_view('front/tooltip/template-1', $data, true); $_t = explode(',', $event_data['term_list']); $bc = epl_get_element(current($_t), $event_bcg_color, '#ffffff'); $tc = epl_get_element(current($_t), $event_font_color, 'blue'); $_r = array('title' => $date_sel_mode ? 'Select' : $event_data['title'], 'raw_title' => $event_data['title'], 'description' => $date_sel_mode ? $this->erm->get_the_dates($event_data['date_id']) : $c, 'term_list' => $event_data['term_list'], 'start_timestamp' => $event_data['date'], 'start' => epl_formatted_date($event_data['date'], 'Y-m-d'), 'end_timestamp' => $event_data['end'], 'end' => epl_formatted_date($event_data['end'], 'Y-m-d'), 'url' => $date_sel_mode ? '' : $event_data['register_link'], 'edit_url' => get_edit_post_link(), 'backgroundColor' => $bc, 'borderColor' => $bc, 'textColor' => $tc, 'className' => $event_data['register_link_type'] == 1 ? 'epl-no-modal' : '', 'id' => $event_data['event_id']); $weekday = date('N', $event_data['date']); //if multiple times, display the event for each time. if (count($event_data['times']['start']) > 1 && !$date_sel_mode) { $_tmp_title = $_r['title']; $_tmp_url = $_r['url']; foreach ($event_data['times']['start'] as $time_id => $time) { if ($time == '') { continue; } if (epl_is_date_level_time()) { if (epl_is_date_specific_time($time_id) && !isset($event_details['_epl_date_specific_time'][$time_id][$event_data['date_id']])) { continue; } } $weekday_specific = epl_get_element_m($time_id, '_epl_weekday_specific_time', $event_details, array()); if (!epl_is_empty_array($weekday_specific) && !isset($weekday_specific[$weekday])) { continue; } //$_r['title'] = '<span class="epl_fc_title_time"> ' . $time . '</span>' . $_tmp_title; $_r['title'] = $_tmp_title; $_r['raw_title'] = $_tmp_title; if ($show_att_counts) { $_r['title'] .= ' ' . '<span style="background-color:red;color:#fff;padding:0 4px;white-space: nowrap;"> ' . epl_get_att_count(array('for' => 'time', 'date_id' => $event_data['date_id'], 'time_id' => $time_id, 'default' => 0)); $_r['title'] .= (epl_get_time_capacity($time_id) != '' ? ' / ' . epl_get_time_capacity($time_id) : '') . '</span>'; $_r['att_counts'] = epl_get_att_count(array('for' => 'time', 'date_id' => $event_data['date_id'], 'time_id' => $time_id, 'default' => 0)); $_r['att_counts'] .= epl_get_time_capacity($time_id) != '' ? ' / ' . epl_get_time_capacity($time_id) : ''; } $_r['url'] = $date_sel_mode ? '' : add_query_arg(array('_time_id' => $time_id), $event_data['register_link']); $tmp_key_for_sorting = strtotime($time, $event_data['date']); if (isset($r[$tmp_key_for_sorting])) { $tmp_key_for_sorting .= '.' . $counter; $counter++; } $_r['start'] = epl_formatted_date(strtotime($time, $event_data['date']), 'Y-m-d H:i:s'); $_r['end'] = epl_formatted_date(strtotime($event_data['times']['end'][$time_id], $show_first_date_only ? $event_data['start'] : $event_data['end']), 'Y-m-d H:i:s'); //$_r['allDay'] = false; $r[$tmp_key_for_sorting] = $_r; //$r[] = $_r; $counter++; } continue; } else { $time = current($event_data['times']['start']); //$_r['title'] = ($time != '' ? '<span class="epl_fc_title_time"> ' . $time . '</span>' : '') . $_r['title']; $_r['title'] = $_r['title']; if (epl_is_empty_array($event_data['times']['start'])) { $_r['start'] = epl_formatted_date($event_data['date'] + 25200, 'Y-m-d H:i:s'); } else { $_r['start'] = epl_formatted_date(strtotime(current($event_data['times']['start']) . ' ', $event_data['date']), 'Y-m-d H:i:s'); } if (epl_is_empty_array($event_data['times']['end'])) { $_r['end'] = epl_formatted_date($event_data['end'] + 86399, 'Y-m-d H:i:s'); } else { $_r['end'] = epl_formatted_date(strtotime(current($event_data['times']['end']) . ' ', $show_first_date_only ? $event_data['start'] : $event_data['end']), 'Y-m-d H:i:s'); } if ($show_att_counts) { $_r['title'] .= ' ' . '<span style="background-color:red;color:#fff;padding:0 4px;white-space: nowrap;"> ' . epl_get_att_count(array('for' => 'date', 'date_id' => $event_data['date_id'], 'default' => 0)); $_r['title'] .= (epl_get_date_capacity($event_data['date_id']) != '' ? ' / ' . epl_get_date_capacity($event_data['date_id']) : '') . '</span>'; $_r['att_counts'] = epl_get_att_count(array('for' => 'date', 'date_id' => $event_data['date_id'], 'default' => 0)); $_r['att_counts'] .= epl_get_date_capacity($event_data['date_id']) != '' ? ' / ' . epl_get_date_capacity($event_data['date_id']) : ''; } } $tmp_key_for_sorting = strtotime(current($event_data['times']['start']) . ' ', $event_data['date']); if (isset($r[$tmp_key_for_sorting])) { $tmp_key_for_sorting .= '.' . $counter; $counter++; } $_r['sort_time'] = $tmp_key_for_sorting; $r[$tmp_key_for_sorting] = $_r; //$_r = apply_filters( 'epl_get_cal_dates_response_loop', $r ); $counter++; } $raw = apply_filters('epl_get_cal_dates_response', $r); ksort($raw); //@TODO - temp solution for showing cal in the month of first avail. event global $first_event_date; $first_event_date = key($raw); if (isset($args['raw'])) { return $raw; } //using array_values to get rid of temp keys, fullcalendar doesn't seem to like them :) $r = json_encode(array_values($r)); if (!epl_user_is_admin()) { set_transient('epl_transient__get_days_for_fc__' . $post->ID, base64_encode($r), 60 * 60 * 4); } return $r; }