/** * Accept an enquiry from the Client Zone. * * @since 1.3 * @param arr $data Passed from the super global $_POST * @return void */ function mdjm_event_accept_enquiry_action($data) { if (!wp_verify_nonce($data['mdjm_nonce'], 'accept_enquiry')) { $message = 'nonce_fail'; } elseif (!isset($data['event_id'])) { $message = 'missing_event'; } else { if (mdjm_accept_enquiry($data)) { $message = 'enquiry_accepted'; } else { $message = 'enquiry_accept_fail'; } } wp_redirect(add_query_arg('mdjm_message', $message, mdjm_get_event_uri($data['event_id']))); die; }
/** * Get Payment Form * * @since 1.3.8 * @return str */ function mdjm_payment_form() { global $mdjm_event; $payment_mode = mdjm_get_chosen_gateway(); ob_start(); echo '<div id="mdjm_payment_wrap">'; do_action('mdjm_print_notices'); echo '<p class="head-nav"><a href="' . mdjm_get_event_uri($mdjm_event->ID) . '">' . __('Back to Event', 'mobile-dj-manager') . '</a></p>'; ?> <div id="mdjm_payments_form_wrap" class="mdjm_clearfix"> <?php do_action('mdjm_before_purchase_form'); ?> <form id="mdjm_payment_form" class="mdjm_form" action="" method="POST" autocomplete="off"> <input type="hidden" name="event_id" id="mdjm-event-id" value="<?php echo $mdjm_event->ID; ?> " /> <?php mdjm_payment_items(); /** * Hooks in at the top of the payment form * * @since 1.3.8 */ do_action('mdjm_payment_form_top'); if (mdjm_show_gateways()) { do_action('mdjm_payment_mode_select'); } else { do_action('mdjm_payment_form'); } /** * Hooks in at the bottom of the checkout form * * @since 1.0 */ do_action('mdjm_checkout_form_bottom'); ?> </form> <?php do_action('mdjm_after_purchase_form'); ?> </div><!--end #mdjm_payments_form_wrap--> <?php echo '</div><!--end #mdjm_payment_wrap-->'; return ob_get_clean(); }
/** * Return all relevant action buttons for the event. * * Allow filtering of the buttons so they can be re-ordered, re-named etc. * * @since 1.3 * @param int $event_id The event ID. * @param bool $min True returns only minimal action buttons used within loop. * @return arr Array of event action buttons. */ function mdjm_get_event_action_buttons($event_id, $min = true) { $event_status = get_post_status($event_id); $buttons = array(); // Buttons for events in enquiry state if ($event_status == 'mdjm-enquiry') { if (mdjm_get_option('online_enquiry', '0')) { $buttons[5] = apply_filters('mdjm_quote_action_button', array('label' => __('View Quote', 'mobile-dj-manager'), 'id' => 'mdjm-quote-button', 'fa' => 'fa fa-file', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('quotes_page'), true)))); } $buttons[10] = apply_filters('mdjm_book_action_button', array('label' => sprintf(__('Book %s', 'mobile-dj-manager'), mdjm_get_label_singular()), 'id' => 'mdjm-book-button', 'fa' => 'fa fa-check', 'url' => add_query_arg(array('mdjm_action' => 'accept_enquiry', 'mdjm_nonce' => wp_create_nonce('accept_enquiry')), mdjm_get_event_uri($event_id)))); } // Buttons for events in awaiting contract state if ($event_status == 'mdjm-contract') { $buttons[15] = apply_filters('mdjm_sign_contract_action_button', array('label' => __('Sign Contract', 'mobile-dj-manager'), 'id' => 'mdjm-sign-contract-button', 'fa' => 'fa fa-pencil', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('contracts_page'), true)))); } // Buttons for events in approved state if ($event_status == 'mdjm-approved' && mdjm_contract_is_signed($event_id)) { $buttons[20] = apply_filters('mdjm_view_contract_action_button', array('label' => __('View Contract', 'mobile-dj-manager'), 'id' => 'mdjm-view-contract-button', 'fa' => 'fa fa-file-text', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('contracts_page'), true)))); } // Playlist action button if (mdjm_playlist_is_open($event_id)) { if ($event_status == 'mdjm-approved' || $event_status == 'mdjm-contract') { $buttons[25] = apply_filters('mdjm_manage_playlist_action_button', array('label' => __('Manage Playlist', 'mobile-dj-manager'), 'id' => 'mdjm-manage-playlist-button', 'fa' => 'fa fa-music', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('playlist_page'), true)))); } } // Payment button if (mdjm_has_gateway() && mdjm_get_event_balance($event_id) > 0) { $buttons[30] = apply_filters('mdjm_make_payment_button', array('label' => __('Make a Payment', 'mobile-dj-manager'), 'id' => 'mdjm-make-a-payment-button', 'fa' => 'fa fa-credit-card-alt', 'url' => add_query_arg('event_id', $event_id, mdjm_get_formatted_url(mdjm_get_option('payments_page'), true)))); } if (empty($min)) { $buttons[50] = apply_filters('mdjm_update_profile_action_button', array('label' => __('Update Profile', 'mobile-dj-manager'), 'id' => 'mdjm-update-profile-button', 'fa' => 'fa fa-user', 'url' => mdjm_get_formatted_url(mdjm_get_option('profile_page'), false))); } $buttons = apply_filters('mdjm_event_action_buttons', $buttons, $event_id); ksort($buttons); return $buttons; }
/** * Content tag: event_url. * The current event url. * * @param int The event ID. * @param * * @return str The current event type label. */ function mdjm_content_tag_event_url($event_id = '') { if (empty($event_id)) { return; } return mdjm_get_event_uri($event_id); }