/** * Display the key generation form * * @access public * @since 1.4 * @return void */ public function extra_tablenav($which = '') { if ('top' != $which) { return; } ?> <form id="api-key-generate-form" method="post" action="<?php echo admin_url('edit.php?post_type=mdjm-event&page=mdjm-tools&tab=api_keys'); ?> "> <?php mdjm_admin_action_field('process_api_key'); ?> <input type="hidden" name="mdjm_api_process" value="generate" /> <?php wp_nonce_field('mdjm-api-nonce', 'api_nonce'); ?> <?php echo MDJM()->html->users_dropdown(array('name' => 'user_id', 'chosen' => true, 'show_option_all' => false, 'show_option_none' => _x('Select a User', 'no dropdown items', 'mobile-dj-manager'))); ?> <?php submit_button(__('Generate New API Keys', 'mobile-dj-manager'), 'secondary', 'submit', false); ?> </form> <?php }
/** * Display the form for adding a new employee to MDJM * * * * */ public static function add_employee_form() { // Ensure user has permssion to add an employee if (!mdjm_employee_can('manage_staff')) { return; } ?> <h3><?php _e('Employee Quick Add', 'mobile-dj-manager'); ?> </h3> <form name="mdjm_employee_add" id="mdjm_employee_add" method="post"> <?php mdjm_admin_action_field('add_employee'); ?> <?php wp_nonce_field('add_employee', 'mdjm_nonce', true, true); ?> <table class="widefat"> <tr> <td style="width: 250px;"><label class="mdjm-label" for="first_name"><?php _e('First Name', 'mobile-dj-manager'); ?> :</label><br /> <input type="text" name="first_name" id="first_name" required /></td> </tr> <tr> <td style="width: 250px;"><label class="mdjm-label" for="last_name"><?php _e('Last Name', 'mobile-dj-manager'); ?> :</label><br /> <input type="text" name="last_name" id="last_name" required /></td> </tr> <tr> <td style="width: 250px;"><label class="mdjm-label" for="user_email"><?php _e('Email Address', 'mobile-dj-manager'); ?> :</label><br /> <input type="text" name="user_email" id="user_email" required /></td> </tr> <tr> <td style="width: 250px;"><label class="mdjm-label" for="employee_role"><?php _e('Role', 'mobile-dj-manager'); ?> :</label><br /> <select name="employee_role" id="employee_role" required> <option value=""><?php _e('Select Role', 'mobile-dj-manager'); ?> …</option> <?php echo MDJM()->roles->roles_dropdown(); ?> </select> </td> </tr> <tr> <td style="text-align: right;"><?php submit_button(__('Add Employee', 'mobile-dj-manager'), 'primary', 'mdjm-add-employee', false); ?> </td> </tr> </table> </form> <?php }
/** * Display the send email form on the communications page. * * @since 1.3 * @param * @return Outputs the page content */ function mdjm_comms_page() { if (!mdjm_employee_can('send_comms')) { wp_die('<h1>' . __('Cheatin’ uh?') . '</h1>' . '<p>' . __('You do not have permission to access this page.', 'mobile-dj-manager') . '</p>', 403); } global $current_user; if (mdjm_employee_can('list_all_clients')) { $clients = mdjm_get_clients(); } else { $clients = mdjm_get_employee_clients(); } if (mdjm_employee_can('mdjm_employee_edit')) { $employees = mdjm_get_employees(); } ?> <div class="wrap"> <h1><?php _e('Client and Employee Communications', 'mobile-dj-manager'); ?> </h1> <form name="mdjm_form_send_comms" id="mdjm_form_send_comms" method="post" enctype="multipart/form-data"> <?php wp_nonce_field('send_comm_email', 'mdjm_nonce', true, true); ?> <?php mdjm_admin_action_field('send_comm_email'); ?> <input type="hidden" name="mdjm_email_from_address" id="mdjm_email_from_address" value="<?php echo $current_user->user_email; ?> " /> <input type="hidden" name="mdjm_email_from_name" id="mdjm_email_from_name" value="<?php echo $current_user->display_name; ?> " /> <?php do_action('mdjm_pre_comms_table'); ?> <table class="form-table"> <?php do_action('mdjm_add_comms_fields_before_recipient'); ?> <tr> <th scope="row"><label for="mdjm_email_to"><?php _e('Select a Recipient', 'mobile-dj-manager'); ?> </label></th> <td> <select name="mdjm_email_to" id="mdjm_email_to"> <option value=""><?php _e('Select a Recipient', 'mobile-dj-manager'); ?> </option> <optgroup label="<?php _e('Clients', 'mobile-dj-manager'); ?> "> <?php if (empty($clients)) { echo '<option disabled="disabled">' . __('No Clients Found', 'mobile-dj-manager') . '</option>'; } else { foreach ($clients as $client) { echo '<option value="' . $client->ID . '">' . $client->display_name . '</option>'; } } ?> </optgroup> <?php if (!empty($employees)) { echo '<optgroup label="' . __('Employees', 'mobile-dj-manager') . '">'; foreach ($employees as $employee) { echo '<option value="' . $employee->ID . '">' . $employee->display_name . '</option>'; } echo '</optgroup>'; } ?> </select> </td> </tr> <?php do_action('mdjm_add_comms_fields_before_subject'); ?> <tr> <th scope="row"><label for="mdjm_email_subject"><?php _e('Subject', 'mobile-dj-manager'); ?> </label></th> <td><input type="text" name="mdjm_email_subject" id="mdjm_email_subject" class="regular-text" value="<?php echo isset($_GET['template']) ? esc_attr(get_the_title($_GET['template'])) : ''; ?> " /></td> </tr> <tr> <th scope="row"><label for="mdjm_email_copy_to"><?php _e('Copy Yourself?', 'mobile-dj-manager'); ?> </label></th> <td><input type="checkbox" name="mdjm_email_copy_to" id="mdjm_email_copy_to" value="<?php echo $current_user->user_email; ?> " /> <span class="description"><?php _e('Settings may dictate that additional email copies are also sent', 'mobile-dj-manager'); ?> </span></td> </tr> <?php do_action('mdjm_add_comms_fields_before_template'); ?> <tr> <th scope="row"><label for="mdjm_email_template"><?php _e('Select a Template', 'mobile-dj-manager'); ?> </label></th> <td> <select name="mdjm_email_template" id="mdjm_email_template"> <option value="0"><?php _e('No Template', 'mobile-dj-manager'); ?> </option> <?php $template = isset($_GET['template']) ? $_GET['template'] : 0; ?> <?php echo mdjm_comms_template_options($template); ?> </select> </td> </tr> <?php do_action('mdjm_add_comms_fields_before_event'); ?> <tr> <th scope="row"><label for="mdjm_email_event"><?php printf(__('Associated %s', 'mobile-dj-manager'), mdjm_get_label_singular()); ?> </label></th> <td> <?php if (isset($_GET['event_id']) || isset($_GET['mdjm-action']) && $_GET['mdjm-action'] == 'respond_unavailable') { ?> <?php $value = mdjm_get_event_date($_GET['event_id']) . ' '; $value .= __('from', 'mobile-dj-manager') . ' '; $value .= mdjm_get_event_start($_GET['event_id']) . ' '; $value .= '(' . mdjm_get_event_status($_GET['event_id']) . ')'; ?> <input type="text" name="mdjm_email_event_show" id="mdjm_email_event_show" value="<?php echo $value; ?> " readonly="readonly" size="50" /> <input type="hidden" name="mdjm_email_event" id="mdjm_email_event" value="<?php echo $_GET['event_id']; ?> " /> <?php } else { ?> <select name="mdjm_email_event" id="mdjm_email_event"> <option value="0"><?php _e('Select an Event', 'mobile-dj-manager'); ?> </option> </select> <?php } ?> <p class="description"><?php printf(__('If no %s is selected <code>{event_*}</code> content tags may not be used', 'mobile-dj-manager'), mdjm_get_label_singular(true)); ?> </p> </td> </tr> <?php do_action('mdjm_add_comms_fields_before_file'); ?> <tr> <th scope="row"><label for="mdjm_email_upload_file"><?php _e('Attach a File', 'mobile-dj-manager'); ?> </label></th> <td><input type="file" name="mdjm_email_upload_file" id="mdjm_email_upload_file" class="regular-text" value="" /> <p class="description"><?php printf(__('Max file size %dMB. Change php.ini <code>post_max_size</code> to increase', 'mobile-dj-manager'), ini_get('post_max_size')); ?> </p> </td> </tr> <?php do_action('mdjm_add_comms_fields_before_content'); ?> <tr> <td colspan="2"> <?php $content = isset($_GET['template']) ? mdjm_get_email_template_content($_GET['template']) : ''; wp_editor($content, 'mdjm_email_content', array('media_buttons' => true, 'textarea_rows' => '10', 'editor_class' => 'required')); ?> </td> </tr> </table> <?php do_action('mdjm_post_comms_table'); ?> <?php submit_button(__('Send Email', 'mobile-dj-manager'), 'primary', 'submit', true); ?> </form> </div> <?php }
/** * Outputs the form for adding an entry * * @access public * @since 1.4 * @return void */ public function entry_form() { ?> <h3><?php _e('Add Entry to Playlist', 'mobile-dj-manager'); ?> </h3> <form id="mdjm-playlist-form" name="mdjm-playlist-form" action="" method="post"> <?php wp_nonce_field('add_playlist_entry', 'mdjm_nonce', true, true); ?> <?php mdjm_admin_action_field('add_playlist_entry'); ?> <input type="hidden" id="entry_event" name="entry_event" value="<?php echo $_GET['event_id']; ?> " /> <input type="hidden" id="entry_addedby" name="entry_addedby" value="<?php echo mdjm_get_event_client_id($_GET['event_id']); ?> " /> <table id="mdjm-playlist-form-table"> <tr> <td> <label for="entry_song"><?php _e('Song', 'mobile-dj-manager'); ?> </label><br /> <?php echo MDJM()->html->text(array('name' => 'entry_song', 'type' => 'text')); ?> </td> <td class="mdjm-playlist-artist-cell"> <label for="entry_artist"><?php _e('Artist', 'mobile-dj-manager'); ?> </label><br /> <?php echo MDJM()->html->text(array('name' => 'entry_artist', 'type' => 'text')); ?> </td> <td class="mdjm-playlist-category-cell"> <label for="entry_category"><?php _e('Category', 'mobile-dj-manager'); ?> </label><br /> <?php $playlist_categories = mdjm_get_playlist_categories(); ?> <?php $options = array(); ?> <?php foreach ($playlist_categories as $playlist_category) { ?> <?php $options[$playlist_category->term_id] = $playlist_category->name; ?> <?php } ?> <?php echo MDJM()->html->select(array('options' => $options, 'name' => 'entry_category', 'selected' => mdjm_get_option('playlist_default_cat', 0))); ?> </td> </tr> <tr> <td class="mdjm-playlist-djnotes-cell" colspan="3"> <label for="mdjm_playlist_djnotes"><?php printf(__('Notes', 'mobile-dj-manager'), '{artist_label}'); ?> </label><br /> <?php echo MDJM()->html->textarea(array('name' => 'entry_djnotes')); ?> </td> </tr> </table> <?php submit_button(__('Add to Playlist', 'mobile-dj-manager'), 'primary'); ?> </form> <?php }