1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Page; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
/** |
7
|
|
|
* EventsAdmin |
8
|
|
|
* Selectors/references for elements in the Events Admin pages |
9
|
|
|
* |
10
|
|
|
* @package Page |
11
|
|
|
* @author Darren Ethier |
12
|
|
|
* @since 1.0.0 |
13
|
|
|
*/ |
14
|
|
|
class EventsAdmin extends CoreAdmin |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Selector for the Add new Event button in the admin. |
19
|
|
|
* @var string |
20
|
|
|
*/ |
21
|
|
|
const ADD_NEW_EVENT_BUTTON_SELECTOR = '#add-new-event'; |
22
|
|
|
|
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Selector for the Event Title field in the event editor |
26
|
|
|
* @var string |
27
|
|
|
*/ |
28
|
|
|
const EVENT_EDITOR_TITLE_FIELD_SELECTOR = "//input[@id='title']"; |
29
|
|
|
|
30
|
|
|
/** |
31
|
|
|
* Selector for the publish submit button in the event editor. |
32
|
|
|
* @var string |
33
|
|
|
*/ |
34
|
|
|
const EVENT_EDITOR_PUBLISH_BUTTON_SELECTOR = "#publish"; |
35
|
|
|
|
36
|
|
|
|
37
|
|
|
/** |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
const EVENT_EDITOR_DEFAULT_REGISTRATION_STATUS_FIELD_SELECTOR = '#EVT_default_registration_status'; |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Selector for the view link after publishing an event. |
44
|
|
|
* @var string |
45
|
|
|
*/ |
46
|
|
|
const EVENT_EDITOR_VIEW_LINK_AFTER_PUBLISH_SELECTOR = "//div[@id='message']/p/a"; |
47
|
|
|
|
48
|
|
|
|
49
|
|
|
/** |
50
|
|
|
* Selector for the ID of the event in the event editor |
51
|
|
|
* @var string |
52
|
|
|
*/ |
53
|
|
|
const EVENT_EDITOR_EVT_ID_SELECTOR = "//input[@id='post_ID']"; |
54
|
|
|
|
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* Selector for the search input on the event list table page. |
58
|
|
|
* @var string |
59
|
|
|
*/ |
60
|
|
|
const EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR = '#toplevel_page_espresso_events-search-input'; |
61
|
|
|
|
62
|
|
|
|
63
|
|
|
|
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* @param string $additional_params |
67
|
|
|
* @return string |
68
|
|
|
*/ |
69
|
|
|
public static function defaultEventsListTableUrl($additional_params = '') |
70
|
|
|
{ |
71
|
|
|
return self::adminUrl('espresso_events', 'default', $additional_params); |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
|
75
|
|
|
/** |
76
|
|
|
* The selector for the DTTname field for the given row in the event editor. |
77
|
|
|
* @param int $row_number |
78
|
|
|
* @return string |
79
|
|
|
*/ |
80
|
|
|
public static function eventEditorDatetimeNameFieldSelector($row_number = 1) |
81
|
|
|
{ |
82
|
|
|
return self::eventEditorDatetimeFieldSelectorForField('DTT_name', $row_number); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* The selector for the DTT_EVT_start field for the given row in the event editor.d |
88
|
|
|
* @param int $row_number |
89
|
|
|
* @return string |
90
|
|
|
*/ |
91
|
|
|
public static function eventEditorDatetimeStartDateFieldSelector($row_number = 1) |
92
|
|
|
{ |
93
|
|
|
return self::eventEditorDatetimeFieldSelectorForField('DTT_EVT_start', $row_number); |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
|
97
|
|
|
/** |
98
|
|
|
* Wrapper for getting the selector for a given field and given row of a datetime in the event editor. |
99
|
|
|
* |
100
|
|
|
* @param string $field_name |
101
|
|
|
* @param int $row_number |
102
|
|
|
* @return string |
103
|
|
|
*/ |
104
|
|
|
public static function eventEditorDatetimeFieldSelectorForField($field_name, $row_number = 1) |
105
|
|
|
{ |
106
|
|
|
return "//input[@id='event-datetime-$field_name-$row_number']"; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* The selector for the TKT_name field for the given display row in the event editor. |
112
|
|
|
* @param int $row_number |
113
|
|
|
* @return string |
114
|
|
|
*/ |
115
|
|
|
public static function eventEditorTicketNameFieldSelector($row_number = 1) |
116
|
|
|
{ |
117
|
|
|
return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_name', $row_number); |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
|
121
|
|
|
public static function eventEditorTicketPriceFieldSelector($row_number = 1) |
122
|
|
|
{ |
123
|
|
|
return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_base_price', $row_number); |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
|
127
|
|
|
public static function eventEditorTicketAdvancedDetailsSelector($row_number = 1) |
128
|
|
|
{ |
129
|
|
|
return "//tr[@id='display-ticketrow-$row_number']//span[contains(@class, 'gear-icon')]"; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
|
133
|
|
|
public static function eventEditorTicketAdvancedDetailsSubtotalSelector($row_number = 1) |
134
|
|
|
{ |
135
|
|
|
return "//span[@id='price-total-amount-$row_number']"; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
|
139
|
|
|
public static function eventEditorTicketAdvancedDetailsTotalSelector($row_number = 1) |
140
|
|
|
{ |
141
|
|
|
return "//span[@id='price-total-amount-$row_number']"; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
|
145
|
|
|
public static function eventEditorTicketTaxableCheckboxSelector($row_number = 1) |
146
|
|
|
{ |
147
|
|
|
return "//input[@id='edit-ticket-TKT_taxable-$row_number']"; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
|
151
|
|
|
/** |
152
|
|
|
* This returns the xpath locater for the Tax amount display container within the advanced settings view for the |
153
|
|
|
* given ticket (row) and the given tax id (PRC_ID). |
154
|
|
|
* |
155
|
|
|
* @param int $tax_id The PRC_ID for the tax you want the locater for. Note, this defaults to the default tax |
156
|
|
|
* setup on a fresh install. |
157
|
|
|
* @param int $row_number What row representing the ticket you want the locator for. |
158
|
|
|
* @return string |
159
|
|
|
*/ |
160
|
|
|
public static function eventEditorTicketTaxAmountDisplayForTaxIdAndTicketRowSelector($tax_id = 2, $row_number = 1) |
161
|
|
|
{ |
162
|
|
|
return "//span[@id='TKT-tax-amount-display-$tax_id-$row_number']"; |
163
|
|
|
} |
164
|
|
|
|
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Wrapper for getting the selector for a given field and given display row of a ticket in the event editor. |
168
|
|
|
* @param $field_name |
169
|
|
|
* @param int $row_number |
170
|
|
|
* @return string |
171
|
|
|
*/ |
172
|
|
|
public static function eventEditorTicketFieldSelectorForFieldInDisplayRow($field_name, $row_number = 1) |
173
|
|
|
{ |
174
|
|
|
return "//tr[@id='display-ticketrow-$row_number']//input[contains(@class, 'edit-ticket-$field_name')]"; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
|
178
|
|
|
/** |
179
|
|
|
* Returns the selector for the event title edit link in the events list table for the given Event Title. |
180
|
|
|
* @param string $event_title |
181
|
|
|
* @return string |
182
|
|
|
*/ |
183
|
|
|
public static function eventListTableEventTitleEditLinkSelectorForTitle($event_title) |
184
|
|
|
{ |
185
|
|
|
return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']"; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
|
189
|
|
|
/** |
190
|
|
|
* Locator for for the ID column in the event list table for a given event title. |
191
|
|
|
* @param string $event_title |
192
|
|
|
* @return string |
193
|
|
|
*/ |
194
|
|
|
public static function eventListTableEventIdSelectorForTitle($event_title) |
195
|
|
|
{ |
196
|
|
|
return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
197
|
|
|
. "//ancestor::tr/th[contains(@class, 'check-column')]/input"; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
|
201
|
|
|
/** |
202
|
|
|
* Locator for the view link in the row of an event list table for the given event title. |
203
|
|
|
* @param string $event_title |
204
|
|
|
* @return string |
205
|
|
|
*/ |
206
|
|
|
public static function eventListTableEventTitleViewLinkSelectorForTitle($event_title) |
207
|
|
|
{ |
208
|
|
|
return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
209
|
|
|
. "//ancestor::td//span[@class='view']/a"; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
|
213
|
|
|
/** |
214
|
|
|
* Locator for the messenger tab in the Notifications metabox in the event editor. |
215
|
|
|
* @param string $messenger_slug The slug for the messenger (it's reference slug). |
216
|
|
|
* @return string |
217
|
|
|
*/ |
218
|
|
|
public static function eventEditorNotificationsMetaBoxMessengerTabSelector($messenger_slug) |
219
|
|
|
{ |
220
|
|
|
return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
221
|
|
|
. "//a[@rel='ee-tab-$messenger_slug']"; |
222
|
|
|
} |
223
|
|
|
|
224
|
|
|
|
225
|
|
|
/** |
226
|
|
|
* Locator for the select input within the notifications metabox. |
227
|
|
|
* Note, this assumes the tab content for the related messenger is already visible. |
228
|
|
|
* @param string $message_type_label The message type label (visible string in the table) you want the selector for. |
229
|
|
|
* @return string |
230
|
|
|
*/ |
231
|
|
|
public static function eventEditorNotificationsMetaBoxSelectSelectorForMessageType($message_type_label) |
232
|
|
|
{ |
233
|
|
|
return "//div[@id='espresso_events_Messages_Hooks_Extend_messages_metabox_metabox']" |
234
|
|
|
. "//table[@class='messages-custom-template-switcher']" |
235
|
|
|
. "//tr/td[contains(.,'Registration Approved')]" |
236
|
|
|
. "//ancestor::tr//select[contains(@class,'message-template-selector')]"; |
237
|
|
|
} |
238
|
|
|
} |
239
|
|
|
|