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
|
|
|
* Selector for the view link after publishing an event. |
38
|
|
|
* @var string |
39
|
|
|
*/ |
40
|
|
|
const EVENT_EDITOR_VIEW_LINK_AFTER_PUBLISH_SELECTOR = "//div[@id='message']/p/a"; |
41
|
|
|
|
42
|
|
|
|
43
|
|
|
/** |
44
|
|
|
* Selector for the ID of the event in the event editor |
45
|
|
|
* @var string |
46
|
|
|
*/ |
47
|
|
|
const EVENT_EDITOR_EVT_ID_SELECTOR = "//input[@id='post_ID']"; |
48
|
|
|
|
49
|
|
|
|
50
|
|
|
/** |
51
|
|
|
* Selector for the search input on the event list table page. |
52
|
|
|
* @var string |
53
|
|
|
*/ |
54
|
|
|
const EVENT_LIST_TABLE_SEARCH_INPUT_SELECTOR = '#toplevel_page_espresso_events-search-input'; |
55
|
|
|
|
56
|
|
|
|
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* @param string $additional_params |
60
|
|
|
* @return string |
61
|
|
|
*/ |
62
|
|
|
public static function defaultEventsListTableUrl($additional_params = '') |
63
|
|
|
{ |
64
|
|
|
return self::adminUrl('espresso_events', 'default', $additional_params); |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* The selector for the DTTname field for the given row in the event editor. |
70
|
|
|
* @param int $row_number |
71
|
|
|
* @return string |
72
|
|
|
*/ |
73
|
|
|
public static function eventEditorDatetimeNameFieldSelector($row_number = 1) |
74
|
|
|
{ |
75
|
|
|
return self::eventEditorDatetimeFieldSelectorForField('DTT_name', $row_number); |
76
|
|
|
} |
77
|
|
|
|
78
|
|
|
|
79
|
|
|
/** |
80
|
|
|
* The selector for the DTT_EVT_start field for the given row in the event editor.d |
81
|
|
|
* @param int $row_number |
82
|
|
|
* @return string |
83
|
|
|
*/ |
84
|
|
|
public static function eventEditorDatetimeStartDateFieldSelector($row_number = 1) |
85
|
|
|
{ |
86
|
|
|
return self::eventEditorDatetimeFieldSelectorForField('DTT_EVT_start', $row_number); |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
|
90
|
|
|
/** |
91
|
|
|
* Wrapper for getting the selector for a given field and given row of a datetime in the event editor. |
92
|
|
|
* |
93
|
|
|
* @param string $field_name |
94
|
|
|
* @param int $row_number |
95
|
|
|
* @return string |
96
|
|
|
*/ |
97
|
|
|
public static function eventEditorDatetimeFieldSelectorForField($field_name, $row_number = 1) |
98
|
|
|
{ |
99
|
|
|
return "//input[@id='event-datetime-$field_name-$row_number']"; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* The selector for the TKT_name field for the given display row in the event editor. |
105
|
|
|
* @param int $row_number |
106
|
|
|
* @return string |
107
|
|
|
*/ |
108
|
|
|
public static function eventEditorTicketNameFieldSelector($row_number = 1) |
109
|
|
|
{ |
110
|
|
|
return self::eventEditorTicketFieldSelectorForFieldInDisplayRow('TKT_name', $row_number); |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* Wrapper for getting the selector for a given field and given display row of a ticket in the event editor. |
116
|
|
|
* @param $field_name |
117
|
|
|
* @param int $row_number |
118
|
|
|
* @return string |
119
|
|
|
*/ |
120
|
|
|
public static function eventEditorTicketFieldSelectorForFieldInDisplayRow($field_name, $row_number = 1) |
121
|
|
|
{ |
122
|
|
|
return "//tr[@id='display-ticketrow-$row_number']/td[2]/input[@class='edit-ticket-$field_name ee-large-text-inp']"; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
|
126
|
|
|
/** |
127
|
|
|
* Returns the selector for the event title edit link in the events list table for the given Event Title. |
128
|
|
|
* @param string $event_title |
129
|
|
|
* @return string |
130
|
|
|
*/ |
131
|
|
|
public static function eventListTableEventTitleEditLinkSelectorForTitle($event_title) |
132
|
|
|
{ |
133
|
|
|
return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']"; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
|
137
|
|
|
public static function eventListTableEventIdSelectorForTitle($event_title) |
138
|
|
|
{ |
139
|
|
|
return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
140
|
|
|
. "//ancestor::tr/th[contains(@class, 'check-column')]/input"; |
141
|
|
|
} |
142
|
|
|
|
143
|
|
|
|
144
|
|
|
public static function eventListTableEventTitleViewLinkSelectorForTitle($event_title) |
145
|
|
|
{ |
146
|
|
|
return "//td[contains(@class, 'column-name')]/strong/a[text()='$event_title']" |
147
|
|
|
. "//ancestor::td//span[@class='view']/a"; |
148
|
|
|
} |
149
|
|
|
} |