Exemplo n.º 1
0
    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 
        }
    }
 /**
  * Adds relevant actions to booking shown in the bookings table
  * @param EM_Booking $EM_Booking
  */
 function bookings_table_actions($actions, $EM_Booking)
 {
     return array('approve' => '<a class="em-bookings-approve em-bookings-approve-offline" href="' . em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'bookings_approve', 'booking_id' => $EM_Booking->booking_id)) . '">' . esc_html__emp('Approve', 'dbem') . '</a>', 'delete' => '<span class="trash"><a class="em-bookings-delete" href="' . em_add_get_params($_SERVER['REQUEST_URI'], array('action' => 'bookings_delete', 'booking_id' => $EM_Booking->booking_id)) . '">' . esc_html__emp('Delete', 'dbem') . '</a></span>', 'edit' => '<a class="em-bookings-edit" href="' . em_add_get_params($EM_Booking->get_event()->get_bookings_url(), array('booking_id' => $EM_Booking->booking_id, 'em_ajax' => null, 'em_obj' => null)) . '">' . esc_html__emp('Edit/View', 'dbem') . '</a>');
 }
    static function edit_form()
    {
        global $EM_Notices, $EM_Coupon;
        //check that user can access this page
        if (is_object($EM_Coupon) && !$EM_Coupon->can_manage('manage_bookings', 'manage_others_bookings')) {
            ?>
			<div class="wrap"><h2><?php 
            esc_html_e_emp('Unauthorized Access', 'dbem');
            ?>
</h2><p><?php 
            echo sprintf(esc_html__emp('You do not have the rights to manage this %s.', 'dbem'), __('coupon', 'em-pro'));
            ?>
</p></div>
			<?php 
            return false;
        } elseif (!is_object($EM_Coupon)) {
            $EM_Coupon = new EM_Coupon();
        }
        $required = "<i>(" . __('required', 'em-pro') . ")</i>";
        ?>
		<div class='wrap nosubsub'>
			<div class="icon32" id="icon-bookings"><br></div>
			<h2><?php 
        _e('Edit Coupon', 'em-pro');
        ?>
</h2>
			<?php 
        echo $EM_Notices;
        ?>
			<form id='coupon-form' method='post' action=''>
				<input type='hidden' name='action' value='coupon_save' />
				<input type='hidden' name='_wpnonce' value='<?php 
        echo wp_create_nonce('coupon_save');
        ?>
' />
				<input type='hidden' name='coupon_id' value='<?php 
        echo $EM_Coupon->coupon_id;
        ?>
'/>
				<table class="form-table">
					<tbody>
					<?php 
        if (!get_option('dbem_multiple_bookings')) {
            ?>
    					<tr valign="top">
    						<th scope="row"><?php 
            _e('Coupon Availability', 'em-pro');
            ?>
</th>
    						<td>
    							<select name="coupon_availability">
    								<option value=""><?php 
            _e('Only on specific events that I own', 'em-pro');
            ?>
</option>
    								<option value="eventwide" <?php 
            if ($EM_Coupon->coupon_eventwide && !$EM_Coupon->coupon_sitewide) {
                echo 'selected="selected"';
            }
            ?>
><?php 
            _e('All my events', 'em-pro');
            ?>
</option>
    								<?php 
            if (current_user_can('manage_others_bookings') || is_super_admin()) {
                ?>
    								<option value="sitewide" <?php 
                if ($EM_Coupon->coupon_sitewide) {
                    echo 'selected="selected"';
                }
                ?>
><?php 
                _e('All events on this site', 'em-pro');
                ?>
</option>
    								<?php 
            }
            ?>
    							</select>
    							<br />
    							<em><?php 
            _e('Choose whether to allow this coupon to be used only on events you choose, all your events or all events on this site.', 'em-pro');
            ?>
</em>
    						</td>
    					</tr>
					<?php 
        } else {
            ?>
					   <tr><td colspan="2"><p><?php 
            _e('This coupon will be available for all bookings made and discount is applied to the total price before checking out.', 'em-pro');
            ?>
</p>
					<?php 
        }
        ?>
					<tr valign="top">
						<th scope="row"><?php 
        _e('Registered Users Only?', 'em-pro');
        ?>
</th>
							<td><input type="checkbox" name="coupon_private" value="1" <?php 
        if ($EM_Coupon->coupon_private) {
            echo 'checked="checked"';
        }
        ?>
 />
							<br />
							<em><?php 
        _e('If checked, only logged in users will be able to use this coupon.', 'em-pro');
        ?>
</em>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php 
        _e('Coupon Code', 'em-pro');
        ?>
</th>
							<td><input type="text" name="coupon_code" value="<?php 
        echo esc_attr($EM_Coupon->coupon_code);
        ?>
" />
							<br />
							<em><?php 
        _e('This is the code you give to users for them to use when booking.', 'em-pro');
        ?>
</em>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php 
        esc_html_e_emp('Name', 'dbem');
        ?>
</th>
							<td><input type="text" name="coupon_name" value="<?php 
        echo esc_attr($EM_Coupon->coupon_name);
        ?>
" />
							<br />
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php 
        esc_html_e_emp('Description', 'dbem');
        ?>
</th>
							<td><input type="text" name="coupon_description" value="<?php 
        echo esc_attr($EM_Coupon->coupon_description);
        ?>
" />
							<br />
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php 
        _e('Total Coupons', 'em-pro');
        ?>
</th>
							<td><input type="text" name="coupon_max" value="<?php 
        echo esc_attr($EM_Coupon->coupon_max);
        ?>
" />
							<br />
							<em><?php 
        _e('If set, this coupon will only be valid that many times.', 'em-pro');
        ?>
</em>
						</td>
					</tr>
					<tbody class="em-date-range">
						<tr valign="top">
							<th scope="row"><?php 
        esc_html_e_emp('Start Date', 'dbem');
        ?>
</th>
							<td>
								<input type="text" class="em-date-input-loc em-date-start" />
								<input type="hidden" class="em-date-input" name="coupon_start" value="<?php 
        echo esc_attr(substr($EM_Coupon->coupon_start, 0, 10));
        ?>
" />
								<br />
								<em><?php 
        _e('Coupons will only be valid from this date onwards.', 'em-pro');
        ?>
</em>
							</td>
						</tr>
						<tr valign="top">
							<th scope="row"><?php 
        esc_html_e_emp('End Date', 'dbem');
        ?>
</th>
							<td>
								<input type="text" class="em-date-input-loc em-date-end" />
								<input type="hidden" class="em-date-input" name="coupon_end" value="<?php 
        echo esc_attr(substr($EM_Coupon->coupon_end, 0, 10));
        ?>
" />
								<br />
								<em><?php 
        _e('Coupons will not be valid after this date.', 'em-pro');
        ?>
</em>
							</td>
						</tr>
					</tbody>
					<tr valign="top">
						<th scope="row"><?php 
        _e('Discount Type', 'em-pro');
        ?>
</th>
						<td>
							<select name="coupon_type">
								<option value="%" <?php 
        echo $EM_Coupon->coupon_type == '%' ? 'selected="selected"' : '';
        ?>
><?php 
        _e('Percentage', 'em-pro');
        ?>
</option>
								<option value="#" <?php 
        echo $EM_Coupon->coupon_type == '#' ? 'selected="selected"' : '';
        ?>
><?php 
        _e('Fixed Amount', 'em-pro');
        ?>
</option>
							</select>
							<br />
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php 
        _e('Apply Before/After Tax', 'em-pro');
        ?>
</th>
						<td>
							<select name="coupon_tax">
								<option value="pre" <?php 
        echo $EM_Coupon->coupon_tax == 'pre' ? 'selected="selected"' : '';
        ?>
><?php 
        _e('Before', 'em-pro');
        ?>
</option>
								<option value="post" <?php 
        echo $EM_Coupon->coupon_tax == 'post' ? 'selected="selected"' : '';
        ?>
><?php 
        _e('After', 'em-pro');
        ?>
</option>
							</select>
							<br />
							<em><?php 
        _e('Choose whether to apply this discount before or after tax has been added, if applicable.', 'em-pro');
        ?>
</em>
						</td>
					</tr>
					<tr valign="top">
						<th scope="row"><?php 
        _e('Discount Amount', 'em-pro');
        ?>
</th>
							<td><input type="text" name="coupon_discount" value="<?php 
        echo esc_attr($EM_Coupon->coupon_discount);
        ?>
" />
							<br />
							<em><?php 
        _e('Enter a number here only, decimals accepted.', 'em-pro');
        ?>
</em>
						</td>
					</tr>
					</tbody>
				</table>				
				<p class="submit">
				<input type="submit" name="Submit" class="button-primary" value="<?php 
        esc_attr_e('Save Changes');
        ?>
" />
				</p>
			</form>
		</div> <!-- wrap -->
		<?php 
    }
    /**
     * Outputs custom PayPal setting fields in the settings page 
     */
    function mysettings()
    {
        global $EM_options;
        ?>
		<table class="form-table">
		<tbody>
		  <tr valign="top">
			  <th scope="row"><?php 
        _e('Success Message', 'em-pro');
        ?>
</th>
			  <td>
			  	<input type="text" name="booking_feedback" value="<?php 
        esc_attr_e(get_option('em_' . $this->gateway . "_booking_feedback"));
        ?>
" style='width: 40em;' /><br />
			  	<em><?php 
        _e('The message that is shown to a user when a booking is successful and payment has been taken.', 'em-pro');
        ?>
</em>
			  </td>
		  </tr>
		  <tr valign="top">
			  <th scope="row"><?php 
        _e('Success Free Message', 'em-pro');
        ?>
</th>
			  <td>
			  	<input type="text" name="booking_feedback_free" value="<?php 
        esc_attr_e(get_option('em_' . $this->gateway . "_booking_feedback_free"));
        ?>
" style='width: 40em;' /><br />
			  	<em><?php 
        _e('If some cases if you allow a free ticket (e.g. pay at gate) as well as paid tickets, this message will be shown and the user will not be charged.', 'em-pro');
        ?>
</em>
			  </td>
		  </tr>
		</tbody>
		</table>
		<h3><?php 
        echo sprintf(esc_html__emp('%s Options', 'dbem'), 'Authorize.net');
        ?>
</h3>
		<p style="font-style:italic;"><?php 
        echo sprintf(__('Please visit the <a href="%s">documentation</a> for further instructions on setting up Authorize.net with Events Manager.', 'em-pro'), 'http://wp-events-plugin.com/documentation/event-bookings-with-authorize-net-aim/');
        ?>
</p>
		<table class="form-table">
		<tbody>
			 <tr valign="top">
				  <th scope="row"><?php 
        _e('Mode', 'em-pro');
        ?>
</th>
				  <td>
					  <select name="mode">
					  	<?php 
        $selected = get_option('em_' . $this->gateway . '_mode');
        ?>
						<option value="sandbox" <?php 
        echo $selected == 'sandbox' ? 'selected="selected"' : '';
        ?>
><?php 
        _e('Sandbox', 'emp-pro');
        ?>
</option>
						<option value="live" <?php 
        echo $selected == 'live' ? 'selected="selected"' : '';
        ?>
><?php 
        _e('Live', 'emp-pro');
        ?>
</option>
					  </select>
					  <br />
					  <em><?php 
        echo sprintf(__('Please visit <a href="%s">Authorize.net</a> to set up a sandbox account if you would like to test this gateway out. Alternatively, you can use your real account in test mode, which you can set on your Authorize.net control panel.', 'em-pro'), 'https://developer.authorize.net/integration/fifteenminutes/');
        ?>
</em>
				  </td>
			</tr>
			<tr valign="top">
				  <th scope="row"><?php 
        _e('API Login ID', 'emp-pro');
        ?>
</th>
				  <td><input type="text" name="api_user" value="<?php 
        esc_attr_e(get_option('em_' . $this->gateway . "_api_user", ""));
        ?>
" /></td>
			</tr>
			<tr valign="top">
			 	<th scope="row"><?php 
        _e('Transaction key', 'emp-pro');
        ?>
</th>
			    <td><input type="text" name="api_key" value="<?php 
        esc_attr_e(get_option('em_' . $this->gateway . "_api_key", ""));
        ?>
" /></td>
			</tr>
			<tr><td colspan="2">
				<p><strong><?php 
        echo __('Payment Notifications', 'em-pro');
        ?>
</strong></p>
				<p><?php 
        _e('If you would like to receive notifications from Authorize.net and handle refunds or voided transactions automatically, you need to enable Silent Post URL and provide an MD5 Hash in your merchant interface.', 'em-pro');
        ?>
</p>
				<p><?php 
        echo sprintf(__('Your return url is %s.', 'em-pro'), '<code>' . $this->get_payment_return_url() . '</code>');
        ?>
 <?php 
        _e('You can use this as your Silent Post URL.', 'em-pro');
        ?>
</p>
			</td></tr>
			<tr>
				<th scope="row"><?php 
        _e('Security: MD5 Hash', 'emp-pro');
        ?>
</th>
				<td>
					<input type="text" name="md5_hash" value="<?php 
        esc_attr_e(get_option('em_' . $this->gateway . "_md5_hash"));
        ?>
" /><br />
					<em><?php 
        _e('This string of text needs to match that in your merchant interface settings.', 'em-pro');
        ?>
</em>
				</td>
			</tr>
			<tr valign="top">
				  <th scope="row"><?php 
        _e('User Login ID', 'emp-pro');
        ?>
</th>
				  <td>
				  	<input type="text" name="user_login" value="<?php 
        esc_attr_e(get_option('em_' . $this->gateway . "_user_login", ""));
        ?>
" /><br />
					<em><?php 
        _e('This is the username you use to log into your merchant interface.', 'em-pro');
        ?>
</em>
				  </td>
			</tr>
			<tr><td colspan="2"><strong><?php 
        echo sprintf(esc_html__emp('%s Options', 'dbem'), esc_html__emp('Advanced', 'dbem'));
        ?>
</strong></td></tr>
			<tr>
				<th scope="row"><?php 
        _e('Email Customer (on success)', 'emp-pro');
        ?>
</th>
				<td>
					<select name="email_customer">
					  	<?php 
        $selected = get_option('em_' . $this->gateway . '_email_customer');
        ?>
						<option value="1" <?php 
        echo $selected ? 'selected="selected"' : '';
        ?>
><?php 
        esc_html_e_emp('Yes', 'dbem');
        ?>
</option>
						<option value="0" <?php 
        echo !$selected ? 'selected="selected"' : '';
        ?>
><?php 
        esc_html_e_emp('No', 'dbem');
        ?>
</option>
					</select>
				</td>
			</tr>
			<tr>
				<th scope="row"><?php 
        _e('Customer Receipt Email Header', 'emp-pro');
        ?>
</th>
				<td><input type="text" name="header_email_receipt" value="<?php 
        esc_attr_e(get_option('em_' . $this->gateway . "_header_email_receipt", __("Thanks for your payment!", "emp-pro")));
        ?>
" /></td>
			</tr>
			<tr>
				<th scope="row"><?php 
        _e('Customer Receipt Email Footer', 'emp-pro');
        ?>
</th>
				<td><input type="text" name="footer_email_receipt" value="<?php 
        esc_attr_e(get_option('em_' . $this->gateway . "_footer_email_receipt", ""));
        ?>
" /></td>
			</tr>
		  <tr valign="top">
			  <th scope="row"><?php 
        _e('Manually approve completed transactions?', 'em-pro');
        ?>
</th>
			  <td>
			  	<input type="checkbox" name="manual_approval" value="1" <?php 
        echo get_option('em_' . $this->gateway . "_manual_approval") ? 'checked="checked"' : '';
        ?>
 /><br />
			  	<em><?php 
        _e('By default, when someone pays for a booking, it gets automatically approved once the payment is confirmed. If you would like to manually verify and approve bookings, tick this box.', 'em-pro');
        ?>
</em><br />
			  	<em><?php 
        echo sprintf(__('Approvals must also be required for all bookings in your <a href="%s">settings</a> for this to work properly.', 'em-pro'), EM_ADMIN_URL . '&amp;page=events-manager-options');
        ?>
</em>
			  </td>
		  </tr>
		</tbody>
		</table>
		<?php 
    }
 /**
  * Deletes ALL bookings related to this booking and then deletes this booking group 
  * @return boolean
  */
 function delete()
 {
     global $wpdb;
     $this->get_bookings(true);
     //queue bookings for deletion
     if (parent::delete()) {
         $result = true;
         $results = array();
         $wpdb->delete(EM_BOOKINGS_RELATIONSHIPS_TABLE, array('booking_main_id' => $this->booking_id), array('%d'));
         foreach ($this->get_bookings() as $EM_Booking) {
             $results[] = $EM_Booking->delete();
         }
         if (in_array(false, $results)) {
             $result = false;
             $this->add_error(sprintf(esc_html__emp('%s could not be deleted', 'dbem'), esc_html__emp('Bookings', 'dbem')));
         }
     } else {
         $result = false;
     }
     return apply_filters('em_multiple_booking_delete', $result !== false, $this);
 }
    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 
    }
