/** * 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; }
/** * Renders an alert if no gateways are defined. * * @since 1.3.8 * @return void */ function mdjm_no_gateway_notice() { if (mdjm_has_gateway()) { return; } ob_start(); $notice = __('A gateway must be installed and enabled within MDJM Event Management before payments can be processed.', 'mobile-dj-manager'); ?> <div class="mdjm-alert mdjm-alert-error"><?php echo $notice; ?> </div> <?php echo ob_get_clean(); }