public static function admin_options()
    {
        if (current_user_can('list_users')) {
            ?>
			<a name="pro-api"></a>
			<div  class="postbox " id="em-opt-gateway-options">
			<div class="handlediv" title="<?php 
            esc_attr_e_emp('Click to toggle', 'dbem');
            ?>
"><br /></div><h3 class='hndle'><span><?php 
            _e('Payment Gateway Options', 'em-pro');
            ?>
 </span></h3>
			<div class="inside">
				<table class='form-table'>
					<?php 
            em_options_radio_binary(__('Enable Quick Pay Buttons?', 'em-pro'), 'dbem_gateway_use_buttons', sprintf(__('Only works with gateways that do not require additional payment information to be submitted (e.g. PayPal and Offline payments). If enabled, the default booking form submit button is not used, and each gateway will have a button (or image, see <a href="%s">individual gateway settings</a>) which if clicked on will submit a booking for that gateway.', 'em-pro'), admin_url('edit.php?post_type=' . EM_POST_TYPE_EVENT . '&page=events-manager-gateways')));
            em_options_input_text(__('Gateway Label', 'em-pro'), 'dbem_gateway_label', __('If you are not using quick pay buttons a drop-down menu will be used, with this label.', 'em-pro'));
            ?>
				</table>
			</div> <!-- . inside -->
			</div> <!-- .postbox -->
		<?php 
        }
    }
    public static function admin_options()
    {
        global $save_button;
        if (current_user_can('list_users')) {
            ?>
			<div  class="postbox " id="em-opt-pro-booking-form-options" >
			<div class="handlediv" title="<?php 
            esc_attr_e_emp('Click to toggle', 'dbem');
            ?>
"><br /></div><h3 class='hndle'><span><?php 
            _e('PRO Booking Form Options', 'em-pro');
            ?>
 </span></h3>
			<div class="inside">
				<table class='form-table'>
					<?php 
            em_options_radio_binary(__('Show profile fields to logged in users?', 'em-pro'), 'dbem_emp_booking_form_reg_show', __('When logged in, users usually don\'t see their profile fields, with this enabled, users will be able to update their profile fields alongside their booking. This is particularly useful if the user is missing key information.', 'em-pro'), '', '#dbem_emp_booking_form_reg_show_name_row, #dbem_emp_booking_form_reg_show_email_row, #dbem_emp_booking_form_reg_input_row');
            em_options_radio_binary(__('Show name profile fields?', 'em-pro'), 'dbem_emp_booking_form_reg_show_name', sprintf(__('If fields are editable users will be able to change their %s whilst making a booking.', 'em-pro'), esc_html__emp('Name', 'dbem')));
            em_options_radio_binary(__('Show email profile fields?', 'em-pro'), 'dbem_emp_booking_form_reg_show_email', sprintf(__('If fields are editable users will be able to change their %s whilst making a booking.', 'em-pro'), esc_html__emp('Email', 'dbem')));
            em_options_radio_binary(__('Make profile fields editable?', 'em-pro'), 'dbem_emp_booking_form_reg_input', __('If profile fields are set to show to logged in users, you can also choose whether or not to make these fields editable or just for viewing reference.', 'em-pro'));
            ?>
				</table>
				<?php 
            echo $save_button;
            ?>
 
			</div> <!-- . inside -->
			</div> <!-- .postbox -->
		<?php 
        }
    }
示例#3
0
//do your own thing, e.g. pro
?>
						</table>
						<p class="em-booking-single-info">
							<input type="button" class="em-booking-submit-modify" id="em-booking-submit-modify" value="<?php 
_e('Modify Booking Information', 'em-pro');
?>
" />
						</p>
						<p class="em-booking-single-edit">
							<input type="submit" class="em-booking-submit" id="em-booking-submit" value="<?php 
esc_attr_e_emp('Submit Changes', 'dbem');
?>
" />
							<input type="button" class="em-booking-submit-cancel" id="em-booking-submit-cancel" value="<?php 
esc_attr_e_emp('Cancel', 'dbem');
?>
" />
						 	<input type='hidden' name='action' value='booking_save'/>
						 	<input type='hidden' name='booking_id' value='<?php 
