-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathsms_settings_rb.php
More file actions
129 lines (109 loc) · 4.97 KB
/
sms_settings_rb.php
File metadata and controls
129 lines (109 loc) · 4.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
<?php
use Robokassa\Payment\RoboDataBase;
if (!\current_user_can('activate_plugins')) {
echo '<br /><br />
<div class="error notice">
<p>У Вас не хватает прав на настройку компонента</p>
</div>
';
return;
}
\wp_enqueue_script(
'robokassa_payment_admin_sms_settings',
\plugin_dir_url(__FILE__) . 'assets/js/admin-sms-settings.js'
);
\wp_enqueue_style(
'robokassa_payment_admin_style_menu',
\plugin_dir_url(__FILE__) . 'assets/css/admin-style.css'
);
?>
<div class="robokassa-admin-wrapper">
<div class="robokassa-admin-container">
<div class="robokassa-card sms-settings">
<h2 class="robokassa-card__title">Настройки SMS</h2>
<p class="robokassa-card__description">Управляйте текстами и условиями отправки SMS-сообщений для
покупателей вашего магазина.</p>
<div class="robokassa-warning">
<p>В теле сообщения доступны следующие метки:</p>
<ul class="robokassa-help-list">
<li><code class="robokassa-code">{address}</code> — адрес доставки заказа.</li>
<li><code class="robokassa-code">{fio}</code> — ФИО покупателя.</li>
<li><code class="robokassa-code">{order_number}</code> — номер заказа.</li>
</ul>
</div>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
<table class="robokassa-form-table form-table">
<tr valign="top">
<th scope="row">Транслитерация SMS сообщений</th>
<td>
<input type="checkbox" id="sms_translit"
name="robokassa_payment_sms_translit" <?php echo get_option('robokassa_payment_sms_translit') == 'on' ? 'checked="checked"' : ''; ?>
onchange="robokassa_payment_refresher();"><label for="sms_translit">Включить/Выключить</label>
</td>
</tr>
<tr valign="top">
<th scope="row">Уведомление об успешной оплате</th>
<td>
<input type="checkbox" id="sms1_enabled"
name="robokassa_payment_sms1_enabled" <?php echo get_option('robokassa_payment_sms1_enabled') == 'on' ? 'checked="checked"' : ''; ?>
onchange="robokassa_payment_refresher();"><label for="sms1_enabled">Включить/Выключить</label>
</td>
</tr>
<tr valign="top">
<th scope="row">Текст сообщения при успешной оплате</th>
<td>
<textarea name="robokassa_payment_sms1_text" id="sms1_text" class="custom-settings"
onkeyup="robokassa_payment_refresher();"><?php echo get_option('robokassa_payment_sms1_text'); ?></textarea>
<p class="description" id="sms1_translit"></p>
<p class="description float">
<span id="counterX1" class="text"></span>
написано, <span id="counterY1"></span> осталось (<span id="counterZ1"></span> смс )
</p>
</td>
</tr>
<tr valign="top">
<th scope="row">Уведомление о завершении заказа</th>
<td>
<input type="checkbox" id="sms2_enabled"
name="robokassa_payment_sms2_enabled" <?php echo get_option('robokassa_payment_sms2_enabled') == 'on' ? 'checked="checked"' : ''; ?>
onchange="robokassa_payment_refresher();"><label for="sms2_enabled">Включить/Выключить</label>
</td>
</tr>
<tr valign="top">
<th scope="row">Текст сообщения при завершении заказа</th>
<td>
<textarea name="robokassa_payment_sms2_text" id="sms2_text" class="custom-settings"
onkeyup="robokassa_payment_refresher();"><?php echo get_option('robokassa_payment_sms2_text'); ?></textarea>
<p class="description" id="sms2_translit"></p>
<p class="description float">
<span id="counterX2" class="text"></span>
написано, <span id="counterY2"></span> осталось (<span id="counterZ2"></span> смс )
</p>
</td>
</tr>
</table>
<input type="hidden" name="action" value="update"/>
<input type="hidden" name="page_options"
value="robokassa_payment_sms_translit,robokassa_payment_sms1_enabled,robokassa_payment_sms1_text,robokassa_payment_sms2_enabled,robokassa_payment_sms2_text"/>
<p class="submit">
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>"/>
</p>
</form>
</div>
</div>
</div>
<?php
global $wpdb;
$dataBase = new RoboDataBase($wpdb);
$table_name = $wpdb->prefix . 'woocommerce_order_items';
$sql = "SELECT order_id FROM {$table_name} ORDER BY order_item_id DESC LIMIT 1";
$next_order_number = (int)$dataBase->getVar($sql);
if ($next_order_number < 0) {
$next_order_number = 0;
}
\wp_add_inline_script(
'robokassa_payment_admin_sms_settings_next_order',
'var next_order = robokassa_payment_countDigits(' . ($next_order_number + 1) . ');'
);
?>