Exemplo n.º 7
0
    /**
     * Generates a settings pages.
     * @uses EM_Gateway::mysettings()
     */
    function settings()
    {
        global $page, $action, $EM_Notices;
        $gateway_link = admin_url('edit.php?post_type=' . EM_POST_TYPE_EVENT . '&page=events-manager-options#bookings');
        $messages['updated'] = esc_html__('Gateway updated.', 'em-pro');
        $messages['error'] = esc_html__('Gateway not updated.', 'em-pro');
        ?>
		<div class='wrap nosubsub'>
			<div class="icon32" id="icon-plugins"><br></div>
			<h2><?php 
        echo sprintf(__('Edit &quot;%s&quot; settings', 'em-pro'), esc_html($this->title));
        ?>
</h2>
			<?php 
        if (isset($_GET['msg']) && !empty($messages[$_GET['msg']])) {
            echo '<div id="message" class="' . $_GET['msg'] . ' fade"><p>' . $messages[$_GET['msg']] . ' <a href="' . em_add_get_params($_SERVER['REQUEST_URI'], array('action' => null, 'gateway' => null, 'msg' => null)) . '">' . esc_html__('Back to gateways', 'em-pro') . '</a>' . '</p></div>';
        }
        ?>
			<form action='' method='post' name='gatewaysettingsform'>
				<input type='hidden' name='action' id='action' value='updated' />
				<input type='hidden' name='gateway' id='gateway' value='<?php 
        echo $this->gateway;
        ?>
' />
				<?php 
        wp_nonce_field('updated-' . $this->gateway);
        ?>
				<h3><?php 
        echo sprintf(esc_html__emp('%s Options', 'dbem'), esc_html__emp('Booking Form', 'dbem'));
        ?>
</h3>
				<table class="form-table">
				<tbody>
				  <tr valign="top">
					  <th scope="row"><?php 
        _e('Gateway Title', 'em-pro');
        ?>
</th>
					  <td>
					  	<input type="text" name="<?php 
        echo $this->gateway;
        ?>
_option_name" value="<?php 
        esc_html_e(get_option('em_' . $this->gateway . "_option_name"));
        ?>
"/><br />
					  	<em><?php 
        echo sprintf(__('Only if you have not enabled quick pay buttons in your <a href="%s">gateway settings</a>.', 'em-pro'), $gateway_link) . ' ' . __('The user will see this as the text option when choosing a payment method.', 'em-pro');
        ?>
</em>
					  </td>
				  </tr>
				  <tr valign="top">
					  <th scope="row"><?php 
        _e('Booking Form Information', 'em-pro');
        ?>
</th>
					  <td>
					  	<textarea name="<?php 
        echo $this->gateway;
        ?>
_form"><?php 
        esc_html_e(get_option('em_' . $this->gateway . "_form"));
        ?>
</textarea><br />
					  	<em><?php 
        echo sprintf(__('Only if you have not enabled quick pay buttons in your <a href="%s">gateway settings</a>.', 'em-pro'), $gateway_link) . ' ' . __('If a user chooses to pay with this gateway, or it is selected by default, this message will be shown just below the selection.', 'em-pro');
        ?>
</em>
					  </td>
				  </tr>
				</tbody>
				</table>
				<?php 
        $this->mysettings();
        ?>
				<?php 
        if ($this->button_enabled) {
            ?>
				<h3><?php 
            echo _e('Quick Pay Buttons', 'em-pro');
            ?>
</h3>
				<p><?php 
            echo sprintf(__('If you have chosen to only use quick pay buttons in your <a href="%s">gateway settings</a>, these settings below will be used.', 'em-pro'), $gateway_link);
            ?>
</p>
				<table class="form-table">
				<tbody>
				  <tr valign="top">
					  <th scope="row"><?php 
            _e('Payment Button', 'em-pro');
            ?>
</th>
					  <td>
					  	<input type="text" name="<?php 
            echo $this->gateway;
            ?>
_button" value="<?php 
            esc_attr_e(get_option('em_' . $this->gateway . "_button", 'http://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif'));
            ?>
" style='width: 40em;' /><br />
					  	<em><?php 
            echo sprintf(__('Choose the button text. To use an image instead, enter the full url starting with %s or %s.', 'em-pro'), '<code>http://www.paypal.com/en_US/i/btn/btn_xpressCheckout.gif</code>', '<code>https://...</code>');
            ?>
</em>
					  </td>
				  </tr>
				</tbody>
				</table>
				<?php 
        }
        ?>
				<?php 
        do_action('em_gateway_settings_footer', $this);
        ?>
				<p class="submit">
				<input type="submit" name="Submit" class="button-primary" value="<?php 
        esc_attr_e('Save Changes');
        ?>
" />
				</p>
			</form>
		</div> <!-- wrap -->
		<?php 
    }
