PluginProbe ʕ •ᴥ•ʔ
LatePoint – Calendar Booking Plugin for Appointments and Events / 5.1.8
LatePoint – Calendar Booking Plugin for Appointments and Events v5.1.8
5.6.7 5.6.6 5.6.5 5.6.4 5.6.3 5.6.2 5.6.1 5.6.0 5.5.2 5.5.1 5.5.0 5.4.2 trunk 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.1.8 5.1.9 5.1.91 5.1.92 5.1.93 5.1.94 5.2.0 5.2.1 5.2.10 5.2.11 5.2.2 5.2.3 5.2.4 5.2.5 5.2.6 5.2.7 5.2.8 5.2.9 5.3.0 5.3.1 5.3.2 5.4.0 5.4.1
latepoint / lib / controllers / manage_order_by_key_controller.php
latepoint / lib / controllers Last commit date
activities_controller.php 1 year ago auth_controller.php 1 year ago booking_form_settings_controller.php 1 year ago bookings_controller.php 1 year ago calendars_controller.php 1 year ago carts_controller.php 1 year ago controller.php 1 year ago customer_cabinet_controller.php 1 year ago customers_controller.php 1 year ago dashboard_controller.php 1 year ago default_agent_controller.php 1 year ago events_controller.php 1 year ago form_fields_controller.php 1 year ago integrations_controller.php 1 year ago invoices_controller.php 1 year ago manage_booking_by_key_controller.php 1 year ago manage_order_by_key_controller.php 1 year ago notifications_controller.php 1 year ago orders_controller.php 1 year ago pro_controller.php 1 year ago process_jobs_controller.php 1 year ago processes_controller.php 1 year ago search_controller.php 1 year ago services_controller.php 1 year ago settings_controller.php 1 year ago steps_controller.php 1 year ago stripe_connect_controller.php 1 year ago support_topics_controller.php 1 year ago todos_controller.php 1 year ago transactions_controller.php 1 year ago wizard_controller.php 1 year ago
manage_order_by_key_controller.php
104 lines
1 <?php
2 /*
3 * Copyright (c) 2023 LatePoint LLC. All rights reserved.
4 */
5
6 if ( ! defined( 'ABSPATH' ) ) {
7 exit; // Exit if accessed directly.
8 }
9
10
11 if ( ! class_exists( 'OsManageOrderByKeyController' ) ) :
12
13
14 class OsManageOrderByKeyController extends OsController {
15 private $order;
16 private $key_for;
17 private $key = '';
18
19 private function set_order_by_key() {
20 if ( empty( $this->params['key'] ) ) {
21 return;
22 }
23 $key = sanitize_text_field( $this->params['key'] );
24 $data = OsOrdersHelper::get_order_id_and_manage_ability_by_key( $key );
25 if ( empty( $data ) ) {
26 return;
27 }
28 $order = new OsOrderModel( $data['order_id'] );
29 if ( $order->id ) {
30 $this->key = $key;
31 $this->order = $order;
32 $this->key_for = $data['for'];
33 }
34 }
35
36 function __construct() {
37 parent::__construct();
38 $this->views_folder = LATEPOINT_VIEWS_ABSPATH . 'manage_order_by_key/';
39
40 $this->action_access['public'] = array_merge( $this->action_access['public'], [
41 'show',
42 'print_order_info',
43 'list_payments'
44 ] );
45
46 $this->set_order_by_key();
47
48 }
49
50 function list_payments(){
51 if ( empty( $this->order->id ) ) {
52 return;
53 }
54
55 $transactions = $this->order->get_transactions();
56
57 $this->vars['order'] = $this->order;
58 $this->vars['transactions'] = $transactions;
59
60 $this->set_layout( 'clean' );
61 $this->format_render(__FUNCTION__);
62 }
63
64
65 function show() {
66 if ( empty( $this->order->id ) ) {
67 return;
68 }
69
70
71 $this->vars['key'] = $this->key;
72 $this->vars['for'] = $this->key_for;
73 $this->vars['order'] = $this->order;
74 $this->vars['viewer'] = $this->key_for == 'agent' ? 'agent' : 'customer';
75
76 $this->vars['timezone_name'] = $this->key_for == 'agent' ? OsTimeHelper::get_wp_timezone_name() : $this->order->customer->get_selected_timezone_name();
77
78 if ( $this->get_return_format() == 'json' ) {
79 $this->set_layout( 'none' );
80 $response_html = $this->format_render_return( __FUNCTION__ );
81 $this->send_json( array( 'status' => LATEPOINT_STATUS_SUCCESS, 'message' => $response_html ) );
82 } else {
83 $this->set_layout( 'clean' );
84 $content = $this->format_render_return( __FUNCTION__ );
85 echo $content;
86 }
87 }
88
89
90 function print_order_info() {
91 if ( empty( $this->order->id ) ) {
92 return;
93 }
94
95 $this->vars['order'] = $this->order;
96 $this->vars['customer'] = $this->order->customer;
97 $this->set_layout( 'print' );
98 $content = $this->format_render_return( __FUNCTION__, [], [], true );
99 echo $content;
100 }
101
102
103 }
104 endif;