Events Manager - Version 5.0b1

Version Description

For those upgrading from version 3 to 4, you must upgrade to version 3.0.98 manually and then to the latest version as usual. Please see this screencast for a walkthrough.

Download this release

Release Info

Developer netweblogic
Plugin Icon 128x128 Events Manager
Version 5.0b1
Comparing to
See all releases

Code changes from version 3.0.98 to 5.0b1

Files changed (210) hide show
  1. admin/bookings/em-cancelled.php +25 -21
  2. admin/bookings/em-confirmed.php +28 -24
  3. admin/bookings/em-events.php +10 -10
  4. admin/bookings/em-pending.php +37 -33
  5. admin/bookings/em-person.php +24 -22
  6. admin/bookings/em-rejected.php +26 -22
  7. admin/em-admin.php +104 -221
  8. admin/em-bookings.php +235 -101
  9. admin/em-categories.php +0 -177
  10. admin/em-docs.php +152 -88
  11. admin/em-event.php +0 -627
  12. admin/em-events.php +0 -242
  13. admin/em-help.php +25 -8
  14. admin/em-locations-search.php +7 -3
  15. admin/em-locations.php +0 -268
  16. admin/em-options.php +320 -103
  17. admin/em-people.php +0 -192
  18. buddypress/bp-em-activity.php +144 -0
  19. buddypress/bp-em-admin.php +65 -0
  20. buddypress/bp-em-core.php +239 -0
  21. buddypress/bp-em-groups.php +57 -0
  22. buddypress/bp-em-notifications.php +135 -0
  23. buddypress/bp-em-templatetags.php +7 -0
  24. buddypress/screens/attending.php +29 -0
  25. buddypress/screens/group-events.php +30 -0
  26. buddypress/screens/my-bookings.php +35 -0
  27. buddypress/screens/my-events.php +67 -0
  28. buddypress/screens/my-group-events.php +27 -0
  29. buddypress/screens/my-locations.php +70 -0
  30. buddypress/screens/profile.php +32 -0
  31. buddypress/screens/settings.php +56 -0
  32. classes/em-booking.php +352 -103
  33. classes/em-bookings.php +256 -157
  34. classes/em-calendar.php +86 -127
  35. classes/em-categories-taxonomy.php +75 -0
  36. classes/em-categories.php +222 -111
  37. classes/em-category.php +129 -96
  38. classes/em-event-post-admin.php +342 -0
  39. classes/em-event-post.php +116 -0
  40. classes/em-event-posts-admin.php +219 -0
  41. classes/em-event-recurring.php +422 -0
  42. classes/em-event.php +1220 -594
  43. classes/em-events.php +161 -40
  44. classes/em-location-post-admin.php +134 -0
  45. classes/em-location-post.php +23 -0
  46. classes/em-location-posts-admin.php +78 -0
  47. classes/em-location.php +437 -193
  48. classes/em-locations.php +105 -41
  49. classes/em-mailer.php +4 -1
  50. classes/em-map.php +0 -60
  51. classes/em-notices.php +196 -0
  52. classes/em-object.php +375 -41
  53. classes/em-people.php +19 -114
  54. classes/em-permalinks.php +199 -0
  55. classes/em-person.php +67 -130
  56. classes/em-recurrence.php +0 -89
  57. classes/em-ticket-booking.php +222 -0
  58. classes/em-ticket.php +337 -0
  59. classes/em-tickets-bookings.php +283 -0
  60. classes/em-tickets.php +241 -0
  61. classes/phpmailer/class.phpmailer.php +2393 -1426
  62. classes/phpmailer/class.smtp.php +721 -949
  63. classes/phpmailer/language/phpmailer.lang-ar.php +27 -0
  64. classes/phpmailer/language/phpmailer.lang-br.php +23 -18
  65. classes/phpmailer/language/phpmailer.lang-ca.php +22 -18
  66. classes/phpmailer/language/phpmailer.lang-ch.php +26 -0
  67. classes/phpmailer/language/phpmailer.lang-cz.php +21 -20
  68. classes/phpmailer/language/phpmailer.lang-de.php +22 -20
  69. classes/phpmailer/language/phpmailer.lang-dk.php +22 -20
  70. classes/phpmailer/language/phpmailer.lang-es.php +22 -19
  71. classes/phpmailer/language/phpmailer.lang-et.php +26 -0
  72. classes/phpmailer/language/phpmailer.lang-fi.php +23 -19
  73. classes/phpmailer/language/phpmailer.lang-fo.php +27 -25
  74. classes/phpmailer/language/phpmailer.lang-fr.php +22 -21
  75. classes/phpmailer/language/phpmailer.lang-hu.php +21 -19
  76. classes/phpmailer/language/phpmailer.lang-it.php +20 -21
  77. classes/phpmailer/language/phpmailer.lang-ja.php +22 -21
  78. classes/phpmailer/language/phpmailer.lang-nl.php +21 -19
  79. classes/phpmailer/language/phpmailer.lang-no.php +22 -20
  80. classes/phpmailer/language/phpmailer.lang-pl.php +21 -20
  81. classes/phpmailer/language/phpmailer.lang-ro.php +24 -20
  82. classes/phpmailer/language/phpmailer.lang-ru.php +25 -23
  83. classes/phpmailer/language/phpmailer.lang-se.php +22 -20
  84. classes/phpmailer/language/phpmailer.lang-tr.php +23 -21
  85. classes/phpmailer/language/phpmailer.lang-zh.php +26 -0
  86. classes/phpmailer/language/phpmailer.lang-zh_cn.php +26 -0
  87. em-actions.php +516 -0
  88. em-ajax.php +0 -101
  89. em-bookings.php +0 -163
  90. em-debug.php +46 -0
  91. em-events.php +162 -84
  92. em-functions.php +297 -89
  93. em-functions.php.bak +479 -0
  94. em-ical.php +33 -0
  95. em-install.php +486 -392
  96. em-posts.php +244 -0
  97. em-rss.php +0 -39
  98. em-shortcode.php +32 -7
  99. em-template-tags.php +155 -13
  100. em-upgrade.php +5 -0
  101. events-manager.php +431 -167
  102. includes/css/events_manager.css +109 -69
  103. includes/css/events_manager_admin.css +63 -3
  104. includes/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  105. includes/css/jquery-ui-1.7.3.custom.css +0 -344
  106. includes/css/{jquery-ui-1.8.5.custom.css → jquery-ui-1.8.13.custom.css} +11 -15
  107. includes/images/close.png +0 -0
  108. includes/images/event-caps-source.png +0 -0
  109. includes/images/event-caps.jpg +0 -0
  110. includes/images/event-perms-source.png +0 -0
  111. includes/js/bookingsform.js +56 -0
  112. includes/js/categories-admin.js +53 -0
  113. includes/js/em_admin.js +0 -271
  114. includes/js/em_calendar_ajax.js +0 -19
  115. includes/js/em_maps.js +0 -92
  116. includes/js/em_ui.js +0 -27
  117. includes/js/events-manager-source.js +668 -0
  118. includes/js/events-manager.js +688 -0
  119. includes/js/i18n/jquery.ui.datepicker-nl.js +3 -2
  120. includes/js/jquery-ui-1.8.5/jquery-ui-1.8.5.custom.min.js +0 -160
  121. includes/langs/dbem-cs_CZ.mo +0 -0
  122. includes/langs/dbem-cs_CZ.po +4239 -886
  123. includes/langs/dbem-da_DK.mo +0 -0
  124. includes/langs/dbem-da_DK.po +5510 -0
  125. includes/langs/dbem-de_DE.mo +0 -0
  126. includes/langs/dbem-de_DE.po +3693 -1089
  127. includes/langs/dbem-es_ES.mo +0 -0
  128. includes/langs/dbem-es_ES.po +3695 -1160
  129. includes/langs/dbem-fr_FR.mo +0 -0
  130. includes/langs/dbem-fr_FR.po +5071 -0
  131. includes/langs/dbem-hu_HU.mo +0 -0
  132. includes/langs/dbem-hu_HU.po +4385 -0
  133. includes/langs/dbem-it_IT.mo +0 -0
  134. includes/langs/dbem-it_IT.po +3767 -1044
  135. includes/langs/dbem-pt_PT.mo +0 -0
  136. includes/langs/dbem-pt_PT.po +4112 -0
  137. includes/langs/dbem-ru_RU.mo +0 -0
  138. includes/langs/dbem-ru_RU.po +4678 -0
  139. includes/langs/dbem-sv_SE.mo +0 -0
  140. includes/langs/dbem-sv_SE.po +3915 -861
  141. includes/langs/events-manager.pot +4615 -1316
  142. includes/{sample-placeholers → sample-placeholders}/booking-email.html +0 -0
  143. includes/sample-placeholders/event-list-default.html +19 -0
  144. includes/sample-placeholders/event-single-default.html +22 -0
  145. includes/{sample-placeholers → sample-placeholders}/event-single.html +19 -5
  146. includes/sample-placeholders/location-single-default.html +17 -0
  147. includes/thumbnails/cache/index.html +0 -0
  148. includes/thumbnails/timthumb-config.php +3 -0
  149. includes/thumbnails/timthumb.php +1189 -0
  150. readme.txt +291 -64
  151. screenshot-1.png +0 -0
  152. screenshot-2.png +0 -0
  153. screenshot-3.png +0 -0
  154. screenshot-4.png +0 -0
  155. screenshot-5.png +0 -0
  156. screenshot-6.png +0 -0
  157. templates/buddypress/group-events.php +164 -0
  158. templates/buddypress/my-bookings.php +12 -0
  159. templates/buddypress/my-events.php +193 -0
  160. templates/buddypress/my-group-events.php +158 -0
  161. templates/buddypress/my-locations.php +89 -0
  162. templates/buddypress/profile.php +39 -0
  163. templates/emails/bookingtickets.php +12 -0
  164. templates/emails/new-user.php +8 -0
  165. templates/formats/readme.txt +21 -0
  166. templates/forms/bookingform/booking-fields.php +27 -0
  167. templates/forms/bookingform/login.php +35 -0
  168. templates/forms/bookingform/ticket-single.php +27 -0
  169. templates/forms/bookingform/tickets-list.php +36 -0
  170. templates/forms/event-editor.php +243 -0
  171. templates/forms/event/attributes.php +89 -0
  172. templates/forms/event/booking-stats.php +36 -0
  173. templates/forms/event/bookings.php +145 -0
  174. templates/forms/event/group.php +27 -0
  175. templates/forms/event/location.php +110 -0
  176. templates/forms/event/recurring-when.php +86 -0
  177. templates/forms/event/when-with-recurring.php +91 -0
  178. templates/forms/event/when.php +31 -0
  179. templates/forms/location-editor.php +117 -0
  180. templates/forms/location/where.php +62 -0
  181. templates/forms/readme.txt +1 -0
  182. templates/forms/ticket-form.php +36 -0
  183. templates/forms/tickets-form.php +22 -0
  184. templates/placeholders/attendees.php +14 -0
  185. templates/placeholders/bookingbutton.php +43 -0
  186. templates/placeholders/bookingform.php +74 -0
  187. templates/placeholders/categories.php +14 -0
  188. templates/placeholders/locationmap.php +28 -0
  189. templates/placeholders/readme.txt +5 -0
  190. templates/templates/bookings-event-printable.php +53 -0
  191. templates/templates/calendar-day.php +23 -0
  192. templates/templates/calendar-full.php +62 -0
  193. templates/templates/calendar-small.php +50 -0
  194. templates/templates/categories-list.php +18 -0
  195. templates/templates/category-single.php +12 -0
  196. templates/templates/csv-event-bookings.php +50 -0
  197. templates/templates/event-single.php +16 -0
  198. templates/templates/events-calendar.php +13 -0
  199. templates/templates/events-list.php +38 -0
  200. templates/templates/events-search.php +153 -0
  201. templates/templates/ical.php +81 -0
  202. templates/templates/location-single.php +12 -0
  203. templates/templates/locations-list.php +19 -0
  204. templates/templates/map-global.php +19 -0
  205. templates/templates/my-bookings.php +102 -0
  206. templates/templates/readme.txt +3 -0
  207. templates/templates/rss.php +40 -0
  208. widgets/em-calendar.php +10 -3
  209. widgets/em-events.php +37 -35
  210. widgets/em-locations.php +7 -5
