Exemplo n.º 1
0
/**
 * Redirect to contract.
 *
 * @since	1.3
 * @param
 * @return	void
 */
function mdjm_goto_contract_action()
{
    if (!isset($_GET['event_id'])) {
        return;
    }
    if (!mdjm_event_exists($_GET['event_id'])) {
        wp_die('Sorry but we could not locate your event.', 'mobile-dj-manager');
    }
    wp_redirect(add_query_arg('event_id', $_GET['event_id'], mdjm_get_formatted_url(mdjm_get_option('contracts_page'))));
    die;
}
Exemplo n.º 2
0
/**
 * Redirect to playlist.
 *
 * @since	1.3
 * @param
 * @return	void
 */
function mdjm_goto_playlist_action($data)
{
    if (!isset($data['event_id'])) {
        return;
    }
    if (!mdjm_event_exists($data['event_id'])) {
        wp_die('Sorry but no event exists', 'mobile-dj-manager');
    }
    wp_redirect(add_query_arg('event_id', $data['event_id'], mdjm_get_formatted_url(mdjm_get_option('playlist_page'))));
    die;
}
Exemplo n.º 3
0
/**
 * Redirect to event.
 *
 * @since	1.3
 * @param
 * @return	void
 */
function mdjm_goto_event_action($data)
{
    if (!isset($data['event_id'])) {
        return;
    }
    if (!mdjm_event_exists($data['event_id'])) {
        wp_die('Sorry but no event exists', 'mobile-dj-manager');
    }
    wp_redirect(mdjm_get_event_uri($data['event_id']));
    die;
}
Exemplo n.º 4
0
/**
 * MDJM Quote Shortcode.
 *
 * Displays the online quotation to the client.
 * 
 * @since	1.3
 * @param	arr		$atts	Arguments passed with the shortcode
 * @return	string
 */
function mdjm_shortcode_quote($atts)
{
    $atts = shortcode_atts(array('button_text' => sprintf(__('Book this %s', 'mobile-dj-manager'), mdjm_get_label_singular())), $atts, 'mdjm-quote');
    $event_id = '';
    if (!empty($_GET['event_id'])) {
        $event_id = $_GET['event_id'];
    } else {
        $next_event = mdjm_get_clients_next_event(get_current_user_id());
        if ($next_event) {
            $event_id = $next_event[0]->ID;
        }
    }
    if (isset($event_id) && mdjm_event_exists($event_id)) {
        if (is_user_logged_in()) {
            global $mdjm_event, $mdjm_quote_button_atts;
            $mdjm_quote_button_atts = $atts;
            $mdjm_event = new MDJM_Event($event_id);
            ob_start();
            if ($mdjm_event) {
                // Some verification
                if (get_current_user_id() != $mdjm_event->client) {
                    mdjm_get_template_part('quote', 'noevent');
                } else {
                    mdjm_get_template_part('quote');
                }
                $output = mdjm_do_content_tags(ob_get_contents(), $mdjm_event->ID, $mdjm_event->client);
            } else {
                mdjm_get_template_part('quote', 'noevent');
                $output = mdjm_do_content_tags(ob_get_contents(), '', get_current_user_id());
            }
            ob_get_clean();
            // Reset global var
            $mdjm_event = '';
            return $output;
        } else {
            echo mdjm_login_form(mdjm_get_current_page_url());
        }
    } else {
        ob_start();
        mdjm_get_template_part('quote', 'noevent');
        $output = mdjm_do_content_tags(ob_get_contents(), '', get_current_user_id());
        ob_get_clean();
    }
}