static function edit_form() { global $EM_Notices, $EM_Coupon; //check that user can access this page if (is_object($EM_Coupon) && !$EM_Coupon->can_manage('manage_bookings', 'manage_others_bookings')) { ?> <div class="wrap"><h2><?php esc_html_e_emp('Unauthorized Access', 'dbem'); ?> </h2><p><?php echo sprintf(esc_html__emp('You do not have the rights to manage this %s.', 'dbem'), __('coupon', 'em-pro')); ?> </p></div> <?php return false; } elseif (!is_object($EM_Coupon)) { $EM_Coupon = new EM_Coupon(); } $required = "<i>(" . __('required', 'em-pro') . ")</i>"; ?> <div class='wrap nosubsub'> <div class="icon32" id="icon-bookings"><br></div> <h2><?php _e('Edit Coupon', 'em-pro'); ?> </h2> <?php echo $EM_Notices; ?> <form id='coupon-form' method='post' action=''> <input type='hidden' name='action' value='coupon_save' /> <input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('coupon_save'); ?> ' /> <input type='hidden' name='coupon_id' value='<?php echo $EM_Coupon->coupon_id; ?> '/> <table class="form-table"> <tbody> <?php if (!get_option('dbem_multiple_bookings')) { ?> <tr valign="top"> <th scope="row"><?php _e('Coupon Availability', 'em-pro'); ?> </th> <td> <select name="coupon_availability"> <option value=""><?php _e('Only on specific events that I own', 'em-pro'); ?> </option> <option value="eventwide" <?php if ($EM_Coupon->coupon_eventwide && !$EM_Coupon->coupon_sitewide) { echo 'selected="selected"'; } ?> ><?php _e('All my events', 'em-pro'); ?> </option> <?php if (current_user_can('manage_others_bookings') || is_super_admin()) { ?> <option value="sitewide" <?php if ($EM_Coupon->coupon_sitewide) { echo 'selected="selected"'; } ?> ><?php _e('All events on this site', 'em-pro'); ?> </option> <?php } ?> </select> <br /> <em><?php _e('Choose whether to allow this coupon to be used only on events you choose, all your events or all events on this site.', 'em-pro'); ?> </em> </td> </tr> <?php } else { ?> <tr><td colspan="2"><p><?php _e('This coupon will be available for all bookings made and discount is applied to the total price before checking out.', 'em-pro'); ?> </p> <?php } ?> <tr valign="top"> <th scope="row"><?php _e('Registered Users Only?', 'em-pro'); ?> </th> <td><input type="checkbox" name="coupon_private" value="1" <?php if ($EM_Coupon->coupon_private) { echo 'checked="checked"'; } ?> /> <br /> <em><?php _e('If checked, only logged in users will be able to use this coupon.', 'em-pro'); ?> </em> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Coupon Code', 'em-pro'); ?> </th> <td><input type="text" name="coupon_code" value="<?php echo esc_attr($EM_Coupon->coupon_code); ?> " /> <br /> <em><?php _e('This is the code you give to users for them to use when booking.', 'em-pro'); ?> </em> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e_emp('Name', 'dbem'); ?> </th> <td><input type="text" name="coupon_name" value="<?php echo esc_attr($EM_Coupon->coupon_name); ?> " /> <br /> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e_emp('Description', 'dbem'); ?> </th> <td><input type="text" name="coupon_description" value="<?php echo esc_attr($EM_Coupon->coupon_description); ?> " /> <br /> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Total Coupons', 'em-pro'); ?> </th> <td><input type="text" name="coupon_max" value="<?php echo esc_attr($EM_Coupon->coupon_max); ?> " /> <br /> <em><?php _e('If set, this coupon will only be valid that many times.', 'em-pro'); ?> </em> </td> </tr> <tbody class="em-date-range"> <tr valign="top"> <th scope="row"><?php esc_html_e_emp('Start Date', 'dbem'); ?> </th> <td> <input type="text" class="em-date-input-loc em-date-start" /> <input type="hidden" class="em-date-input" name="coupon_start" value="<?php echo esc_attr(substr($EM_Coupon->coupon_start, 0, 10)); ?> " /> <br /> <em><?php _e('Coupons will only be valid from this date onwards.', 'em-pro'); ?> </em> </td> </tr> <tr valign="top"> <th scope="row"><?php esc_html_e_emp('End Date', 'dbem'); ?> </th> <td> <input type="text" class="em-date-input-loc em-date-end" /> <input type="hidden" class="em-date-input" name="coupon_end" value="<?php echo esc_attr(substr($EM_Coupon->coupon_end, 0, 10)); ?> " /> <br /> <em><?php _e('Coupons will not be valid after this date.', 'em-pro'); ?> </em> </td> </tr> </tbody> <tr valign="top"> <th scope="row"><?php _e('Discount Type', 'em-pro'); ?> </th> <td> <select name="coupon_type"> <option value="%" <?php echo $EM_Coupon->coupon_type == '%' ? 'selected="selected"' : ''; ?> ><?php _e('Percentage', 'em-pro'); ?> </option> <option value="#" <?php echo $EM_Coupon->coupon_type == '#' ? 'selected="selected"' : ''; ?> ><?php _e('Fixed Amount', 'em-pro'); ?> </option> </select> <br /> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Apply Before/After Tax', 'em-pro'); ?> </th> <td> <select name="coupon_tax"> <option value="pre" <?php echo $EM_Coupon->coupon_tax == 'pre' ? 'selected="selected"' : ''; ?> ><?php _e('Before', 'em-pro'); ?> </option> <option value="post" <?php echo $EM_Coupon->coupon_tax == 'post' ? 'selected="selected"' : ''; ?> ><?php _e('After', 'em-pro'); ?> </option> </select> <br /> <em><?php _e('Choose whether to apply this discount before or after tax has been added, if applicable.', 'em-pro'); ?> </em> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Discount Amount', 'em-pro'); ?> </th> <td><input type="text" name="coupon_discount" value="<?php echo esc_attr($EM_Coupon->coupon_discount); ?> " /> <br /> <em><?php _e('Enter a number here only, decimals accepted.', 'em-pro'); ?> </em> </td> </tr> </tbody> </table> <p class="submit"> <input type="submit" name="Submit" class="button-primary" value="<?php esc_attr_e('Save Changes'); ?> " /> </p> </form> </div> <!-- wrap --> <?php }
<th colspan="2"><?php echo $discount_summary['name']; ?> </th> <td>- <?php echo $discount_summary['amount']; ?> </td> </tr> <?php } ?> <?php } ?> <tr> <th colspan="2"><?php esc_html_e_emp('Total Price', 'dbem'); ?> </th> <td><?php echo $price_summary['total']; ?> </td> </tr> <?php do_action('em_multiple_bookings_table_after_totals', $EM_Multiple_Booking); //do not delete ?> </tbody> </table>
}); $('.em-booking-single-status-info').show(); $('.em-booking-single-status-edit').hide(); }); </script> </div> </div> <div id="em-booking-notes" class="stuffbox"> <h3> <?php _e('Booking Notes', 'dbem'); ?> </h3> <div class="inside"> <p><?php esc_html_e_emp('You can add private notes below for internal reference that only event managers will see.', 'dbem'); ?> </p> <?php foreach ($EM_Multiple_Booking->get_notes() as $note) { $user = new EM_Person($note['author']); ?> <div> <?php echo sprintf(esc_html_x_emp('%1$s - %2$s wrote', '[Date] - [Name] wrote', 'dbem'), date(get_option('date_format'), $note['timestamp']), $user->get_name()); ?> : <p style="background:#efefef; padding:5px;"><?php echo nl2br($note['note']); ?> </p>
/** * Outputs custom PayPal setting fields in the settings page */ function mysettings() { global $EM_options; ?> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"><?php _e('Success Message', 'em-pro'); ?> </th> <td> <input type="text" name="booking_feedback" value="<?php esc_attr_e(get_option('em_' . $this->gateway . "_booking_feedback")); ?> " style='width: 40em;' /><br /> <em><?php _e('The message that is shown to a user when a booking is successful and payment has been taken.', 'em-pro'); ?> </em> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('Success Free Message', 'em-pro'); ?> </th> <td> <input type="text" name="booking_feedback_free" value="<?php esc_attr_e(get_option('em_' . $this->gateway . "_booking_feedback_free")); ?> " style='width: 40em;' /><br /> <em><?php _e('If some cases if you allow a free ticket (e.g. pay at gate) as well as paid tickets, this message will be shown and the user will not be charged.', 'em-pro'); ?> </em> </td> </tr> </tbody> </table> <h3><?php echo sprintf(esc_html__emp('%s Options', 'dbem'), 'Authorize.net'); ?> </h3> <p style="font-style:italic;"><?php echo sprintf(__('Please visit the <a href="%s">documentation</a> for further instructions on setting up Authorize.net with Events Manager.', 'em-pro'), 'http://wp-events-plugin.com/documentation/event-bookings-with-authorize-net-aim/'); ?> </p> <table class="form-table"> <tbody> <tr valign="top"> <th scope="row"><?php _e('Mode', 'em-pro'); ?> </th> <td> <select name="mode"> <?php $selected = get_option('em_' . $this->gateway . '_mode'); ?> <option value="sandbox" <?php echo $selected == 'sandbox' ? 'selected="selected"' : ''; ?> ><?php _e('Sandbox', 'emp-pro'); ?> </option> <option value="live" <?php echo $selected == 'live' ? 'selected="selected"' : ''; ?> ><?php _e('Live', 'emp-pro'); ?> </option> </select> <br /> <em><?php echo sprintf(__('Please visit <a href="%s">Authorize.net</a> to set up a sandbox account if you would like to test this gateway out. Alternatively, you can use your real account in test mode, which you can set on your Authorize.net control panel.', 'em-pro'), 'https://developer.authorize.net/integration/fifteenminutes/'); ?> </em> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('API Login ID', 'emp-pro'); ?> </th> <td><input type="text" name="api_user" value="<?php esc_attr_e(get_option('em_' . $this->gateway . "_api_user", "")); ?> " /></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Transaction key', 'emp-pro'); ?> </th> <td><input type="text" name="api_key" value="<?php esc_attr_e(get_option('em_' . $this->gateway . "_api_key", "")); ?> " /></td> </tr> <tr><td colspan="2"> <p><strong><?php echo __('Payment Notifications', 'em-pro'); ?> </strong></p> <p><?php _e('If you would like to receive notifications from Authorize.net and handle refunds or voided transactions automatically, you need to enable Silent Post URL and provide an MD5 Hash in your merchant interface.', 'em-pro'); ?> </p> <p><?php echo sprintf(__('Your return url is %s.', 'em-pro'), '<code>' . $this->get_payment_return_url() . '</code>'); ?> <?php _e('You can use this as your Silent Post URL.', 'em-pro'); ?> </p> </td></tr> <tr> <th scope="row"><?php _e('Security: MD5 Hash', 'emp-pro'); ?> </th> <td> <input type="text" name="md5_hash" value="<?php esc_attr_e(get_option('em_' . $this->gateway . "_md5_hash")); ?> " /><br /> <em><?php _e('This string of text needs to match that in your merchant interface settings.', 'em-pro'); ?> </em> </td> </tr> <tr valign="top"> <th scope="row"><?php _e('User Login ID', 'emp-pro'); ?> </th> <td> <input type="text" name="user_login" value="<?php esc_attr_e(get_option('em_' . $this->gateway . "_user_login", "")); ?> " /><br /> <em><?php _e('This is the username you use to log into your merchant interface.', 'em-pro'); ?> </em> </td> </tr> <tr><td colspan="2"><strong><?php echo sprintf(esc_html__emp('%s Options', 'dbem'), esc_html__emp('Advanced', 'dbem')); ?> </strong></td></tr> <tr> <th scope="row"><?php _e('Email Customer (on success)', 'emp-pro'); ?> </th> <td> <select name="email_customer"> <?php $selected = get_option('em_' . $this->gateway . '_email_customer'); ?> <option value="1" <?php echo $selected ? 'selected="selected"' : ''; ?> ><?php esc_html_e_emp('Yes', 'dbem'); ?> </option> <option value="0" <?php echo !$selected ? 'selected="selected"' : ''; ?> ><?php esc_html_e_emp('No', 'dbem'); ?> </option> </select> </td> </tr> <tr> <th scope="row"><?php _e('Customer Receipt Email Header', 'emp-pro'); ?> </th> <td><input type="text" name="header_email_receipt" value="<?php esc_attr_e(get_option('em_' . $this->gateway . "_header_email_receipt", __("Thanks for your payment!", "emp-pro"))); ?> " /></td> </tr> <tr> <th scope="row"><?php _e('Customer Receipt Email Footer', 'emp-pro'); ?> </th> <td><input type="text" name="footer_email_receipt" value="<?php esc_attr_e(get_option('em_' . $this->gateway . "_footer_email_receipt", "")); ?> " /></td> </tr> <tr valign="top"> <th scope="row"><?php _e('Manually approve completed transactions?', 'em-pro'); ?> </th> <td> <input type="checkbox" name="manual_approval" value="1" <?php echo get_option('em_' . $this->gateway . "_manual_approval") ? 'checked="checked"' : ''; ?> /><br /> <em><?php _e('By default, when someone pays for a booking, it gets automatically approved once the payment is confirmed. If you would like to manually verify and approve bookings, tick this box.', 'em-pro'); ?> </em><br /> <em><?php echo sprintf(__('Approvals must also be required for all bookings in your <a href="%s">settings</a> for this to work properly.', 'em-pro'), EM_ADMIN_URL . '&page=events-manager-options'); ?> </em> </td> </tr> </tbody> </table> <?php }
public static function event_bookings_meta_box() { //Get available coupons for user global $wpdb, $EM_Event; self::get_form($EM_Event); $default_form_id = get_option('em_booking_form_fields'); ?> <br style="clear" /> <h4><?php esc_html_e_emp('Booking Form', 'dbem'); ?> </h4> <p><em><?php _e('You can choose to use a custom booking form, or leave as is to use the default booking form.', 'em-pro'); ?> </em></p> <div> <?php _e('Selected Booking Form', 'em-pro'); ?> : <select name="custom_booking_form" onchange="this.parentNode.submit()"> <option value="0">[ <?php _e('Default', 'em-pro'); ?> ]</option> <?php foreach (self::get_forms_names() as $form_key => $form_name_option) { ?> <?php if ($form_key != $default_form_id) { ?> <option value="<?php echo $form_key; ?> " <?php if ($form_key == self::$form_id) { echo 'selected="selected"'; } ?> ><?php echo $form_name_option; ?> </option> <?php } ?> <?php } ?> </select> <?php do_action('emp_bookings_form_select_footer'); ?> </div> <?php }
public static function emails() { global $save_button; $bookings_placeholders = '<a href="' . EM_ADMIN_URL . '&page=events-manager-help#booking-placeholders">' . esc_html__emp('Booking Related Placeholders', 'dbem') . '</a>'; $bookings_placeholder_tip = " " . sprintf(esc_html__emp('This accepts %s placeholders.', 'dbem'), $bookings_placeholders); ?> <div class="postbox " id="em-opt-multiple-booking-emails" > <div class="handlediv" title="<?php esc_attr_e_emp('Click to toggle', 'dbem'); ?> "><br /></div><h3><span><?php _e('Multiple Booking Email Templates', 'em-pro'); ?> </span></h3> <div class="inside"> <div class="em-boxheader"> <p><?php echo sprintf(__('When users make a booking in Multiple Bookings Mode or cancels their booking, these emails get sent to the attendee and administrator emails you assign in the %s section above.', 'em-pro'), '<code>' . esc_html__emp('Booking Email Templates', 'dbem') . '</code>'); ?> </p> <p><?php _e('When administrators modify a set of multiple bookings rather than individual events, these templates will be used to notify the attendee.', 'em-pro'); ?> </p> </div> <table class='form-table'> <?php $email_subject_tip = esc_html__emp('You can disable this email by leaving the subject blank.', 'dbem'); em_options_radio_binary(__('Email event owners?', 'em-pro'), 'dbem_multiple_bookings_contact_email', sprintf(__('If enabled, additional emails will be sent to administrators and event owners for EVERY event booked based on the above %s settings.', 'em-pro'), '<code>' . esc_html__emp('Booking Email Templates', 'dbem') . '</code>')); ?> <tr class="em-header"><td colspan='2'><h4><?php esc_html_e_emp('Event Admin/Owner Emails', 'dbem'); ?> </h4></td></tr> <tbody class="em-subsection"> <tr class="em-subheader"><td colspan='2'> <h5><?php esc_html_e_emp('Contact person booking confirmed', 'dbem'); ?> </h5> <em><?php esc_html_e_emp('An email will be sent to the event contact when a booking is first made.', 'dbem') . $bookings_placeholder_tip; ?> </em> </td></tr> <?php em_options_input_text(esc_html__emp('Contact person email subject', 'dbem'), 'dbem_multiple_bookings_contact_email_subject', $email_subject_tip); em_options_textarea(esc_html__emp('Contact person email', 'dbem'), 'dbem_multiple_bookings_contact_email_body', ''); ?> <tr class="em-subheader"><td colspan='2'> <h5><?php esc_html_e_emp('Contact person booking cancelled', 'dbem'); ?> </h5> <em><?php esc_html_e_emp('An email will be sent to the event contact if someone cancels their booking.', 'dbem') . $bookings_placeholder_tip; ?> </em> </td></tr> <?php em_options_input_text(esc_html__emp('Contact person cancellation subject', 'dbem'), 'dbem_multiple_bookings_contact_email_cancelled_subject', $email_subject_tip); em_options_textarea(esc_html__emp('Contact person cancellation email', 'dbem'), 'dbem_multiple_bookings_contact_email_cancelled_body', ''); ?> </tbody> <tbody class="em-subsection"> <tr class="em-header"><td colspan='2'><h4><?php esc_html_e_emp('Booked User Emails', 'dbem'); ?> </h4></td></tr> <tr class="em-subheader"><td colspan='2'> <h5><?php esc_html_e_emp('Confirmed booking email', 'dbem'); ?> </h5> <em><?php esc_html_e_emp('This is sent when a person\'s booking is confirmed. This will be sent automatically if approvals are required and the booking is approved. If approvals are disabled, this is sent out when a user first submits their booking.', 'dbem') . $bookings_placeholder_tip; ?> </em> </td></tr> <?php em_options_input_text(esc_html__emp('Booking confirmed email subject', 'dbem'), 'dbem_multiple_bookings_email_confirmed_subject', $email_subject_tip); em_options_textarea(esc_html__emp('Booking confirmed email', 'dbem'), 'dbem_multiple_bookings_email_confirmed_body', ''); ?> <tr class="em-subheader"><td colspan='2'> <h5><?php esc_html_e_emp('Pending booking email', 'dbem'); ?> </h5> <em><?php esc_html_e_emp('This will be sent to the person when they first submit their booking. Not relevant if bookings don\'t require approval.', 'dbem') . $bookings_placeholder_tip; ?> </em> </td></tr> <?php em_options_input_text(esc_html__emp('Booking pending email subject', 'dbem'), 'dbem_multiple_bookings_email_pending_subject', $email_subject_tip); em_options_textarea(esc_html__emp('Booking pending email', 'dbem'), 'dbem_multiple_bookings_email_pending_body', ''); ?> <tr class="em-subheader"><td colspan='2'> <h5><?php esc_html_e_emp('Rejected booking email', 'dbem'); ?> </h5> <em><?php esc_html_e_emp('This will be sent automatically when a booking is rejected. Not relevant if bookings don\'t require approval.', 'dbem') . $bookings_placeholder_tip; ?> </em> </td></tr> <?php em_options_input_text(esc_html__emp('Booking rejected email subject', 'dbem'), 'dbem_multiple_bookings_email_rejected_subject', $email_subject_tip); em_options_textarea(esc_html__emp('Booking rejected email', 'dbem'), 'dbem_multiple_bookings_email_rejected_body', ''); ?> <tr class="em-subheader"><td colspan='2'> <h5><?php esc_html_e_emp('Booking cancelled', 'dbem'); ?> </h5> <em><?php esc_html_e_emp('This will be sent when a user cancels their booking.', 'dbem') . $bookings_placeholder_tip; ?> </em> </td></tr> <?php em_options_input_text(esc_html__emp('Booking cancelled email subject', 'dbem'), 'dbem_multiple_bookings_email_cancelled_subject', $email_subject_tip); em_options_textarea(esc_html__emp('Booking cancelled email', 'dbem'), 'dbem_multiple_bookings_email_cancelled_body', ''); ?> </tbody> <?php echo $save_button; ?> </table> </div> <!-- . inside --> </div> <!-- .postbox --> <?php }
?> <tr class="em-cart-table-event-summary" id="em-cart-table-event-summary-<?php echo $EM_Booking->get_event()->event_id; ?> "> <td> <?php ob_start(); ?> <span class="em-cart-table-event-title">#_EVENTLINK</span><br/> <?php esc_html_e_emp('When', 'dbem'); ?> : #_EVENTDATES @ #_EVENTTIMES<br /> <?php esc_html_e_emp('Where', 'dbem'); ?> : #_LOCATIONFULLLINE <?php echo $EM_Booking->output(ob_get_clean()); ?> <br /> <div class="em-cart-table-details-actions"> <!-- <a href="#" class="em-cart-table-actions-edit" rel="<?php echo $EM_Booking->get_event()->event_id; ?> " id="em-cart-table-actions-edit-<?php echo $EM_Booking->get_event()->event_id; ?> "> <?php
function print_transactions($transactions, $columns = 7) { ob_start(); if ($transactions) { foreach ($transactions as $key => $transaction) { ?> <tr valign="middle" class="alternate"> <td> <?php $EM_Booking = em_get_booking($transaction->booking_id); if (get_class($EM_Booking) == 'EM_Multiple_Booking') { $link = em_add_get_params($EM_Booking->get_admin_url(), array('booking_id' => $EM_Booking->booking_id, 'em_ajax' => null, 'em_obj' => null)); echo '<a href="' . $link . '">' . $EM_Booking->get_event()->event_name . '</a>'; } else { echo '<a href="' . $EM_Booking->get_event()->get_bookings_url() . '">' . $EM_Booking->get_event()->event_name . '</a>'; } ?> </td> <td> <?php echo '<a href="' . $EM_Booking->get_person()->get_bookings_url() . '">' . $EM_Booking->person->get_name() . '</a>'; ?> </td> <td class="column-date"> <?php echo mysql2date(get_option('dbem_date_format'), $transaction->transaction_timestamp); ?> </td> <td class="column-amount"> <?php $amount = $transaction->transaction_total_amount; echo $transaction->transaction_currency; echo " " . number_format($amount, 2, '.', ','); ?> </td> <td class="column-gateway-trans-id"> <?php if (!empty($transaction->transaction_gateway_id)) { echo $transaction->transaction_gateway_id; } else { echo __('None yet', 'em-pro'); } ?> </td> <td class="column-gateway"> <?php if (!empty($transaction->transaction_gateway)) { echo $transaction->transaction_gateway; } else { echo __('None yet', 'em-pro'); } ?> </td> <td class="column-trans-status"> <?php if (!empty($transaction->transaction_status)) { echo $transaction->transaction_status; } else { echo __('None yet', 'em-pro'); } ?> </td> <td class="column-trans-note-id"> <?php if (!empty($transaction->transaction_note)) { echo esc_html($transaction->transaction_note); } else { echo __('None', 'em-pro'); } ?> </td> <td class="column-trans-note-id"> <?php if ($EM_Booking->can_manage()) { ?> <span class="trash"><a class="em-transaction-delete" href="<?php echo em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'transaction_delete', 'txn_id' => $transaction->transaction_id, '_wpnonce' => wp_create_nonce('transaction_delete_' . $transaction->transaction_id . '_' . get_current_user_id()))); ?> "><?php esc_html_e_emp('Delete', 'dbem'); ?> </a></span> <?php } ?> </td> </tr> <?php } } else { $columncount = count($columns); ?> <tr valign="middle" class="alternate" > <td colspan="<?php echo $columncount; ?> " scope="row"><?php _e('No Transactions', 'em-pro'); ?> </td> </tr> <?php } return ob_get_clean(); }
/** * Outputs the form editor in the admin area */ public static function admin_page() { $EM_Form = self::get_form(); ?> <div id="poststuff" class="metabox-holder"> <div id="post-body"> <div id="post-body-content"> <?php do_action('em_booking_attendee_form_admin_page_header'); ?> <div id="attendee-form-settings" class="stuffbox"> <h3 id="attendee-form"> <?php _e('Attendee Form', 'em-pro'); ?> </h3> <div class="inside"> <p><?php _e("If enabled, this form will be shown and required for every space booked.", 'em-pro'); ?> </p> <form method="post" action="#attendee-form"> <p> <?php _e('Enable Attendee Forms', 'em-pro'); ?> : <input type="radio" name="em_attendee_fields_enabled" value="1" class="attendee-enable" <?php if (get_option('em_attendee_fields_enabled')) { echo 'checked="checked"'; } ?> /> <?php esc_html_e_emp('Yes', 'dbem'); ?> <input type="radio" name="em_attendee_fields_enabled" value="0" class="attendee-enable" <?php if (!get_option('em_attendee_fields_enabled')) { echo 'checked="checked"'; } ?> /> <?php esc_html_e_emp('No', 'dbem'); ?> <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('em_attendee_fields_enabled'); ?> " /> <input type="submit" class="button-secondary" value="<?php esc_attr_e_emp('Save Changes', 'dbem'); ?> " /> </p> </form> <?php if (get_option('em_attendee_fields_enabled')) { ?> <div id="em-attendee-form-editor"> <form method="get" action="#attendee-form"> <?php _e('Selected Attendee Form', 'em-pro'); ?> : <select name="att_form_id" onchange="this.parentNode.submit()"> <option value="0" <?php if (!self::$form_id) { echo 'selected="selected"'; } ?> ><?php _e('None', 'em-pro'); ?> </option> <?php foreach (self::get_forms_names() as $form_key => $form_name_option) { ?> <option value="<?php echo $form_key; ?> " <?php if ($form_key == self::$form_id) { echo 'selected="selected"'; } ?> ><?php echo $form_name_option; ?> </option> <?php } ?> </select> <input type="hidden" name="post_type" value="<?php echo EM_POST_TYPE_EVENT; ?> " /> <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?> " /> </form> <?php if (self::$form_id != get_option('em_attendee_form_fields')) { ?> <form method="post" action="<?php echo add_query_arg(array('att_form_id' => null)); ?> #attendee-form"> <input type="hidden" name="att_form_id" value="<?php echo esc_attr($_REQUEST['att_form_id']); ?> " /> <input type="hidden" name="attendee_form_action" value="default" /> <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('attendee_form_default'); ?> " /> <input type="submit" value="<?php _e('Make Default', 'em-pro'); ?> »" class="button-secondary" onclick="return confirm('<?php _e('You are about to make this your default booking form. All events without an existing specifically chosen booking form will use this new default form from now on.\\n\\n Are you sure you want to do this?'); ?> ');" /> </form> <?php } ?> | <form method="post" action="<?php echo add_query_arg(array('att_form_id' => null)); ?> #attendee-form" id="attendee-form-add"> <input type="text" name="form_name" /> <input type="hidden" name="attendee_form_action" value="add" /> <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('attendee_form_add'); ?> " /> <input type="submit" value="<?php _e('Add New', 'em-pro'); ?> »" class="button-secondary" /> </form> <?php do_action('em_attendees_form_admin_page_actions', $EM_Form); ?> <?php if (self::$form_id == get_option('em_attendee_form_fields') && self::$form_id > 0) { ?> <br /><em><?php _e('This is the default attendee form and will be used for any event where you have not chosen a specific form to use.', 'em-pro'); ?> </em> <?php } ?> <br /><em><?php _e("If you don't want to ask for attendee information by default, select None as your booking form and make it the default form.", 'em-pro'); ?> </em> <?php if (self::$form_id > 0) { ?> <br /><br /> <form method="post" action="<?php echo add_query_arg(array('att_form_id' => null)); ?> #attendee-form" id="attendee-form-rename"> <span style="font-weight:bold;"><?php echo sprintf(__("You are now editing ", 'em-pro'), self::$form_name); ?> </span> <input type="text" name="form_name" value="<?php echo self::$form_name; ?> " /> <input type="hidden" name="att_form_id" value="<?php echo self::$form_id; ?> " /> <input type="hidden" name="attendee_form_action" value="rename" /> <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('attendee_form_rename'); ?> " /> <input type="submit" value="<?php _e('Rename', 'em-pro'); ?> »" class="button-secondary" /> </form> <?php if (self::$form_id != get_option('em_attendee_form_fields')) { ?> <form method="post" action="<?php echo add_query_arg(array('att_form_id' => null)); ?> #attendee-form" id="attendee-form-rename"> <input type="hidden" name="att_form_id" value="<?php echo esc_attr($_REQUEST['att_form_id']); ?> " /> <input type="hidden" name="attendee_form_action" value="delete" /> <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('attendee_form_delete'); ?> " /> <input type="submit" value="<?php _e('Delete', 'em-pro'); ?> »" class="button-secondary" onclick="return confirm('<?php _e('Are you sure you want to delete this form?\\n\\n All events using this form will start using the default form automatically.'); ?> ');" /> </form> <?php } ?> <p><?php _e('<strong>Important:</strong> When editing this form, to make sure your old booking information is displayed, make sure new field ids correspond with the old ones.', 'em-pro'); ?> </p> <br /><br /> <?php echo $EM_Form->editor(false, true, false); ?> <?php } else { ?> <p><em><?php if (self::$form_id == get_option('em_attendee_form_fields')) { echo __('Default Value', 'em-pro') . ' - '; } ?> <?php _e('No attendee form selected. Choose a form, or create a new one above.', 'em-pro'); ?> </em></p> <?php } ?> </div> <?php } ?> </div> </div> </div> </div> </div> <?php }
/** * @param string $summary * @param EM_Person $EM_Person * @return string|unknown */ public static function em_person_display_summary($summary, $EM_Person) { global $EM_Booking; $EM_Form = self::get_form(); $no_user = get_option('dbem_bookings_registration_disable') && $EM_Person->ID == get_option('dbem_bookings_registration_user'); ob_start(); //a bit of repeated stuff from the original EM_Person::display_summary() static function ?> <table class="em-form-fields"> <tr> <td><?php echo get_avatar($EM_Person->ID); ?> </td> <td style="padding-left:10px; vertical-align: top;"> <table> <?php if ($no_user) { ?> <tr><th><?php esc_html_e_emp('Name', 'dbem'); ?> : </th><th><?php echo $EM_Person->get_name(); ?> </th></tr> <?php } else { ?> <tr><th><?php esc_html_e_emp('Name', 'dbem'); ?> : </th><th><a href="<?php echo $EM_Person->get_bookings_url(); ?> "><?php echo $EM_Person->get_name(); ?> </a></th></tr> <?php } ?> <tr><th><?php esc_html_e_emp('Email', 'dbem'); ?> : </th><td><?php echo esc_html($EM_Person->user_email); ?> </td></tr> <?php foreach ($EM_Form->form_fields as $field_id => $field) { if ($field['type'] == 'html') { ?> <td colspan="2"><?php echo $field['options_html_content']; ?> </td> <?php } else { $value = esc_html(self::get_user_meta($EM_Person->ID, $field_id, true)); //override by registration value in case value is now empty, otherwise show n/a if (!empty($EM_Booking->booking_meta['registration'][$field_id]) && (empty($value) || $no_user)) { $value = $EM_Booking->booking_meta['registration'][$field_id]; } elseif (empty($value) || $no_user) { $value = "<em>" . __('n/a', 'em-pro') . "</em>"; } if ($value != "<em>" . __('n/a', 'em-pro') . "</em>") { $value = $EM_Form->get_formatted_value($field, $value); } ?> <tr><th><?php echo $field['label']; ?> : </th><td><?php echo $value; ?> </td></tr> <?php } } ?> </table> </td> </tr> </table> <?php return ob_get_clean(); }
/** * Builds form for overriding booking emails * @param array $emails_array_custom * @param array $emails_values_custom */ public static function emails_editor($emails_values_custom = array(), $emails_array_custom = array(), $admin_emails_custom = array(), $param = 'em_custom_email') { //build structure of emails to show $emails_array = !empty($emails_array_custom) ? $emails_array_custom : self::get_default_emails(); //override defaults $default_emails = self::get_default_email_values(); $emails_values = !empty($emails_values_custom) ? $emails_values_custom : self::get_default_email_values(); //override defaults $group_count = count($emails_array); //output the structure in an html form format ?> <div class="emp-cet"> <?php foreach ($emails_array as $email_array_group_name => $email_array_group) { ?> <h4 class="emp-cet-group-trigger"> <?php if ($group_count > 1) { ?> <a href="#" rel="#emp-cet-group-<?php echo $email_array_group_name; ?> "> <?php } ?> <?php echo $email_array_group['title']; ?> <?php if ($group_count > 1) { ?> <span>+</span></a> <?php } ?> </h4> <div class="emp-cet-group" id="emp-cet-group-<?php echo $email_array_group_name; ?> "> <div><?php if (!empty($email_array_group['text'])) { echo $email_array_group['text']; } ?> </div> <?php if (is_array($admin_emails_custom)) { ?> <label><?php _e('Also Send Event Owner Emails To:', 'em-pro'); ?> </label> <input type="text" class="emp-cet-email" name="<?php echo $param; ?> _admins[<?php echo $email_array_group_name; ?> ]" value="<?php if (!empty($admin_emails_custom[$email_array_group_name])) { echo $admin_emails_custom[$email_array_group_name]; } ?> " /><br /> <em><?php esc_html_e_emp('For multiple emails, seperate by commas (e.g. email1@test.com,email2@test.com,etc.)', 'dbem'); ?> </em> <?php } ?> <?php foreach ($email_array_group['subgroups'] as $email_array_subgroup => $email_array) { ?> <h5 class="emp-cet-subgroup-trigger"><a href="#" rel="#emp-cet-subgroup-<?php echo $email_array_subgroup; ?> "><?php echo $email_array['title']; ?> <span>+</span></a></h5> <div class="emp-cet-subgroup" id="emp-cet-subgroup-<?php echo $email_array_subgroup; ?> " > <p><?php echo $email_array['text']; ?> </p> <?php foreach ($email_array['emails'] as $email_type_name => $email_type) { ?> <div class="emp-cet-subgroup-email"> <?php $status = !empty($emails_values[$email_array_subgroup][$email_type_name]['status']) ? $emails_values[$email_array_subgroup][$email_type_name]['status'] : 0; $subject = !empty($emails_values[$email_array_subgroup][$email_type_name]['subject']) ? $emails_values[$email_array_subgroup][$email_type_name]['subject'] : $default_emails[$email_array_subgroup][$email_type_name]['subject']; $message = !empty($emails_values[$email_array_subgroup][$email_type_name]['message']) ? $emails_values[$email_array_subgroup][$email_type_name]['message'] : $default_emails[$email_array_subgroup][$email_type_name]['message']; ?> <select class="emp-cet-status" name="<?php echo $param; ?> [<?php echo $email_array_subgroup; ?> ][<?php echo $email_type_name; ?> ][status]"> <option value="0" class="emp-default"><?php esc_html_e('Default', 'em-pro'); ?> </option> <option value="1" class="emp-enabled" <?php if ($status == 1) { echo 'selected="selected"'; } ?> ><?php esc_html_e('Enabled', 'em-pro'); ?> </option> <option value="2" class="emp-disabled" <?php if ($status == 2) { echo 'selected="selected"'; } ?> ><?php esc_html_e('Disabled', 'em-pro'); ?> </option> </select> <strong><?php echo $email_type['title']; ?> </strong> <div class="emp-cet-vals"> <div class="emp-cet-val"> <label><?php _e('Subject', 'em-pro'); ?> </label> <input type="text" name="<?php echo $param; ?> [<?php echo $email_array_subgroup; ?> ][<?php echo $email_type_name; ?> ][subject]" value="<?php echo esc_attr($subject); ?> " /> </div> <div class="emp-cet-val"> <label><?php _e('Title', 'em-pro'); ?> </label> <textarea name="<?php echo $param; ?> [<?php echo $email_array_subgroup; ?> ][<?php echo $email_type_name; ?> ][message]"><?php echo esc_html($message); ?> </textarea> </div> </div> </div> <?php } ?> </div> <?php } ?> </div> <?php } ?> </div> <script type="text/javascript"> jQuery(document).ready(function($){ //hide all groups by default unless only 1 exists, then just subgroups var trigger_selector = '.emp-cet-subgroup-trigger a'; $('.emp-cet-subgroup').hide(); if( $('.emp-cet-group').length > 1 ){ $('.emp-cet-group').hide(); trigger_selector = '.emp-cet-group-trigger a, .emp-cet-subgroup-trigger a'; } //add listener to triggers for groups and subgroups $(trigger_selector).click(function(e){ e.preventDefault(); var a = $(this); if( a.children('span').text() == '+'){ $(a.attr('rel')).show(); a.children('span').text('-'); }else{ $(a.attr('rel')).hide(); a.children('span').text('+'); } }); //add listeners to individual email status changes $('.emp-cet select.emp-cet-status').change(function(){ var el = $(this); var selected = el.find('option:selected'); el.attr('class',selected.attr('class')); //show or hide if( selected.val() != 1 ){ el.nextAll('.emp-cet-vals').hide(); }else{ el.nextAll('.emp-cet-vals').show(); } //show subgroup and groups if not default value if( selected.val() != 0 ){ var subgroup = el.closest('.emp-cet-subgroup').show(); subgroup.prevAll('.emp-cet-subgroup-trigger').first().find('a span').text('-'); if( $('.emp-cet-group').length > 1 ){ var group = subgroup.closest('.emp-cet-group').show(); group.prevAll('.emp-cet-group-trigger').first().find('a span').text('-'); } } }).trigger('change'); $('.emp-cet input.emp-cet-email').each(function(){ if( this.value != '' ){ var group = $(this).closest('.emp-cet-group').show(); group.prevAll('.emp-cet-group-trigger').first().find('a span').text('-'); } }) }); </script> <?php }