admin/bookings/em-cancelled.php CHANGED
@@ -5,7 +5,7 @@
5
* @param int $event_id
6
*/
7
function em_bookings_cancelled_table(){
8
- global $EM_Event, $wpdb, $current_user;
9
10
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_cancelled_table' );
11
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
@@ -14,12 +14,16 @@ function em_bookings_cancelled_table(){
14
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
15
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
16
17
- if( is_object($EM_Event) ){
18
- $bookings = $EM_Event->get_bookings()->get_cancelled_bookings();
19
}else{
20
- return false;
21
}
22
- $bookings_count = (is_array($bookings)) ? count($bookings):0;
23
?>
24
<div class='wrap em_bookings_pending_table em_obj'>
25
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
@@ -31,9 +35,9 @@ function em_bookings_cancelled_table(){
31
</li>
32
</ul>
33
<p class="search-box">
34
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
35
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
36
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
37
</p>
38
-->
39
<?php if ( $bookings_count >= $limit ) : ?>
@@ -42,7 +46,7 @@ function em_bookings_cancelled_table(){
42
<div class="alignleft actions">
43
<select name="action">
44
<option value="-1" selected="selected">
45
- <?php _e('Bulk Actions'); ?>
46
</option>
47
<option value="approve">
48
<?php _e('Approve', 'dbem'); ?>
@@ -61,8 +65,7 @@ function em_bookings_cancelled_table(){
61
-->
62
<?php
63
if ( $bookings_count >= $limit ) {
64
- $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], array('pno'=>'%PAGE%', 'em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
65
- $bookings_nav = em_admin_paginate( $page_link_template, $bookings_count, $limit, $page, 5);
66
echo $bookings_nav;
67
}
68
?>
@@ -72,16 +75,16 @@ function em_bookings_cancelled_table(){
72
<div class="clear"></div>
73
<?php if( $bookings_count > 0 ): ?>
74
<div class='table-wrap'>
75
- <table id='dbem-bookings-table' class='widefat post fixed'>
76
<thead>
77
<tr>
78
<th class='manage-column column-cb check-column' scope='col'>
79
<input class='select-all' type="checkbox" value='1' />
80
</th>
81
- <th class='manage-column' scope='col'>Booker</th>
82
- <th class='manage-column' scope='col'>E-mail</th>
83
- <th class='manage-column' scope='col'>Phone number</th>
84
- <th class='manage-column' scope='col'>Spaces</th>
85
<th class='manage-column' scope='col'>&nbsp;</th>
86
</tr>
87
</thead>
@@ -89,23 +92,24 @@ function em_bookings_cancelled_table(){
89
<?php
90
$rowno = 0;
91
$event_count = 0;
92
- foreach ($bookings as $EM_Booking) {
93
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
94
$rowno++;
95
?>
96
<tr>
97
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
98
- <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->id; ?>"><?php echo $EM_Booking->person->name ?></a></td>
99
- <td><?php echo $EM_Booking->person->email ?></td>
100
<td><?php echo $EM_Booking->person->phone ?></td>
101
- <td><?php echo $EM_Booking->seats ?></td>
102
<td>
103
<?php
104
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
105
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
106
?>
107
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
108
- <a class="em-bookings-edit" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit'); ?></a> |
109
<a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a>
110
</td>
111
</tr>
@@ -121,7 +125,7 @@ function em_bookings_cancelled_table(){
121
<?php _e('No cancelled bookings.', 'dbem'); ?>
122
<?php endif; ?>
123
</form>
124
- <?php if( !empty($bookings_nav) ) : ?>
125
<div class='tablenav'>
126
<?php echo $bookings_nav; ?>
127
<div class="clear"></div>
5
* @param int $event_id
6
*/
7
function em_bookings_cancelled_table(){
8
+ global $EM_Event, $EM_Ticket, $wpdb, $current_user;
9
10
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_cancelled_table' );
11
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
14
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
15
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
16
17
+ if( is_object($EM_Ticket) ){
18
+ $EM_Bookings = $EM_Ticket->get_bookings()->get_cancelled_bookings();
19
}else{
20
+ if( is_object($EM_Event) ){
21
+ $EM_Bookings = $EM_Event->get_bookings()->get_cancelled_bookings();
22
+ }else{
23
+ return false;
24
+ }
25
}
26
+ $bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
27
?>
28
<div class='wrap em_bookings_pending_table em_obj'>
29
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
35
</li>
36
</ul>
37
<p class="search-box">
38
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
39
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
40
+ <input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
41
</p>
42
-->
43
<?php if ( $bookings_count >= $limit ) : ?>
46
<div class="alignleft actions">
47
<select name="action">
48
<option value="-1" selected="selected">
49
+ <?php _e('Bulk Actions', 'dbem'); ?>
50
</option>
51
<option value="approve">
52
<?php _e('Approve', 'dbem'); ?>
65
-->
66
<?php
67
if ( $bookings_count >= $limit ) {
68
+ $bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
69
echo $bookings_nav;
70
}
71
?>
75
<div class="clear"></div>
76
<?php if( $bookings_count > 0 ): ?>
77
<div class='table-wrap'>
78
+ <table id='dbem-bookings-table' class='widefat post '>
79
<thead>
80
<tr>
81
<th class='manage-column column-cb check-column' scope='col'>
82
<input class='select-all' type="checkbox" value='1' />
83
</th>
84
+ <th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
85
+ <th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
86
+ <th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
87
+ <th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
88
<th class='manage-column' scope='col'>&nbsp;</th>
89
</tr>
90
</thead>
92
<?php
93
$rowno = 0;
94
$event_count = 0;
95
+ foreach ($EM_Bookings->bookings as $EM_Booking) {
96
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
97
$rowno++;
98
?>
99
<tr>
100
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
101
+ <td><a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
102
+ <td><?php echo $EM_Booking->person->user_email ?></td>
103
<td><?php echo $EM_Booking->person->phone ?></td>
104
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
105
<td>
106
<?php
107
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
108
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
109
+ $edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->id, 'em_ajax'=>null, 'em_obj'=>null));
110
?>
111
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
112
+ <a class="em-bookings-edit" href="<?php echo $edit_url; ?>"><?php _e('Edit/View','dbem'); ?></a> |
113
<a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a>
114
</td>
115
</tr>
125
<?php _e('No cancelled bookings.', 'dbem'); ?>
126
<?php endif; ?>
127
</form>
128
+ <?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
129
<div class='tablenav'>
130
<?php echo $bookings_nav; ?>
131
<div class="clear"></div>
admin/bookings/em-confirmed.php CHANGED
@@ -6,7 +6,7 @@
6
* @param int $event_id
7
*/
8
function em_bookings_confirmed_table(){
9
- global $EM_Event, $wpdb, $current_user;
10
11
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
12
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
@@ -15,12 +15,16 @@ function em_bookings_confirmed_table(){
15
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
16
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
17
18
- if( is_object($EM_Event) ){
19
- $bookings = $EM_Event->get_bookings()->get_bookings();
20
}else{
21
- return false;
22
}
23
- $bookings_count = (is_array($bookings)) ? count($bookings):0;
24
?>
25
<div class='wrap em_bookings_pending_table em_obj'>
26
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
@@ -32,9 +36,9 @@ function em_bookings_confirmed_table(){
32
</li>
33
</ul>
34
<p class="search-box">
35
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
36
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
37
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
38
</p>
39
-->
40
<?php if ( $bookings_count >= $limit ) : ?>
@@ -43,7 +47,7 @@ function em_bookings_confirmed_table(){
43
<div class="alignleft actions">
44
<select name="action">
45
<option value="-1" selected="selected">
46
- <?php _e('Bulk Actions'); ?>
47
</option>
48
<option value="approve">
49
<?php _e('Approve', 'dbem'); ?>
@@ -62,8 +66,7 @@ function em_bookings_confirmed_table(){
62
-->
63
<?php
64
if ( $bookings_count >= $limit ) {
65
- $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], array('pno'=>'%PAGE%', 'em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
66
- $bookings_nav = em_admin_paginate( $page_link_template, $bookings_count, $limit, $page, 5);
67
echo $bookings_nav;
68
}
69
?>
@@ -73,16 +76,16 @@ function em_bookings_confirmed_table(){
73
<div class="clear"></div>
74
<?php if( $bookings_count > 0 ): ?>
75
<div class='table-wrap'>
76
- <table id='dbem-bookings-table' class='widefat post fixed'>
77
<thead>
78
<tr>
79
<th class='manage-column column-cb check-column' scope='col'>
80
<input class='select-all' type="checkbox" value='1' />
81
</th>
82
- <th class='manage-column' scope='col'>Booker</th>
83
- <th class='manage-column' scope='col'>E-mail</th>
84
- <th class='manage-column' scope='col'>Phone number</th>
85
- <th class='manage-column' scope='col'>Spaces</th>
86
<th class='manage-column' scope='col'>&nbsp;</th>
87
</tr>
88
</thead>
@@ -90,29 +93,30 @@ function em_bookings_confirmed_table(){
90
<?php
91
$rowno = 0;
92
$event_count = 0;
93
- foreach ($bookings as $EM_Booking) {
94
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
95
$rowno++;
96
?>
97
<tr>
98
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
99
- <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person_id; ?>"><?php echo $EM_Booking->person->name ?></a></td>
100
- <td><?php echo $EM_Booking->person->email ?></td>
101
<td><?php echo $EM_Booking->person->phone ?></td>
102
- <td><?php echo $EM_Booking->seats ?></td>
103
- <td>
104
<?php
105
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->id));
106
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->id));
107
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
108
?>
109
- <?php if( get_option('dbem_bookings_approval') ): ?>
110
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
111
<?php else: ?>
112
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
113
<?php endif; ?>
114
- <a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a> |
115
- <a class="em-bookings-edit" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit'); ?></a>
116
</td>
117
</tr>
118
<?php
@@ -127,7 +131,7 @@ function em_bookings_confirmed_table(){
127
<?php _e('No confirmed bookings.', 'dbem'); ?>
128
<?php endif; ?>
129
</form>
130
- <?php if( !empty($bookings_nav) ) : ?>
131
<div class='tablenav'>
132
<?php echo $bookings_nav; ?>
133
<div class="clear"></div>
6
* @param int $event_id
7
*/
8
function em_bookings_confirmed_table(){
9
+ global $EM_Event, $EM_Ticket, $wpdb, $current_user;
10
11
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
12
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
15
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
16
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
17
18
+ if( is_object($EM_Ticket) ){
19
+ $EM_Bookings = $EM_Ticket->get_bookings()->get_bookings();
20
}else{
21
+ if( is_object($EM_Event) ){
22
+ $EM_Bookings = $EM_Event->get_bookings()->get_bookings();
23
+ }else{
24
+ return false;
25
+ }
26
}
27
+ $bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
28
?>
29
<div class='wrap em_bookings_pending_table em_obj'>
30
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
36
</li>
37
</ul>
38
<p class="search-box">
39
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
40
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
41
+ <input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
42
</p>
43
-->
44
<?php if ( $bookings_count >= $limit ) : ?>
47
<div class="alignleft actions">
48
<select name="action">
49
<option value="-1" selected="selected">
50
+ <?php _e('Bulk Actions', 'dbem'); ?>
51
</option>
52
<option value="approve">
53
<?php _e('Approve', 'dbem'); ?>
66
-->
67
<?php
68
if ( $bookings_count >= $limit ) {
69
+ $bookings_nav = em_admin_paginate($bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
70
echo $bookings_nav;
71
}
72
?>
76
<div class="clear"></div>
77
<?php if( $bookings_count > 0 ): ?>
78
<div class='table-wrap'>
79
+ <table id='dbem-bookings-table' class='widefat post '>
80
<thead>
81
<tr>
82
<th class='manage-column column-cb check-column' scope='col'>
83
<input class='select-all' type="checkbox" value='1' />
84
</th>
85
+ <th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
86
+ <th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
87
+ <th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
88
+ <th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
89
<th class='manage-column' scope='col'>&nbsp;</th>
90
</tr>
91
</thead>
93
<?php
94
$rowno = 0;
95
$event_count = 0;
96
+ foreach ($EM_Bookings->bookings as $EM_Booking) {
97
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
98
$rowno++;
99
?>
100
<tr>
101
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
102
+ <td><a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person_id; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
103
+ <td><?php echo $EM_Booking->person->user_email ?></td>
104
<td><?php echo $EM_Booking->person->phone ?></td>
105
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
106
+ <td>
107
<?php
108
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->id));
109
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->id));
110
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
111
+ $edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->id, 'em_ajax'=>null, 'em_obj'=>null));
112
?>
113
+ <?php if( current_user_can('manage_bookings') && get_option('dbem_bookings_approval') ): ?>
114
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
115
<?php else: ?>
116
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
117
<?php endif; ?>
118
+ <span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
119
+ <a class="em-bookings-edit" href="<?php echo $edit_url; ?>"><?php _e('Edit/View','dbem'); ?></a>
120
</td>
121
</tr>
122
<?php
131
<?php _e('No confirmed bookings.', 'dbem'); ?>
132
<?php endif; ?>
133
</form>
134
+ <?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
135
<div class='tablenav'>
136
<?php echo $bookings_nav; ?>
137
<div class="clear"></div>
admin/bookings/em-events.php CHANGED
@@ -35,13 +35,14 @@ function em_bookings_events_table() {
35
$title = __ ( 'Future Events', 'dbem' );
36
$scope = "future";
37
}
38
- $events = EM_Events::get( array('scope'=>$scope, 'limit'=>0, 'order'=>$order, 'rsvp'=>true ) );
39
$events_count = count ( $events );
40
41
$use_events_end = get_option ( 'dbem_use_event_end' );
42
?>
43
<div class="wrap em_bookings_events_table em_obj">
44
- <form id="posts-filter" action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="get">
45
<input type="hidden" name="em_obj" value="em_bookings_events_table" />
46
<?php if(!empty($_GET['page'])): ?>
47
<input type='hidden' name='page' value='events-manager-bookings' />
@@ -77,8 +78,7 @@ function em_bookings_events_table() {
77
-->
78
<?php
79
if ( $events_count >= $limit ) {
80
- $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], array('pno'=>'%PAGE%', 'em_ajax'=>0, 'em_obj'=>'em_bookings_events_table'));
81
- $events_nav = em_admin_paginate( $page_link_template, $events_count, $limit, $page, 5);
82
echo $events_nav;
83
}
84
?>
@@ -112,8 +112,8 @@ function em_bookings_events_table() {
112
$rowno++;
113
$class = ($rowno % 2) ? ' class="alternate"' : '';
114
// FIXME set to american
115
- $localised_start_date = date_i18n('D d M Y', $event->start);
116
- $localised_end_date = date_i18n('D d M Y', $event->end);
117
$style = "";
118
$today = date ( "Y-m-d" );
119
@@ -128,12 +128,12 @@ function em_bookings_events_table() {
128
</td>
129
<td>
130
<strong>
131
- <a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;event_id=<?php echo $event->id ?>"><?php echo ($event->name); ?></a>
132
</strong>
133
&ndash;
134
- <?php _e("Booked Seats",'dbem') ?>: <?php echo $event->get_bookings()->get_booked_seats()."/".$event->seats ?>
135
<?php if( get_option('dbem_bookings_approval') == 1 ) : ?>
136
- | <?php _e("Pending",'dbem') ?>: <?php echo $event->get_bookings()->get_pending_seats(); ?>
137
<?php endif; ?>
138
</td>
139
@@ -162,7 +162,7 @@ function em_bookings_events_table() {
162
<div class="alignleft actions">
163
<br class='clear' />
164
</div>
165
- <?php if( !empty($events_nav) ) : ?>
166
<div class="tablenav-pages">
167
<?php
168
echo $events_nav;
35
$title = __ ( 'Future Events', 'dbem' );
36
$scope = "future";
37
}
38
+ $owner = !current_user_can('edit_others_events') ? get_current_user_id() : false;
39
+ $events = EM_Events::get( array('scope'=>$scope, 'limit'=>0, 'order'=>$order, 'bookings'=>true, 'owner' => $owner ) );
40
$events_count = count ( $events );
41
42
$use_events_end = get_option ( 'dbem_use_event_end' );
43
?>
44
<div class="wrap em_bookings_events_table em_obj">
45
+ <form id="posts-filter" action="" method="get">
46
<input type="hidden" name="em_obj" value="em_bookings_events_table" />
47
<?php if(!empty($_GET['page'])): ?>
48
<input type='hidden' name='page' value='events-manager-bookings' />
78
-->
79
<?php
80
if ( $events_count >= $limit ) {
81
+ $events_nav = em_admin_paginate( $events_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_events_table'));
82
echo $events_nav;
83
}
84
?>
112
$rowno++;
113
$class = ($rowno % 2) ? ' class="alternate"' : '';
114
// FIXME set to american
115
+ $localised_start_date = date_i18n(get_option('date_format'), $event->start);
116
+ $localised_end_date = date_i18n(get_option('date_format'), $event->end);
117
$style = "";
118
$today = date ( "Y-m-d" );
119
128
</td>
129
<td>
130
<strong>
131
+ <?php echo $event->output('#_BOOKINGSLINK'); ?>
132
</strong>
133
&ndash;
134
+ <?php _e("Booked Spaces",'dbem') ?>: <?php echo $event->get_bookings()->get_booked_spaces()."/".$event->get_spaces() ?>
135
<?php if( get_option('dbem_bookings_approval') == 1 ) : ?>
136
+ | <?php _e("Pending",'dbem') ?>: <?php echo $event->get_bookings()->get_pending_spaces(); ?>
137
<?php endif; ?>
138
</td>
139
162
<div class="alignleft actions">
163
<br class='clear' />
164
</div>
165
+ <?php if (!empty($events_nav) && $events_count >= $limit ) : ?>
166
<div class="tablenav-pages">
167
<?php
168
echo $events_nav;
admin/bookings/em-pending.php CHANGED
@@ -7,7 +7,7 @@
7
* @param int $event_id
8
*/
9
function em_bookings_pending_table($event_id = false){
10
- global $EM_Event, $wpdb, $current_user;
11
12
if( get_option('dbem_bookings_approval') == 0 ){
13
return false;
@@ -20,21 +20,25 @@ function em_bookings_pending_table($event_id = false){
20
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
21
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
22
23
- if( is_object($EM_Event) ){
24
- $bookings = $EM_Event->get_bookings()->get_pending();
25
}else{
26
- //To optimize performance, we can do one query here for all pending bookings to show.
27
- $bookings = EM_Bookings::get(array('status'=>0));
28
- $events = array();
29
- //Now let's create events and bookings for this:
30
- foreach($bookings as $EM_Booking){
31
- //create event
32
- if( !array_key_exists($EM_Booking->event_id,$events) ){
33
- $events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
34
}
35
}
36
}
37
- $bookings_count = (is_array($bookings)) ? count($bookings):0;
38
?>
39
<div class='wrap em_bookings_pending_table em_obj'>
40
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
@@ -46,9 +50,9 @@ function em_bookings_pending_table($event_id = false){
46
</li>
47
</ul>
48
<p class="search-box">
49
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
50
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
51
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
52
</p>
53
-->
54
<?php if ( $bookings_count >= $limit ) : ?>
@@ -57,7 +61,7 @@ function em_bookings_pending_table($event_id = false){
57
<div class="alignleft actions">
58
<select name="action">
59
<option value="-1" selected="selected">
60
- <?php _e('Bulk Actions'); ?>
61
</option>
62
<option value="approve">
63
<?php _e('Approve', 'dbem'); ?>
@@ -76,8 +80,7 @@ function em_bookings_pending_table($event_id = false){
76
-->
77
<?php
78
if ( $bookings_count >= $limit ) {
79
- $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], array('pno'=>'%PAGE%', 'em_ajax'=>0, 'em_obj'=>'em_bookings_pending_table'));
80
- $bookings_nav = em_admin_paginate( $page_link_template, $bookings_count, $limit, $page, 5);
81
echo $bookings_nav;
82
}
83
?>
@@ -87,19 +90,19 @@ function em_bookings_pending_table($event_id = false){
87
<div class="clear"></div>
88
<?php if( $bookings_count > 0 ): ?>
89
<div class='table-wrap'>
90
- <table id='dbem-bookings-table' class='widefat post fixed'>
91
<thead>
92
<tr>
93
<th class='manage-column column-cb check-column' scope='col'>
94
<input class='select-all' type="checkbox" value='1' />
95
</th>
96
- <th class='manage-column' scope='col'>Booker</th>
97
- <?php if( !is_object($EM_Event) ): ?>
98
- <th class='manage-column' scope="col">Event</th>
99
<?php endif; ?>
100
- <th class='manage-column' scope='col'>E-mail</th>
101
- <th class='manage-column' scope='col'>Phone number</th>
102
- <th class='manage-column' scope='col'>Spaces</th>
103
<th class='manage-column' scope='col'>&nbsp;</th>
104
</tr>
105
</thead>
@@ -107,27 +110,29 @@ function em_bookings_pending_table($event_id = false){
107
<?php
108
$rowno = 0;
109
$event_count = 0;
110
- foreach ($bookings as $EM_Booking) {
111
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
112
$rowno++;
113
?>
114
<tr>
115
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
116
- <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->id; ?>"><?php echo $EM_Booking->person->name ?></a></td>
117
- <?php if( !is_object($EM_Event) ): ?>
118
- <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;event_id=<?php echo $EM_Booking->event_id; ?>"><?php echo $events[$EM_Booking->event_id]->name ?></a></td>
119
<?php endif; ?>
120
- <td><?php echo $EM_Booking->person->email ?></td>
121
<td><?php echo $EM_Booking->person->phone ?></td>
122
- <td><?php echo $EM_Booking->seats ?></td>
123
<td>
124
<?php
125
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
126
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->id));
127
?>
128
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
129
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
130
- <a class="em-bookings-edit" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit'); ?></a>
131
</td>
132
</tr>
133
<?php
@@ -142,7 +147,7 @@ function em_bookings_pending_table($event_id = false){
142
<?php _e('No pending bookings.', 'dbem'); ?>
143
<?php endif; ?>
144
</form>
145
- <?php if( !empty($bookings_nav) ) : ?>
146
<div class='tablenav'>
147
<?php echo $bookings_nav; ?>
148
<div class="clear"></div>
@@ -150,6 +155,5 @@ function em_bookings_pending_table($event_id = false){
150
<?php endif; ?>
151
</div>
152
<?php
153
-
154
}
155
?>
7
* @param int $event_id
8
*/
9
function em_bookings_pending_table($event_id = false){
10
+ global $EM_Event, $EM_Ticket, $wpdb, $current_user;
11
12
if( get_option('dbem_bookings_approval') == 0 ){
13
return false;
20
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
21
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
22
23
+ if( is_object($EM_Ticket) ){
24
+ $EM_Bookings = $EM_Ticket->get_bookings()->get_pending_bookings();
25
}else{
26
+ if( is_object($EM_Event) ){
27
+ $EM_Bookings = $EM_Event->get_bookings()->get_pending_bookings();
28
+ }else{
29
+ //To optimize performance, we can do one query here for all pending bookings to show.
30
+ $EM_Bookings = EM_Bookings::get(array('status'=>0));
31
+ $events = array();
32
+ //Now let's create events and bookings for this:
33
+ foreach($EM_Bookings->bookings as $EM_Booking){
34
+ //create event
35
+ if( !array_key_exists($EM_Booking->event_id,$events) ){
36
+ $events[$EM_Booking->event_id] = new EM_Event($EM_Booking->event_id);
37
+ }
38
}
39
}
40
}
41
+ $bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
42
?>
43
<div class='wrap em_bookings_pending_table em_obj'>
44
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
50
</li>
51
</ul>
52
<p class="search-box">
53
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
54
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
55
+ <input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
56
</p>
57
-->
58
<?php if ( $bookings_count >= $limit ) : ?>
61
<div class="alignleft actions">
62
<select name="action">
63
<option value="-1" selected="selected">
64
+ <?php _e('Bulk Actions', 'dbem'); ?>
65
</option>
66
<option value="approve">
67
<?php _e('Approve', 'dbem'); ?>
80
-->
81
<?php
82
if ( $bookings_count >= $limit ) {
83
+ $bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_pending_table'));
84
echo $bookings_nav;
85
}
86
?>
90
<div class="clear"></div>
91
<?php if( $bookings_count > 0 ): ?>
92
<div class='table-wrap'>
93
+ <table id='dbem-bookings-table' class='widefat post '>
94
<thead>
95
<tr>
96
<th class='manage-column column-cb check-column' scope='col'>
97
<input class='select-all' type="checkbox" value='1' />
98
</th>
99
+ <th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
100
+ <?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
101
+ <th class='manage-column' scope="col"><?php _e('Event', 'dbem'); ?></th>
102
<?php endif; ?>
103
+ <th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
104
+ <th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
105
+ <th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
106
<th class='manage-column' scope='col'>&nbsp;</th>
107
</tr>
108
</thead>
110
<?php
111
$rowno = 0;
112
$event_count = 0;
113
+ foreach ($EM_Bookings->bookings as $EM_Booking) {
114
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
115
$rowno++;
116
?>
117
<tr>
118
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
119
+ <td><a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
120
+ <?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
121
+ <td><a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;event_id=<?php echo $EM_Booking->event_id; ?>"><?php echo $events[$EM_Booking->event_id]->name ?></a></td>
122
<?php endif; ?>
123
+ <td><?php echo $EM_Booking->person->user_email ?></td>
124
<td><?php echo $EM_Booking->person->phone ?></td>
125
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
126
<td>
127
<?php
128
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
129
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->id));
130
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
131
?>
132
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
133
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
134
+ <span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
135
+ <a class="em-bookings-edit" href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit/View','dbem'); ?></a>
136
</td>
137
</tr>
138
<?php
147
<?php _e('No pending bookings.', 'dbem'); ?>
148
<?php endif; ?>
149
</form>
150
+ <?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
151
<div class='tablenav'>
152
<?php echo $bookings_nav; ?>
153
<div class="clear"></div>
155
<?php endif; ?>
156
</div>
157
<?php
158
}
159
?>
admin/bookings/em-person.php CHANGED
@@ -18,7 +18,7 @@ function em_bookings_person_table(){
18
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
19
20
$bookings = $EM_Person->get_bookings();
21
- $bookings_count = (is_array($bookings)) ? count($bookings):0;
22
if($bookings_count > 0){
23
//Get events here in one query to speed things up
24
foreach($bookings as $EM_Booking){
@@ -37,9 +37,9 @@ function em_bookings_person_table(){
37
</li>
38
</ul>
39
<p class="search-box">
40
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
41
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
42
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
43
</p>
44
-->
45
<?php if ( $bookings_count >= $limit ) : ?>
@@ -48,7 +48,7 @@ function em_bookings_person_table(){
48
<div class="alignleft actions">
49
<select name="action">
50
<option value="-1" selected="selected">
51
- <?php _e('Bulk Actions'); ?>
52
</option>
53
<option value="approve">
54
<?php _e('Approve', 'dbem'); ?>
@@ -67,8 +67,7 @@ function em_bookings_person_table(){
67
-->
68
<?php
69
if ( $bookings_count >= $limit ) {
70
- $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], array('pno'=>'%PAGE%', 'em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
71
- $bookings_nav = em_admin_paginate( $page_link_template, $bookings_count, $limit, $page, 5);
72
echo $bookings_nav;
73
}
74
?>
@@ -78,15 +77,15 @@ function em_bookings_person_table(){
78
<div class="clear"></div>
79
<?php if( $bookings_count > 0 ): ?>
80
<div class='table-wrap'>
81
- <table id='dbem-bookings-table' class='widefat post fixed'>
82
<thead>
83
<tr>
84
<th class='manage-column column-cb check-column' scope='col'>
85
<input class='select-all' type="checkbox" value='1' />
86
</th>
87
- <th class='manage-column' scope='col'>Event</th>
88
- <th class='manage-column' scope='col'>Spaces</th>
89
- <th class='manage-column' scope='col'>Status</th>
90
<th class='manage-column' scope='col'>&nbsp;</th>
91
</tr>
92
</thead>
@@ -96,33 +95,36 @@ function em_bookings_person_table(){
96
$event_count = 0;
97
foreach ($bookings as $EM_Booking) {
98
$EM_Event = $events[$EM_Booking->event_id];
99
- if( $EM_Event->can_manage() && ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
100
$rowno++;
101
?>
102
<tr>
103
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
104
- <td><a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;event_id=<?php echo $EM_Event->id ?>"><?php echo ($EM_Event->name); ?></a></td>
105
- <td><?php echo $EM_Booking->seats ?></td>
106
<td><?php echo $EM_Booking->status_array[$EM_Booking->status]; ?>
107
</td>
108
<td>
109
<?php
110
- $unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'bookings'=>$EM_Booking->id));
111
- $approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'bookings'=>$EM_Booking->id));
112
- $reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'bookings'=>$EM_Booking->id));
113
- $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'bookings'=>$EM_Booking->id));
114
?>
115
- <?php if( $EM_Booking->status == 0 || $EM_Booking->status == 2 ): ?>
116
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
117
<?php endif; ?>
118
- <?php if( $EM_Booking->status == 2 ): ?>
119
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
120
<?php endif; ?>
121
<?php if( $EM_Booking->status == 0 || $EM_Booking->status == 1 ): ?>
122
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
123
<?php endif; ?>
124
- <a class="em-bookings-edit" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit'); ?></a> |
125
- <a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a>
126
</td>
127
</tr>
128
<?php
@@ -137,7 +139,7 @@ function em_bookings_person_table(){
137
<?php _e('No confirmed bookings.', 'dbem'); ?>
138
<?php endif; ?>
139
</form>
140
- <?php if( !empty($bookings_nav) ) : ?>
141
<div class='tablenav'>
142
<?php echo $bookings_nav; ?>
143
<div class="clear"></div>
18
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
19
20
$bookings = $EM_Person->get_bookings();
21
+ $bookings_count = count($bookings);
22
if($bookings_count > 0){
23
//Get events here in one query to speed things up
24
foreach($bookings as $EM_Booking){
37
</li>
38
</ul>
39
<p class="search-box">
40
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
41
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
42
+ <input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
43
</p>
44
-->
45
<?php if ( $bookings_count >= $limit ) : ?>
48
<div class="alignleft actions">
49
<select name="action">
50
<option value="-1" selected="selected">
51
+ <?php _e('Bulk Actions', 'dbem'); ?>
52
</option>
53
<option value="approve">
54
<?php _e('Approve', 'dbem'); ?>
67
-->
68
<?php
69
if ( $bookings_count >= $limit ) {
70
+ $bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
71
echo $bookings_nav;
72
}
73
?>
77
<div class="clear"></div>
78
<?php if( $bookings_count > 0 ): ?>
79
<div class='table-wrap'>
80
+ <table id='dbem-bookings-table' class='widefat post '>
81
<thead>
82
<tr>
83
<th class='manage-column column-cb check-column' scope='col'>
84
<input class='select-all' type="checkbox" value='1' />
85
</th>
86
+ <th class='manage-column' scope='col'><?php _e('Event', 'dbem'); ?></th>
87
+ <th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
88
+ <th class='manage-column' scope='col'><?php _e('Status', 'dbem'); ?></th>
89
<th class='manage-column' scope='col'>&nbsp;</th>
90
</tr>
91
</thead>
95
$event_count = 0;
96
foreach ($bookings as $EM_Booking) {
97
$EM_Event = $events[$EM_Booking->event_id];
98
+ if( $EM_Event->can_manage('edit_events','edit_others_events') && ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
99
$rowno++;
100
?>
101
<tr>
102
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
103
+ <td><a class="row-title" href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;event_id=<?php echo $EM_Event->id ?>"><?php echo ($EM_Event->name); ?></a></td>
104
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
105
<td><?php echo $EM_Booking->status_array[$EM_Booking->status]; ?>
106
</td>
107
<td>
108
<?php
109
+ $unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->id));
110
+ $approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
111
+ $reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->id));
112
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
113
?>
114
+ <?php if( get_option('dbem_bookings_approval') && ($EM_Booking->status == 0 ) ): ?>
115
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
116
<?php endif; ?>
117
+ <?php if( get_option('dbem_bookings_approval') && $EM_Booking->status == 1 ): ?>
118
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
119
<?php endif; ?>
120
+ <?php if( $EM_Booking->status == 2 ): ?>
121
+ <a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
122
+ <?php endif; ?>
123
<?php if( $EM_Booking->status == 0 || $EM_Booking->status == 1 ): ?>
124
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
125
<?php endif; ?>
126
+ <a class="em-bookings-edit" href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit/View','dbem'); ?></a> |
127
+ <span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span>
128
</td>
129
</tr>
130
<?php
139
<?php _e('No confirmed bookings.', 'dbem'); ?>
140
<?php endif; ?>
141
</form>
142
+ <?php if( !empty($bookings_nav) && $bookings >= $limit ) : ?>
143
<div class='tablenav'>
144
<?php echo $bookings_nav; ?>
145
<div class="clear"></div>
admin/bookings/em-rejected.php CHANGED
@@ -5,7 +5,7 @@
5
* @param int $event_id
6
*/
7
function em_bookings_rejected_table(){
8
- global $EM_Event, $wpdb, $current_user;
9
10
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
11
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
@@ -14,12 +14,16 @@ function em_bookings_rejected_table(){
14
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
15
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
16
17
- if( is_object($EM_Event) ){
18
- $bookings = $EM_Event->get_bookings()->get_rejected_bookings();
19
}else{
20
- return false;
21
}
22
- $bookings_count = (is_array($bookings)) ? count($bookings):0;
23
?>
24
<div class='wrap em_bookings_pending_table em_obj'>
25
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
@@ -31,9 +35,9 @@ function em_bookings_rejected_table(){
31
</li>
32
</ul>
33
<p class="search-box">
34
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
35
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
36
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
37
</p>
38
-->
39
<?php if ( $bookings_count >= $limit ) : ?>
@@ -42,7 +46,7 @@ function em_bookings_rejected_table(){
42
<div class="alignleft actions">
43
<select name="action">
44
<option value="-1" selected="selected">
45
- <?php _e('Bulk Actions'); ?>
46
</option>
47
<option value="approve">
48
<?php _e('Approve', 'dbem'); ?>
@@ -61,8 +65,7 @@ function em_bookings_rejected_table(){
61
-->
62
<?php
63
if ( $bookings_count >= $limit ) {
64
- $page_link_template = em_add_get_params($_SERVER['REQUEST_URI'], array('pno'=>'%PAGE%', 'em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
65
- $bookings_nav = em_admin_paginate( $page_link_template, $bookings_count, $limit, $page, 5);
66
echo $bookings_nav;
67
}
68
?>
@@ -72,16 +75,16 @@ function em_bookings_rejected_table(){
72
<div class="clear"></div>
73
<?php if( $bookings_count > 0 ): ?>
74
<div class='table-wrap'>
75
- <table id='dbem-bookings-table' class='widefat post fixed'>
76
<thead>
77
<tr>
78
<th class='manage-column column-cb check-column' scope='col'>
79
<input class='select-all' type="checkbox" value='1' />
80
</th>
81
- <th class='manage-column' scope='col'>Booker</th>
82
- <th class='manage-column' scope='col'>E-mail</th>
83
- <th class='manage-column' scope='col'>Phone number</th>
84
- <th class='manage-column' scope='col'>Spaces</th>
85
<th class='manage-column' scope='col'>&nbsp;</th>
86
</tr>
87
</thead>
@@ -89,24 +92,25 @@ function em_bookings_rejected_table(){
89
<?php
90
$rowno = 0;
91
$event_count = 0;
92
- foreach ($bookings as $EM_Booking) {
93
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
94
$rowno++;
95
?>
96
<tr>
97
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
98
- <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->id; ?>"><?php echo $EM_Booking->person->name ?></a></td>
99
- <td><?php echo $EM_Booking->person->email ?></td>
100
<td><?php echo $EM_Booking->person->phone ?></td>
101
- <td><?php echo $EM_Booking->seats ?></td>
102
<td>
103
<?php
104
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
105
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
106
?>
107
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
108
- <a class="em-bookings-edit" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit'); ?></a> |
109
- <a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a>
110
</td>
111
</tr>
112
<?php
@@ -121,7 +125,7 @@ function em_bookings_rejected_table(){
121
<?php _e('No rejected bookings.', 'dbem'); ?>
122
<?php endif; ?>
123
</form>
124
- <?php if( !empty($bookings_nav) ) : ?>
125
<div class='tablenav'>
126
<?php echo $bookings_nav; ?>
127
<div class="clear"></div>
5
* @param int $event_id
6
*/
7
function em_bookings_rejected_table(){
8
+ global $EM_Event, $EM_Ticket, $wpdb, $current_user;
9
10
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
11
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
14
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
15
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
16
17
+ if( is_object($EM_Ticket) ){
18
+ $EM_Bookings = $EM_Ticket->get_bookings()->get_rejected_bookings();
19
}else{
20
+ if( is_object($EM_Event) ){
21
+ $EM_Bookings = $EM_Event->get_bookings()->get_rejected_bookings();
22
+ }else{
23
+ return false;
24
+ }
25
}
26
+ $bookings_count = (is_array($EM_Bookings->bookings)) ? count($EM_Bookings->bookings):0;
27
?>
28
<div class='wrap em_bookings_pending_table em_obj'>
29
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
35
</li>
36
</ul>
37
<p class="search-box">
38
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search', 'dbem'); ?>:</label>
39
<input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
40
+ <input type="submit" value="<?php _e('Search', 'dbem'); ?>" class="button" />
41
</p>
42
-->
43
<?php if ( $bookings_count >= $limit ) : ?>
46
<div class="alignleft actions">
47
<select name="action">
48
<option value="-1" selected="selected">
49
+ <?php _e('Bulk Actions', 'dbem'); ?>
50
</option>
51
<option value="approve">
52
<?php _e('Approve', 'dbem'); ?>
65
-->
66
<?php
67
if ( $bookings_count >= $limit ) {
68
+ $bookings_nav = em_admin_paginate( $bookings_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_confirmed_table'));
69
echo $bookings_nav;
70
}
71
?>
75
<div class="clear"></div>
76
<?php if( $bookings_count > 0 ): ?>
77
<div class='table-wrap'>
78
+ <table id='dbem-bookings-table' class='widefat post '>
79
<thead>
80
<tr>
81
<th class='manage-column column-cb check-column' scope='col'>
82
<input class='select-all' type="checkbox" value='1' />
83
</th>
84
+ <th class='manage-column' scope='col'><?php _e('Booker', 'dbem'); ?></th>
85
+ <th class='manage-column' scope='col'><?php _e('E-mail', 'dbem'); ?></th>
86
+ <th class='manage-column' scope='col'><?php _e('Phone number', 'dbem'); ?></th>
87
+ <th class='manage-column' scope='col'><?php _e('Spaces', 'dbem'); ?></th>
88
<th class='manage-column' scope='col'>&nbsp;</th>
89
</tr>
90
</thead>
92
<?php
93
$rowno = 0;
94
$event_count = 0;
95
+ foreach ($EM_Bookings->bookings as $EM_Booking) {
96
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
97
$rowno++;
98
?>
99
<tr>
100
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
101
+ <td><a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->get_name() ?></a></td>
102
+ <td><?php echo $EM_Booking->person->user_email ?></td>
103
<td><?php echo $EM_Booking->person->phone ?></td>
104
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
105
<td>
106
<?php
107
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
108
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
109
+ $edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->id, 'em_ajax'=>null, 'em_obj'=>null));
110
?>
111
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
112
+ <a class="em-bookings-edit" href="<?php echo $edit_url ?>"><?php _e('Edit/View','dbem'); ?></a> |
113
+ <span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span>
114
</td>
115
</tr>
116
<?php
125
<?php _e('No rejected bookings.', 'dbem'); ?>
126
<?php endif; ?>
127
</form>
128
+ <?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
129
<div class='tablenav'>
130
<?php echo $bookings_nav; ?>
131
<div class="clear"></div>
admin/em-admin.php CHANGED
@@ -1,87 +1,132 @@
1
<?php
2
//Admin functions
3
4
/**
5
* Generate warnings and notices in the admin area
6
*/
7
function em_admin_warnings() {
8
//If we're editing the events page show hello to new user
9
$events_page_id = get_option ( 'dbem_events_page' );
10
$dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';
11
12
- if( em_verify_admin() ){
13
//New User Intro
14
if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){
15
// Disable Hello to new user if requested
16
- update_option ( 'dbem_hello_to_user', 0 );
17
- }elseif ( get_option ( 'dbem_hello_to_user' ) == 1 && !empty($_GET['page']) && $_GET['page'] == 'events-manager-events' ) {
18
- $current_user = wp_get_current_user ();
19
//FIXME update welcome msg with good links
20
- $advice = sprintf ( __ ( "<p>Hey, <strong>%s</strong>, welcome to <strong>Events Manager</strong>! We hope you like it around here.</p>
21
- <p>Now it's time to insert events lists through <a href='%s' title='Widgets page'>widgets</a>, <a href='%s' title='Template tags documentation'>template tags</a> or <a href='%s' title='Shortcodes documentation'>shortcodes</a>.</p>
22
- <p>By the way, have you taken a look at the <a href='%s' title='Change settings'>Settings page</a>? That's where you customize the way events and locations are displayed.</p>
23
- <p>What? Tired of seeing this advice? I hear you, <a href='%s' title='Don't show this advice again'>click here</a> and you won't see this again!</p>", 'dbem' ), $current_user->display_name, get_bloginfo ( 'url' ) . '/wp-admin/widgets.php', 'http://wp-events-plugin.com/documentation/template-tags/', 'http://wp-events-plugin.com/documentation/shortcodes/', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager&disable_hello_to_user=true' );
24
?>
25
<div id="message" class="updated">
26
<?php echo $advice; ?>
27
</div>
28
<?php
29
- }
30
-
31
- //If events page couldn't be created
32
- if( !empty($_GET['em_dismiss_admin_notice']) ){
33
- delete_option('dbem_admin_notice_'.$_GET['em_dismiss_admin_notice']);
34
- }else{
35
- if ( get_option('dbem_admin_notice_3.0.91') ){
36
- ?>
37
- <div class="updated">
38
- <p><?php echo sprintf ( __( '<strong>Events Manager has some new features!</strong><ul><li>Bookings can now be approved before they count towards your event\'s space allocations.</li><li>Events now have owners, and you can restrict users so they can only manage events/locations/categories they create.<br/><br/>These new permissions are enabled by default, but since you upgraded it has been disabled to maintain the previous plugin behaviour. You can re-enable it from the <a href="%s">settings page</a>. <a href="%s">Dismiss</a>', 'dbem'), get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_admin_notice=3.0.91' ); ?></p>
39
- </div>
40
- <?php
41
- }
42
- }
43
- //If events page couldn't be created
44
- if( !empty($_GET['em_dismiss_rc_notice']) ){
45
- delete_option('dbem_admin_notice_rc');
46
- }elseif( get_option('dbem_admin_notice_rc')){
47
- ?>
48
- <div class="updated">
49
- <p>
50
- <strong>Events Manager 4.0 on its way!</strong>
51
- We've just about finished with 4.0, which boasts TONS of long awaited features including advanced booking, permalinks, MultiSite and BuddPress integration, and much more!
52
- It is undergoing final testing to be released in the coming days, and the website has already had a documentation and tutorial overhaul in preparation.
53
- </p><p>
54
- To read up on the changes and get a hold of the Release Candidate
55
- <a href="http://wp-events-plugin.com/try-the-beta/?utm_source=plugin&utm_medium=html&utm_campaign=rc_notice">click here</a>.
56
- Please make sure to have a look at this page if you use EM for bookings or have made any mods to the plugin, as there are some considerations to make when upgrading.<br />
57
- <a href="http://wp-events-plugin.com/try-the-beta/?utm_source=plugin&utm_medium=html&utm_campaign=rc_notice">See what's new</a> | <a href="<?php echo $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_rc_notice=1' ?>">Dismiss this message.</a>
58
- </p>
59
- </div>
60
- <?php
61
}
62
63
- //If events page couldn't be created
64
if( !empty($_GET['em_dismiss_events_page']) ){
65
update_option('dbem_dismiss_events_page',1);
66
}else{
67
if ( !get_page($events_page_id) && !get_option('dbem_dismiss_events_page') ){
68
?>
69
<div id="em_page_error" class="updated">
70
- <p><?php echo sprintf ( __( 'Uh Oh! For some reason wordpress could not create an events page for you (or you just deleted it). Not to worry though, all you have to do is create an empty page, name it whatever you want, and select it as your events page in your <a href="%s">settings page</a>. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so <a href="%s">ignore this message</a>', 'dbem'), get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1' ); ?></p>
71
</div>
72
<?php
73
}
74
}
75
}
76
//Warn about EM page edit
77
if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
78
- $message = sprintf ( __ ( "This page corresponds to <strong>Events Manager</strong> events page. Its content will be overriden by <strong>Events Manager</strong>. If you want to display your content, you can can assign another page to <strong>Events Manager</strong> in the the <a href='%s'>Settings</a>. ", 'dbem' ), 'admin.php?page=events-manager-options' );
79
$notice = "<div class='error'><p>$message</p></div>";
80
echo $notice;
81
}
82
-
83
}
84
- add_action ( 'admin_notices', 'em_admin_warnings' );
85
86
/**
87
* Creates a wp-admin style navigation. All this does is wrap some html around the em_paginate function result to make it style correctly in the admin area.
@@ -93,53 +138,23 @@ add_action ( 'admin_notices', 'em_admin_warnings' );
93
* @return string
94
* @uses em_paginate()
95
*/
96
- function em_admin_paginate($link, $total, $limit, $page=1, $pagesToShow=5){
97
$return = '<div class="tablenav-pages">';
98
- $return .= sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>',
99
number_format_i18n( ( $page - 1 ) * $limit + 1 ),
100
number_format_i18n( min( $page * $limit, $total ) ),
101
- number_format_i18n( $total )
102
);
103
- $return .= em_paginate($link, $total, $limit, $page, $pagesToShow);
104
$return .= '</div>';
105
- return $return;
106
- }
107
-
108
- /**
109
- * Called by admin_print_scripts-(hook|page) action, created when adding menu items in events-manager.php
110
- */
111
- function em_admin_load_scripts(){
112
- //Load the UI items, currently date picker and autocomplete plus dependencies
113
- //wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/jquery-ui-1.8.5.custom.min.js', array('jquery', 'jquery-ui-core'));
114
- wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/em_ui.js', array('jquery', 'jquery-ui-core'));
115
-
116
- //Add maps
117
- if( get_option('dbem_gmap_is_active') ){
118
- wp_enqueue_script('em-google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
119
- }
120
- //Time Entry
121
- wp_enqueue_script('em-timeentry', WP_PLUGIN_URL.'/events-manager/includes/js/timeentry/jquery.timeentry.js', array('jquery'));
122
-
123
- //Date Picker Locale
124
- $locale_code = substr ( get_locale (), 0, 2 );
125
- $locale_file = "/events-manager/includes/js/i18n/jquery.ui.datepicker-$locale_code.js";
126
- if ( file_exists(WP_PLUGIN_DIR.$locale_file) ) {
127
- wp_enqueue_script("em-ui-datepicker-$locale_code", WP_PLUGIN_URL.$locale_file, array('em-ui-js'));
128
- }
129
- wp_enqueue_script('em-script', WP_PLUGIN_URL.'/events-manager/includes/js/em_admin.js', array('em-ui-js'));
130
-
131
- //TinyMCE Editor
132
- remove_filter('the_editor', 'qtrans_modifyRichEditor'); //qtranslate filter
133
- add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
134
- add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
135
- wp_enqueue_script('post');
136
- if ( user_can_richedit() )
137
- wp_enqueue_script('editor');
138
-
139
- add_thickbox();
140
- wp_enqueue_script('media-upload');
141
- wp_enqueue_script('word-count');
142
- wp_enqueue_script('quicktags');
143
}
144
145
/**
@@ -147,139 +162,7 @@ function em_admin_load_scripts(){
147
*/
148
function em_admin_load_styles() {
149
add_thickbox();
150
- wp_enqueue_style('em-ui-css', WP_PLUGIN_URL.'/events-manager/includes/css/jquery-ui-1.7.3.custom.css');
151
- wp_enqueue_style('events-manager-admin', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager_admin.css');
152
- }
153
-
154
- /**
155
- * Loads script inline due to insertion of php values
156
- */
157
- function em_admin_general_script() {
158
- //TODO clean script up, remove dependency of php so it can be moved to js file.
159
- // Check if the locale is there and loads it
160
- $locale_code = substr ( get_locale (), 0, 2 );
161
- $show24Hours = 'true';
162
- // Setting 12 hours format for those countries using it
163
- if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
164
- $show24Hours = 'false';
165
- ?>
166
- <script type="text/javascript">
167
- //<![CDATA[
168
- // TODO: make more general, to support also latitude and longitude (when added)
169
-
170
- jQuery(document).ready( function($) {
171
-
172
- function updateIntervalDescriptor () {
173
- $(".interval-desc").hide();
174
- var number = "-plural";
175
- if ($('input#recurrence-interval').val() == 1 || $('input#recurrence-interval').val() == "")
176
- number = "-singular"
177
- var descriptor = "span#interval-"+$("select#recurrence-frequency").val()+number;
178
- $(descriptor).show();
179
- }
180
- function updateIntervalSelectors () {
181
- $('p.alternate-selector').hide();
182
- $('p#'+ $('select#recurrence-frequency').val() + "-selector").show();
183
- }
184
- function updateShowHideRsvp () {
185
- if($('input#rsvp-checkbox').attr("checked")) {
186
- $("div#rsvp-data").fadeIn();
187
- } else {
188
- $("div#rsvp-data").hide();
189
- }
190
- }
191
- function updateShowHideRecurrence () {
192
- if( $('input#event-recurrence').attr("checked")) {
193
- $("#event_recurrence_pattern").fadeIn();
194
- $("#event-date-explanation").hide();
195
- $("#recurrence-dates-explanation").show();
196
- $("h3#recurrence-dates-title").show();
197
- $("h3#event-date-title").hide();
198
- } else {
199
- $("#event_recurrence_pattern").hide();
200
- $("#recurrence-dates-explanation").hide();
201
- $("#event-date-explanation").show();
202
- $("h3#recurrence-dates-title").hide();
203
- $("h3#event-date-title").show();
204
- }
205
- }
206
- $("#recurrence-dates-explanation").hide();
207
- $("#localised-date").show();
208
- $("#localised-end-date").show();
209
-
210
- $("#date-to-submit").hide();
211
- $("#end-date-to-submit").hide();
212
-
213
- $("#start-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?> });
214
- $("#end-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?>});
215
-
216
- $('input.select-all').change(function(){
217
- if($(this).is(':checked'))
218
- $('input.row-selector').attr('checked', true);
219
- else
220
- $('input.row-selector').attr('checked', false);
221
- });
222
-
223
- updateIntervalDescriptor();
224
- updateIntervalSelectors();
225
- updateShowHideRecurrence();
226
- updateShowHideRsvp();
227
- $('input#event-recurrence').change(updateShowHideRecurrence);
228
- $('input#rsvp-checkbox').change(updateShowHideRsvp);
229
-
230
- // recurrency elements
231
- $('input#recurrence-interval').keyup(updateIntervalDescriptor);
232
- $('select#recurrence-frequency').change(updateIntervalDescriptor);
233
- $('select#recurrence-frequency').change(updateIntervalSelectors);
234
-
235
- // hiding or showing notes according to their content
236
- $('.postbox h3').prepend('<a class="togbox">+</a> ');
237
- $('#event_notes h3').click( function() {
238
- $(this).parent().first().toggleClass('closed');
239
- });
240
-
241
- // users cannot submit the event form unless some fields are filled
242
- function validateEventForm(){
243
- errors = "";
244
- var recurring = $("input[@name=repeated_event]:checked").val();
245
- requiredFields= new Array('event_name', 'localised_event_date', 'location_name','location_address','location_town');
246
- var localisedRequiredFields = {
247
- 'event_name':"<?php _e ( 'Name', 'dbem' )?>",
248
- 'localised_event_date':"<?php _e ( 'Date', 'dbem' )?>",
249
- 'location_name':"<?php _e ( 'Location', 'dbem' )?>",
250
- 'location_address':"<?php _e ( 'Address', 'dbem' )?>",
251
- 'location_town':"<?php _e ( 'Town', 'dbem' )?>"
252
- };
253
- missingFields = new Array;
254
- for (var i in requiredFields) {
255
- if ($("input[@name=" + requiredFields[i]+ "]").val() == 0) {
256
- missingFields.push(localisedRequiredFields[requiredFields[i]]);
257
- $("input[@name=" + requiredFields[i]+ "]").css('border','2px solid red');
258
- } else {
259
- $("input[@name=" + requiredFields[i]+ "]").css('border','1px solid #DFDFDF');
260
- }
261
- }
262
-
263
- // alert('ciao ' + recurring+ " end: " + $("input[@name=localised_event_end_date]").val());
264
- if (missingFields.length > 0) {
265
- errors = "<?php _e ( 'Some required fields are missing:', 'dbem' )?> " + missingFields.join(", ") + ".\n";
266
- }
267
- if(recurring && $("input[@name=localised_event_end_date]").val() == "") {
268
- errors = errors + "<?php _e ( 'Since the event is repeated, you must specify an end date', 'dbem' )?>.";
269
- $("input[@name=localised_event_end_date]").css('border','2px solid red');
270
- } else {
271
- $("input[@name=localised_event_end_date]").css('border','1px solid #DFDFDF');
272
- }
273
- if(errors != "") {
274
- alert(errors);
275
- return false;
276
- }
277
- return true;
278
- }
279
- $('#event-form').bind("submit", validateEventForm);
280
- });
281
- //]]>
282
- </script>
283
- <?php
284
}
285
?>
1
<?php
2
//Admin functions
3
+ function em_admin_menu(){
4
+ global $menu, $submenu, $pagenow;
5
+ //Count pending bookings
6
+ $bookings_num = '';
7
+ $bookings_pending_count = apply_filters('em_bookings_pending_count',0);
8
+ if( get_option('dbem_bookings_approval') == 1){
9
+ $bookings_pending_count += count(EM_Bookings::get(array('status'=>'0'))->bookings);
10
+ }
11
+ if($bookings_pending_count > 0){
12
+ $bookings_num = '<span class="update-plugins count-'.$bookings_pending_count.'"><span class="plugin-count">'.$bookings_pending_count.'</span></span>';
13
+ }
14
+ //Count pending events
15
+ $events_num = '';
16
+ $events_pending_count = EM_Events::count(array('status'=>0, 'scope'=>'all'));
17
+ //TODO Add flexible permissions
18
+ if($events_pending_count > 0){
19
+ $events_num = '<span class="update-plugins count-'.$events_pending_count.'"><span class="plugin-count">'.$events_pending_count.'</span></span>';
20
+ }
21
+ $both_pending_count = apply_filters('em_items_pending_count', $events_pending_count + $bookings_pending_count);
22
+ $both_num = ($both_pending_count > 0) ? '<span class="update-plugins count-'.$both_pending_count.'"><span class="plugin-count">'.$both_pending_count.'</span></span>':'';
23
+ // Add a submenu to the custom top-level menu:
24
+ $plugin_pages = array();
25
+ if( !get_option('dbem_cp_events_recurring_show_menu') ){
26
+ $plugin_pages['recurrences'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Recurring Events', 'dbem'), __('Recurring Events', 'dbem'), 'edit_recurrences', 'events-manager-recurrences', array('EM_Event_Posts_Admin','recurrence_redirect'));
27
+ }
28
+ if( !get_option('dbem_cp_locations_show_menu') ){
29
+ $plugin_pages['locations'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Locations', 'dbem'), __('Locations', 'dbem'), 'read_others_locations', 'events-manager-locations', array('EM_Event_Posts_Admin','location_redirect'));
30
+ }
31
+ $plugin_pages['bookings'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Bookings', 'dbem'), __('Bookings', 'dbem').$bookings_num, 'manage_bookings', 'events-manager-bookings', "em_bookings_page");
32
+ $plugin_pages['options'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Events Manager Settings','dbem'),__('Settings','dbem'), 'activate_plugins', "events-manager-options", 'em_admin_options_page');
33
+ $plugin_pages['help'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Getting Help for Events Manager','dbem'),__('Help','dbem'), 'activate_plugins', "events-manager-help", 'em_admin_help_page');
34
+ $plugin_pages = apply_filters('em_create_events_submenu',$plugin_pages);
35
+ //We have to modify the menus manually
36
+ if( !empty($both_num) ){ //Main Event Menu
37
+ //go through the menu array and modify the events menu if found
38
+ foreach ( (array)$menu as $key => $parent_menu ) {
39
+ if ( $parent_menu[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
40
+ $menu[$key][0] = $menu[$key][0]. $both_num;
41
+ break;
42
+ }
43
+ }
44
+ }
45
+ if( !empty($events_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Event Item
46
+ //go through the menu array and modify the events menu if found
47
+ foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
48
+ if ( $submenu_item[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
49
+ $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_num;
50
+ break;
51
+ }
52
+ }
53
+ }
54
+ //highlight location/recurrence menus - hack!
55
+ global $pagenow, $post;
56
+ if( !get_option('dbem_cp_events_recurring_show_menu') ){
57
+ $is_rec_edit_page = ($pagenow == 'edit.php' && !empty($_GET['post_type']) && $_GET['post_type'] == 'event-recurring');
58
+ $is_rec_post_page = (($pagenow == 'post.php' || $pagenow == 'post-new.php' ) && ((!empty($_GET['post_type']) && $_GET['post_type'] == 'event-recurring') || (!empty($_GET['post']) && get_post_type($_GET['post'])== 'event-recurring')));
59
+ }
60
+ if( !get_option('dbem_cp_locations_show_menu') && !$is_rec_edit_page && !$is_rec_edit_page ){ //don't need to proceed if any of the last two were true
61
+ $is_loc_edit_page = ($pagenow == 'edit.php' && !empty($_GET['post_type']) && $_GET['post_type'] == EM_POST_TYPE_LOCATION);
62
+ $is_loc_post_page = (($pagenow == 'post.php' || $pagenow == 'post-new.php' ) && ((!empty($_GET['post_type']) && $_GET['post_type'] == EM_POST_TYPE_LOCATION) || (!empty($_GET['post']) && get_post_type($_GET['post'])== EM_POST_TYPE_LOCATION)));
63
+ }
64
+ if( $is_rec_edit_page || $is_rec_post_page || $is_loc_edit_page || $is_loc_post_page ){
65
+ foreach( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ){
66
+ if( $submenu_item[2] == 'events-manager-recurrences' && ($is_rec_edit_page || $is_rec_post_page) ){
67
+ $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = "<strong style='color:black'>".$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]."</strong>";
68
+ }elseif( $submenu_item[2] == 'events-manager-locations' && ($is_loc_edit_page || $is_loc_post_page) ){
69
+ $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = "<strong style='color:black'>".$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]."</strong>";
70
+ }
71
+ }
72
+ }
73
+ }
74
+ add_action('admin_menu','em_admin_menu');
75
76
/**
77
* Generate warnings and notices in the admin area
78
*/
79
function em_admin_warnings() {
80
+ global $EM_Notices;
81
//If we're editing the events page show hello to new user
82
$events_page_id = get_option ( 'dbem_events_page' );
83
$dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';
84
85
+ if( current_user_can('activate_plugins') ){
86
//New User Intro
87
if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){
88
// Disable Hello to new user if requested
89
+ update_option('dbem_hello_to_user',0);
90
+ }elseif ( get_option ( 'dbem_hello_to_user' ) ) {
91
//FIXME update welcome msg with good links
92
+ $advice = sprintf( __("<p>Events Manager is ready to go! It is highly recommended you read the <a href='%s'>Getting Started</a> guide on our site, as well as checking out the <a href='%s'>Settings Page</a>. <a href='%s' title='Don't show this advice again'>Dismiss</a></p>", 'dbem'), 'http://wp-events-plugin.com/documentation/getting-started/?utm_source=em&utm_medium=plugin&utm_content=installationlink&utm_campaign=plugin_links', EM_ADMIN_URL .'&amp;page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'disable_hello_to_user=true');
93
?>
94
<div id="message" class="updated">
95
<?php echo $advice; ?>
96
</div>
97
<?php
98
}
99
100
+ //If events page couldn't be created or is missing
101
if( !empty($_GET['em_dismiss_events_page']) ){
102
update_option('dbem_dismiss_events_page',1);
103
}else{
104
if ( !get_page($events_page_id) && !get_option('dbem_dismiss_events_page') ){
105
?>
106
<div id="em_page_error" class="updated">
107
+ <p><?php echo sprintf ( __( 'Uh Oh! For some reason wordpress could not create an events page for you (or you just deleted it). Not to worry though, all you have to do is create an empty page, name it whatever you want, and select it as your events page in your <a href="%s">settings page</a>. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so <a href="%s">ignore this message</a>', 'dbem'), EM_ADMIN_URL .'&amp;page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1' ); ?></p>
108
</div>
109
<?php
110
}
111
}
112
+
113
+ if( defined('EMP_VERSION') && EMP_VERSION < EM_PRO_MIN_VERSION ){
114
+ ?>
115
+ <div id="em_page_error" class="updated">
116
+ <p><?php __('There is a newer version of Events Manager Pro which is required for this current version of Events Manager. Please go to the plugin website and download the latest update.','dbem'); ?></p>
117
+ </div>
118
+ <?php
119
+ }
120
}
121
//Warn about EM page edit
122
if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
123
+ $message = sprintf ( __ ( "This page corresponds to <strong>Events Manager</strong> events page. Its content will be overriden by Events Manager, although if you include the word CONTENTS (exactly in capitals) and surround it with other text, only CONTENTS will be overwritten. If you want to change the way your events look, go to the <a href='%s'>settings</a> page. ", 'dbem' ), EM_ADMIN_URL .'&amp;page=events-manager-options' );
124
$notice = "<div class='error'><p>$message</p></div>";
125
echo $notice;
126
}
127
+ echo $EM_Notices;
128
}
129
+ add_action ( 'admin_notices', 'em_admin_warnings', 100 );
130
131
/**
132
* Creates a wp-admin style navigation. All this does is wrap some html around the em_paginate function result to make it style correctly in the admin area.
138
* @return string
139
* @uses em_paginate()
140
*/
141
+ function em_admin_paginate($total, $limit, $page=1, $vars=false){
142
$return = '<div class="tablenav-pages">';
143
+ $events_nav = paginate_links( array(
144
+ 'base' => add_query_arg( 'pno', '%#%' ),
145
+ 'format' => '',
146
+ 'total' => ceil($total / $limit),
147
+ 'current' => $page,
148
+ 'add_args' => $vars
149
+ ));
150
+ $return .= sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s', 'dbem') . ' </span>%s',
151
number_format_i18n( ( $page - 1 ) * $limit + 1 ),
152
number_format_i18n( min( $page * $limit, $total ) ),
153
+ number_format_i18n( $total ),
154
+ $events_nav
155
);
156
$return .= '</div>';
157
+ return apply_filters('em_admin_paginate',$return,$total,$limit,$page,$vars);
158
}
159
160
/**
162
*/
163
function em_admin_load_styles() {
164
add_thickbox();
165
+ wp_enqueue_style('em-ui-css', plugins_url('includes/css/jquery-ui-1.8.13.custom.css',dirname(__FILE__)));
166
+ wp_enqueue_style('events-manager-admin', plugins_url('includes/css/events_manager_admin.css',dirname(__FILE__)));
167
}
168
?>
admin/em-bookings.php CHANGED
@@ -6,46 +6,17 @@
6
function em_admin_actions_bookings() {
7
global $dbem_form_add_message;
8
global $dbem_form_delete_message;
9
- global $wpdb, $EM_Booking, $EM_Event;
10
11
- if( current_user_can(EM_MIN_CAPABILITY) && is_object($EM_Booking) && !empty($_REQUEST['action']) ) {
12
- if( $_REQUEST['action'] == 'bookings_delete' ){
13
- //Delete
14
- if( isset($_POST['booking_id']) ){
15
- $EM_Booking = new EM_Booking($_POST['booking_id']);
16
- $EM_Booking->delete();
17
- }
18
- }elseif( $_REQUEST['action'] == 'bookings_edit' ){
19
- //Edit Booking
20
- $validation = $EM_Booking->get_post();
21
- if ( $validation ) { //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
22
- //Save
23
- if( $EM_Booking->save() ) {
24
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
25
- }else{
26
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="error"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
27
- }
28
- }else{
29
- //TODO make errors clearer when saving person
30
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="error"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
31
- }
32
- add_action ( 'admin_notices', 'em_booking_save_notification' );
33
- }elseif( $_REQUEST['action'] == 'bookings_approve' || $_REQUEST['action'] == 'bookings_reject' || $_REQUEST['action'] == 'bookings_unapprove' ){
34
- //Booking Approvals
35
- $status_array = array('bookings_unapprove' => 0,'bookings_approve' => 1,'bookings_reject' => 2, 'bookings_cancel' => 3);
36
- if( $EM_Booking->set_status( $status_array[$_REQUEST['action']] ) ) {
37
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
38
- }else{
39
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="error"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
40
- }
41
- add_action ( 'admin_notices', 'em_booking_save_notification' );
42
- }elseif( $_REQUEST['action'] == 'bookings_add_note' ){
43
$EM_Booking->add_note($_REQUEST['booking_note']);
44
function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
45
add_action ( 'admin_notices', 'em_booking_save_notification' );
46
}
47
- }elseif( current_user_can(EM_MIN_CAPABILITY) && is_object($EM_Event) && !empty($_REQUEST['action']) ){
48
- if( $_REQUEST['action'] == 'export_csv' ){
49
$EM_Event->get_bookings()->export_csv();
50
exit();
51
}
@@ -57,13 +28,18 @@ add_action('admin_init','em_admin_actions_bookings',100);
57
* Decide what content to show in the bookings section.
58
*/
59
function em_bookings_page(){
60
//First any actions take priority
61
- if( !empty($_REQUEST['booking_id']) ){
62
em_bookings_single();
63
}elseif( !empty($_REQUEST['person_id']) ){
64
em_bookings_person();
65
}elseif( !empty($_REQUEST['event_id']) ){
66
em_bookings_event();
67
}else{
68
em_bookings_dashboard();
69
}
@@ -73,6 +49,7 @@ function em_bookings_page(){
73
* Generates the bookings dashboard, showing information on all events
74
*/
75
function em_bookings_dashboard(){
76
?>
77
<div class='wrap'>
78
<div id='icon-users' class='icon32'>
@@ -81,12 +58,14 @@ function em_bookings_dashboard(){
81
<h2>
82
<?php _e('Event Bookings Dashboard', 'dbem'); ?>
83
</h2>
84
- <?php if( get_option('dbem_bookings_approval') ): ?>
85
<h2><?php _e('Pending Bookings','dbem'); ?></h2>
86
<?php em_bookings_pending_table(); ?>
87
<?php endif; ?>
88
<h2><?php _e('Events With Bookings Enabled','dbem'); ?></h2>
89
<?php em_bookings_events_table(); ?>
90
</div>
91
<?php
92
}
@@ -95,9 +74,9 @@ function em_bookings_dashboard(){
95
* Shows all booking data for a single event
96
*/
97
function em_bookings_event(){
98
- global $EM_Event,$EM_Person;
99
//check that user can access this page
100
- if( is_object($EM_Event) && !$EM_Event->can_manage() ){
101
?>
102
<div class="wrap"><h2><?php _e('Unauthorized Access','dbem'); ?></h2><p><?php _e('You do not have the rights to manage this event.','dbem'); ?></p></div>
103
<?php
@@ -112,12 +91,14 @@ function em_bookings_event(){
112
</div>
113
<h2>
114
<?php echo sprintf(__('Manage %s Bookings', 'dbem'), "'{$EM_Event->name}'"); ?>
115
- <a href="admin.php?page=events-manager-event&event_id=<?php echo $EM_Event->id; ?>" class="button add-new-h2"><?php _e('View/Edit Event','dbem') ?></a>
116
</h2>
117
- <div><a href='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=events-manager-bookings&action=export_csv&event_id=".$EM_Event->id ?>'><?php _e('export csv','dbem')?></a></div>
118
<div>
119
<p><strong><?php _e('Event Name','dbem'); ?></strong> : <?php echo ($EM_Event->name); ?></p>
120
- <p><strong>Availability :</strong> <?php echo $EM_Event->get_bookings()->get_booked_seats() . '/'. $EM_Event->seats ." ". __('Seats confirmed','dbem'); ?></p>
121
<p>
122
<strong><?php _e('Date','dbem'); ?></strong> :
123
<?php echo $localised_start_date; ?>
@@ -126,10 +107,10 @@ function em_bookings_event(){
126
</p>
127
<p>
128
<strong><?php _e('Location','dbem'); ?></strong> :
129
- <a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-locations&amp;location_id=<?php echo $EM_Event->location->id ?>"><?php echo ($EM_Event->location->name); ?></a>
130
</p>
131
</div>
132
- <?php if( get_option('dbem_bookings_approval') ): ?>
133
<h2><?php _e('Pending Bookings','dbem'); ?></h2>
134
<?php em_bookings_pending_table(); ?>
135
<?php endif; ?>
@@ -139,15 +120,68 @@ function em_bookings_event(){
139
<?php em_bookings_rejected_table(); ?>
140
<h2><?php _e('Cancelled Bookings','dbem'); ?></h2>
141
<?php em_bookings_cancelled_table(); ?>
142
</div>
143
<?php
144
}
145
146
/**
147
* Shows a single booking for a single person.
148
*/
149
function em_bookings_single(){
150
- global $EM_Booking;
151
//check that user can access this page
152
if( is_object($EM_Booking) && !$EM_Booking->can_manage() ){
153
?>
@@ -163,35 +197,138 @@ function em_bookings_single(){
163
<h2>
164
<?php _e('Edit Booking', 'dbem'); ?>
165
</h2>
166
- <div id="poststuff" class="metabox-holder has-right-sidebar">
167
<div id="post-body">
168
<div id="post-body-content">
169
- <div id="event_name" class="stuffbox">
170
<h3>
171
<?php _e ( 'Booking Details', 'dbem' ); ?>
172
</h3>
173
<div class="inside">
174
- <?php em_bookings_edit_form(); ?>
175
</div>
176
- </div>
177
- </div>
178
- </div>
179
- </div>
180
- <br style="clear:both;" />
181
- <div id="poststuff" class="metabox-holder has-right-sidebar">
182
- <div id="post-body">
183
- <div id="post-body-content">
184
- <div id="event_name" class="stuffbox">
185
<h3>
186
<?php _e ( 'Booking Notes', 'dbem' ); ?>
187
</h3>
188
<div class="inside">
189
<p><?php _e('You can add private notes below for internal reference that only event managers will see.','dbem'); ?></p>
190
<?php foreach( $EM_Booking->notes as $note ):
191
- $user = get_userdata($note['author']);
192
?>
193
<div>
194
- <?php echo date(get_option('date_format'), $note['timestamp']) .' - '. $user->display_name; ?> <?php _e('wrote','dbem'); ?>:
195
<p style="background:#efefef; padding:5px;"><?php echo nl2br($note['note']); ?></p>
196
</div>
197
<?php endforeach; ?>
@@ -202,11 +339,12 @@ function em_bookings_single(){
202
</form>
203
</div>
204
</div>
205
</div>
206
</div>
207
</div>
208
<br style="clear:both;" />
209
- <?php do_action('em_bookings_single_footer'); ?>
210
</div>
211
<?php
212
@@ -216,7 +354,20 @@ function em_bookings_single(){
216
* Shows all bookings made by one person.
217
*/
218
function em_bookings_person(){
219
- global $EM_Person;
220
?>
221
<div class='wrap'>
222
<div id='icon-users' class='icon32'>
@@ -224,8 +375,12 @@ function em_bookings_person(){
224
</div>
225
<h2>
226
<?php _e('Manage Person\'s Booking', 'dbem'); ?>
227
- <a href="admin.php?page=events-manager-bookings&action=person_delete&person_id=<?php echo $EM_Person->id; ?>" onclick="if( !confirm('<?php _e('Are you sure you want to delete this person? All bookings corresponding to this person will be deleted and this is not reversible.','dbem') ?>') ){ return false; }" class="button add-new-h2"><?php _e('Delete Person','dbem') ?></a>
228
</h2>
229
<div id="poststuff" class="metabox-holder has-right-sidebar">
230
<div id="post-body">
231
<div id="post-body-content">
@@ -234,55 +389,34 @@ function em_bookings_person(){
234
<?php _e ( 'Personal Details', 'dbem' ); ?>
235
</h3>
236
<div class="inside">
237
- <?php em_person_edit_form(); ?>
238
</div>
239
</div>
240
</div>
241
</div>
242
</div>
243
<br style="clear:both;" />
244
<h3><?php _e('Past And Present Bookings','dbem'); ?></h3>
245
<?php em_bookings_person_table(); ?>
246
</div>
247
<?php
248
}
249
250
- function em_bookings_edit_form(){
251
- global $EM_Booking;
252
- $EM_Event = new EM_Event($EM_Booking->event_id);
253
- $localised_start_date = date_i18n('D d M Y', $EM_Event->start);
254
- $localised_end_date = date_i18n('D d M Y', $EM_Event->end);
255
- ?>
256
- <form action="" method="post" id="em-person-form">
257
- <h4>Event Details</h4>
258
- <table>
259
- <tr><td><strong><?php _e('Name','dbem'); ?></strong></td><td><a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;event_id=<?php echo $EM_Event->id ?>"><?php echo ($EM_Event->name); ?></a></td></tr>
260
- <tr>
261
- <td><strong><?php _e('Date/Time','dbem'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td>
262
- <td>
263
- <?php echo $localised_start_date; ?>
264
- <?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
265
- <?php echo substr ( $EM_Event->start_time, 0, 5 ) . " - " . substr ( $EM_Event->end_time, 0, 5 ); ?>
266
- </td>
267
- </tr>
268
- </table>
269
- <h4>Personal Details</h4>
270
- <table>
271
- <tr><td><strong><?php _e('Name','dbem'); ?> </strong></td><td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person_id; ?>"><?php echo $EM_Booking->person->name ?></a></td></tr>
272
- <tr><td><strong><?php _e('Phone','dbem'); ?> </strong></td><td><?php echo $EM_Booking->person->phone; ?></td></tr>
273
- <tr><td><strong><?php _e('E-mail','dbem'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td><td><?php echo $EM_Booking->person->email; ?></td></tr>
274
- </table>
275
- <h4>Booking Details</h4>
276
- <table>
277
- <tr><td><strong><?php _e('Spaces','dbem'); ?> </strong></td><td><input type="text" name="booking_seats" value="<?php echo $EM_Booking->seats; ?>" /></td></tr>
278
- <tr><td><strong><?php _e('Comment','dbem'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td><td><textarea name="booking_comment"><?php echo $EM_Booking->comment; ?></textarea></td></tr>
279
- </table>
280
- <p class="submit">
281
- <input type="submit" name="events_update" value="<?php _e ( 'Save' ); ?> &raquo;" />
282
- </p>
283
- <input type="hidden" name="action" value="bookings_edit" />
284
- <input type="hidden" name="booking_id" value="<?php echo $EM_Booking->id; ?>" />
285
- </form>
286
- <?php
287
- }
288
?>
6
function em_admin_actions_bookings() {
7
global $dbem_form_add_message;
8
global $dbem_form_delete_message;
9
+ global $wpdb, $EM_Booking, $EM_Event, $EM_Notices;
10
11
+ if( is_object($EM_Booking) && !empty($_REQUEST['action']) && $EM_Booking->can_manage('manage_bookings','manage_others_bookings') ) {
12
+ if( $_REQUEST['action'] == 'bookings_add_note' ){
13
$EM_Booking->add_note($_REQUEST['booking_note']);
14
function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
15
add_action ( 'admin_notices', 'em_booking_save_notification' );
16
}
17
+ }
18
+ if( is_object($EM_Event) && !empty($_REQUEST['action']) ){
19
+ if( $_REQUEST['action'] == 'bookings_export_csv' && wp_verify_nonce($_REQUEST['_wpnonce'],'bookings_export_csv') ){
20
$EM_Event->get_bookings()->export_csv();
21
exit();
22
}
28
* Decide what content to show in the bookings section.
29
*/
30
function em_bookings_page(){
31
+ global $action;
32
//First any actions take priority
33
+ if( !empty($_REQUEST['action']) && substr($_REQUEST['action'],0,7) != 'booking' ){ //actions not starting with booking_
34
+ do_action('em_bookings_'.$action);
35
+ }elseif( !empty($_REQUEST['booking_id']) ){
36
em_bookings_single();
37
}elseif( !empty($_REQUEST['person_id']) ){
38
em_bookings_person();
39
}elseif( !empty($_REQUEST['event_id']) ){
40
em_bookings_event();
41
+ }elseif( !empty($_REQUEST['ticket_id']) ){
42
+ em_bookings_ticket();
43
}else{
44
em_bookings_dashboard();
45
}
49
* Generates the bookings dashboard, showing information on all events
50
*/
51
function em_bookings_dashboard(){
52
+ global $EM_Notices;
53
?>
54
<div class='wrap'>
55
<div id='icon-users' class='icon32'>
58
<h2>
59
<?php _e('Event Bookings Dashboard', 'dbem'); ?>
60
</h2>
61
+ <?php echo $EM_Notices; ?>
62
+ <?php if( get_option('dbem_bookings_approval')): ?>
63
<h2><?php _e('Pending Bookings','dbem'); ?></h2>
64
<?php em_bookings_pending_table(); ?>
65
<?php endif; ?>
66
<h2><?php _e('Events With Bookings Enabled','dbem'); ?></h2>
67
<?php em_bookings_events_table(); ?>
68
+ <?php do_action('em_bookings_dashboard'); ?>
69
</div>
70
<?php
71
}
74
* Shows all booking data for a single event
75
*/
76
function em_bookings_event(){
77
+ global $EM_Event,$EM_Person,$EM_Notices;
78
//check that user can access this page
79
+ if( is_object($EM_Event) && !$EM_Event->can_manage('manage_bookings','manage_others_bookings') ){
80
?>
81
<div class="wrap"><h2><?php _e('Unauthorized Access','dbem'); ?></h2><p><?php _e('You do not have the rights to manage this event.','dbem'); ?></p></div>
82
<?php
91
</div>
92
<h2>
93
<?php echo sprintf(__('Manage %s Bookings', 'dbem'), "'{$EM_Event->name}'"); ?>
94
+ <a href="<?php echo $EM_Event->output('#_EDITEVENTURL'); ?>" class="button add-new-h2"><?php _e('View/Edit Event','dbem') ?></a>
95
+ <?php do_action('em_admin_event_booking_options_buttons'); ?>
96
</h2>
97
+ <?php echo $EM_Notices; ?>
98
+ <div><a href='<?php echo EM_ADMIN_URL ."&amp;page=events-manager-bookings&action=bookings_export_csv&_wpnonce=".wp_create_nonce('bookings_export_csv')."&event_id=".$EM_Event->id ?>'><?php _e('export csv','dbem')?></a></div>
99
<div>
100
<p><strong><?php _e('Event Name','dbem'); ?></strong> : <?php echo ($EM_Event->name); ?></p>
101
+ <p><strong><?php _e('Availability','dbem'); ?></strong> : <?php echo $EM_Event->get_bookings()->get_booked_spaces() . '/'. $EM_Event->get_spaces() ." ". __('Spaces confirmed','dbem'); ?></p>
102
<p>
103
<strong><?php _e('Date','dbem'); ?></strong> :
104
<?php echo $localised_start_date; ?>
107
</p>
108
<p>
109
<strong><?php _e('Location','dbem'); ?></strong> :
110
+ <a class="row-title" href="<?php echo admin_url(); ?>post.php?action=edit&amp;post=<?php echo $EM_Event->get_location()->post_id ?>"><?php echo ($EM_Event->get_location()->name); ?></a>
111
</p>
112
</div>
113
+ <?php if( get_option('dbem_bookings_approval')): ?>
114
<h2><?php _e('Pending Bookings','dbem'); ?></h2>
115
<?php em_bookings_pending_table(); ?>
116
<?php endif; ?>
120
<?php em_bookings_rejected_table(); ?>
121
<h2><?php _e('Cancelled Bookings','dbem'); ?></h2>
122
<?php em_bookings_cancelled_table(); ?>
123
+ <?php do_action('em_bookings_event_footer', $EM_Event); ?>
124
</div>
125
<?php
126
}
127
128
+ /**
129
+ * Shows a ticket view
130
+ */
131
+ function em_bookings_ticket(){
132
+ global $EM_Ticket,$EM_Notices;
133
+ $EM_Event = $EM_Ticket->get_event();
134
+ //check that user can access this page
135
+ if( is_object($EM_Ticket) && !$EM_Ticket->can_manage() ){
136
+ ?>
137
+ <div class="wrap"><h2><?php _e('Unauthorized Access','dbem'); ?></h2><p><?php _e('You do not have the rights to manage this ticket.','dbem'); ?></p></div>
138
+ <?php
139
+ return false;
140
+ }
141
+ ?>
142
+ <div class='wrap'>
143
+ <div id='icon-users' class='icon32'>
144
+ <br/>
145
+ </div>
146
+ <h2>
147
+ <?php echo sprintf(__('Ticket for %s', 'dbem'), "'{$EM_Event->name}'"); ?>
148
+ <a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-event&event_id=<?php echo $EM_Event->id; ?>" class="button add-new-h2"><?php _e('View/Edit Event','dbem') ?></a>
149
+ <a href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&event_id=<?php echo $EM_Event->id; ?>" class="button add-new-h2"><?php _e('View Event Bookings','dbem') ?></a>
150
+ </h2>
151
+ <?php echo $EM_Notices; ?>
152
+ <div>
153
+ <table>
154
+ <tr><td><?php echo __('Name','dbem'); ?></td><td></td><td><?php echo $EM_Ticket->name; ?></td></tr>
155
+ <tr><td><?php echo __('Description','dbem'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td></td><td><?php echo ($EM_Ticket->description) ? $EM_Ticket->description : '-'; ?></td></tr>
156
+ <tr><td><?php echo __('Price','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->price) ? $EM_Ticket->price : '-'; ?></td></tr>
157
+ <tr><td><?php echo __('Spaces','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->spaces) ? $EM_Ticket->spaces : '-'; ?></td></tr>
158
+ <tr><td><?php echo __('Min','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->min) ? $EM_Ticket->min : '-'; ?></td></tr>
159
+ <tr><td><?php echo __('Max','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->max) ? $EM_Ticket->max : '-'; ?></td></tr>
160
+ <tr><td><?php echo __('Start','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->start) ? $EM_Ticket->start : '-'; ?></td></tr>
161
+ <tr><td><?php echo __('End','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->end) ? $EM_Ticket->end : '-'; ?></td></tr>
162
+ <?php do_action('em_booking_admin_ticket_row', $EM_Ticket); ?>
163
+ </table>
164
+ </div>
165
+ <?php if( get_option('dbem_bookings_approval')): ?>
166
+ <h2><?php _e('Pending Bookings','dbem'); ?></h2>
167
+ <?php em_bookings_pending_table(); ?>
168
+ <?php endif; ?>
169
+ <h2><?php _e('Confirmed Bookings','dbem'); ?></h2>
170
+ <?php em_bookings_confirmed_table(); ?>
171
+ <h2><?php _e('Rejected Bookings','dbem'); ?></h2>
172
+ <?php em_bookings_rejected_table(); ?>
173
+ <h2><?php _e('Cancelled Bookings','dbem'); ?></h2>
174
+ <?php em_bookings_cancelled_table(); ?>
175
+ <?php do_action('em_bookings_ticket_footer', $EM_Ticket); ?>
176
+ </div>
177
+ <?php
178
+ }
179
+
180
/**
181
* Shows a single booking for a single person.
182
*/
183
function em_bookings_single(){
184
+ global $EM_Booking, $EM_Notices;
185
//check that user can access this page
186
if( is_object($EM_Booking) && !$EM_Booking->can_manage() ){
187
?>
197
<h2>
198
<?php _e('Edit Booking', 'dbem'); ?>
199
</h2>
200
+ <?php echo $EM_Notices; ?>
201
+ <div id="poststuff" class="metabox-holder">
202
<div id="post-body">
203
<div id="post-body-content">
204
+ <div id="em-booking-details" class="stuffbox">
205
+ <h3>
206
+ <?php _e ( 'Event Details', 'dbem' ); ?>
207
+ </h3>
208
+ <div class="inside">
209
+ <?php
210
+ $EM_Event = $EM_Booking->get_event();
211
+ $localised_start_date = date_i18n('D d M Y', $EM_Event->start);
212
+ $localised_end_date = date_i18n('D d M Y', $EM_Event->end);
213
+ ?>
214
+ <table>
215
+ <tr><td><strong><?php _e('Name','dbem'); ?></strong></td><td><a class="row-title" href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;event_id=<?php echo $EM_Event->id ?>"><?php echo ($EM_Event->name); ?></a></td></tr>
216
+ <tr>
217
+ <td><strong><?php _e('Date/Time','dbem'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td>
218
+ <td>
219
+ <?php echo $localised_start_date; ?>
220
+ <?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
221
+ <?php echo substr ( $EM_Event->start_time, 0, 5 ) . " - " . substr ( $EM_Event->end_time, 0, 5 ); ?>
222
+ </td>
223
+ </tr>
224
+ </table>
225
+ </div>
226
+ </div>
227
+ <div id="em-booking-details" class="stuffbox">
228
+ <h3>
229
+ <?php _e ( 'Personal Details', 'dbem' ); ?>
230
+ </h3>
231
+ <div class="inside">
232
+ <?php echo $EM_Booking->get_person()->display_summary(); ?>
233
+ </div>
234
+ </div>
235
+ <div id="em-booking-details" class="stuffbox">
236
<h3>
237
<?php _e ( 'Booking Details', 'dbem' ); ?>
238
</h3>
239
<div class="inside">
240
+ <?php
241
+ $EM_Event = $EM_Booking->get_event();
242
+ $localised_start_date = date_i18n('D d M Y', $EM_Event->start);
243
+ $localised_end_date = date_i18n('D d M Y', $EM_Event->end);
244
+ $shown_tickets = array();
245
+ ?>
246
+ <p><strong><?php _e('Status','dbem'); ?> : </strong><?php echo $EM_Booking->get_status(); ?></p>
247
+ <form action="" method="post">
248
+ <table class="em-tickets-bookings-table" cellspacing="0" cellpadding="0">
249
+ <thead>
250
+ <tr>
251
+ <th><?php _e('Ticket Type','dbem'); ?></th>
252
+ <th><?php _e('Spaces','dbem'); ?></th>
253
+ <th><?php _e('Price','dbem'); ?></th>
254
+ </tr>
255
+ </thead>
256
+ <tbody>
257
+ <?php foreach($EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking): ?>
258
+ <tr>
259
+ <td class="ticket-type"><a class="row-title" href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;ticket_id=<?php echo $EM_Ticket_Booking->get_ticket()->id ?>"><?php echo $EM_Ticket_Booking->get_ticket()->name ?></a></td>
260
+ <td>
261
+ <input name="em_tickets[<?php echo $EM_Ticket_Booking->get_ticket()->id; ?>][spaces]" class="em-ticket-select" value="<?php echo $EM_Ticket_Booking->get_spaces(); ?>" />
262
+ </td>
263
+ <td><?php echo $EM_Ticket_Booking->get_price(true,true); ?></td>
264
+ </tr>
265
+ <?php $shown_tickets[] = $EM_Ticket_Booking->ticket_id; ?>
266
+ <?php endforeach; ?>
267
+ <?php if( count($shown_tickets) < count($EM_Event->get_bookings()->get_tickets()->tickets)): ?><tr>
268
+ <?php foreach($EM_Event->get_bookings()->get_tickets()->tickets as $EM_Ticket): ?>
269
+ <?php if( !in_array($EM_Ticket->id, $shown_tickets) ): ?>
270
+ <tr>
271
+ <td class="ticket-type"><a class="row-title" href="<?php echo EM_ADMIN_URL; ?>&amp;page=events-manager-bookings&amp;ticket_id=<?php echo $EM_Ticket->id ?>"><?php echo $EM_Ticket->name ?></a></td>
272
+ <td>
273
+ <input name="em_tickets[<?php echo $EM_Ticket->id; ?>][spaces]" class="em-ticket-select" value="0" />
274
+ </td>
275
+ <td><?php echo em_get_currency_symbol() ?>0.00</td>
276
+ </tr>
277
+ <?php endif; ?>
278
+ <?php endforeach; ?>
279
+ <?php endif; ?>
280
+ </tbody>
281
+ <tfoot>
282
+ <tr>
283
+ <th><?php _e('Totals','dbem'); ?></th>
284
+ <th><?php echo $EM_Booking->get_spaces(); ?></th>
285
+ <th><?php echo $EM_Booking->get_price(true, true); ?></th>
286
+ </tr>
287
+ <?php if( !get_option('dbem_bookings_tax_auto_add') && is_numeric(get_option('dbem_bookings_tax')) && get_option('dbem_bookings_tax') > 0 ): ?>
288
+ <tr>
289
+ <th><?php _e('Tax','dbem'); ?></th>
290
+ <th><?php echo get_option('dbem_bookings_tax') ?>%</th>
291
+ <th><?php echo em_get_currency_symbol().number_format($EM_Booking->get_price() * (get_option('dbem_bookings_tax')/100),2); ?></th>
292
+ </tr>
293
+ <tr>
294
+ <th><?php _e('Total (inc. tax)','dbem'); ?></th>
295
+ <th>&nbsp;</th>
296
+ <th><?php echo em_get_currency_symbol().number_format($EM_Booking->get_price()* (1 + get_option('dbem_bookings_tax')/100),2); ?></th>
297
+ </tr>
298
+ <?php endif; ?>
299
+ </tfoot>
300
+ </table>
301
+ <p>
302
+ <input type="submit" class="em-booking-submit" id="em-booking-submit" value="<?php _e('Modify Booking', 'dbem'); ?>" />
303
+ <input type='hidden' name='action' value='booking_save'/>
304
+ <input type='hidden' name='booking_id' value='<?php echo $EM_Booking->id; ?>'/>
305
+ <input type='hidden' name='event_id' value='<?php echo $EM_Event->id; ?>'/>
306
+ <input type='hidden' name='_wpnonce' value='<?php echo wp_create_nonce('booking_save'); ?>'/>
307
+ <em><?php _e('<strong>Note:</strong> ticket availability not taken into account (i.e. you can overbook). Confirmation email is not resent automatically.','dbem'); ?></em>
308
+ </p>
309
+ <table cellspacing="0" cellpadding="0">
310
+ <?php if( !get_option('em_booking_form_custom') ): ?>
311
+ <tr><td><strong><?php _e('Comment','dbem'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td><td><?php echo $EM_Booking->comment; ?></td></tr>
312
+ <?php foreach( $EM_Booking->get_custom() as $custom_option ){
313
+ ?><tr><td><strong><?php echo $custom_option['name'] ?></strong></td><td><?php echo esc_html($custom_option['value']); ?></td></tr><?php
314
+ } ?>
315
+ <?php else: do_action('em_bookings_single_custom',$EM_Booking); ?>
316
+ <?php endif; ?>
317
+ </table>
318
+ </form>
319
</div>
320
+ </div>
321
+ <div id="em-booking-notes" class="stuffbox">
322
<h3>
323
<?php _e ( 'Booking Notes', 'dbem' ); ?>
324
</h3>
325
<div class="inside">
326
<p><?php _e('You can add private notes below for internal reference that only event managers will see.','dbem'); ?></p>
327
<?php foreach( $EM_Booking->notes as $note ):
328
+ $user = new EM_Person($note['author']);
329
?>
330
<div>
331