/**
 * Shortcut for the esc_html_e function
 * @param string $text
 * @param string $domain
 */
function esc_html_e_emp($text, $domain = 'dbem')
{
    echo esc_html__emp($text, $domain);
}
        function mytransactions($context = false)
        {
            global $EM_Person;
            $transactions = $this->get_transactions($context);
            $total = $this->total_transactions;
            $columns = array();
            $columns['event'] = __('Event', 'em-pro');
            $columns['user'] = __('User', 'em-pro');
            $columns['date'] = __('Date', 'em-pro');
            $columns['amount'] = __('Amount', 'em-pro');
            $columns['transid'] = __('Transaction id', 'em-pro');
            $columns['gateway'] = __('Gateway', 'em-pro');
            $columns['status'] = __('Status', 'em-pro');
            $columns['note'] = __('Notes', 'em-pro');
            $columns['actions'] = '';
            $trans_navigation = paginate_links(array('base' => add_query_arg('paged', '%#%'), 'format' => '', 'total' => ceil($total / 20), 'current' => $this->page));
            ?>
		<div id="em-transactions-table" class="em_obj">
		<form id="em-transactions-table-form" class="transactions-filter" action="" method="post">
			<?php 
            if (is_object($context) && get_class($context) == "EM_Event") {
                ?>
			<input type="hidden" name="event_id" value='<?php 
                echo $context->event_id;
                ?>
' />
			<?php 
            } elseif (is_object($context) && get_class($context) == "EM_Person") {
                ?>
			<input type="hidden" name="person_id" value='<?php 
                echo $context->person_id;
                ?>
' />
			<?php 
            }
            ?>
			<input type="hidden" name="pno" value='<?php 
            echo $this->page;
            ?>
' />
			<input type="hidden" name="order" value='<?php 
            echo $this->order;
            ?>
' />
			<input type="hidden" name="orderby" value='<?php 
            echo $this->orderby;
            ?>
' />
			<input type="hidden" name="_wpnonce" value="<?php 
            echo !empty($_REQUEST['_wpnonce']) ? esc_attr($_REQUEST['_wpnonce']) : wp_create_nonce('em_transactions_table');
            ?>
" />
			<input type="hidden" name="action" value="em_transactions_table" />
			
			<div class="tablenav">
				<div class="alignleft actions">
					<select name="limit">
						<option value="<?php 
            echo $this->limit;
            ?>
"><?php 
            echo sprintf(esc_html__emp('%s Rows', 'dbem'), $this->limit);
            ?>
</option>
						<option value="5">5</option>
						<option value="10">10</option>
						<option value="25">25</option>
						<option value="50">50</option>
						<option value="100">100</option>
					</select>
					<select name="gateway">
						<option value="">All</option>
						<?php 
            global $EM_Gateways;
            foreach ($EM_Gateways as $EM_Gateway) {
                ?>
<option value='<?php 
                echo $EM_Gateway->gateway;
                ?>
' <?php 
                if ($EM_Gateway->gateway == $this->gateway) {
                    echo "selected='selected'";
                }
                ?>
><?php 
                echo $EM_Gateway->title;
                ?>
</option><?php 
            }
            ?>
					</select>
					<input id="post-query-submit" class="button-secondary" type="submit" value="<?php 
            _e('Filter');
            ?>
" />
					<?php 
            if (is_object($context) && get_class($context) == "EM_Event") {
                ?>
					<?php 
                esc_html_e_emp('Displaying Event', 'dbem');
                ?>
 : <?php 
                echo $context->event_name;
                ?>
					<?php 
            } elseif (is_object($context) && get_class($context) == "EM_Person") {
                ?>
					<?php 
                esc_html_e_emp('Displaying User', 'dbem');
                echo ' : ' . $context->get_name();
                ?>
					<?php 
            }
            ?>
				</div>
				<?php 
            if ($this->total_transactions >= $this->limit) {
                echo em_admin_paginate($this->total_transactions, $this->limit, $this->page, array(), '#%#%', '#');
            }
            ?>
			</div>

			<div class="table-wrap">
			<table cellspacing="0" class="widefat">
				<thead>
				<tr>
				<?php 
            foreach ($columns as $key => $col) {
                ?>
						<th style="" class="manage-column column-<?php 
                echo $key;
                ?>
" id="<?php 
                echo $key;
                ?>
" scope="col"><?php 
                echo $col;
                ?>
</th>
						<?php 
            }
            ?>
				</tr>
				</thead>

				<tfoot>
				<tr>
					<?php 
            reset($columns);
            foreach ($columns as $key => $col) {
                ?>
							<th style="" class="manage-column column-<?php 
                echo $key;
                ?>
" id="<?php 
                echo $key;
                ?>
" scope="col"><?php 
                echo $col;
                ?>
</th>
							<?php 
            }
            ?>
				</tr>
				</tfoot>

				<tbody>
					<?php 
            echo $this->print_transactions($transactions);
            ?>

				</tbody>
			</table>
			</div>
		</form>
		</div>
		<?php 
        }
 public static function event_meta_box()
 {
     global $EM_Event;
     //get custom email values if they exist
     $custom_email_values = EM_Custom_Emails::get_event_emails($EM_Event);
     $custom_admin_emails = false;
     if (get_option('dbem_custom_emails_events_admins')) {
         $custom_admin_emails = EM_Custom_Emails::get_event_admin_emails($EM_Event);
     }
     if (get_option('dbem_multiple_bookings')) {
         //warn users that these emails only apply when resending emails in multipl bookings mode
         echo '<p class="em-event-custom-emails-multiple-bookings-warning" style="font-style:italic; font-weight:bold;">';
         echo sprintf(esc_html__('Since %s is enabled, these emails will only be sent when individual bookings are modified afterwards, such as changing the status of the booking individually or resending an email.', 'em-pro'), esc_html__('Multiple Bookings Mode', 'em-pro'));
         echo '</p>';
     }
     echo '<p>' . sprintf(__('Below you can modify the emails that are sent when bookings are made. This will override the default emails located in your %s settings page.', 'em-pro'), '<a href="' . admin_url('edit.php?post_type=event&page=events-manager-options#emails:booking-emails') . '">' . esc_html__emp('Booking Email Templates', 'dbem') . '</a>');
     if (get_option('dbem_custom_emails_gateways')) {
         echo '<p>' . sprintf(__('You can also create default emails for specific gateways in your individual %s settings page.', 'em-pro'), '<a href="' . admin_url('edit.php?post_type=event&page=events-manager-gateways') . '">' . __('Gateway Settings', 'em-pro') . '</a>');
     }
     echo "<p>" . __('Click on the title texts with a plus (+) next to them to reveal further options, and the minus (-) sign to hide them.', 'em-pro') . "</p>";
     self::emails_editor($custom_email_values, array(), $custom_admin_emails);
 }