echo EALogic::get_option_value("trans.service"); ?> </label> <div class="col-sm-8"> <select name="service" data-c="service" class="filter form-control" data-currency> <?php $this->get_options("services"); ?> </select> </div> </div> <div class="step form-group"> <div class="block"></div> <label class="ea-label col-sm-4 control-label"> <?php echo EALogic::get_option_value("trans.worker"); ?> </label> <div class="col-sm-8"> <select name="worker" data-c="worker" class="filter form-control"> <?php $this->get_options("staff"); ?> </select> </div> </div> <div class="step calendar" class="filter"> <div class="block"></div> <div class="date"></div> </div> <div class="step" class="filter">
public function ajax_appointment() { $response = $this->parse_appointment(false); if ($response == false) { $this->send_err_json_result('err'); } if ($this->type != 'NEW' && $this->type != 'UPDATE') { $this->send_ok_json_result($response); } if (isset($this->data['_mail'])) { EALogic::send_status_change_mail($response->id); } $this->send_ok_json_result($response); }
/** * Content of top menu page */ public function top_settings_menu() { $settings = EALogic::get_options(); wp_localize_script('ea-settings', 'ea_settings', $settings); $screen = get_current_screen(); $screen->add_help_tab(array('id' => 'easyapp_settings_help', 'title' => 'Settings', 'content' => '<p>You need to define at least one location, worker and service! Without that widget wont work.</p>')); $screen->set_help_sidebar('<a href="http://nikolaloncar.com/easy-appointments-wordpress-plugin/easy-appointments-documentation/">More info!</a>'); require_once EA_SRC_DIR . 'templates/admin.tpl.php'; require_once EA_SRC_DIR . 'templates/inlinedata.tpl.php'; }
<script> window.eaData = {}; var ea = window.eaData; ea.Locations = <?php echo EADBModels::get_pre_cache_json('ea_locations'); ?> ; ea.Services = <?php echo EADBModels::get_pre_cache_json('ea_services'); ?> ; ea.Workers = <?php echo EADBModels::get_pre_cache_json('ea_staff'); ?> ; ea.MetaFields = <?php echo EADBModels::get_pre_cache_json('ea_meta_fields', array('position' => 'ASC')); ?> ; ea.Status = <?php echo json_encode(EALogic::getStatus()); ?> </script>
/** * Sending mail with every status change */ public static function send_status_change_mail($app_id) { global $wpdb; $dbmodels = new EADBModels(); $table_name = 'ea_appointments'; $app = $dbmodels->get_row($table_name, $app_id); $app_array = $dbmodels->get_appintment_by_id($app_id); $params = array(); foreach ($app_array as $key => $value) { $params["#{$key}#"] = $value; } $body_template = EALogic::get_option_value('mail.' . $app->status, 'mail'); $body = str_replace(array_keys($params), array_values($params), $body_template); if (array_key_exists('email', $app_array)) { $headers = array('Content-Type: text/html; charset=UTF-8'); wp_mail($app_array['email'], 'Reservation #' . $app_id, $body, $headers); } }
/** * Bootstrap */ public function ea_bootstrap($attrs) { $settings = EALogic::get_options(); $settings['width'] = $this->defaultSettings($attrs, 'width', '400px'); $settings['scroll_off'] = $this->defaultSettings($attrs, 'scroll_off', false); $settings['layout_cols'] = $this->defaultSettings($attrs, 'layout_cols', '1'); $settings['trans.please-select-new-date'] = __('Please select another day', 'easy-appointments'); $settings['trans.personal-informations'] = __('Personal information', 'easy-appointments'); $settings['trans.field-required'] = __('This field is required.', 'easy-appointments'); $settings['trans.error-email'] = __('Please enter a valid email address', 'easy-appointments'); $settings['trans.error-name'] = __('Please enter at least 3 characters.', 'easy-appointments'); $settings['trans.error-phone'] = __('Please enter at least 3 digits.', 'easy-appointments'); $settings['trans.fields'] = __('Fields with * are required', 'easy-appointments'); $settings['trans.email'] = __('Email', 'easy-appointments'); $settings['trans.name'] = __('Name', 'easy-appointments'); $settings['trans.phone'] = __('Phone', 'easy-appointments'); $settings['trans.comment'] = __('Comment', 'easy-appointments'); $settings['trans.overview-message'] = __('Please check your appointment details below and confirm:', 'easy-appointments'); $settings['trans.booking-overview'] = __('Booking overview', 'easy-appointments'); $settings['trans.date-time'] = __('Date & time', 'easy-appointments'); $settings['trans.submit'] = __('Submit', 'easy-appointments'); $settings['trans.cancel'] = __('Cancel', 'easy-appointments'); $settings['trans.price'] = __('Price', 'easy-appointments'); $settings['trans.iagree'] = __('I agree with terms and conditions', 'easy-appointments'); $settings['trans.field-iagree'] = __('You must agree with terms and conditions', 'easy-appointments'); $customCss = $settings['custom.css']; $customCss = strip_tags($customCss); $customCss = str_replace(array('<?php', '?>'), array('', ''), $customCss); unset($settings['custom.css']); $dbmod = new EADBModels(); $rows = $dbmod->get_all_rows("ea_meta_fields", array(), array('position' => 'ASC')); $settings['MetaFields'] = $rows; wp_localize_script('ea-front-bootstrap', 'ea_settings', $settings); wp_enqueue_script('underscore'); wp_enqueue_script('ea-validator'); wp_enqueue_script('ea-bootstrap'); // wp_enqueue_script( 'ea-datepicker-localization' ); // wp_enqueue_script( 'ea-bootstrap-select' ); wp_enqueue_script('ea-front-bootstrap'); if (empty($settings['css.off'])) { wp_enqueue_style('ea-bootstrap'); // wp_enqueue_style( 'ea-bootstrap-select' ); // wp_enqueue_style( 'ea-frontend-style' ); wp_enqueue_style('ea-admin-awesome-css'); wp_enqueue_style('ea-frontend-bootstrap'); } ob_start(); echo "<style type='text/css'>{$customCss}</style>"; require EA_SRC_DIR . 'templates/ea_bootstrap.tpl.php'; require EA_SRC_DIR . 'templates/booking.overview.tpl.php'; ?> <div class="ea-bootstrap bootstrap" /><?php return ob_get_clean(); }
/** * Send email notification for admin */ public static function send_notification($data) { $emails = self::get_option_value('pending.email', ''); if ($emails == '') { return; } $dbmodels = new EADBModels(); $app_id = $data['id']; $data = $dbmodels->get_appintment_by_id($app_id); $meta = $dbmodels->get_all_rows('ea_meta_fields', array(), array('position' => 'ASC')); $params = array(); $time_format = get_option('time_format'); $date_format = get_option('date_format'); foreach ($data as $key => $value) { if ($key == 'start' || $key == 'end') { $value = date($time_format, strtotime("{$data['date']} {$value}")); } if ($key == 'date') { $value = date($date_format, strtotime("{$value} {$data['start']}")); } $params["#{$key}#"] = $value; $data[$key] = $value; } $subject_template = EALogic::get_option_value('pending.subject.email', 'Notification : #id#'); $send_from = EALogic::get_option_value('send.from.email', ''); $subject = str_replace(array_keys($params), array_values($params), $subject_template); ob_start(); require EA_SRC_DIR . 'templates/mail.notification.tpl.php'; $mail_content = ob_get_clean(); $headers = array('Content-Type: text/html; charset=UTF-8'); if (!empty($send_from)) { $headers[] = 'From: ' . $send_from; } wp_mail($emails, $subject, $mail_content, $headers); }
public function generateFormSettings() { $settings = EALogic::get_options(); wp_localize_script('ea-settings', 'ea_settings', $settings); $screen = get_current_screen(); require_once EA_SRC_DIR . 'templates/admin.tpl.php'; require_once EA_SRC_DIR . 'templates/inlinedata.tpl.php'; }