echo $EM_Multiple_Booking->booking_id;
?>
'/>
						 	<input type='hidden' name='event_id' value='<?php 
echo $EM_Event->event_id;
?>
'/>
						 	<input type='hidden' name='_wpnonce' value='<?php 
echo wp_create_nonce('booking_save_' . $EM_Multiple_Booking->booking_id);
?>
'/>
    public static function emails()
    {
        global $save_button;
        $bookings_placeholders = '<a href="' . EM_ADMIN_URL . '&amp;page=events-manager-help#booking-placeholders">' . esc_html__emp('Booking Related Placeholders', 'dbem') . '</a>';
        $bookings_placeholder_tip = " " . sprintf(esc_html__emp('This accepts %s placeholders.', 'dbem'), $bookings_placeholders);
        ?>
		<div  class="postbox " id="em-opt-multiple-booking-emails" >
		<div class="handlediv" title="<?php 
        esc_attr_e_emp('Click to toggle', 'dbem');
        ?>
"><br /></div><h3><span><?php 
        _e('Multiple Booking Email Templates', 'em-pro');
        ?>
 </span></h3>
		<div class="inside">
		    <div class="em-boxheader">
                <p><?php 
        echo sprintf(__('When users make a booking in Multiple Bookings Mode or cancels their booking, these emails get sent to the attendee and administrator emails you assign in the %s section above.', 'em-pro'), '<code>' . esc_html__emp('Booking Email Templates', 'dbem') . '</code>');
        ?>
</p>
                <p><?php 
        _e('When administrators modify a set of multiple bookings rather than individual events, these templates will be used to notify the attendee.', 'em-pro');
        ?>
</p>
            </div>
			<table class='form-table'>
				<?php 
        $email_subject_tip = esc_html__emp('You can disable this email by leaving the subject blank.', 'dbem');
        em_options_radio_binary(__('Email event owners?', 'em-pro'), 'dbem_multiple_bookings_contact_email', sprintf(__('If enabled, additional emails will be sent to administrators and event owners for EVERY event booked based on the above %s settings.', 'em-pro'), '<code>' . esc_html__emp('Booking Email Templates', 'dbem') . '</code>'));
        ?>
				<tr class="em-header"><td colspan='2'><h4><?php 
        esc_html_e_emp('Event Admin/Owner Emails', 'dbem');
        ?>
</h4></td></tr>
				<tbody class="em-subsection">
    				<tr class="em-subheader"><td colspan='2'>
    					<h5><?php 
        esc_html_e_emp('Contact person booking confirmed', 'dbem');
        ?>
</h5>
    					<em><?php 
        esc_html_e_emp('An email will be sent to the event contact when a booking is first made.', 'dbem') . $bookings_placeholder_tip;
        ?>
</em>
    				</td></tr>
    				<?php 
        em_options_input_text(esc_html__emp('Contact person email subject', 'dbem'), 'dbem_multiple_bookings_contact_email_subject', $email_subject_tip);
        em_options_textarea(esc_html__emp('Contact person email', 'dbem'), 'dbem_multiple_bookings_contact_email_body', '');
        ?>
    				<tr class="em-subheader"><td colspan='2'>
    					<h5><?php 
        esc_html_e_emp('Contact person booking cancelled', 'dbem');
        ?>
</h5>
    					<em><?php 
        esc_html_e_emp('An email will be sent to the event contact if someone cancels their booking.', 'dbem') . $bookings_placeholder_tip;
        ?>
</em>
    				</td></tr>
    				<?php 
        em_options_input_text(esc_html__emp('Contact person cancellation subject', 'dbem'), 'dbem_multiple_bookings_contact_email_cancelled_subject', $email_subject_tip);
        em_options_textarea(esc_html__emp('Contact person cancellation email', 'dbem'), 'dbem_multiple_bookings_contact_email_cancelled_body', '');
        ?>
				</tbody>
				<tbody class="em-subsection">
    				<tr class="em-header"><td colspan='2'><h4><?php 
        esc_html_e_emp('Booked User Emails', 'dbem');
        ?>
</h4></td></tr>
    				<tr class="em-subheader"><td colspan='2'>
    					<h5><?php 
        esc_html_e_emp('Confirmed booking email', 'dbem');
        ?>
</h5>
    					<em><?php 
        esc_html_e_emp('This is sent when a person\'s booking is confirmed. This will be sent automatically if approvals are required and the booking is approved. If approvals are disabled, this is sent out when a user first submits their booking.', 'dbem') . $bookings_placeholder_tip;
        ?>
</em>
    				</td></tr>
    				<?php 
        em_options_input_text(esc_html__emp('Booking confirmed email subject', 'dbem'), 'dbem_multiple_bookings_email_confirmed_subject', $email_subject_tip);
        em_options_textarea(esc_html__emp('Booking confirmed email', 'dbem'), 'dbem_multiple_bookings_email_confirmed_body', '');
        ?>
    				<tr class="em-subheader"><td colspan='2'>
    					<h5><?php 
        esc_html_e_emp('Pending booking email', 'dbem');
        ?>
</h5>
    					<em><?php 
        esc_html_e_emp('This will be sent to the person when they first submit their booking. Not relevant if bookings don\'t require approval.', 'dbem') . $bookings_placeholder_tip;
        ?>
</em>
    				</td></tr>
    				<?php 
        em_options_input_text(esc_html__emp('Booking pending email subject', 'dbem'), 'dbem_multiple_bookings_email_pending_subject', $email_subject_tip);
        em_options_textarea(esc_html__emp('Booking pending email', 'dbem'), 'dbem_multiple_bookings_email_pending_body', '');
        ?>
    				<tr class="em-subheader"><td colspan='2'>
    					<h5><?php 
        esc_html_e_emp('Rejected booking email', 'dbem');
        ?>
</h5>
    					<em><?php 
        esc_html_e_emp('This will be sent automatically when a booking is rejected. Not relevant if bookings don\'t require approval.', 'dbem') . $bookings_placeholder_tip;
        ?>
</em>
    				</td></tr>
    				<?php 
        em_options_input_text(esc_html__emp('Booking rejected email subject', 'dbem'), 'dbem_multiple_bookings_email_rejected_subject', $email_subject_tip);
        em_options_textarea(esc_html__emp('Booking rejected email', 'dbem'), 'dbem_multiple_bookings_email_rejected_body', '');
        ?>
    				<tr class="em-subheader"><td colspan='2'>
    					<h5><?php 
        esc_html_e_emp('Booking cancelled', 'dbem');
        ?>
</h5>
    					<em><?php 
        esc_html_e_emp('This will be sent when a user cancels their booking.', 'dbem') . $bookings_placeholder_tip;
        ?>
</em>
    				</td></tr>
    				<?php 
        em_options_input_text(esc_html__emp('Booking cancelled email subject', 'dbem'), 'dbem_multiple_bookings_email_cancelled_subject', $email_subject_tip);
        em_options_textarea(esc_html__emp('Booking cancelled email', 'dbem'), 'dbem_multiple_bookings_email_cancelled_body', '');
        ?>
    			</tbody>
				<?php 
        echo $save_button;
        ?>
			</table>
		</div> <!-- . inside -->
		</div> <!-- .postbox -->
		<?php 
    }
    /**
     * Generates meta box for settings page 
     */
    public static function custom_email_options()
    {
        global $save_button;
        ?>
		<div  class="postbox " id="em-opt-custom-emails" >
		<div class="handlediv" title="<?php 
        esc_attr_e_emp('Click to toggle', 'dbem');
        ?>
"><br /></div><h3><?php 
        _e('Custom Booking Email Templates', 'em-pro');
        ?>
 <em>(Beta)</em></h3>
		<div class="inside">
			<table class='form-table'>
				<tr class="em-boxheader"><td colspan='2'>
					<p><?php 
        _e('You can customize the email templates sent when users make a booking for one of your events.', 'em-pro');
        ?>
</p>
				</td></tr>
				<?php 
        em_options_radio_binary(sprintf(_x('Enable %s?', 'Enable a feature in settings page', 'em-pro'), __('Custom Booking Email Templates', 'em-pro')), 'dbem_custom_emails', '');
        ?>
				<tbody class="dbem-js-custom-emails">
					<tr class="em-header"><td colspan="2"><h4><?php 
        _e('Event Emails', 'em-pro');
        ?>
</h4></td></tr>
					<?php 
        em_options_radio_binary(__('Allow custom emails for events?', 'em-pro'), 'dbem_custom_emails_events', __('Allow custom booking email templates to be configured for individual events.', 'em-pro') . ' ' . __('Users with the %s user capability will be able to do this when adding/editing events.', 'em-pro'));
        em_options_radio_binary(__('Allow custom admin email addresses for events?', 'em-pro'), 'dbem_custom_emails_events_admins', __('Allow adding custom email addresses to be addded to individual events.', 'em-pro') . ' ' . __('Users with the %s user capability will be able to do this when adding/editing events.', 'em-pro'));
        ?>
					<tr class="em-header"><td colspan="2"><h4><?php 
        _e('Gateway Emails', 'em-pro');
        ?>
</h4></td></tr>
					<?php 
        em_options_radio_binary(__('Allow custom emails for gateways?', 'em-pro'), 'dbem_custom_emails_gateways', sprintf(__('Allow administrators of this blog to configure custom booking email templates inside each %s settings page.', 'em-pro'), '<a href="' . admin_url('edit.php?post_type=event&page=events-manager-gateways') . '">' . __('Payment Gateways', 'em-pro') . '</a>'));
        em_options_radio_binary(__('Allow custom admin email addresses for gateways?', 'em-pro'), 'dbem_custom_emails_gateways_admins', sprintf(__('Allow administrators of this blog to add additional admin email addresses for gateways inside each %s settings page.', 'em-pro'), '<a href="' . admin_url('edit.php?post_type=event&page=events-manager-gateways') . '">' . __('Payment Gateways', 'em-pro') . '</a>'));
        ?>
				</tbody>
				<?php 
        echo $save_button;
        ?>
			</table>
		</div> <!-- . inside -->
		</div> <!-- .postbox -->
		<script type="text/javascript">
			jQuery(document).ready(function($){
				$('input:radio[name="dbem_custom_emails"]').change(function(){
					if( $('input:radio[name="dbem_custom_emails"]:checked').val() == 1 ){
						$('tbody.dbem-js-custom-emails').show();
					}else{
						$('tbody.dbem-js-custom-emails').hide();					
					}
				}).first().trigger('change');
				$('input:radio[name="dbem_custom_emails_events"], input:radio[name="dbem_custom_emails_gateways"]').change(function(){
					if( $('input:radio[name="'+this.name+'"]:checked').val() == 1 ){
						$('tr#'+this.name+'_admins_row').show();
					}else{
						$('tr#'+this.name+'_admins_row').hide();
					}
				}).filter('input:radio:checked').trigger('change');
			});
		</script>
	    <?php 
    }
    public static function admin_options()
    {
        global $save_button;
        $api = !self::check_api_key();
        if (is_super_admin()) {
            ?>
			<a name="pro-api"></a>
			<div  class="postbox " id="em-opt-pro-key" >
			<div class="handlediv" title="<?php 
            esc_attr_e_emp('Click to toggle', 'dbem');
            ?>
"><br /></div><h3 class='hndle'><span><?php 
            _e('Pro Membership Key', 'em-pro');
            ?>
 </span></h3>
			<div class="inside">
				<table class='form-table' <?php 
            echo $api ? 'style="background-color:#ffece8;"' : '';
            ?>
>
					<?php 
            em_options_input_text(__('Pro Member Key', 'em-pro'), 'dbem_pro_api_key', sprintf(__("Insert your Pro Member Key to access automatic updates you can get your membership key from <a href=\"%s\">here</a>.", 'em-pro'), 'http://eventsmanagerpro.com/account/'));
            ?>
					<?php 
            if (!self::check_api_key() && get_option('dbem_pro_api_key') != '') {
                ?>
						<?php 
                $response = get_site_transient('dbem_pro_api_key_check');
                if ($api) {
                    ?>
							<tr>
								<td colspan="2">
									<b>Returned Data:</b> 
									<?php 
                    print_r($response);
                    ?>
								</td>
							</tr>
							<?php 
                }
                ?>
					<?php 
            }
            ?>
				</table>
				<?php 
            echo $save_button;
            ?>
			</div> <!-- . inside -->
			</div> <!-- .postbox -->
		<?php 
        }
    }
    /**
     *  Outputs the form editor in the admin area
     */
    public static function admin_page()
    {
        $EM_Form = self::get_form();
        ?>
		<div id="poststuff" class="metabox-holder">
			<div id="post-body">
				<div id="post-body-content">
					<?php 
        do_action('em_booking_attendee_form_admin_page_header');
        ?>
					<div id="attendee-form-settings" class="stuffbox">
						<h3 id="attendee-form">
							<?php 
        _e('Attendee Form', 'em-pro');
        ?>
						</h3>
						<div class="inside">
							<p><?php 
        _e("If enabled, this form will be shown and required for every space booked.", 'em-pro');
        ?>
</p>
							<form method="post" action="#attendee-form"> 
								<p>
								<?php 
        _e('Enable Attendee Forms', 'em-pro');
        ?>
 :
								<input type="radio" name="em_attendee_fields_enabled" value="1" class="attendee-enable" <?php 
        if (get_option('em_attendee_fields_enabled')) {
            echo 'checked="checked"';
        }
        ?>
 /> <?php 
        esc_html_e_emp('Yes', 'dbem');
        ?>
								<input type="radio" name="em_attendee_fields_enabled" value="0" class="attendee-enable" <?php 
        if (!get_option('em_attendee_fields_enabled')) {
            echo 'checked="checked"';
        }
        ?>
 /> <?php 
        esc_html_e_emp('No', 'dbem');
        ?>
								<input type="hidden" name="_wpnonce" value="<?php 
        echo wp_create_nonce('em_attendee_fields_enabled');
        ?>
" />
								<input type="submit" class="button-secondary" value="<?php 
        esc_attr_e_emp('Save Changes', 'dbem');
        ?>
" />
								</p>
							</form>
							<?php 
        if (get_option('em_attendee_fields_enabled')) {
            ?>
							<div id="em-attendee-form-editor">
								<form method="get" action="#attendee-form"> 
									<?php 
            _e('Selected Attendee Form', 'em-pro');
            ?>
 :
									<select name="att_form_id" onchange="this.parentNode.submit()">
										<option value="0" <?php 
            if (!self::$form_id) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('None', 'em-pro');
            ?>
</option>
										<?php 
            foreach (self::get_forms_names() as $form_key => $form_name_option) {
                ?>
										<option value="<?php 
                echo $form_key;
                ?>
" <?php 
                if ($form_key == self::$form_id) {
                    echo 'selected="selected"';
                }
                ?>
><?php 
                echo $form_name_option;
                ?>
</option>
										<?php 
            }
            ?>
									</select>
									<input type="hidden" name="post_type" value="<?php 
            echo EM_POST_TYPE_EVENT;
            ?>
" />
									<input type="hidden" name="page" value="<?php 
            echo esc_attr($_REQUEST['page']);
            ?>
" />
								</form>
								<?php 
            if (self::$form_id != get_option('em_attendee_form_fields')) {
                ?>
								<form method="post" action="<?php 
                echo add_query_arg(array('att_form_id' => null));
                ?>
#attendee-form"> 
									<input type="hidden" name="att_form_id" value="<?php 
                echo esc_attr($_REQUEST['att_form_id']);
                ?>
" />
									<input type="hidden" name="attendee_form_action" value="default" />
									<input type="hidden" name="_wpnonce" value="<?php 
                echo wp_create_nonce('attendee_form_default');
                ?>
" />
									<input type="submit" value="<?php 
                _e('Make Default', 'em-pro');
                ?>
 &raquo;" class="button-secondary" onclick="return confirm('<?php 
                _e('You are about to make this your default booking form. All events without an existing specifically chosen booking form will use this new default form from now on.\\n\\n Are you sure you want to do this?');
                ?>
');" />
								</form>
								<?php 
            }
            ?>
 | 
								<form method="post" action="<?php 
            echo add_query_arg(array('att_form_id' => null));
            ?>
#attendee-form" id="attendee-form-add">
									<input type="text" name="form_name" />
									<input type="hidden" name="attendee_form_action" value="add" />
									<input type="hidden" name="_wpnonce" value="<?php 
            echo wp_create_nonce('attendee_form_add');
            ?>
" />
									<input type="submit"  value="<?php 
            _e('Add New', 'em-pro');
            ?>
 &raquo;" class="button-secondary" />
								</form>
								<?php 
            do_action('em_attendees_form_admin_page_actions', $EM_Form);
            ?>
								<?php 
            if (self::$form_id == get_option('em_attendee_form_fields') && self::$form_id > 0) {
                ?>
								<br /><em><?php 
                _e('This is the default attendee form and will be used for any event where you have not chosen a specific form to use.', 'em-pro');
                ?>
</em>
								<?php 
            }
            ?>
								<br /><em><?php 
            _e("If you don't want to ask for attendee information by default, select None as your booking form and make it the default form.", 'em-pro');
            ?>
</em>
								<?php 
            if (self::$form_id > 0) {
                ?>
									<br /><br />
									<form method="post" action="<?php 
                echo add_query_arg(array('att_form_id' => null));
                ?>
#attendee-form" id="attendee-form-rename">
										<span style="font-weight:bold;"><?php 
                echo sprintf(__("You are now editing ", 'em-pro'), self::$form_name);
                ?>
</span>
										<input type="text" name="form_name" value="<?php 
                echo self::$form_name;
                ?>
" />
										<input type="hidden" name="att_form_id" value="<?php 
                echo self::$form_id;
                ?>
" />
										<input type="hidden" name="attendee_form_action" value="rename" />
										<input type="hidden" name="_wpnonce" value="<?php 
                echo wp_create_nonce('attendee_form_rename');
                ?>
" />
										<input type="submit" value="<?php 
                _e('Rename', 'em-pro');
                ?>
 &raquo;" class="button-secondary" />
									</form>
									<?php 
                if (self::$form_id != get_option('em_attendee_form_fields')) {
                    ?>
									<form method="post" action="<?php 
                    echo add_query_arg(array('att_form_id' => null));
                    ?>
#attendee-form" id="attendee-form-rename">
										<input type="hidden" name="att_form_id" value="<?php 
                    echo esc_attr($_REQUEST['att_form_id']);
                    ?>
" />
										<input type="hidden" name="attendee_form_action" value="delete" />
										<input type="hidden" name="_wpnonce" value="<?php 
                    echo wp_create_nonce('attendee_form_delete');
                    ?>
" />
										<input type="submit" value="<?php 
                    _e('Delete', 'em-pro');
                    ?>
 &raquo;" class="button-secondary" onclick="return confirm('<?php 
                    _e('Are you sure you want to delete this form?\\n\\n All events using this form will start using the default form automatically.');
                    ?>
');" />
									</form>
									<?php 
                }
                ?>
									<p><?php 
                _e('<strong>Important:</strong> When editing this form, to make sure your old booking information is displayed, make sure new field ids correspond with the old ones.', 'em-pro');
                ?>
</p>
									<br /><br />
									<?php 
                echo $EM_Form->editor(false, true, false);
                ?>
								<?php 
            } else {
                ?>
									<p><em><?php 
                if (self::$form_id == get_option('em_attendee_form_fields')) {
                    echo __('Default Value', 'em-pro') . ' - ';
                }
                ?>
 <?php 
                _e('No attendee form selected. Choose a form, or create a new one above.', 'em-pro');
                ?>
</em></p>
								<?php 
            }
            ?>
							</div>
							<?php 
        }
        ?>
						</div>
					</div>
				</div>
			</div>
		</div>
		<?php 
    }