function syn_restaurant_manager_get_meal_options() { global $syn_restaurant_config; $session = new \syntaxthemes\restaurant\session(); $menu_id = $session->post_var('menu_id'); $course_id = $session->post_var('course_id'); $relation = empty($menu_id) || empty($course_id) ? 'OR' : 'AND'; if (!empty($menu_id) || !empty($course_id)) { $args = array('post_type' => 'syn_rest_meal', 'post_status' => 'publish', 'posts_per_page' => -1, 'tax_query' => array('relation' => $relation, array('taxonomy' => 'syn_rest_menu', 'field' => 'id', 'terms' => $menu_id), array('taxonomy' => 'syn_rest_course', 'field' => 'id', 'terms' => $course_id))); } else { $args = array('post_type' => 'syn_rest_meal', 'post_status' => 'publish', 'posts_per_page' => -1); } $query = new \WP_Query($args); $html = ''; if ($query->have_posts()) { while ($query->have_posts()) { $query->the_post(); global $post; $post_id = get_the_ID(); $currency_symbol = get_option($syn_restaurant_config->plugin_prefix . 'currency_symbol', '£'); $full_price = get_post_meta($post_id, 'full_price', true); $html .= "<li><input type=\"checkbox\" name=\"syn_restaurant_menu_ids\" value=\"{$post->ID}\"> <label><span class=\"meal-title\">{$post->post_title}</span><span class=\"meal-price\">{$currency_symbol}{$full_price}</span></label></li>"; } } $xml_response = new WP_Ajax_Response(); $response = array('id' => 1, 'what' => 'syn_restaurant_menu_ids', 'action' => 'update_meal_items', 'data' => $html); $xml_response->add($response); $xml_response->send(); die; }
/** * The notifications form variable processing. * @global type $syn_restaurant_config * @return type */ function syn_restaurant_manager_process_notifications_settings_form() { global $syn_restaurant_config; $session = new \syntaxthemes\restaurant\session(); if ('POST' !== strtoupper($session->server_var('REQUEST_METHOD'))) { return; } if ('save_notification_settings' !== $session->post_var('form_action')) { return; } $nonce = $session->post_var('_wpnonce'); if (!wp_verify_nonce($nonce, 'save_notification_settings')) { return; } $reply_to_name = $session->post_var('reply_to_name'); $reply_to_email = $session->post_var('reply_to_email'); $admin_email_subject = $session->post_var('admin_email_subject'); $admin_email = wpautop($_POST['admin_email']); $reservation_email_subject = $session->post_var('reservation_email_subject'); $reservation_email = wpautop($_POST['reservation_email']); $reservation_confirmed_email_subject = $session->post_var('reservation_confirmed_email_subject'); $reservation_confirmed_email = wpautop($_POST['reservation_confirmed_email']); $reservation_rejected_email_subject = $session->post_var('reservation_rejected_email_subject'); $reservation_rejected_email = wpautop($_POST['reservation_rejected_email']); update_option($syn_restaurant_config->plugin_prefix . 'reply_to_name', $reply_to_name); update_option($syn_restaurant_config->plugin_prefix . 'reply_to_email', $reply_to_email); update_option($syn_restaurant_config->plugin_prefix . 'admin_email_subject', $admin_email_subject); update_option($syn_restaurant_config->plugin_prefix . 'admin_email', $admin_email); update_option($syn_restaurant_config->plugin_prefix . 'reservation_email_subject', $reservation_email_subject); update_option($syn_restaurant_config->plugin_prefix . 'reservation_email', $reservation_email); update_option($syn_restaurant_config->plugin_prefix . 'reservation_confirmed_email_subject', $reservation_confirmed_email_subject); update_option($syn_restaurant_config->plugin_prefix . 'reservation_confirmed_email', $reservation_confirmed_email); update_option($syn_restaurant_config->plugin_prefix . 'reservation_rejected_email_subject', $reservation_rejected_email_subject); update_option($syn_restaurant_config->plugin_prefix . 'reservation_rejected_email', $reservation_rejected_email); echo '<div class="updated"><p>' . __('Your notifications settings have been successfully updated.', 'syn_restaurant_plugin') . '</p></div>'; }
/** * The notifications settings page. * @global type $syn_restaurant_config */ function syn_restaurant_manager_notifications_page() { global $syn_restaurant_config; do_action('syn_restaurant_manager_process_form'); $session = new syntaxthemes\restaurant\session(); $reply_to_name = get_option($syn_restaurant_config->plugin_prefix . 'reply_to_name', ''); $reply_to_email = get_option($syn_restaurant_config->plugin_prefix . 'reply_to_email', ''); $admin_email_subject = get_option($syn_restaurant_config->plugin_prefix . 'admin_email_subject', ''); $admin_email = get_option($syn_restaurant_config->plugin_prefix . 'admin_email', ''); $reservation_email_subject = get_option($syn_restaurant_config->plugin_prefix . 'reservation_email_subject', ''); $reservation_email = get_option($syn_restaurant_config->plugin_prefix . 'reservation_email', ''); $reservation_confirmed_email_subject = get_option($syn_restaurant_config->plugin_prefix . 'reservation_confirmed_email_subject', ''); $reservation_confirmed_email = get_option($syn_restaurant_config->plugin_prefix . 'reservation_confirmed_email', ''); $reservation_rejected_email_subject = get_option($syn_restaurant_config->plugin_prefix . 'reservation_rejected_email_subject', ''); $reservation_rejected_email = get_option($syn_restaurant_config->plugin_prefix . 'reservation_rejected_email', ''); ?> <h3><?php _e('Notification Settings', 'syn_restaurant_plugin'); ?> </h3> <form id="syn_restaurant_manager_notifications_form" action="<?php $session->current_page_url(true); ?> " method="POST"> <table class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Reply To Name', 'syn_restaurant_plugin'); ?> </th> <td> <input id="reply_to_name" class="regular-text" name="reply_to_name" type="text" placeholder="<?php bloginfo('name'); ?> " value="<?php echo $reply_to_name; ?> " /> <p class="description"><?php _e('Set the reply to email name.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> <tr> <th scope="row"><?php _e('Reply To Email', 'syn_restaurant_plugin'); ?> </th> <td> <input id="reply_to_email" class="regular-text" name="reply_to_email" type="text" placeholder="<?php bloginfo('admin_email'); ?> " value="<?php echo $reply_to_email; ?> " /> <p class="description"><?php _e('Set the reply to email address.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> </table> <h3><?php _e('Email Templates', 'syn_restaurant_plugin'); ?> </h3> <p> <?php _e('The following emails are automatically sent to your customers when the status of their reservation changes. You can change these templates to suit your own needs.', 'syn_restaurant_plugin'); ?> </p> <h4><?php _e('Template Tags', 'syn_restaurant_plugin'); ?> </h4> <p> <?php _e('Use the follwing template tags in your emails to automatically add your customer and their booking data to the emails. Tags labeled with an asterisk(*) can be used in the email subject.', 'syn_restaurant_plugin'); ?> </p> <ul id="email_template_tags_list"> <li class="template-tag-item"> <span class="tag-name">%first_name%</span> <span class="tag-description"><?php _e('* This is your customers first name.', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%last_name%</span> <span class="tag-description"><?php _e('* This is your customers last name.', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%telephone%</span> <span class="tag-description"><?php _e('The telephone number of the customer.', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%email_address%</span> <span class="tag-description"><?php _e('The email address of the customer.', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%guests_count%</span> <span class="tag-description"><?php _e('* The size of the party for the reservation.', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%reservation_date%</span> <span class="tag-description"><?php _e('* The reservation date of the customer booking .', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%reservation_time%</span> <span class="tag-description"><?php _e('* The reservation time of the customer booking .', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%message%</span> <span class="tag-description"><?php _e('The message left by the customer when creating the reservation.', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%site_name%</span> <span class="tag-description"><?php _e('The name of your restaurant set in the General Settings tab.', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%site_link%</span> <span class="tag-description"><?php _e('A link to your website.', 'syn_restaurant_plugin'); ?> </span> </li> <li class="template-tag-item"> <span class="tag-name">%current_time%</span> <span class="tag-description"><?php _e('This is the current date and time. Used for audit purposes.', 'syn_restaurant_plugin'); ?> </span> </li> </ul> <table class="form-table"> <tr> <th scope="row"><?php _e('Administrator Email Subject', 'syn_restaurant_plugin'); ?> </th> <td> <input id="admin_email_subject" class="regular-text" name="admin_email_subject" type="text" placeholder="<?php _e('You have a booking request', 'syn_restaurant_plugin'); ?> " value="<?php echo $admin_email_subject; ?> " /> <p class="description"><?php _e('Set the administrator email subject.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> <tr> <th scope="row"><?php _e('Administrator Email', 'syn_restaurant_plugin'); ?> </th> <td> <?php $admin_email_settings = array('textarea_name' => 'admin_email', 'textarea_rows' => 10, 'media_buttons' => false, 'teeny' => true, 'wpautop' => true); wp_editor($admin_email, 'admin_email', $admin_email_settings); ?> <p class="description"><?php _e('Create the email which your administrator will receive.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> <tr> <th scope="row"><?php _e('New Reservation Email Subject', 'syn_restaurant_plugin'); ?> </th> <td> <input id="new_reservation_email_subject" class="regular-text" name="reservation_email_subject" type="text" placeholder="<?php _e('You have a booking request', 'syn_restaurant_plugin'); ?> " value="<?php echo $reservation_email_subject; ?> " /> <p class="description"><?php _e('Set the new reservation email subject.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> <tr> <th scope="row"><?php _e('New Reservation Email', 'syn_restaurant_plugin'); ?> </th> <td> <?php $reservation_email_settings = array('textarea_name' => 'reservation_email', 'textarea_rows' => 10, 'media_buttons' => false, 'teeny' => true, 'wpautop' => true); wp_editor($reservation_email, 'new_reservation_email', $reservation_email_settings); ?> <p class="description"><?php _e('Create the email which your customer will receive.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> <tr> <th scope="row"><?php _e('Reservation Confirmed Email Subject', 'syn_restaurant_plugin'); ?> </th> <td> <input id="reservation_confirmed_email_subject" class="regular-text" name="reservation_confirmed_email_subject" type="text" placeholder="<?php _e('Your reservation request has been confirmed', 'syn_restaurant_plugin'); ?> " value="<?php echo $reservation_confirmed_email_subject; ?> " /> <p class="description"><?php _e('Set the new reservation email subject.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> <tr> <th scope="row"><?php _e('Reservation Confirmed Email', 'syn_restaurant_plugin'); ?> </th> <td> <?php $reservation_confirmed_email_settings = array('textarea_name' => 'reservation_confirmed_email', 'textarea_rows' => 10, 'media_buttons' => false, 'teeny' => true, 'wpautop' => true); wp_editor($reservation_confirmed_email, 'reservation_confirmed_email', $reservation_confirmed_email_settings); ?> <p class="description"><?php _e('Create the email which your customer will receive.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> <tr> <th scope="row"><?php _e('Reservation Rejected Email Subject', 'syn_restaurant_plugin'); ?> </th> <td> <input id="reservation_rejected_email_subject" class="regular-text" name="reservation_rejected_email_subject" type="text" placeholder="<?php _e('Unfortunately we cannot make your reservation', 'syn_restaurant_plugin'); ?> " value="<?php echo $reservation_rejected_email_subject; ?> " /> <p class="description"><?php _e('Set the email subject for reservation rejections.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> <tr> <th scope="row"><?php _e('Reservation Rejected Email', 'syn_restaurant_plugin'); ?> </th> <td> <?php $reservation_rejected_email_settings = array('textarea_name' => 'reservation_rejected_email', 'textarea_rows' => 10, 'media_buttons' => false, 'teeny' => true, 'wpautop' => true); wp_editor($reservation_rejected_email, 'reservation_rejected_email', $reservation_rejected_email_settings); ?> <p class="description"><?php _e('Create the email which your customer will receive.', 'syn_restaurant_plugin'); ?> </p> </td> </tr> </tbody> </table> <p class="submit"> <?php wp_nonce_field('save_notification_settings'); ?> <input type="hidden" name="form_action" value="save_notification_settings"> <input type="submit" name="submit" id="submit" class="button button-primary" value="<?php _e('Save Changes', 'syn_restaurant_plugin'); ?> "> </p> </form> <?php }