/** * Display the event playlist page. * * @since 1.3 * @param * @return str The event playlist page content. */ function mdjm_display_event_playlist_page() { if (!mdjm_employee_can('read_events') && !mdjm_employee_working_event($_GET['event_id'])) { wp_die('<h1>' . __('Cheatin’ uh?') . '</h1>' . '<p>' . __('You do not have permission to view this playlist.', 'mobile-dj-manager') . '</p>', 403); } if (!class_exists('MDJM_PlayList_Table')) { require_once MDJM_PLUGIN_DIR . '/includes/admin/events/class-mdjm-playlist-table.php'; } $playlist_obj = new MDJM_PlayList_Table(); ?> <div class="wrap"> <h1><?php printf(__('Playlist for %s %s', 'mobile-dj-manager'), mdjm_get_label_singular(), mdjm_get_event_contract_id($_GET['event_id'])); ?> </h1> <form method="post"> <?php $playlist_obj->prepare_items(); $playlist_obj->display_header(); if (count($playlist_obj->items) > 0) { $playlist_obj->views(); } $playlist_obj->display(); $playlist_obj->entry_form(); ?> </form> <br class="clear"> </div> <?php }
/** * Display a notice if an upgrade is required. * * @since 1.4 */ function mdjm_show_upgrade_notice() { if (isset($_GET['page']) && $_GET['page'] == 'mdjm-upgrades') { return; } $mdjm_version = get_option('mdjm_version'); $mdjm_version = preg_replace('/[^0-9.].*/', '', $mdjm_version); // Check if there is an incomplete upgrade routine. $resume_upgrade = mdjm_maybe_resume_upgrade(); if (!empty($resume_upgrade)) { $resume_url = add_query_arg($resume_upgrade, admin_url('index.php')); printf('<div class="notice notice-error"><p>' . __('MDJM Event Management needs to complete an upgrade that was previously started. Click <a href="%s">here</a> to resume the upgrade.', 'mobile-dj-manager') . '</p></div>', esc_url($resume_url)); } else { if (version_compare($mdjm_version, '1.4', '<') || !mdjm_has_upgrade_completed('upgrade_event_packages')) { printf('<div class="notice notice-error"><p>' . __('MDJM Event Management needs to perform an upgrade to %s Packages and Add-ons. Click <a href="%s">here</a> to start the upgrade.', 'mobile-dj-manager') . '</p></div>', mdjm_get_label_singular(true), esc_url(admin_url('index.php?page=mdjm-upgrades&mdjm-upgrade=upgrade_event_packages&message=1&redirect=' . mdjm_get_current_page_url()))); } /* * NOTICE: * * When adding new upgrade notices, please be sure to put the action into the upgrades array during install: * /includes/install.php @ Appox Line 783 * */ } }
/** * Define the columns to be displayed for transaction posts * * @since 0.5 * @param arr $columns Array of column names * @return arr $columns Filtered array of column names */ function mdjm_transaction_post_columns($columns) { $columns = array('cb' => '<input type="checkbox" />', 'title' => __('ID', 'mobile-dj-manager'), 'txn_date' => __('Date', 'mobile-dj-manager'), 'direction' => __('In/Out', 'mobile-dj-manager'), 'payee' => __('To/From', 'mobile-dj-manager'), 'txn_status' => __('Status', 'mobile-dj-manager'), 'detail' => __('Details', 'mobile-dj-manager'), 'event' => sprintf(__('%s', 'mobile-dj-manager'), mdjm_get_label_singular()), 'txn_value' => __('Value', 'mobile-dj-manager')); if (!mdjm_employee_can('edit_txns') && isset($columns['cb'])) { unset($columns['cb']); } return $columns; }
/** * Get things started * * @since 1.4 * @see WP_List_Table::__construct() */ public function __construct() { global $status, $page; // Set parent defaults parent::__construct(array('singular' => mdjm_get_label_singular(), 'plural' => mdjm_get_label_plural(), 'ajax' => false)); $this->label_single = mdjm_get_label_singular(); $this->label_plural = mdjm_get_label_plural(); }
/** * Define the columns to be displayed for communication posts * * @since 0.5 * @param arr $columns Array of column names * @return arr $columns Filtered array of column names */ function mdjm_communication_post_columns($columns) { $columns = array('cb' => '<input type="checkbox" />', 'date_sent' => __('Date Sent', 'mobile-dj-manager'), 'title' => __('Email Subject', 'mobile-dj-manager'), 'from' => __('From', 'mobile-dj-manager'), 'recipient' => __('Recipient', 'mobile-dj-manager'), 'event' => sprintf(__('%s', 'mobile-dj-manager'), mdjm_get_label_singular()), 'current_status' => __('Status', 'mobile-dj-manager'), 'source' => __('Source', 'mobile-dj-manager')); if (!mdjm_is_admin() && isset($columns['cb'])) { unset($columns['cb']); } return $columns; }
/** * Fires after an event's status is updated. * * Add journal entry. * * @since 1.3 * @param int|bool $result The result of the status change function. False is an unsuccessful status update. * @param int $event_id The event ID. * @param str $new_status The new event status. * @param str $old_status The old event status. * @param arr $args Arguments passed to the mdjm_update_event_status function * @return void */ function mdjm_event_add_journal_after_status_change($result, $event_id, $new_status, $old_status, $args) { if (empty($result)) { return; } $reject_reason = $new_status == 'mdjm-rejected' && !empty($args['reject_reason']) ? '<br />' . $args['reject_reason'] : ''; $comment_args = array('user_id' => is_user_logged_in() ? get_current_user_id() : 1, 'event_id' => $event_id, 'comment_content' => sprintf(__('%s status updated to %s.%s', 'mobile-dj-manager'), mdjm_get_label_singular(), mdjm_get_event_status($event_id), $reject_reason)); mdjm_add_journal($comment_args); }
/** * Get things started * * @since 1.4 * @see WP_List_Table::__construct() */ public function __construct() { global $status, $page; // Set parent defaults parent::__construct(array('singular' => __('Transaction', 'mobile-dj-manager'), 'plural' => __('Transactions', 'mobile-dj-manager'), 'ajax' => false)); $this->label_single = mdjm_get_label_singular(); $this->label_plural = mdjm_get_label_plural(); add_action('mdjm_reports_txn_types_additional_stats', array($this, 'graph_totals')); }
/** * Get things started * * @since 1.4 * @see WP_List_Table::__construct() */ public function __construct() { global $status, $page; // Set parent defaults parent::__construct(array('singular' => mdjm_get_label_singular(), 'plural' => mdjm_get_label_plural(), 'ajax' => false)); $this->label_single = mdjm_get_label_singular(); $this->label_plural = mdjm_get_label_plural(); add_action('mdjm_reports_conversions_graph_additional_stats', array($this, 'graph_totals')); }
/** * Registers and sets up the MDJM Event Management custom post types * * @since 1.3 * @return void */ function mdjm_register_post_types() { // Event Post Type $event_labels = apply_filters('mdjm_event_labels', array('name' => _x('%2$s', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('%1$s', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('MDJM %2$s', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('%1$s', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Create %1$s', 'mobile-dj-manager'), 'add_new_item' => __('Create New %1$s', 'mobile-dj-manager'), 'new_item' => __('New %1$s', 'mobile-dj-manager'), 'edit_item' => __('Edit %1$s', 'mobile-dj-manager'), 'view_item' => __('View %1$s', 'mobile-dj-manager'), 'all_items' => __('All %2$s', 'mobile-dj-manager'), 'search_items' => __('Search %2$s', 'mobile-dj-manager'), 'not_found' => __('No %3$s found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No %3$s found in Trash.', 'mobile-dj-manager'))); foreach ($event_labels as $key => $value) { $event_labels[$key] = sprintf($value, mdjm_get_label_singular(), mdjm_get_label_plural(), mdjm_get_label_plural(true)); } $event_args = array('labels' => $event_labels, 'description' => __('MDJM Events', 'mobile-dj-manager'), 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => defined('MDJM_MENU_POS') ? MDJM_MENU_POS : 58.4, 'show_in_admin_bar' => true, 'capability_type' => 'mdjm_event', 'capabilities' => apply_filters('mdjm_event_caps', array('publish_posts' => 'publish_mdjm_events', 'edit_posts' => 'edit_mdjm_events', 'edit_others_posts' => 'edit_others_mdjm_events', 'delete_posts' => 'delete_mdjm_events', 'delete_others_posts' => 'delete_others_mdjm_events', 'read_private_posts' => 'read_private_mdjm_events', 'edit_post' => 'edit_mdjm_event', 'delete_post' => 'delete_mdjm_event', 'read_post' => 'read_mdjm_event')), 'map_meta_cap' => true, 'has_archive' => true, 'supports' => apply_filters('mdjm_event_supports', array('title')), 'menu_icon' => plugins_url('mobile-dj-manager/assets/images/mdjm-menu-16x16.jpg'), 'taxonomies' => array('mdjm-event')); register_post_type('mdjm-event', apply_filters('mdjm_event_post_type_args', $event_args)); if (mdjm_packages_enabled()) { // Packages Post Type $package_labels = apply_filters('mdjm_package_labels', array('name' => _x('Packages', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Package', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Packages', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Package', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Package', 'mobile-dj-manager'), 'add_new_item' => __('Add New Package', 'mobile-dj-manager'), 'new_item' => __('New Package', 'mobile-dj-manager'), 'edit_item' => __('Edit Package', 'mobile-dj-manager'), 'view_item' => __('View Package', 'mobile-dj-manager'), 'all_items' => __('All Packages', 'mobile-dj-manager'), 'search_items' => __('Search Packages', 'mobile-dj-manager'), 'not_found' => __('No packages found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No packages found in Trash.', 'mobile-dj-manager'))); $package_args = array('labels' => $package_labels, 'description' => __('Equipment Packages for the MDJM Event Management plugin', 'mobile-dj-manager'), 'public' => true, 'show_in_menu' => 'edit.php?post_type=mdjm-package', 'has_archive' => true, 'rewrite' => array('slug' => 'packages'), 'supports' => apply_filters('mdjm_package_supports', array('title', 'editor', 'revisions', 'excerpt', 'thumbnail'))); register_post_type('mdjm-package', apply_filters('mdjm_package_post_type_args', $package_args)); // Addons Post Type $addon_labels = apply_filters('mdjm_addon_labels', array('name' => _x('Addons', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Addon', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Addons', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Addon', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Addon', 'mobile-dj-manager'), 'add_new_item' => __('Add New Addon', 'mobile-dj-manager'), 'new_item' => __('New Addon', 'mobile-dj-manager'), 'edit_item' => __('Edit Addon', 'mobile-dj-manager'), 'view_item' => __('View Addon', 'mobile-dj-manager'), 'all_items' => __('All Addons', 'mobile-dj-manager'), 'search_items' => __('Search Addons', 'mobile-dj-manager'), 'not_found' => __('No addons found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No addons found in Trash.', 'mobile-dj-manager'))); $addon_args = array('labels' => $addon_labels, 'description' => __('Equipment Addons for the MDJM Event Management plugin', 'mobile-dj-manager'), 'public' => true, 'show_in_menu' => 'edit.php?post_type=mdjm-addon', 'has_archive' => true, 'rewrite' => array('slug' => 'addons'), 'supports' => apply_filters('mdjm_addon_supports', array('title', 'editor', 'revisions', 'excerpt', 'thumbnail'))); register_post_type('mdjm-addon', apply_filters('mdjm_addon_post_type_args', $addon_args)); } // Communication History Post Type $email_history_labels = apply_filters('mdjm_email_history_labels', array('name' => _x('Email History', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Email History', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Email History', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Email History', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Communication', 'mobile-dj-manager'), 'add_new_item' => __('Add New Communication', 'mobile-dj-manager'), 'new_item' => __('New Communication', 'mobile-dj-manager'), 'edit_item' => __('Review Email', 'mobile-dj-manager'), 'view_item' => __('View Email', 'mobile-dj-manager'), 'all_items' => __('All Emails', 'mobile-dj-manager'), 'search_items' => __('Search Emails', 'mobile-dj-manager'), 'not_found' => __('No Emails found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No Emails found in Trash.', 'mobile-dj-manager'))); $email_history_args = array('labels' => $email_history_labels, 'description' => __('Communication used by the MDJM Event Management for WordPress plugin', 'mobile-dj-manager'), 'exclude_from_search' => true, 'show_ui' => true, 'show_in_menu' => 'edit.php?post_type=mdjm_communication', 'show_in_admin_bar' => false, 'rewrite' => array('slug' => 'mdjm-communications'), 'capability_type' => 'mdjm_comm', 'capabilities' => apply_filters('mdjm_communications_caps', array('edit_post' => 'edit_mdjm_comm', 'read_post' => 'read_mdjm_comm', 'delete_post' => 'delete_mdjm_comm', 'edit_posts' => 'edit_mdjm_comms', 'edit_others_posts' => 'edit_others_mdjm_comms', 'publish_posts' => 'publish_mdjm_comms', 'read_private_posts' => 'read_private_mdjm_comms')), 'map_meta_cap' => true, 'has_archive' => true, 'supports' => apply_filters('mdjm_email_history_supports', array('title'))); register_post_type('mdjm_communication', apply_filters('mdjm_email_history_post_type_args', $email_history_args)); // Contract Post Type $contract_labels = apply_filters('mdjm_contract_labels', array('name' => _x('Contract Templates', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Contract Template', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Contract Templates', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Contract Template', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Contract Template', 'mobile-dj-manager'), 'add_new_item' => __('Add New Contract Template', 'mobile-dj-manager'), 'new_item' => __('New Contract Template', 'mobile-dj-manager'), 'edit_item' => __('Edit Contract Template', 'mobile-dj-manager'), 'view_item' => __('View Contract Template', 'mobile-dj-manager'), 'all_items' => __('All Contract Templates', 'mobile-dj-manager'), 'search_items' => __('Search Contract Templates', 'mobile-dj-manager'), 'not_found' => __('No contract templates found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No contract templates found in Trash.', 'mobile-dj-manager'))); $contract_args = array('labels' => $contract_labels, 'description' => __('Contracts used by the MDJM plugin', 'mobile-dj-manager'), 'exclude_from_search' => true, 'show_ui' => true, 'show_in_menu' => 'edit.php?post_type=contract', 'rewrite' => array('slug' => 'contract-templates'), 'capability_type' => array('mdjm_template', 'mdjm_templates'), 'capabilities' => apply_filters('mdjm_contract_caps', array('edit_post' => 'edit_mdjm_template', 'read_post' => 'read_mdjm_template', 'delete_post' => 'delete_mdjm_template', 'edit_posts' => 'edit_mdjm_templates', 'edit_others_posts' => 'edit_others_mdjm_templates', 'publish_posts' => 'publish_mdjm_templates', 'read_private_posts' => 'read_private_mdjm_templates')), 'map_meta_cap' => true, 'has_archive' => true, 'supports' => apply_filters('mdjm_contract_supports', array('title', 'editor', 'revisions'))); register_post_type('contract', apply_filters('mdjm_contract_post_type_args', $contract_args)); // Signed Contract Post Type $signed_contract_labels = apply_filters('mdjm_signed_contract_labels', array('name' => _x('Signed Contracts', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Signed Contract', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Signed Contracts', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Signed Contract', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Signed Contract', 'mobile-dj-manager'), 'add_new_item' => __('Add New Signed Contract', 'mobile-dj-manager'), 'new_item' => __('New Signed Contract', 'mobile-dj-manager'), 'edit_item' => __('Edit Signed Contract', 'mobile-dj-manager'), 'view_item' => __('View Signed Contract', 'mobile-dj-manager'), 'all_items' => __('All Signed Contracts', 'mobile-dj-manager'), 'search_items' => __('Search Signed Contracts', 'mobile-dj-manager'), 'not_found' => __('No signed contracts found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No signed contracts found in Trash.', 'mobile-dj-manager'))); $signed_contract_args = array('labels' => $signed_contract_labels, 'description' => __('Signed Contracts used by the MDJM plugin', 'mobile-dj-manager'), 'rewrite' => array('slug' => 'mdjm-signed-contract'), 'capability_type' => array('mdjm_signed_contract', 'mdjm_signed_contracts'), 'map_meta_cap' => true, 'has_archive' => true, 'supports' => array('')); register_post_type('mdjm-signed-contract', apply_filters('mdjm_signed_contract_post_type_args', $signed_contract_args)); // Custom Field Post Type $custom_field_labels = apply_filters('mdjm_custom_field_contract_labels', array('name' => _x('Custom Event Fields', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Custom Event Field', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Custom Event Fields', 'admin menu', 'mobile-dj-manager'), 'add_new' => _x('Add Custom Event Field', 'add new on admin bar', 'mobile-dj-manager'), 'add_new_item' => __('Add New Custom Event Field'), 'edit' => __('Edit Custom Event Field'), 'edit_item' => __('Edit Custom Event Field'), 'new_item' => __('New Hosted Plugin'), 'view' => __('View Custom Event Field'), 'view_item' => __('View Custom Event Field'), 'search_items' => __('Search Custom Event Field'), 'not_found' => __('No Custom Event Fields found'), 'not_found_in_trash' => __('No Custom Event Fields found in trash'))); $custom_field_args = array('labels' => $custom_field_labels, 'description' => __('This is where you can add Custom Event Fields for use in the event screen.', 'mobile-dj-manager'), 'rewrite' => array('slug' => 'mdjm-custom-fields'), 'supports' => array('title')); register_post_type('mdjm-custom-field', apply_filters('mdjm_custom_field_post_type_args', $custom_field_args)); // Email Template Post Type $email_template_labels = apply_filters('mdjm_email_template_labels', array('name' => _x('Email Templates', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Email Template', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Email Templates', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Email Template', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Template', 'mobile-dj-manager'), 'add_new_item' => __('Add New Template', 'mobile-dj-manager'), 'new_item' => __('New Template', 'mobile-dj-manager'), 'edit_item' => __('Edit Template', 'mobile-dj-manager'), 'view_item' => __('View Template', 'mobile-dj-manager'), 'all_items' => __('All Templates', 'mobile-dj-manager'), 'search_items' => __('Search Templates', 'mobile-dj-manager'), 'not_found' => __('No templates found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No templates found in Trash.', 'mobile-dj-manager'))); $email_template_args = array('labels' => $email_template_labels, 'description' => __('Email Templates for the MDJM Event Management plugin', 'mobile-dj-manager'), 'show_ui' => true, 'show_in_menu' => 'edit.php?post_type=email_template', 'show_in_admin_bar' => true, 'rewrite' => array('slug' => 'email-template'), 'capability_type' => 'mdjm_template', 'capabilities' => apply_filters('mdjm_email_template_caps', array('publish_posts' => 'publish_mdjm_templates', 'edit_posts' => 'edit_mdjm_templates', 'edit_others_posts' => 'edit_others_mdjm_templates', 'delete_posts' => 'delete_mdjm_templates', 'delete_others_posts' => 'delete_others_mdjm_templates', 'read_private_posts' => 'read_private_mdjm_templates', 'edit_post' => 'edit_mdjm_template', 'delete_post' => 'delete_mdjm_template', 'read_post' => 'read_mdjm_template')), 'map_meta_cap' => true, 'has_archive' => true, 'supports' => apply_filters('mdjm_email_template_supports', array('title', 'editor', 'revisions'))); register_post_type('email_template', apply_filters('mdjm_email_template_post_type_args', $email_template_args)); // Playlist Post Type $playlist_labels = apply_filters('mdjm_playlist_labels', array('name' => _x('Playlist Entries', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Playlist Entry', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Playlist Entries', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Playlist Entry', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Playlist Entry', 'mobile-dj-manager'), 'add_new_item' => __('Add New Playlist Entry', 'mobile-dj-manager'), 'new_item' => __('New Entry', 'mobile-dj-manager'), 'edit_item' => __('Edit Entry', 'mobile-dj-manager'), 'view_item' => __('View Entry', 'mobile-dj-manager'), 'all_items' => __('All Entries', 'mobile-dj-manager'), 'search_items' => __('Search Entries', 'mobile-dj-manager'), 'not_found' => __('No entries found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No entries found in Trash.', 'mobile-dj-manager'))); $playlist_args = array('labels' => $playlist_labels, 'description' => __('MDJM Event Management Playlist Entries', 'mobile-dj-manager'), 'show_ui' => true, 'show_in_menu' => false, 'capability_type' => 'mdjm_playlist', 'capabilities' => apply_filters('mdjm_playlist_caps', array('edit_post' => 'edit_mdjm_playlist', 'read_post' => 'read_mdjm_playlist', 'delete_post' => 'delete_mdjm_playlist', 'edit_posts' => 'edit_mdjm_playlists', 'edit_others_posts' => 'edit_others_mdjm_playlists', 'publish_posts' => 'publish_mdjm_playlists', 'read_private_posts' => 'read_private_mdjm_playlists')), 'map_meta_cap' => true, 'supports' => apply_filters('mdjm_playlist_supports', array('title')), 'taxonomies' => array('mdjm-playlist')); register_post_type('mdjm-playlist', apply_filters('mdjm_playlist_post_type_args', $playlist_args)); // Quote Post Type $quote_labels = apply_filters('mdjm_quote_labels', array('name' => _x('Quotes', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Quote', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Quotes', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Quote', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Create Quote', 'mobile-dj-manager'), 'add_new_item' => __('Create New Quote', 'mobile-dj-manager'), 'new_item' => __('New Quote', 'mobile-dj-manager'), 'edit_item' => __('Edit Quote', 'mobile-dj-manager'), 'view_item' => __('View Quote', 'mobile-dj-manager'), 'all_items' => __('All Quotes', 'mobile-dj-manager'), 'search_items' => __('Search Quotes', 'mobile-dj-manager'), 'not_found' => __('No quotes found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No quotes found in Trash.', 'mobile-dj-manager'))); $quote_args = array('labels' => $quote_labels, 'description' => __('MDJM Event Management Quotes', 'mobile-dj-manager'), 'show_ui' => true, 'show_in_menu' => 'edit.php?post_type=mdjm-quotes', 'show_in_admin_bar' => false, 'rewrite' => array('slug' => 'mdjm-quotes'), 'capability_type' => 'mdjm_quote', 'capabilities' => apply_filters('mdjm_quote_caps', array('edit_post' => 'edit_mdjm_quote', 'read_post' => 'read_mdjm_quote', 'delete_post' => 'delete_mdjm_quote', 'edit_posts' => 'edit_mdjm_quotes', 'edit_others_posts' => 'edit_others_mdjm_quotes', 'publish_posts' => 'publish_mdjm_quotes', 'read_private_posts' => 'read_private_mdjm_quotes')), 'map_meta_cap' => true, 'has_archive' => true, 'supports' => apply_filters('mdjm_quote_supports', array('title'))); register_post_type('mdjm-quotes', apply_filters('mdjm_quotes_post_type_args', $quote_args)); // Transaction Post Type $txn_labels = apply_filters('mdjm_txn_labels', array('name' => _x('Transactions', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Transaction', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Transactions', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Transaction', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Transaction', 'mobile-dj-manager'), 'add_new_item' => __('Add New Transaction', 'mobile-dj-manager'), 'new_item' => __('New Transaction', 'mobile-dj-manager'), 'edit_item' => __('Edit Transaction', 'mobile-dj-manager'), 'view_item' => __('View Transaction', 'mobile-dj-manager'), 'all_items' => __('All Transactions', 'mobile-dj-manager'), 'search_items' => __('Search Transactions', 'mobile-dj-manager'), 'not_found' => __('No Transactions found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No Transactions found in Trash.'))); $txn_args = array('labels' => $txn_labels, 'description' => __('Transactions for the MDJM Event Management plugin', 'mobile-dj-manager'), 'show_ui' => true, 'show_in_menu' => 'edit.php?post_type=mdjm-transaction', 'show_in_admin_bar' => true, 'rewrite' => array('slug' => 'mdjm-transaction'), 'capability_type' => 'mdjm_txn', 'capabilities' => apply_filters('mdjm_transaction_caps', array('edit_post' => 'edit_mdjm_txn', 'read_post' => 'read_mdjm_txn', 'delete_post' => 'delete_mdjm_txn', 'edit_posts' => 'edit_mdjm_txns', 'edit_others_posts' => 'edit_others_mdjm_txns', 'publish_posts' => 'publish_mdjm_txns', 'read_private_posts' => 'read_private_mdjm_txns')), 'map_meta_cap' => true, 'has_archive' => true, 'supports' => apply_filters('mdjm_transaction_supports', array('title')), 'taxonomies' => array('mdjm-transaction')); register_post_type('mdjm-transaction', apply_filters('mdjm_transaction_post_type_args', $txn_args)); // Venue Post Type $venue_labels = apply_filters('mdjm_txn_labels', array('name' => _x('Venues', 'post type general name', 'mobile-dj-manager'), 'singular_name' => _x('Venue', 'post type singular name', 'mobile-dj-manager'), 'menu_name' => _x('Venues', 'admin menu', 'mobile-dj-manager'), 'name_admin_bar' => _x('Venue', 'add new on admin bar', 'mobile-dj-manager'), 'add_new' => __('Add Venue', 'mobile-dj-manager'), 'add_new_item' => __('Add New Venue', 'mobile-dj-manager'), 'new_item' => __('New Venue', 'mobile-dj-manager'), 'edit_item' => __('Edit Venue', 'mobile-dj-manager'), 'view_item' => __('View Venue', 'mobile-dj-manager'), 'all_items' => __('All Venues', 'mobile-dj-manager'), 'search_items' => __('Search Venues', 'mobile-dj-manager'), 'not_found' => __('No Venues found.', 'mobile-dj-manager'), 'not_found_in_trash' => __('No Venues found in Trash.', 'mobile-dj-manager'))); $venue_args = array('labels' => $venue_labels, 'description' => __('Venues stored for the MDJM Event Management plugin', 'mobile-dj-manager'), 'show_ui' => true, 'show_in_menu' => 'edit.php?post_type=mdjm-venue', 'show_in_admin_bar' => true, 'rewrite' => array('slug' => 'mdjm-venue'), 'capability_type' => 'mdjm_venue', 'capabilities' => apply_filters('mdjm_venue_caps', array('edit_post' => 'edit_mdjm_venue', 'read_post' => 'read_mdjm_venue', 'delete_post' => 'delete_mdjm_venue', 'edit_posts' => 'edit_mdjm_venues', 'edit_others_posts' => 'edit_others_mdjm_venues', 'publish_posts' => 'publish_mdjm_venues', 'read_private_posts' => 'read_private_mdjm_venues')), 'map_meta_cap' => true, 'has_archive' => true, 'supports' => apply_filters('mdjm_venue_supports', array('title')), 'taxonomies' => array('mdjm-venue')); register_post_type('mdjm-venue', apply_filters('mdjm_venue_post_type_args', $venue_args)); }
/** * Communications contextual help. * * @since 1.3 * @return void */ function mdjm_comms_email_contextual_help() { $screen = get_current_screen(); if ($screen->id != 'mdjm-event_page_mdjm-comms') { return; } $screen->set_help_sidebar('<p><strong>' . __('For more information:', 'mobile-dj-manager') . '</strong></p>' . '<p>' . sprintf(__('Visit the <a href="%s">documentation</a> on the MDJM Event Management website.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/support/')) . '</p>' . '<p>' . sprintf(__('Join our <a href="%s">Facebook Group</a>.', 'mobile-dj-manager'), esc_url('https://www.facebook.com/groups/mobiledjmanager/')) . '</p>' . '<p>' . sprintf(__('<a href="%s">Post an issue</a> on <a href="%s">GitHub</a>.', 'mobile-dj-manager'), esc_url('https://github.com/mdjm/mobile-dj-manager/issues'), esc_url('https://github.com/mdjm/mobile-dj-manager/')) . '</p>' . '<p>' . sprintf(__('View <a href="%s">add-ons</a>.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/add-ons/')) . '</p>'); do_action('mdjm_pre_comms_email_contextual_help', $screen); $screen->add_help_tab(array('id' => 'mdjm-comm-email', 'title' => __('Communications', 'mobile-dj-manager'), 'content' => '<p>' . sprintf(__('<strong>Select a Recipient</strong> - Choose from the dropdown list who your email is to. Users are grouped into Clients and Employees. Once you have selected a recipient the Associated %s list will be updated with their active %s. This is a required field.', 'mobile-dj-manager'), mdjm_get_label_plural(), mdjm_get_label_plural(true)) . '</p>' . '<p>' . __('<strong>Subject</strong> - Enter the subject of your email. If you select a template the subject will be updated to the title of the template. This is a required field.', 'mobile-dj-manager') . '</p>' . '<p>' . __('<strong>Copy Yourself?</strong> - Select this option if you wish to receive a copy of the email. If the settings options have been enabled to copy Admin and/or Employee into Client emails, you may receive a copy regardless of whether or not this option is selected.', 'mobile-dj-manager') . '</p>' . '<p>' . __('<strong>Select a Template</strong> - Choose a pre-defined email or contract template to populate the content field. Anything you have already entered into the content field will be overwritten. If you do not select a template, you will need to manually enter content into the content field.', 'mobile-dj-manager') . '</p>' . '<p>' . sprintf(__('<strong>Associated %s</strong> - If the Client or Employee you have selected within the <strong>Select a Recipient</strong> field has active %s it is displayed here. Select it to tell MDJM that the email you are sending is associated to this %s and %1$s content tags can be used within the email content.', 'mobile-dj-manager'), mdjm_get_label_singular(), mdjm_get_label_plural(true), mdjm_get_label_singular(true)) . '</p>' . '<p>' . __('<strong>Attach a File</strong> - Enables you to select a file from your computer to the email.', 'mobile-dj-manager') . '</p>' . '<p>' . __('<strong>Content</strong> - If you have selected a template within the <strong>Select a Template</strong> field, this field will be populated with that templates content. You can adjust this content as required. Alternatively, if no template is selected, use this as a free text field for your email content. Content tags are supported and can be entered via the <strong>MDJM</strong> button on the text editor toolbar. Remember this field is resizeable. Drag from the bottom right hand corner to make bigger if necessary. This is a required field.', 'mobile-dj-manager') . '</p>')); do_action('mdjm_post_comms_email_contextual_help', $screen); }
public function create_tasks() { global $mdjm_options; $time = current_time('timestamp'); if (isset($mdjm_options['upload_playlists'])) { $playlist_nextrun = strtotime('+1 day', $time); } else { $playlist_nextrun = 'N/A'; } $mdjm_schedules = array('complete-events' => array('slug' => 'complete-events', 'name' => 'Complete Events', 'active' => 'Y', 'desc' => sprintf(__('Mark %s as completed once the %s date has passed', 'mobile-dj-manager'), mdjm_get_label_plural(true), mdjm_get_label_singular(true)), 'frequency' => 'Daily', 'nextrun' => $time, 'lastran' => 'Never', 'options' => array('email_client' => 'N', 'email_template' => '0', 'email_subject' => sprintf(__('Task Complete %s has finished', 'mobile-dj-manager'), mdjm_get_label_plural()), 'email_from' => 'admin', 'run_when' => 'after_event', 'age' => '1 HOUR', 'notify_admin' => 'Y', 'notify_dj' => 'N'), 'function' => 'complete_event', 'totalruns' => '0', 'default' => 'Y'), 'request-deposit' => array('slug' => 'request-deposit', 'name' => 'Request Deposit', 'active' => 'N', 'desc' => sprintf(__('Send reminder email to client requesting deposit payment if %s status is Approved and deposit has not been received', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'frequency' => 'Daily', 'nextrun' => 'N/A', 'lastran' => 'Never', 'options' => array('email_client' => 'Y', 'email_template' => '0', 'email_subject' => __('Request Deposit Task Complete', 'mobile-dj-manager'), 'email_from' => 'admin', 'run_when' => 'after_approval', 'age' => '3 DAY', 'notify_admin' => 'Y', 'notify_dj' => 'N'), 'function' => 'request_deposit', 'totalruns' => '0', 'default' => 'Y'), 'balance-reminder' => array('slug' => 'balance-reminder', 'name' => __('Balance Reminder', 'mobile-dj-manager'), 'active' => 'N', 'desc' => sprintf(__('Send email to client requesting they pay remaining balance for %s', 'mobile-dj-manager'), mdjm_get_label_singular(true)), 'frequency' => 'Daily', 'nextrun' => 'N/A', 'lastran' => 'Never', 'options' => array('email_client' => 'Y', 'email_template' => '0', 'email_subject' => __('Balance Reminder Task Complete', 'mobile-dj-manager'), 'email_from' => 'admin', 'run_when' => 'before_event', 'age' => '2 WEEK', 'notify_admin' => 'Y', 'notify_dj' => 'N'), 'function' => 'balance_reminder', 'totalruns' => '0', 'default' => 'Y'), 'fail-enquiry' => array('slug' => 'fail-enquiry', 'name' => __('Fail Enquiry', 'mobile-dj-manager'), 'active' => 'N', 'desc' => __('Automatically fail enquiries that have not been updated within the specified amount of time', 'mobile-dj-manager'), 'frequency' => 'Daily', 'nextrun' => 'N/A', 'lastran' => 'Never', 'options' => array('email_client' => 'N', 'email_template' => '0', 'email_subject' => __('Fail Enquiry Task Complete', 'mobile-dj-manager'), 'email_from' => 'admin', 'run_when' => 'event_created', 'age' => '2 WEEK', 'notify_admin' => 'Y', 'notify_dj' => 'N'), 'function' => 'fail_enquiry', 'totalruns' => '0', 'default' => 'Y'), 'upload-playlists' => array('slug' => 'upload-playlists', 'name' => __('Upload Playlists', 'mobile-dj-manager'), 'active' => 'Y', 'desc' => __('Transmit playlist information back to the MDJM servers to help build an information library. This option is updated the MDJM Settings pages.', 'mobile-dj-manager'), 'frequency' => 'Twice Daily', 'nextrun' => $playlist_nextrun, 'lastran' => 'Never', 'options' => array('email_client' => 'N', 'email_template' => '0', 'email_subject' => '0', 'email_from' => '0', 'run_when' => 'after_event', 'age' => '1 HOUR', 'notify_admin' => 'N', 'notify_dj' => 'N'), 'function' => 'submit_playlist', 'totalruns' => '0', 'default' => 'Y')); update_option('mdjm_schedules', $mdjm_schedules); }
/** * Contracts contextual help. * * @since 1.3 * @return void */ function mdjm_contract_contextual_help() { $screen = get_current_screen(); if ($screen->id != 'contract') { return; } $screen->set_help_sidebar('<p><strong>' . __('For more information:', 'mobile-dj-manager') . '</strong></p>' . '<p>' . sprintf(__('Visit the <a href="%s">documentation</a> on the MDJM Event Management website.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/support/')) . '</p>' . '<p>' . sprintf(__('Join our <a href="%s">Facebook Group</a>.', 'mobile-dj-manager'), esc_url('https://www.facebook.com/groups/mobiledjmanager/')) . '</p>' . '<p>' . sprintf(__('<a href="%s">Post an issue</a> on <a href="%s">GitHub</a>.', 'mobile-dj-manager'), esc_url('https://github.com/mdjm/mobile-dj-manager/issues'), esc_url('https://github.com/mdjm/mobile-dj-manager/')) . '</p>' . '<p>' . sprintf(__('View <a href="%s">add-ons</a>.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/add-ons/')) . '</p>'); do_action('mdjm_pre_contract_contextual_help', $screen); $screen->add_help_tab(array('id' => 'mdjm-contract-add', 'title' => __('Add New Template', 'mobile-dj-manager'), 'content' => '<p>' . __('<strong>Title</strong> - Enter a title for your contract. A good title is short but descriptive of the type of contract.', 'mobile-dj-manager') . '</p>' . '<p>' . __('<strong>Content</strong> - Enter the content for your template. HTML, images, and MDJM content tags are supported. Use the MDJM button on the content editor toolbar for easy access to the content tags.', 'mobile-dj-manager') . '</p>')); $screen->add_help_tab(array('id' => 'mdjm-contract-save', 'title' => __('Save Contract', 'mobile-dj-manager'), 'content' => '<p>' . __("Save a draft if you've still got content to add, click preview to see what your contract looks like when formatted and click Save Contract when you are ready to publish.", 'mobile-dj-manager') . '</p>')); $screen->add_help_tab(array('id' => 'mdjm-contract-details', 'title' => sprintf(__('%s Details', 'mobile-dj-manager'), mdjm_get_label_singular()), 'content' => '<p>' . sprintf(__('Displays general information regarding this contract such as Author, whether it is the default contract used for %1$s, and the number of %1$s it is assigned to. Enter a description if necessary to describe the type of contract and for which type of %1$s it should be used. The description will not be seen by clients.', 'mobile-dj-manager'), mdjm_get_label_plural(true)) . '</p>')); do_action('mdjm_post_contract_contextual_help', $screen); }
/** * Output for the Contract Details meta box. * * @since 1.3 * @param obj $post The post object (WP_Post). * @return */ function mdjm_contract_details_metabox($post) { do_action('mdjm_pre_contract_details_metabox', $post); wp_nonce_field(basename(__FILE__), 'mdjm-contract' . '_nonce'); $contract_events = get_posts(array('post_type' => 'mdjm-event', 'posts_per_page' => -1, 'meta_key' => '_mdjm_event_contract', 'meta_value_num' => $post->ID, 'post_status' => 'any')); $event_count = count($contract_events); $total_events = sprintf(_n(' %s', ' %s', $event_count), mdjm_get_label_singular(), mdjm_get_label_plural()); $default_contract = mdjm_get_option('default_contract') == $post->ID ? __('Yes') : __('No'); ?> <script type="text/javascript"> document.getElementById("title").className += " required"; document.getElementById("content").className += " required"; </script> <p><?php printf(__('<strong>Author</strong>: <a href="%s">%s</a>', 'mobile-dj-manager'), admin_url("user-edit.php?user_id={$post->post_author}"), get_the_author_meta('display_name', $post->post_author)); ?> </p> <p><?php _e('<strong>Default</strong>?', 'mobile-dj-manager'); echo ' ' . $default_contract; ?> </p> <p><?php _e('<strong>Assigned To</strong>: ', 'mobile-dj-manager'); printf(_n($event_count . ' %1$s', $event_count . ' %2$s', $event_count), mdjm_get_label_singular(), mdjm_get_label_plural()); ?> </p> <p><?php _e('<strong>Description</strong>: <span class="description">(optional)</span>', 'mobile-dj-manager'); ?> <br /> <input type="hidden" name="mdjm_update_custom_post" id="mdjm_update_custom_post" value="mdjm_update" /> <textarea name="contract_description" id="contract_description" class="widefat" rows="5" placeholder="<?php _e('i.e To be used for Pubs/Clubs', 'mobile-dj-manager'); ?> "><?php echo esc_attr(get_post_meta($post->ID, '_contract_description', true)); ?> </textarea> </p> <?php do_action('mdjm_post_contract_details_metabox', $post); }
/** * Events contextual help. * * @since 1.3 * @return void */ function mdjm_events_contextual_help() { $screen = get_current_screen(); if ($screen->id != 'mdjm-event') { return; } $screen->set_help_sidebar('<p><strong>' . __('For more information:', 'mobile-dj-manager') . '</strong></p>' . '<p>' . sprintf(__('Visit the <a href="%s">documentation</a> on the MDJM Event Management website.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/support/')) . '</p>' . '<p>' . sprintf(__('Join our <a href="%s">Facebook Group</a>.', 'mobile-dj-manager'), esc_url('https://www.facebook.com/groups/mobiledjmanager/')) . '</p>' . '<p>' . sprintf(__('<a href="%s">Post an issue</a> on <a href="%s">GitHub</a>.', 'mobile-dj-manager'), esc_url('https://github.com/mdjm/mobile-dj-manager/issues'), esc_url('https://github.com/mdjm/mobile-dj-manager/')) . '</p>' . '<p>' . sprintf(__('View <a href="%s">add-ons</a>.', 'mobile-dj-manager'), esc_url('http://mdjm.co.uk/add-ons/')) . '</p>'); $screen->add_help_tab(array('id' => 'mdjm-event-options', 'title' => sprintf(__('%s Options', 'mobile-dj-manager'), mdjm_get_label_singular()), 'content' => '<p>' . sprintf(__('<strong>%1$s Status</strong> - Set the status of this %1$s. An description of each status can be found <a href="%2$s" target="_blank">here</a>', 'mobile-dj-manager'), mdjm_get_label_singular(), 'http://mdjm.co.uk/docs/event-statuses/') . '</p>' . '<p>' . sprintf(__('<strong>%1$s Status</strong> - Set the type of %1$s <em>i.e. Wedding or 40th Birthday</em>. You can define the types <a href="%s">here</a>.', 'mobile-dj-manager'), mdjm_get_label_singular(), admin_url('edit-tags.php?taxonomy=event-types&post_type=mdjm-event')) . '</p>' . '<p>' . sprintf(__('<strong>%1$s Contract</strong> - Select the contract associated with this %1$s.', 'mobile-dj-manager'), mdjm_get_label_singular()) . '</p>' . '<p>' . __('<strong>Disable Client Update Emails?</strong> - Selecting this option will stop any emails being sent to the client during update.', 'mobile-dj-manager') . '</p>' . '<p>' . __("<strong>Reset Client Password</strong> - If selected whilst transitioning to enquiry status, the client's password will be reset. If you insert the <code>{client_password}</code> content tag into your email template, the password will be inserted.", 'mobile-dj-manager') . '</p>' . '<p>' . __('<strong>Email Quote Template</strong> - During transition to Enquiry status, select which quote email template should be sent to the client.', 'mobile-dj-manager') . '</p>' . '<p>' . __('<strong>Online Quote Template</strong> - During transition to Enquiry status, select which quote template should be used to generate the page that displays the online quote.', 'mobile-dj-manager') . '</p>' . '<p>' . sprintf(__('<strong>%1$s Paid?</strong> - Select this option if the client has paid their %1$s.', 'mobile-dj-manager'), mdjm_get_deposit_label()) . '</p>' . '<p>' . sprintf(__('<strong>%1$s Paid?</strong> - Select this option if the client has paid their %1$s.', 'mobile-dj-manager'), mdjm_get_balance_label()) . '</p>' . '<p>' . sprintf(__('<strong>Enable %1$s Playlist?</strong> - Toggle whether or not the client can manage the playlist for this %1$s.', 'mobile-dj-manager'), mdjm_get_label_singular()) . '</p>')); $screen->add_help_tab(array('id' => 'mdjm-settings-client-details', 'title' => __('Client Details', 'mobile-dj-manager'), 'content' => '<p>' . sprintf(__("Select a client for this %s. If the client does not exist, you can select <em>Add New Client</em>. In doing so, additional fields will be displayed enabling you to enter the new client's details.", 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>')); $screen->add_help_tab(array('id' => 'mdjm-event-details', 'title' => sprintf(__('%s Details', 'mobile-dj-manager'), mdjm_get_label_singular()), 'content' => '<p>' . sprintf(__('<strong>%1$s Name</strong> - Assign a name for this %1$s. Can be viewed and adjusted by the client.', 'mobile-dj-manager'), mdjm_get_label_singular()) . '</p>' . '<p>' . sprintf(__('<strong>Select Primary Employee</strong> - Select the primary employee for this %s.', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>' . '<p>' . sprintf(__('<strong>%1$s Date</strong> - Use the datepicker to set the date for this %1s$s.', 'mobile-dj-manager'), mdjm_get_label_singular()) . '</p>' . '<p>' . sprintf(__('<strong>Start Time</strong> - Set the start time of the %s', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>' . '<p>' . sprintf(__('<strong>End Time</strong> - Set the end time of the %', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>' . '<p>' . sprintf(__('<strong>Total Cost</strong> - Enter the total cost of the %s. If using equipment packages and add-ons, selecting these will automatically set this cost.', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>' . '<p>' . sprintf(__('<strong>%1$s</strong> - Enter the %1$s that needs to be collected for this %2$s upon contract signing. This field can be auto populated depending on your settings and equipment packages and add-on selections', 'mobile-dj-manager'), mdjm_get_deposit_label(), mdjm_get_label_singular(true)) . '</p>' . '<p>' . sprintf(__('<strong>Select an %1$s Package</strong> - If packages are enabled and defined you can assign one to the %1$s here. Doing so will auto update the <em>Total Cost</em> and <em>%2$s</em> fields. Additionally, the <em>Select Add-ons</em> options will be updated to exclude add-ons included within the selected package.', 'mobile-dj-manager'), mdjm_get_label_singular(), mdjm_get_deposit_label()) . '</p>' . '<p>' . sprintf(__('<strong>Select Add-ons</strong> - If packages are enabled you can assign add-ons to your %s here. The <em>Total Cost</em> and <em>%s</em> fields will be updated automatically to reflect the new costs.', 'mobile-dj-manager'), mdjm_get_label_singular(true), mdjm_get_deposit_label()) . '</p>' . '<p>' . __('<strong>Notes</strong> - Information entered here will be visible to the client and all event employees.', 'mobile-dj-manager') . '</p>')); $screen->add_help_tab(array('id' => 'mdjm-event-employees', 'title' => sprintf(__('%s Employees', 'mobile-dj-manager'), mdjm_get_label_singular()), 'content' => '<p>' . sprintf(__('Employees that are assigned to the %1$s are listed here together with their role and wage. You can add additional employees to the %1$s, select their %1$s role and allocate their wages.', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>')); $screen->add_help_tab(array('id' => 'mdjm-event-venue-details', 'title' => __('Venue Details', 'mobile-dj-manager'), 'content' => '<p>' . __('Select the venue from the drop down. If the venue does not exist, you can specify it manually by selecting <em>Enter Manually</em> and completing the additional fields that are then displayed.', 'mobile-dj-manager') . '</p>' . '<p>' . __('Check the <em>Save this Venue</em> option to save the venue.', 'mobile-dj-manager') . '</p>')); $screen->add_help_tab(array('id' => 'mdjm-event-transactions', 'title' => __('Transactions', 'mobile-dj-manager'), 'content' => '<p>' . sprintf(__('This section allows you to add transactions associated with the %1$s as well as listing existing associated transactions.', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>' . '<p>' . sprintf(__('If transactions already exist, the total amount of income and expenditure is displayed as well as the total overall earnings so far for the %1$s.', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>')); $screen->add_help_tab(array('id' => 'mdjm-event-administration', 'title' => __('Administration', 'mobile-dj-manager'), 'content' => '<p>' . __('<strong>Enquiry Source</strong> - Select how the client heard about your business', 'mobile-dj-manager') . '</p>' . '<p>' . sprintf(__('<strong>Setup Date</strong> - Use the datepicker to select the date that you need to setup for this %s.', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>' . '<p>' . sprintf(__('<strong>Setup Time</strong> - Select the time that you need to setup for this %s.', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>' . '<p>' . __('<strong>Employee Notes</strong> - Enter notes that are only visible by employees. Clients will not see these notes', 'mobile-dj-manager') . '</p>' . '<p>' . sprintf(__('<strong>Admin Notes</strong> - Enter notes that are only visible by admins. Employees and clients will not see these notes', 'mobile-dj-manager'), mdjm_get_label_singular(true)) . '</p>')); do_action('mdjm_events_contextual_help', $screen); }
/** * Set the CSV columns * * @access public * @since 1.4 * @return arr $cols All the columns */ public function csv_cols() { if (!empty($_POST['mdjm_export_event'])) { $cols = array('first_name' => __('First Name', 'mobile-dj-manager'), 'last_name' => __('Last Name', 'mobile-dj-manager'), 'email' => __('Email', 'mobile-dj-manager'), 'date' => sprintf(__('%s Date', 'mobile-dj-manager'), mdjm_get_label_singular())); } else { $cols = array(); if ('emails' != $_POST['mdjm_export_option']) { $cols['name'] = __('Name', 'mobile-dj-manager'); } $cols['email'] = __('Email', 'mobile-dj-manager'); if ('full' == $_POST['mdjm_export_option']) { $cols['events'] = sprintf(__('Total %s', 'mobile-dj-manager'), mdjm_get_label_plural()); $cols['amount'] = __('Total Value', 'mobile-dj-manager') . ' (' . html_entity_decode(mdjm_currency_filter('')) . ')'; } } return $cols; }
/** * Add an option field to set the default event type when editing a type. * * @since 1.3 * @param obj $tag The tag object * @return str */ function mdjm_edit_event_type_fields($tag) { ?> <tr class="form-field term-group-wrap"> <th scope="row"><label for="event_type_default"><?php printf(__('Set as Default %s type?', 'mobile-dj-manager'), mdjm_get_label_singular()); ?> </label></th> <td><input type="checkbox" id="event_type_default" name="event_type_default" value="<?php echo $tag->term_id; ?> " <?php checked(mdjm_get_option('event_type_default'), $tag->term_id); ?> ></td> </tr> <?php }
/** * Define the data to be displayed in each of the custom columns for the Contract post types * * @since 0.9 * @param str $column_name The name of the column to display * @param int $post_id The current post ID * @return */ function mdjm_contract_posts_custom_column($column_name, $post_id) { switch ($column_name) { // Is Default? case 'event_default': $event_default = mdjm_get_option('default_contract'); if ($event_default == $post_id) { echo '<span style="color: green; font-weight: bold;">' . __('Yes'); } else { _e('No'); } break; // Assigned To // Assigned To case 'assigned': $contract_events = get_posts(array('post_type' => 'mdjm-event', 'posts_per_page' => -1, 'meta_key' => '_mdjm_event_contract', 'meta_value' => $post_id, 'post_status' => 'any')); $total = count($contract_events); echo $total . sprintf(_n(' %1$s', ' %2$s', $total, 'mobile-dj-manager'), mdjm_get_label_singular(), mdjm_get_label_plural()); break; } // switch }
/** * Output the event emails table * * @since 1.3.7 * @global obj $mdjm_event MDJM_Event class object * @global bool $mdjm_event_update True if this event is being updated, false if new. * @param int $event_id The event ID. * @return str */ function mdjm_event_metabox_history_emails_table($event_id) { global $mdjm_event, $mdjm_event_update; if (!mdjm_get_option('track_client_emails')) { return; } $emails = mdjm_event_get_emails($event_id); $count = count($emails); $i = 0; ?> <div id="mdjm-event-emails-table"> <strong><?php _e('Associated Emails', 'mobile-dj-manager'); ?> </strong> <table class="widefat mdjm_event_emails_table mdjm_form_fields"> <thead> <tr> <th><?php _e('Date', 'mobile-dj-manager'); ?> </th> <th><?php _e('Subject', 'mobile-dj-manager'); ?> </th> <th><?php _e('Status', 'mobile-dj-manager'); ?> </th> </tr> </thead> <tbody> <?php if ($emails) { ?> <?php foreach ($emails as $email) { ?> <tr> <td><?php echo date(mdjm_get_option('time_format') . ' ' . mdjm_get_option('short_date_format'), strtotime($email->post_date)); ?> </td> <td><a href="<?php echo get_edit_post_link($email->ID); ?> "><?php echo get_the_title($email->ID); ?> </a></td> <td><?php echo get_post_status_object($email->post_status)->label; if (!empty($email->post_modified) && 'opened' == $email->post_status) { ?> <?php echo '<br />'; ?> <span class="description"><?php echo date(mdjm_get_option('time_format', 'H:i') . ' ' . mdjm_get_option('short_date_format', 'd/m/Y'), strtotime($email->post_modified)); ?> </span> <?php } ?> </td> </tr> <?php $i++; ?> <?php if ($i >= 3) { break; } ?> <?php } ?> <?php } else { ?> <tr> <td colspan="3"><?php printf(__('There are no emails associated with this %s', 'mobile-dj-manager'), mdjm_get_label_singular(true)); ?> </td> </tr> <?php } ?> </tbody> <?php if ($emails) { ?> <tfoot> <tr> <td colspan="3"><span class="description">(<?php printf(__('Displaying the most recent %d emails of %d total', 'mobile-dj-manager'), $count >= 3 ? 3 : $count, $count); ?> )</span></td> </tr> </tfoot> <?php } ?> </table> </div> <?php }
/** * Output for the Communication Details meta box. * * @since 1.3 * @param obj $post The post object (WP_Post). * @return */ function mdjm_communication_details_metabox($post) { do_action('mdjm_pre_communication_details_metabox', $post); wp_nonce_field(basename(__FILE__), 'mdjm_communication' . '_nonce'); $from = get_userdata($post->post_author); $recipient = get_userdata(get_post_meta($post->ID, '_recipient', true)); $attachments = get_children(array('post_parent' => $post->ID, 'post_type' => 'attachment', 'number_posts' => -1, 'post_status' => 'any')); ?> <p><?php printf(__('<strong>Date Sent</strong>: %s', 'mobile-dj-manager'), date(mdjm_get_option('time_format', 'H:i') . ' ' . mdjm_get_option('short_date_format', 'd/m/Y'), get_post_meta($post->ID, '_date_sent', true))); ?> </p> <p><?php printf(__('<strong>From</strong>: <a href="%s">%s</a>', 'mobile-dj-manager'), admin_url("/user-edit.php?user_id={$from->ID}"), $from->display_name); ?> </p> <p><?php printf(__('<strong>Recipient</strong>: <a href="%s">%s</a>', 'mobile-dj-manager'), admin_url("/user-edit.php?user_id={$recipient->ID}"), $recipient->display_name); ?> </p> <?php $copies = get_post_meta($post->ID, '_mdjm_copy_to', true); if (!empty($copies)) { ?> <p><?php _e('<strong>Copied To</strong>: ', 'mobile-dj-manager'); ?> <?php $i = 1; foreach ($copies as $copy) { $user = get_user_by('email', $copy); if ($user) { echo "<em>{$user->display_name}</em>"; $i++; if ($i < count($copies)) { echo '<br />'; } } } ?> </p><?php } ?> <p><?php _e('<strong>Status</strong>:', 'mobile-dj-manager'); ?> <?php echo get_post_status_object($post->post_status)->label; if ($post->post_status == 'opened') { echo ' ' . date(mdjm_get_option('time_format', 'H:i') . ' ' . mdjm_get_option('short_date_format', 'd/m/Y'), strtotime($post->post_modified)); } ?> </p> <p><strong><?php echo mdjm_get_label_singular(); ?> </strong>: <a href="<?php echo get_edit_post_link(get_post_meta($post->ID, '_event', true)); ?> "><?php echo mdjm_get_event_contract_id(stripslashes(get_post_meta($post->ID, '_event', true))); ?> </a></p> <?php if (!empty($attachments)) { $i = 1; ?> <p><strong><?php _e('Attachments', 'mobile-dj-manager'); ?> </strong>:<br /> <?php foreach ($attachments as $attachment) { echo '<a style="font-size: 11px;" href="' . wp_get_attachment_url($attachment->ID) . '">'; echo basename(get_attached_file($attachment->ID)); echo '</a>'; echo $i < count($attachments) ? '<br />' : ''; $i++; } ?> </p> <?php } ?> <a class="button-secondary" href="<?php echo $_SERVER['HTTP_REFERER']; ?> " title="<?php _e('Back to List', 'mobile-dj-manager'); ?> "><?php _e('Back', 'mobile-dj-manager'); ?> </a> <?php do_action('mdjm_post_communication_details_metabox', $post); }
/** * Email the manual payment confirmation to the client from a customisable email template. * * @since 1.3 * @param int $event_id The event ID * @return void */ function mdjm_email_manual_payment_confirmation($event_id) { if (!mdjm_get_option('manual_payment_cfm_template')) { return; } $mdjm_event = mdjm_get_event($event_id); $from_name = mdjm_email_set_from_name('manual_payment', $mdjm_event); $from_name = apply_filters('mdjm_email_from_name', $from_name, 'manual_payment', $mdjm_event); $from_email = mdjm_email_set_from_address('manual_payment', $mdjm_event); $from_email = apply_filters('mdjm_email_from_address', $from_email, 'manual_payment', $mdjm_event); $client = get_userdata($mdjm_event->client); $to_email = $client->user_email; $subject = mdjm_email_set_subject(mdjm_get_option('manual_payment_cfm_template', false)); $subject = apply_filters('mdjm_manual_payment_subject', wp_strip_all_tags($subject)); $subject = mdjm_do_content_tags($subject, $event_id, $mdjm_event->client); $attachments = apply_filters('mdjm_manual_payment_attachments', array(), $mdjm_event); $message = mdjm_get_email_template_content(mdjm_get_option('manual_payment_cfm_template', false)); $message = mdjm_do_content_tags($message, $event_id, $mdjm_event->client); $emails = MDJM()->emails; $emails->__set('event_id', $mdjm_event->ID); $emails->__set('from_name', $from_name); $emails->__set('from_address', $from_email); $headers = apply_filters('mdjm_manual_payment_headers', $emails->get_headers(), $event_id, $mdjm_event->client); $emails->__set('headers', $headers); $emails->__set('track', apply_filters('mdjm_track_email_manual_payment', mdjm_get_option('track_client_emails'))); if (mdjm_get_option('bcc_admin_to_client')) { $emails->__set('copy_to', array(mdjm_get_option('system_email'))); } $emails->send($to_email, $subject, $message, $attachments, sprintf(__('Payment received confirmation for %s', 'mobile-dj-manager'), mdjm_get_label_singular())); }
function mdjm_admin_toolbar($admin_bar) { if (!current_user_can('mdjm_employee')) { return; } // Build out the toolbar menu structure $admin_bar->add_menu(array('id' => 'mdjm', 'title' => sprintf(__('MDJM %s', 'mobile-dj-manager'), mdjm_get_label_plural()), 'href' => mdjm_employee_can('read_events') ? admin_url('edit.php?post_type=mdjm-event') : '#', 'meta' => array('title' => __('MDJM Event Management', 'mobile-dj-manager')))); if (mdjm_employee_can('read_events')) { // Events $admin_bar->add_menu(array('id' => 'mdjm-events', 'parent' => 'mdjm', 'title' => mdjm_get_label_plural(), 'href' => admin_url('edit.php?post_type=mdjm-event'), 'meta' => array('title' => sprintf(__('MDJM %s', 'mobile-dj-manager'), mdjm_get_label_plural())))); } if (mdjm_employee_can('manage_all_events')) { $admin_bar->add_menu(array('id' => 'mdjm-add-events', 'parent' => 'mdjm-events', 'title' => sprintf(__('Create %s', 'mobile-dj-manager'), mdjm_get_label_singular()), 'href' => admin_url('post-new.php?post_type=mdjm-event'), 'meta' => array('title' => sprintf(__('Create New %s', 'mobile-dj-manager'), mdjm_get_label_singular())))); // Enquiries $event_status = array('mdjm-unattended' => __('Unattended Enquiries', 'mobile-dj-manager'), 'mdjm-enquiry' => __('View Enquiries', 'mobile-dj-manager')); foreach ($event_status as $current_status => $display) { $status_count = MDJM()->events->mdjm_count_event_status($current_status); if (!$status_count) { continue; } $admin_bar->add_menu(array('id' => 'mdjm-' . str_replace(' ', '-', strtolower($display)), 'parent' => 'mdjm-events', 'title' => $display . ' (' . $status_count . ')', 'href' => admin_url('edit.php?post_status=' . $current_status . '&post_type=mdjm-event'), 'meta' => array('title' => $display))); } // Event Types $admin_bar->add_menu(array('id' => 'mdjm-event-types', 'parent' => 'mdjm-events', 'title' => sprintf(__('%s Types', 'mobile-dj-manager'), mdjm_get_label_singular()), 'href' => admin_url('edit-tags.php?taxonomy=event-types&post_type=mdjm-event'), 'meta' => array('title' => sprintf(__('Manage %s Types', 'mobile-dj-manager'), mdjm_get_label_singular())))); // Playlist Categories $admin_bar->add_menu(array('id' => 'mdjm-playlist-cats', 'parent' => 'mdjm-events', 'title' => __('Playlist Categories', 'mobile-dj-manager'), 'href' => admin_url('edit-tags.php?taxonomy=playlist-category&post_type=mdjm-playlist'), 'meta' => array('title' => __('Manage Playlist Categories', 'mobile-dj-manager')))); // Enquiry Sources $admin_bar->add_menu(array('id' => 'mdjm-enquiry-sources', 'parent' => 'mdjm-events', 'title' => __('Enquiry Sources', 'mobile-dj-manager'), 'href' => admin_url('edit-tags.php?taxonomy=enquiry-source&post_type=mdjm-event'), 'meta' => array('title' => __('Manage Enquiry Sources', 'mobile-dj-manager')))); } // Dashboard /*$admin_bar->add_menu( array( 'id' => 'mdjm-dashboard', 'parent' => 'mdjm', 'title' => __( 'Dashboard', 'mobile-dj-manager' ), 'href' => admin_url( 'admin.php?page=mdjm-dashboard' ), 'meta' => array( 'title' => __( 'MDJM Dashboard', 'mobile-dj-manager' ), ), ) ); */ // Settings if (mdjm_is_admin()) { $admin_bar->add_menu(array('id' => 'mdjm-settings', 'parent' => 'mdjm', 'title' => __('Settings', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-settings'), 'meta' => array('title' => __('MDJM Settings', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-settings-general', 'parent' => 'mdjm-settings', 'title' => __('General', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-settings&tab=general'), 'meta' => array('title' => __('MDJM General Settings', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-settings-events', 'parent' => 'mdjm-settings', 'title' => mdjm_get_label_plural(), 'href' => admin_url('admin.php?page=mdjm-settings&tab=events'), 'meta' => array('title' => __('MDJM Event Settings', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-settings-permissions', 'parent' => 'mdjm-settings', 'title' => __('Permissions', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-settings&tab=general§ion=mdjm_app_permissions'), 'meta' => array('title' => __('MDJM Permission Settings', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-settings-emails', 'parent' => 'mdjm-settings', 'title' => sprintf(__('Email %s Template Settings', 'mobile-dj-manager'), '&'), 'href' => admin_url('admin.php?page=mdjm-settings&tab=emails'), 'meta' => array('title' => sprintf(__('MDJM Email %s Template Settings', 'mobile-dj-manager'), '&')))); $admin_bar->add_menu(array('id' => 'mdjm-settings-client-zone', 'parent' => 'mdjm-settings', 'title' => sprintf(__('%s Settings', 'mobile-dj-manager'), mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager'))), 'href' => admin_url('admin.php?page=mdjm-settings&tab=client_zone'), 'meta' => array('title' => sprintf(__('%s Settings', 'mobile-dj-manager'), mdjm_get_option('app_name', __('Client Zone', 'mobile-dj-manager')))))); $admin_bar->add_menu(array('id' => 'mdjm-settings-payments', 'parent' => 'mdjm-settings', 'title' => __('Payment Settings', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-settings&tab=payments'), 'meta' => array('title' => __('MDJM Payment Settings', 'mobile-dj-manager')))); } do_action('mdjm_admin_bar_settings_items', $admin_bar); if (mdjm_is_employer() && mdjm_employee_can('manage_employees')) { // Employees $admin_bar->add_menu(array('id' => 'mdjm-employees', 'parent' => 'mdjm', 'title' => __('Employees', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-employees'), 'meta' => array('title' => __('Employees', 'mobile-dj-manager')))); } if (mdjm_is_admin()) { // Employee Availability $admin_bar->add_menu(array('id' => 'mdjm-availability', 'parent' => mdjm_is_employer() ? 'mdjm-employees' : 'mdjm', 'title' => __('Employee Availability', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-availability'), 'meta' => array('title' => __('Employee Availability', 'mobile-dj-manager')))); // Automated Tasks $admin_bar->add_menu(array('id' => 'mdjm-tasks', 'parent' => 'mdjm', 'title' => __('Automated Tasks', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-tasks'), 'meta' => array('title' => __('Automated Tasks', 'mobile-dj-manager')))); } if (mdjm_employee_can('view_clients_list')) { // Clients $admin_bar->add_menu(array('id' => 'mdjm-clients', 'parent' => 'mdjm', 'title' => __('Clients', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-clients'), 'meta' => array('title' => __('Clients', 'mobile-dj-manager')))); } if (mdjm_employee_can('list_all_clients')) { $admin_bar->add_menu(array('id' => 'mdjm-add-client', 'parent' => 'mdjm-clients', 'title' => __('Add Client', 'mobile-dj-manager'), 'href' => admin_url('user-new.php'), 'meta' => array('title' => __('Add New Client', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-custom-client-fields', 'parent' => 'mdjm-clients', 'title' => __('Custom Client Fields', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-custom-client-fields'), 'meta' => array('title' => __('Custom Client Field', 'mobile-dj-manager')))); } // Communications if (mdjm_employee_can('send_comms')) { $admin_bar->add_menu(array('id' => 'mdjm-comms', 'parent' => 'mdjm', 'title' => __('Communications', 'mobile-dj-manager'), 'href' => admin_url('admin.php?page=mdjm-comms'), 'meta' => array('title' => __('Communications', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'edit.php?post_type=mdjm_communication', 'parent' => 'mdjm-comms', 'title' => __('Communication History', 'mobile-dj-manager'), 'href' => admin_url('edit.php?post_type=mdjm_communication'), 'meta' => array('title' => __('Communication History', 'mobile-dj-manager')))); } // Filter for MDJM DCF Admin Bar Items do_action('mdjm_dcf_admin_bar_items', $admin_bar); if (mdjm_employee_can('manage_templates')) { // Contract Templates $admin_bar->add_menu(array('id' => 'mdjm-contracts', 'parent' => 'mdjm', 'title' => __('Contract Templates', 'mobile-dj-manager'), 'href' => admin_url('edit.php?post_type=contract'), 'meta' => array('title' => __('Contract Templates', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-new-contract', 'parent' => 'mdjm-contracts', 'title' => __('Add Contract Template', 'mobile-dj-manager'), 'href' => admin_url('post-new.php?post_type=contract'), 'meta' => array('title' => __('New Contract Template', 'mobile-dj-manager')))); } if (mdjm_employee_can('manage_templates')) { // Email Templates $admin_bar->add_menu(array('id' => 'mdjm-email-templates', 'parent' => 'mdjm', 'title' => __('Email Templates', 'mobile-dj-manager'), 'href' => admin_url('edit.php?post_type=email_template'), 'meta' => array('title' => __('Email Templates', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-new-email-template', 'parent' => 'mdjm-email-templates', 'title' => __('Add Template', 'mobile-dj-manager'), 'href' => admin_url('post-new.php?post_type=email_template'), 'meta' => array('title' => __('New Email Template', 'mobile-dj-manager')))); } // Equipment Packages & Add-ons if (mdjm_packages_enabled() && mdjm_employee_can('manage_packages')) { $admin_bar->add_menu(array('id' => 'mdjm-packages', 'parent' => 'mdjm', 'title' => __('Packages', 'mobile-dj-manager'), 'href' => admin_url('edit.php?post_type=mdjm-package'), 'meta' => array('title' => __('Packages', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-package-cats', 'parent' => 'mdjm-packages', 'title' => __('Package Categories', 'mobile-dj-manager'), 'href' => admin_url('edit-tags.php?taxonomy=package-category&post_type=mdjm-package'), 'meta' => array('title' => __('Package Categories', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-addons', 'parent' => 'mdjm-packages', 'title' => __('Add-ons', 'mobile-dj-manager'), 'href' => admin_url('edit.php?post_type=mdjm-addon'), 'meta' => array('title' => __('Add-ons', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-addon-cats', 'parent' => 'mdjm-packages', 'title' => __('Addon Categories', 'mobile-dj-manager'), 'href' => admin_url('edit-tags.php?taxonomy=addon-category&post_type=mdjm-addon'), 'meta' => array('title' => __('Addon Categories', 'mobile-dj-manager')))); } // Custom Event Fields if (mdjm_is_admin()) { $admin_bar->add_menu(array('id' => 'mdjm-event-fields', 'parent' => 'mdjm-events', 'title' => sprintf(__('Custom %s Fields', 'mobile-dj-manager'), mdjm_get_label_singular()), 'href' => admin_url('admin.php?page=mdjm-custom-event-fields'), 'meta' => array('title' => sprintf(__('Manage Custom %s Fields', 'mobile-dj-manager'), mdjm_get_label_singular())))); } // Event Quotes if (mdjm_get_option('online_enquiry', false) && mdjm_employee_can('list_own_quotes')) { $admin_bar->add_menu(array('id' => 'mdjm-event-quotes', 'parent' => 'mdjm-events', 'title' => sprintf(__('%s Quotes', 'mobile-dj-manager'), mdjm_get_label_singular()), 'href' => admin_url('edit.php?post_type=mdjm-quotes'), 'meta' => array('title' => sprintf(__('View %s Quotes', 'mobile-dj-manager'), mdjm_get_label_singular())))); } // Reporting /*if( current_user_can( 'manage_options' ) ) { $admin_bar->add_menu( array( 'id' => 'mdjm-reports', 'parent' => 'mdjm', 'title' => __( 'Reports', 'mobile-dj-manager' ), 'href' => admin_url( 'admin.php?page=mdjm-reports' ), 'meta' => array( 'title' => __( 'MDJM Reports', 'mobile-dj-manager' ), ), ) ); }*/ if (mdjm_employee_can('edit_txns')) { // Transactions $admin_bar->add_menu(array('id' => 'mdjm-transactions', 'parent' => 'mdjm', 'title' => __('Transactions', 'mobile-dj-manager'), 'href' => 'edit.php?post_type=mdjm-transaction', 'meta' => array('title' => __('MDJM Transactions', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-add-transaction', 'parent' => 'mdjm-transactions', 'title' => __('Add Transaction', 'mobile-dj-manager'), 'href' => admin_url('post-new.php?post_type=mdjm-transaction'), 'meta' => array('title' => __('Add Transaction', 'mobile-dj-manager')))); // Transaction Types $admin_bar->add_menu(array('id' => 'mdjm-transaction-types', 'parent' => 'mdjm-transactions', 'title' => __('Transaction Types', 'mobile-dj-manager'), 'href' => admin_url('edit-tags.php?taxonomy=transaction-types&post_type=mdjm-transaction'), 'meta' => array('title' => __('View / Edit Transaction Types', 'mobile-dj-manager')))); } if (mdjm_employee_can('list_venues')) { // Venues $admin_bar->add_menu(array('id' => 'mdjm-venues', 'parent' => 'mdjm', 'title' => __('Venues', 'mobile-dj-manager'), 'href' => admin_url('edit.php?post_type=mdjm-venue'), 'meta' => array('title' => __('Venues', 'mobile-dj-manager')))); if (mdjm_employee_can('add_venues')) { $admin_bar->add_menu(array('id' => 'mdjm-add-venue', 'parent' => 'mdjm-venues', 'title' => __('Add Venue', 'mobile-dj-manager'), 'href' => admin_url('post-new.php?post_type=mdjm-venue'), 'meta' => array('title' => __('Add New Venue', 'mobile-dj-manager')))); $admin_bar->add_menu(array('id' => 'mdjm-venue-details', 'parent' => 'mdjm-venues', 'title' => __('Venue Details', 'mobile-dj-manager'), 'href' => admin_url('edit-tags.php?taxonomy=venue-details&post_type=mdjm-venue'), 'meta' => array('title' => __('View / Edit Venue Details', 'mobile-dj-manager')))); } } // MDJM Links $admin_bar->add_menu(array('id' => 'mdjm-user-guides', 'parent' => 'mdjm', 'title' => sprintf(__('%sDocumentation%s', 'mobile-dj-manager'), '<span style="color:#F90">', '</span>'), 'href' => 'http://mdjm.co.uk/support/', 'meta' => array('title' => __('Documentation', 'mobile-dj-manager'), 'target' => '_blank'))); $admin_bar->add_menu(array('id' => 'mdjm-support', 'parent' => 'mdjm', 'title' => sprintf(__('%sSupport%s', 'mobile-dj-manager'), '<span style="color:#F90">', '</span>'), 'href' => 'http://www.mydjplanner.co.uk/forums/', 'meta' => array('title' => __('MDJM Support Forums', 'mobile-dj-manager'), 'target' => '_blank'))); }
/** * Admin Messages * * @since 1.3 * @global $mdjm_options Array of all the MDJM Options * @return void */ function mdjm_admin_notices() { global $mdjm_options; // Unattended events if (mdjm_employee_can('manage_all_events') && mdjm_get_option('warn_unattended')) { $unattended = MDJM()->events->mdjm_count_event_status('mdjm-unattended'); if (!empty($unattended) && $unattended > 0) { echo '<div class="notice notice-info is-dismissible">'; echo '<p>' . sprintf(__('You have unattended enquiries. <a href="%s">Click here</a> to manage.', 'mobile-dj-manager'), admin_url('edit.php?post_type=mdjm-event&post_status=mdjm-unattended')) . '</p>'; echo '</div>'; } } if (isset($_GET['mdjm-message']) && 'upgrade-completed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-upgraded', __('MDJM Event Management has been upgraded successfully.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'song_added' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-added-song', __('Entry added to playlist.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'adding_song_failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-adding-song-failed', __('Could not add entry to playlist.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'song_removed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-removed-song', __('The selected songs were removed.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'song_remove_failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-remove-faled', __('The songs count not be removed.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'security_failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-security-failed', __('Security verification failed. Action not completed.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'playlist_emailed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-playlist-emailed', __('The playlist was emailed successfully.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'playlist_email_failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-playlist-email-failed', __('The playlist could not be emailed.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'employee_added' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-employee_added', __('Employee added.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'employee_add_failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-employee_add-failed', __('Could not add employee.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'employee_info_missing' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-employee_info-missing', __('Insufficient information to create employee.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'comm_missing_content' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-comm_content-missing', __('Not all required fields have been completed.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'comm_sent' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-comm_sent', __('Email sent successfully.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'comm_not_sent' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-comm_not_sent', __('Email not sent.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-action']) && 'get_event_availability' == $_GET['mdjm-action']) { if (!wp_verify_nonce($_GET['mdjm_nonce'], 'get_event_availability')) { return; } elseif (!isset($_GET['event_id'])) { return; } else { $date = get_post_meta($_GET['event_id'], '_mdjm_event_date', true); $result = mdjm_do_availability_check($date); if (!empty($result['available'])) { $notice = '<ul>'; foreach ($result['available'] as $employee_id) { $notice .= '<li>' . sprintf(__('<a href="%s" title="Assign & Respond to Enquiry">Assign %s & respond to enquiry</a>', 'mobile-dj-manager'), add_query_arg('primary_employee', $employee_id, get_edit_post_link($_GET['event_id'])), mdjm_get_employee_display_name($employee_id)) . '</li>'; } $notice .= '</ul>'; echo '<div class="notice notice-info is-dismissible">'; echo '<p>' . sprintf(__('You have %d employees available to work %s %s on %s.', 'mobile-dj-manager'), count($result['available']), mdjm_get_label_singular(true), mdjm_get_event_contract_id($_GET['event_id']), mdjm_get_event_long_date($_GET['event_id'])) . $notice . '</p>'; echo '</div>'; } else { echo '<div class="notice notice-error is-dismissible">'; echo '<p>' . sprintf(__('There are no employees available to work %s %s on %s', 'mobile-dj-manager'), mdjm_get_label_singular(true), mdjm_get_event_contract_id($_GET['event_id']), mdjm_get_event_long_date($_GET['event_id'])) . '</p>'; echo '</div>'; } } } if (isset($_GET['mdjm-message']) && 'payment_event_missing' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-payment_event_missing', __('Event not identified.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'pay_employee_failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-payment_employee_failed', __('Unable to make payment to employee.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'pay_all_employees_failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-payment_employees_failed', __('Unable to make payment to employees.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'pay_all_employees_some_success' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-payment_all_employees_some_success', __('Not all employees could be paid.', 'mobile-dj-manager'), 'notice-info'); } if (isset($_GET['mdjm-message']) && 'pay_employee_success' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-payment_employeee_success', __('Employee successfully paid.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'pay_all_employees_success' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-payment_all_employeees_success', __('Employees successfully paid.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'unattended_enquiries_rejected_success' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-unattended_enquiries_rejected_success', sprintf(_n('%1$s %2$s successfully rejected.', '%1$s %3$s successfully rejected.', $_GET['mdjm-count'], 'mobile-dj-manager'), $_GET['mdjm-count'], mdjm_get_label_singular(), mdjm_get_label_plural()), 'updated'); } if (isset($_GET['mdjm-message']) && 'unattended_enquiries_rejected_failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-unattended_enquiries_rejected_failed', __('Errors were encountered.', 'mobile-dj-manager'), 'error'); } if (isset($_GET['mdjm-message']) && 'api-key-generated' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-api-key-generated', __('API keys generated.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'api-key-regenerated' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-api-key-regenerated', __('API keys re-generated.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'api-key-revoked' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-api-key-revoked', __('API keys revoked.', 'mobile-dj-manager'), 'updated'); } if (isset($_GET['mdjm-message']) && 'api-key-failed' == $_GET['mdjm-message']) { add_settings_error('mdjm-notices', 'mdjm-api-key-failed', __('Generating API keys failed.', 'mobile-dj-manager'), 'error'); } settings_errors('mdjm-notices'); }
/** * Renders the 'Export' tab on the Reports Page * * @since 1.4 * @return void */ function mdjm_reports_tab_export() { if (!mdjm_employee_can('run_reports')) { wp_die(__('You do not have permission to export reports', 'mobile-dj-manager'), __('Error', 'mobile-dj-manager'), array('response' => 403)); } $label_single = mdjm_get_label_singular(); $label_plural = mdjm_get_label_plural(); ?> <div id="mdjm-dashboard-widgets-wrap"> <div class="metabox-holder"> <div id="post-body"> <div id="post-body-content"> <?php do_action('mdjm_reports_tab_export_content_top'); ?> <div class="postbox mdjm-export-events-earnings"> <h3><span><?php _e('Export Transaction History', 'mobile-dj-manager'); ?> </span></h3> <div class="inside"> <p><?php _e('Download a CSV of all transactions recorded.'); ?> </p> <form id="mdjm-export-txns" class="mdjm-export-form mdjm-import-export-form" method="post"> <?php mdjm_insert_datepicker(array('id' => 'mdjm-txn-export-start', 'altfield' => 'txn_start')); ?> <?php echo MDJM()->html->date_field(array('id' => 'mdjm-txn-export-start', 'name' => 'display_start_date', 'placeholder' => __('Select Start Date', 'mobile-dj-manager'))); ?> <?php echo MDJM()->html->hidden(array('name' => 'txn_start')); ?> <?php mdjm_insert_datepicker(array('id' => 'mdjm-txn-export-end', 'altfield' => 'txn_end')); ?> <?php echo MDJM()->html->date_field(array('id' => 'mdjm-txn-export-end', 'name' => 'display_end_date', 'placeholder' => __('Select End Date', 'mobile-dj-manager'))); ?> <?php echo MDJM()->html->hidden(array('name' => 'txn_end')); ?> <select name="txn_status"> <option value=""><?php _e('All Statuses', 'mobile-dj-manager'); ?> </option> <option value="Completed"><?php _e('Completed', 'mobile-dj-manager'); ?> </option> <option value="Pending"><?php _e('Pending', 'mobile-dj-manager'); ?> </option> <option value="Cancelled"><?php _e('Cancelled', 'mobile-dj-manager'); ?> </option> </select> <?php wp_nonce_field('mdjm_ajax_export', 'mdjm_ajax_export'); ?> <input type="hidden" name="mdjm-export-class" value="MDJM_Batch_Export_Txns"/> <span> <input type="submit" value="<?php _e('Generate CSV', 'mobile-dj-manager'); ?> " class="button-secondary"/> <span class="spinner"></span> </span> </form> </div><!-- .inside --> </div><!-- .postbox --> <div class="postbox mdjm-export-events"> <h3><span><?php printf(__('Export %s', 'mobile-dj-manager'), $label_plural); ?> </span></h3> <div class="inside"> <p><?php printf(__('Download a CSV of %s data.'), $label_plural); ?> </p> <form id="mdjm-export-events" class="mdjm-export-form mdjm-import-export-form" method="post"> <?php mdjm_insert_datepicker(array('id' => 'mdjm-event-export-start', 'altfield' => 'event_start')); ?> <?php echo MDJM()->html->date_field(array('id' => 'mdjm-event-export-start', 'name' => 'display_start_date', 'placeholder' => __('Select Start Date', 'mobile-dj-manager'))); ?> <?php echo MDJM()->html->hidden(array('name' => 'event_start')); ?> <?php mdjm_insert_datepicker(array('id' => 'mdjm-event-export-end', 'altfield' => 'event_end')); ?> <?php echo MDJM()->html->date_field(array('id' => 'mdjm-event-export-end', 'name' => 'display_end_date', 'placeholder' => __('Select End Date', 'mobile-dj-manager'))); ?> <?php echo MDJM()->html->hidden(array('name' => 'event_end')); ?> <select name="event_status"> <option value="any"><?php _e('All Statuses', 'mobile-dj-manager'); ?> </option> <?php foreach (mdjm_all_event_status() as $status => $label) { ?> <option value="<?php echo $status; ?> "><?php echo $label; ?> </option> <?php } ?> </select> <?php wp_nonce_field('mdjm_ajax_export', 'mdjm_ajax_export'); ?> <input type="hidden" name="mdjm-export-class" value="MDJM_Batch_Export_Events"/> <span> <input type="submit" value="<?php _e('Generate CSV', 'mobile-dj-manager'); ?> " class="button-secondary"/> <span class="spinner"></span> </span> </form> </div><!-- .inside --> </div><!-- .postbox --> <div class="postbox mdjm-export-clients"> <h3><span><?php _e('Export Clients', 'mobile-dj-manager'); ?> </span></h3> <div class="inside"> <p><?php _e('Download a CSV of clients.', 'mobile-dj-manager'); ?> </p> <form id="mdjm-export-clients" class="mdjm-export-form mdjm-import-export-form" method="post"> <?php wp_nonce_field('mdjm_ajax_export', 'mdjm_ajax_export'); ?> <input type="hidden" name="mdjm-export-class" value="MDJM_Batch_Export_Clients"/> <input type="submit" value="<?php _e('Generate CSV', 'mobile-dj-manager'); ?> " class="button-secondary"/> </form> </div><!-- .inside --> </div><!-- .postbox --> <?php if (mdjm_is_employer()) { ?> <div class="postbox mdjm-export-employees"> <h3><span><?php _e('Export Employees', 'mobile-dj-manager'); ?> </span></h3> <div class="inside"> <p><?php _e('Download a CSV of employees.', 'mobile-dj-manager'); ?> </p> <form id="mdjm-export-employees" class="mdjm-export-form mdjm-import-export-form" method="post"> <?php wp_nonce_field('mdjm_ajax_export', 'mdjm_ajax_export'); ?> <input type="hidden" name="mdjm-export-class" value="MDJM_Batch_Export_Employees"/> <input type="submit" value="<?php _e('Generate CSV', 'mobile-dj-manager'); ?> " class="button-secondary"/> </form> </div><!-- .inside --> </div><!-- .postbox --> <?php } ?> </div><!-- .post-body-content --> </div><!-- .post-body --> </div><!-- .metabox-holder --> </div><!-- #mdjm-dashboard-widgets-wrap --> <?php }
/** * Send admin notice of payment. * * @since 1.3.8 * @param * @return void */ function mdjm_admin_payment_notice($txn_data) { if (isset($txn_data['gateway'])) { $gateway = mdjm_get_gateway_admin_label($txn_data['gateway']); } else { $gateway = mdjm_get_gateway_admin_label(mdjm_get_default_gateway()); } $subject = sprintf(__('%s Payment received via %s', 'mobile-dj-manager'), mdjm_get_label_singular(), $gateway); $subject = apply_filters('mdjm_admin_payment_notice_subject', $subject); $content = '<!DOCTYPE html>' . "\n"; $content .= '<html>' . "\n" . '<body>' . "\n"; $content .= '<p>' . __('Hi there', 'mobile-dj-manager') . ',</p>' . "\n"; $content .= '<p>' . __('A payment has just been received via MDJM Event Management', 'mobile-dj-manager') . '</p>' . "\n"; $content .= '<hr />' . "\n"; $content .= '<h4>' . sprintf(__('%s ID', 'mobile-dj-manager'), mdjm_get_label_singular()) . ': ' . mdjm_get_event_contract_id($txn_data['event_id']) . '</a></h4>' . "\n"; $content .= '<p>' . "\n"; $content .= __('Date', 'mobile-dj-manager') . ': {event_date}<br />' . "\n"; $content .= __('Status', 'mobile-dj-manager') . ': {event_status}<br />' . "\n"; $content .= __('Client', 'mobile-dj-manager') . ': {client_fullname}<br />' . "\n"; $content .= __('Payment Date', 'mobile-dj-manager') . ': {payment_date}<br />' . "\n"; $content .= __('For', 'mobile-dj-manager') . ': {payment_for}<br />' . "\n"; $content .= __('Amount', 'mobile-dj-manager') . ': {payment_amount}<br />' . "\n"; $content .= __('Merchant', 'mobile-dj-manager') . ': ' . $gateway . '<br />' . "\n"; if (!empty($txn_data['fee'])) { $content .= __('Transaction Fee', 'mobile-dj-manager') . ': ' . mdjm_currency_filter(mdjm_format_amount($txn_data['fee'])) . '</span><br />' . "\n"; $content .= '<strong>' . __('Total Received', 'mobile-dj-manager') . ': ' . mdjm_currency_filter(mdjm_format_amount($txn_data['total'] - $txn_data['fee'])) . '</strong><br />' . "\n"; } $content .= __('Outstanding Balance', 'mobile-dj-manager') . ': {balance}</p>' . "\n"; $content .= sprintf(__('<a href="%s">View %s</a>', 'mobile-dj-manager'), admin_url('post.php?post=' . $txn_data['event_id'] . '&action=edit'), mdjm_get_label_singular()) . '</p>' . "\n"; $content .= '<hr />' . "\n"; $content .= '<p>' . __('Regards', 'mobile-dj-manager') . '<br />' . "\n"; $content .= '{company_name}</p>' . "\n"; $content .= '</body>' . "\n"; $content .= '</html>' . "\n"; $content = apply_filters('mdjm_admin_payment_notice_content', $content); mdjm_send_email_content(array('to_email' => mdjm_get_option('system_email'), 'from_name' => mdjm_get_option('company_name'), 'from_email' => mdjm_get_option('system_email'), 'event_id' => $txn_data['event_id'], 'client_id' => mdjm_get_event_client_id($txn_data['event_id']), 'subject' => $subject, 'message' => $content, 'copy_to' => 'disable', 'source' => __('Automated Payment Received', 'mobile-dj-manager'))); }
/** * Save the event transaction * * */ function mdjm_save_event_transaction_ajax() { global $mdjm_event; $result = array(); $mdjm_event = new MDJM_Event($_POST['event_id']); $mdjm_txn = new MDJM_Txn(); $txn_data = array('post_parent' => $_POST['event_id'], 'post_author' => $mdjm_event->client, 'post_status' => $_POST['direction'] == 'Out' ? 'mdjm-expenditure' : 'mdjm-income', 'post_date' => date('Y-m-d H:i:s', strtotime($_POST['date']))); $txn_meta = array('_mdjm_txn_status' => 'Completed', '_mdjm_payment_from' => $mdjm_event->client, '_mdjm_txn_total' => $_POST['amount'], '_mdjm_payer_firstname' => mdjm_get_client_firstname($mdjm_event->client), '_mdjm_payer_lastname' => mdjm_get_client_lastname($mdjm_event->client), '_mdjm_payer_email' => mdjm_get_client_email($mdjm_event->client), '_mdjm_payment_from' => mdjm_get_client_display_name($mdjm_event->client), '_mdjm_txn_source' => $_POST['src']); if ($_POST['direction'] == 'In') { if (!empty($_POST['from'])) { $txn_meta['_mdjm_payment_from'] = sanitize_text_field($_POST['from']); } else { $txn_meta['_mdjm_payment_from'] = mdjm_get_client_display_name($mdjm_event->client); } } if ($_POST['direction'] == 'Out') { if (!empty($_POST['to'])) { $txn_meta['_mdjm_payment_to'] = sanitize_text_field($_POST['to']); } else { $txn_meta['_mdjm_payment_to'] = mdjm_get_client_display_name($mdjm_event->client); } } $mdjm_txn->create($txn_data, $txn_meta); if ($mdjm_txn->ID > 0) { $result['type'] = 'success'; mdjm_set_txn_type($mdjm_txn->ID, $_POST['for']); $args = array('user_id' => get_current_user_id(), 'event_id' => $_POST['event_id'], 'comment_content' => sprintf(__('%1$s payment of %2$s received for %3$s %4$s.', 'mobile-dj-manager'), $_POST['direction'] == 'In' ? __('Incoming', 'mobile-dj-manager') : __('Outgoing', 'mobile-dj-manager'), mdjm_currency_filter(mdjm_format_amount($_POST['amount'])), mdjm_get_label_singular(true), mdjm_get_event_contract_id($_POST['event_id']))); mdjm_add_journal($args); // Email overide if (empty($_POST['send_notice']) && mdjm_get_option('manual_payment_cfm_template')) { $manual_email_template = mdjm_get_option('manual_payment_cfm_template'); mdjm_update_option('manual_payment_cfm_template', 0); } $payment_for = $mdjm_txn->get_type(); $amount = mdjm_currency_filter(mdjm_format_amount($_POST['amount'])); mdjm_add_content_tag('payment_for', __('Reason for payment', 'mobile-dj-manager'), function () use($payment_for) { return $payment_for; }); mdjm_add_content_tag('payment_amount', __('Payment amount', 'mobile-dj-manager'), function () use($amount) { return $amount; }); mdjm_add_content_tag('payment_date', __('Date of payment', 'mobile-dj-manager'), 'mdjm_content_tag_ddmmyyyy'); /** * Allow hooks into this payment. The hook is suffixed with 'in' or 'out' depending * on the payment direction. i.e. mdjm_post_add_manual_txn_in and mdjm_post_add_manual_txn_out * * @since 1.3.7 * @param int $event_id * @param obj $txn_id */ do_action('mdjm_post_add_manual_txn_' . strtolower($_POST['direction']), $_POST['event_id'], $mdjm_txn->ID); // Email overide if (empty($_POST['send_notice']) && isset($manual_email_template)) { mdjm_update_option('manual_payment_cfm_template', $manual_email_template); } $result['deposit_paid'] = 'N'; $result['balance_paid'] = 'N'; if ($mdjm_event->get_remaining_deposit() < 1) { mdjm_update_event_meta($mdjm_event->ID, array('_mdjm_event_deposit_status' => 'Paid')); $result['deposit_paid'] = 'Y'; } if ($mdjm_event->get_balance() < 1) { mdjm_update_event_meta($mdjm_event->ID, array('_mdjm_event_balance_status' => 'Paid')); mdjm_update_event_meta($mdjm_event->ID, array('_mdjm_event_deposit_status' => 'Paid')); $result['balance_paid'] = 'Y'; $result['deposit_paid'] = 'Y'; } } else { $result['type'] = 'error'; $result['msg'] = __('Unable to add transaction', 'mobile-dj-manager'); } ob_start(); mdjm_do_event_txn_table($_POST['event_id']); $result['transactions'] = ob_get_contents(); ob_get_clean(); echo json_encode($result); die; }
<?php /** * This template is used when the current logged in client accesses the playlist page but has no events. * * @version 1.0 * @author Mike Howard * @since 1.3 * @content_tag {client_*} * @shortcodes Not Supported * * Do not customise this file! * If you wish to make changes, copy this file to your theme directory /theme/mdjm-templates/quote/quote-noevent.php */ ?> <div id="client-quote-no-events"> <p><?php printf(__("We haven't been able to locate your %s. Please return to our <a href='%s'>%s</a> page to see a list of your %s."), mdjm_get_label_singular(), '{application_home}', '{application_name}', mdjm_get_label_plural()); ?> </p> </div>
/** * Displays the signed contract for review. * * @since 1.3.6 * @param int $event_id The event ID. * @return void */ function mdjm_review_signed_contract() { if (empty($_GET['mdjm_action'])) { return; } if ('review_contract' !== $_GET['mdjm_action']) { return; } if (!mdjm_employee_can('manage_events')) { return; } $mdjm_event = new MDJM_Event($_GET['event_id']); if (!mdjm_is_admin()) { if (!array_key_exists(get_current_user_id(), $mdjm_event->get_all_employees())) { return; } } if (!$mdjm_event->get_contract_status()) { printf(__('The contract for this %s is not signed', 'mobile-dj-manager'), mdjm_get_label_singular()); exit; } $contract_id = $mdjm_event->get_contract(); if (empty($contract_id)) { return; } echo mdjm_show_contract($contract_id, $mdjm_event); exit; }
/** * Add event count to At a glance widget * * @since 1.4 * @return void */ function mdjm_dashboard_at_a_glance_widget($items) { $num_posts = mdjm_count_events(); $count = 0; $statuses = mdjm_all_event_status(); foreach ($statuses as $status => $label) { if (!empty($num_posts->{$status})) { $count += $num_posts->{$status}; } } if ($num_posts && $count > 0) { $text = _n('%s ' . mdjm_get_label_singular(), '%s ' . mdjm_get_label_plural(), $count, 'mobile-dj-manager'); $text = sprintf($text, number_format_i18n($count)); if (mdjm_employee_can('read_events')) { $text = sprintf('<a class="event-count" href="edit.php?post_type=mdjm-event">%1$s</a>', $text); } else { $text = sprintf('<span class="event-count">%1$s</span>', $text); } $items[] = $text; } return $items; }
<?php do_action('mdjm_print_notices'); ?> <p class="head-nav"><a href="{event_url}"><?php printf(__('Back to %s', 'mobile-dj-manager'), mdjm_get_label_singular()); ?> </a></p> <?php do_action('mdjm_pre_contract_header', $mdjm_event->ID); ?> <p><?php printf(__('The contract for your %s taking place on %s is displayed below.', 'mobile-dj-manager'), mdjm_get_label_singular(true), '{event_date}'); ?> </p> <p class="mdjm-alert mdjm-alert-success"><span style="font-weight: bold;"><?php _e('Your contract is signed', 'mobile-dj-manager'); ?> </span><br /> <?php printf(__('Signed on %s by %s with password verification', 'mobile-dj-manager'), '{contract_date}', '{contract_signatory}'); ?> <br /> <?php printf(__('IP address recorded as: %s', 'mobile-dj-manager'), '{contract_signatory_ip}'); ?> </p>
$playlist = mdjm_get_playlist_by_category($mdjm_event->ID); ?> <?php if ($playlist) { ?> <div id="mdjm-playlist-entries"> <?php do_action('mdjm_playlist_entries_top', $mdjm_event->ID); ?> <?php $entries_in_playlist = mdjm_count_playlist_entries($mdjm_event->ID); ?> <p><?php printf(__('Your playlist currently consists of %d %s and is approximately %s long. Your %s is %s long.', 'mobile-dj-manager'), $entries_in_playlist, _n('track', 'tracks', $entries_in_playlist, 'mobile-dj-manager'), '{playlist_duration}', mdjm_get_label_singular(), '{event_duration}'); ?> </p> <?php foreach ($playlist as $category => $entries) { ?> <?php $entries_in_category = mdjm_count_playlist_entries($mdjm_event->ID, $category); ?> <div class="row"> <div class="category"><?php echo $category;