Events Manager - Version 5.0b3

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.0b3
Comparing to
See all releases

Code changes from version 3.0.98 to 5.0b3

Files changed (237) hide show
  1. admin/bookings/em-cancelled.php +28 -24
  2. admin/bookings/em-confirmed.php +32 -28
  3. admin/bookings/em-events.php +10 -10
  4. admin/bookings/em-pending.php +40 -36
  5. admin/bookings/em-person.php +25 -23
  6. admin/bookings/em-rejected.php +29 -25
  7. admin/em-admin.php +184 -213
  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-ms-locations.php +55 -0
  17. admin/em-ms-options.php +213 -0
  18. admin/em-options.php +1197 -297
  19. admin/em-people.php +0 -192
  20. buddypress/bp-em-activity.php +126 -0
  21. buddypress/bp-em-core.php +240 -0
  22. buddypress/bp-em-groups.php +57 -0
  23. buddypress/bp-em-notifications.php +82 -0
  24. buddypress/bp-em-templatetags.php +21 -0
  25. buddypress/screens/attending.php +29 -0
  26. buddypress/screens/group-events.php +30 -0
  27. buddypress/screens/my-bookings.php +35 -0
  28. buddypress/screens/my-events.php +67 -0
  29. buddypress/screens/my-group-events.php +27 -0
  30. buddypress/screens/my-locations.php +69 -0
  31. buddypress/screens/profile.php +32 -0
  32. classes/em-booking.php +355 -104
  33. classes/em-bookings.php +260 -162
  34. classes/em-calendar.php +101 -126
  35. classes/em-categories-taxonomy.php +87 -0
  36. classes/em-categories.php +259 -107
  37. classes/em-category-taxonomy.php +57 -0
  38. classes/em-category.php +136 -95
  39. classes/em-event-post-admin.php +372 -0
  40. classes/em-event-post.php +250 -0
  41. classes/em-event-posts-admin.php +243 -0
  42. classes/em-event.php +1311 -607
  43. classes/em-events.php +180 -70
  44. classes/em-location-post-admin.php +123 -0
  45. classes/em-location-post.php +67 -0
  46. classes/em-location-posts-admin.php +68 -0
  47. classes/em-location.php +484 -189
  48. classes/em-locations.php +139 -58
  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 +401 -41
  53. classes/em-people.php +19 -114
  54. classes/em-permalinks.php +191 -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 +338 -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 +512 -0
  88. em-ajax.php +0 -101
  89. em-bookings.php +0 -163
  90. em-debug.php +46 -0
  91. em-events.php +181 -103
  92. em-functions.php +327 -97
  93. em-ical.php +33 -0
  94. em-install.php +736 -386
  95. em-posts.php +334 -0
  96. em-rss.php +0 -39
  97. em-shortcode.php +53 -8
  98. em-template-tags.php +174 -13
  99. em-upgrade.php +5 -0
  100. events-manager.php +463 -162
  101. includes/css/events_manager.css +118 -69
  102. includes/css/events_manager_admin.css +54 -4
  103. includes/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  104. includes/css/jquery-ui-1.7.3.custom.css +0 -344
  105. includes/css/{jquery-ui-1.8.5.custom.css → jquery-ui-1.8.13.custom.css} +11 -15
  106. includes/images/close.png +0 -0
  107. includes/images/event-caps-source.png +0 -0
  108. includes/images/event-caps.jpg +0 -0
  109. includes/images/event-perms-source.png +0 -0
  110. includes/js/bookingsform.js +56 -0
  111. includes/js/categories-admin.js +53 -0
  112. includes/js/em_admin.js +0 -271
  113. includes/js/em_calendar_ajax.js +0 -19
  114. includes/js/em_maps.js +0 -92
  115. includes/js/em_ui.js +0 -27
  116. includes/js/events-manager-source.js +668 -0
  117. includes/js/events-manager.js +786 -0
  118. includes/js/i18n/jquery.ui.datepicker-nl.js +3 -2
  119. includes/js/jquery-ui-1.8.5/jquery-ui-1.8.5.custom.min.js +0 -160
  120. includes/js/timeentry/jquery.timeentry-de.js +0 -9
  121. includes/js/timeentry/jquery.timeentry-es.js +0 -9
  122. includes/js/timeentry/jquery.timeentry-fr.js +0 -9
  123. includes/js/timeentry/jquery.timeentry-hu.js +0 -9
  124. includes/js/timeentry/jquery.timeentry-it.js +0 -9
  125. includes/js/timeentry/jquery.timeentry-nl.js +0 -9
  126. includes/js/timeentry/jquery.timeentry-pl.js +0 -9
  127. includes/js/timeentry/jquery.timeentry-pt.js +0 -9
  128. includes/js/timeentry/jquery.timeentry-ro.js +0 -9
  129. includes/js/timeentry/jquery.timeentry-ru.js +0 -9
  130. includes/js/timeentry/jquery.timeentry-sk.js +0 -9
  131. includes/js/timeentry/jquery.timeentry-sv.js +0 -9
  132. includes/js/timeentry/jquery.timeentry-tr.js +0 -9
  133. includes/js/timeentry/jquery.timeentry-zh-CN.js +0 -9
  134. includes/js/timeentry/jquery.timeentry.compat-1.2.6.js +0 -77
  135. includes/js/timeentry/jquery.timeentry.css +0 -8
  136. includes/js/timeentry/jquery.timeentry.ent +0 -22
  137. includes/js/timeentry/jquery.timeentry.js +0 -900
  138. includes/js/timeentry/jquery.timeentry.min.js +0 -7
  139. includes/js/timeentry/jquery.timeentry.pack.js +0 -7
  140. includes/js/timeentry/timeEntry.png +0 -0
  141. includes/js/timeentry/timeEntry2.png +0 -0
  142. includes/js/timeentry/timeEntry3.png +0 -0
  143. includes/js/timeentry/timeEntry4.png +0 -0
  144. includes/js/timeentry/timeEntry5.png +0 -0
  145. includes/js/timeentry/timeEntry6.png +0 -0
  146. includes/langs/dbem-cs_CZ.mo +0 -0
  147. includes/langs/dbem-cs_CZ.po +4239 -886
  148. includes/langs/dbem-da_DK.mo +0 -0
  149. includes/langs/dbem-da_DK.po +5510 -0
  150. includes/langs/dbem-de_DE.mo +0 -0
  151. includes/langs/dbem-de_DE.po +3693 -1089
  152. includes/langs/dbem-es_ES.mo +0 -0
  153. includes/langs/dbem-es_ES.po +3695 -1160
  154. includes/langs/dbem-fr_FR.mo +0 -0
  155. includes/langs/dbem-fr_FR.po +5071 -0
  156. includes/langs/dbem-hu_HU.mo +0 -0
  157. includes/langs/dbem-hu_HU.po +4385 -0
  158. includes/langs/dbem-it_IT.mo +0 -0
  159. includes/langs/dbem-it_IT.po +3767 -1044
  160. includes/langs/dbem-pt_PT.mo +0 -0
  161. includes/langs/dbem-pt_PT.po +4112 -0
  162. includes/langs/dbem-ru_RU.mo +0 -0
  163. includes/langs/dbem-ru_RU.po +4678 -0
  164. includes/langs/dbem-sv_SE.mo +0 -0
  165. includes/langs/dbem-sv_SE.po +3915 -861
  166. includes/langs/events-manager.pot +4615 -1316
  167. includes/{sample-placeholers → sample-placeholders}/booking-email.html +0 -0
  168. includes/sample-placeholders/event-list-default.html +19 -0
  169. includes/sample-placeholders/event-single-default.html +22 -0
  170. includes/{sample-placeholers → sample-placeholders}/event-single.html +19 -5
  171. includes/sample-placeholders/location-single-default.html +17 -0
  172. includes/thumbnails/cache/index.html +0 -0
  173. includes/thumbnails/timthumb-config.php +3 -0
  174. includes/thumbnails/timthumb.php +1189 -0
  175. readme.txt +296 -69
  176. screenshot-1.png +0 -0
  177. screenshot-2.png +0 -0
  178. screenshot-3.png +0 -0
  179. screenshot-4.png +0 -0
  180. screenshot-5.png +0 -0
  181. screenshot-6.png +0 -0
  182. templates/buddypress/group-events.php +164 -0
  183. templates/buddypress/my-bookings.php +12 -0
  184. templates/buddypress/my-events.php +193 -0
  185. templates/buddypress/my-group-events.php +158 -0
  186. templates/buddypress/my-locations.php +2 -0
  187. templates/buddypress/profile.php +39 -0
  188. templates/emails/bookingtickets.php +12 -0
  189. templates/emails/new-user.php +8 -0
  190. templates/formats/readme.txt +21 -0
  191. templates/forms/bookingform/booking-fields.php +27 -0
  192. templates/forms/bookingform/login.php +35 -0
  193. templates/forms/bookingform/ticket-single.php +27 -0
  194. templates/forms/bookingform/tickets-list.php +36 -0
  195. templates/forms/event-editor.php +232 -0
  196. templates/forms/event/attributes.php +89 -0
  197. templates/forms/event/booking-stats.php +36 -0
  198. templates/forms/event/bookings.php +144 -0
  199. templates/forms/event/group.php +27 -0
  200. templates/forms/event/location.php +128 -0
  201. templates/forms/event/recurring-when.php +85 -0
  202. templates/forms/event/when-with-recurring.php +96 -0
  203. templates/forms/event/when.php +28 -0
  204. templates/forms/location-editor.php +60 -0
  205. templates/forms/location/where.php +62 -0
  206. templates/forms/readme.txt +1 -0
  207. templates/forms/ticket-form.php +36 -0
  208. templates/forms/tickets-form.php +22 -0
  209. templates/placeholders/attendees.php +14 -0
  210. templates/placeholders/bookingbutton.php +43 -0
  211. templates/placeholders/bookingform.php +74 -0
  212. templates/placeholders/categories.php +14 -0
  213. templates/placeholders/eventtags.php +12 -0
  214. templates/placeholders/locationmap.php +28 -0
  215. templates/placeholders/readme.txt +5 -0
  216. templates/tables/locations.php +91 -0
  217. templates/templates/bookings-event-printable.php +53 -0
  218. templates/templates/calendar-day.php +23 -0
  219. templates/templates/calendar-full.php +62 -0
  220. templates/templates/calendar-small.php +50 -0
  221. templates/templates/categories-list.php +18 -0
  222. templates/templates/category-single.php +12 -0
  223. templates/templates/csv-event-bookings.php +50 -0
  224. templates/templates/event-single.php +16 -0
  225. templates/templates/events-calendar.php +13 -0
  226. templates/templates/events-list.php +38 -0
  227. templates/templates/events-search.php +98 -0
  228. templates/templates/ical.php +86 -0
  229. templates/templates/location-single.php +12 -0
  230. templates/templates/locations-list.php +16 -0
  231. templates/templates/map-global.php +19 -0
  232. templates/templates/my-bookings.php +103 -0
  233. templates/templates/readme.txt +3 -0
  234. templates/templates/rss.php +40 -0
  235. widgets/em-calendar.php +10 -3
  236. widgets/em-events.php +61 -44
  237. widgets/em-locations.php +28 -8
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->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->booking_id));
108
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
109
+ $edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->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->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->booking_id));
109
+ $reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
110
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
111
+ $edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->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->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->booking_id));
129
+ $reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
130
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->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->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->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->booking_id));
110
+ $approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->booking_id));
111
+ $reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->booking_id));
112
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->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->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->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->booking_id));
108
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->booking_id));
109
+ $edit_url = em_add_get_params($_SERVER['REQUEST_URI'], array('booking_id'=>$EM_Booking->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,188 @@
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.
@@ -91,55 +192,26 @@ add_action ( 'admin_notices', 'em_admin_warnings' );
91
* @param int $page
92
* @param int $pagesToShow
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 +219,38 @@ 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
+ if( get_option('dbem_rsvp_enabled') ){
7
+ $bookings_num = '';
8
+ $bookings_pending_count = apply_filters('em_bookings_pending_count',0);
9
+ if( get_option('dbem_bookings_approval') == 1){
10
+ $bookings_pending_count += count(EM_Bookings::get(array('status'=>'0', 'blog'=>get_current_blog_id()))->bookings);
11
+ }
12
+ if($bookings_pending_count > 0){
13
+ $bookings_num = '<span class="update-plugins count-'.$bookings_pending_count.'"><span class="plugin-count">'.$bookings_pending_count.'</span></span>';
14
+ }
15
+ }else{
16
+ $bookings_num = '';
17
+ $bookings_pending_count = 0;
18
+ }
19
+ //Count pending events
20
+ $events_num = '';
21
+ $events_pending_count = EM_Events::count(array('status'=>0, 'scope'=>'all', 'blog'=>get_current_blog_id()));
22
+ //TODO Add flexible permissions
23
+ if($events_pending_count > 0){
24
+ $events_num = '<span class="update-plugins count-'.$events_pending_count.'"><span class="plugin-count">'.$events_pending_count.'</span></span>';
25
+ }
26
+ //Count pending recurring events
27
+ $events_recurring_num = '';
28
+ $events_recurring_pending_count = EM_Events::count(array('status'=>0, 'recurring'=>1, 'scope'=>'all', 'blog'=>get_current_blog_id()));
29
+ //TODO Add flexible permissions
30
+ if($events_recurring_pending_count > 0){
31
+ $events_recurring_num = '<span class="update-plugins count-'.$events_recurring_pending_count.'"><span class="plugin-count">'.$events_recurring_pending_count.'</span></span>';
32
+ }
33
+ $both_pending_count = apply_filters('em_items_pending_count', $events_pending_count + $bookings_pending_count + $events_recurring_pending_count);
34
+ $both_num = ($both_pending_count > 0) ? '<span class="update-plugins count-'.$both_pending_count.'"><span class="plugin-count">'.$both_pending_count.'</span></span>':'';
35
+ // Add a submenu to the custom top-level menu:
36
+ $plugin_pages = array();
37
+ if( get_option('dbem_rsvp_enabled') ){
38
+ $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");
39
+ }
40
+ $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');
41
+ $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');
42
+ //If multisite global with locations set to be saved in main blogs we can force locations to be created on the main blog only
43
+ if( EM_MS_GLOBAL && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){
44
+ include( dirname(__FILE__)."/em-ms-locations.php" );
45
+ $plugin_pages['locations'] = add_submenu_page('edit.php?post_type='.EM_POST_TYPE_EVENT, __('Locations','dbem'),__('Locations','dbem'), 'read_others_locations', "locations", 'em_admin_ms_locations');
46
+ }
47
+ $plugin_pages = apply_filters('em_create_events_submenu',$plugin_pages);
48
+ //We have to modify the menus manually
49
+ if( !empty($both_num) ){ //Main Event Menu
50
+ //go through the menu array and modify the events menu if found
51
+ foreach ( (array)$menu as $key => $parent_menu ) {
52
+ if ( $parent_menu[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
53
+ $menu[$key][0] = $menu[$key][0]. $both_num;
54
+ break;
55
+ }
56
+ }
57
+ }
58
+ if( !empty($events_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Event Item
59
+ //go through the menu array and modify the events menu if found
60
+ foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
61
+ if ( $submenu_item[2] == 'edit.php?post_type='.EM_POST_TYPE_EVENT ){
62
+ $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_num;
63
+ break;
64
+ }
65
+ }
66
+ }
67
+ if( !empty($events_recurring_num) && !empty($submenu['edit.php?post_type='.EM_POST_TYPE_EVENT]) ){ //Submenu Recurring Event Item
68
+ //go through the menu array and modify the events menu if found
69
+ foreach ( (array)$submenu['edit.php?post_type='.EM_POST_TYPE_EVENT] as $key => $submenu_item ) {
70
+ if ( $submenu_item[2] == 'edit.php?post_type=event-recurring' ){
71
+ $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0] = $submenu['edit.php?post_type='.EM_POST_TYPE_EVENT][$key][0]. $events_recurring_num;
72
+ break;
73
+ }
74
+ }
75
+ }
76
+ /* Hack! Add location/recurrence isn't possible atm so this is a workaround */
77
+ global $_wp_submenu_nopriv;
78
+ if( $pagenow == 'post-new.php' && !empty($_REQUEST['post_type']) ){
79
+ if( $_REQUEST['post_type'] == EM_POST_TYPE_LOCATION && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_locations') ){
80
+ unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
81
+ }
82
+ if( $_REQUEST['post_type'] == 'event-recurring' && !empty($_wp_submenu_nopriv['edit.php']['post-new.php']) && current_user_can('edit_recurring_events') ){
83
+ unset($_wp_submenu_nopriv['edit.php']['post-new.php']);
84
+ }
85
+ }
86
+ }
87
+ add_action('admin_menu','em_admin_menu');
88
+
89
+ function em_ms_admin_menu(){
90
+ add_menu_page( __('Events Manager','dbem'), __('Events Manager','dbem'), 'activate_plugins', 'events-manager-options', 'em_ms_admin_options_page', plugins_url('includes/images/calendar-16.png', dirname(dirname(__FILE__)).'/events-manager.php') );
91
+ add_submenu_page('events-manager-options', __('Update Blogs','dbem'),__('Update Blogs','dbem'), 'activate_plugins', "events-manager-update", 'em_ms_upgrade');
92
+ }
93
+ add_action('network_admin_menu','em_ms_admin_menu');
94
+
95
+ function em_admin_init(){
96
+ //in MS global mode
97
+ if( EM_MS_GLOBAL && is_user_logged_in() && !is_main_site() && get_site_option('dbem_ms_mainblog_locations') ){
98
+ EM_Object::ms_global_switch();
99
+ $user = new WP_User(get_current_user_id());
100
+ if( count($user->roles) == 0 ){
101
+ $user->set_role('subscriber');
102
+ }
103
+ EM_Object::ms_global_switch_back();
104
+ }
105
+ }
106
+ add_action('admin_init','em_admin_init');
107
108
/**
109
* Generate warnings and notices in the admin area
110
*/
111
function em_admin_warnings() {
112
+ global $EM_Notices;
113
//If we're editing the events page show hello to new user
114
$events_page_id = get_option ( 'dbem_events_page' );
115
$dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';
116
117
+ if( current_user_can('activate_plugins') ){
118
//New User Intro
119
if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){
120
// Disable Hello to new user if requested
121
+ update_option('dbem_hello_to_user',0);
122
+ }elseif ( get_option ( 'dbem_hello_to_user' ) ) {
123
//FIXME update welcome msg with good links
124
+ $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');
125
?>
126
<div id="message" class="updated">
127
<?php echo $advice; ?>
128
</div>
129
<?php
130
+ }
131
132
+ //If events page couldn't be created or is missing
133
+ if( !empty($_GET['em_dismiss_events_page']) ){
134
+ update_option('dbem_dismiss_events_page',1);
135
}else{
136
+ if ( !get_page($events_page_id) && !get_option('dbem_dismiss_events_page') ){
137
?>
138
+ <div id="em_page_error" class="updated">
139
+ <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>
140
</div>
141
<?php
142
}
143
}
144
+
145
+ if( defined('EMP_VERSION') && EMP_VERSION < EM_PRO_MIN_VERSION ){
146
?>
147
+ <div id="em_page_error" class="updated">
148
+ <p><?php _e('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>
149
</div>
150
+ <?php
151
}
152
153
+ if( is_multisite() && !empty($_REQUEST['page']) && $_REQUEST['page']=='events-manager-options' && is_super_admin() && get_option('dbem_ms_update_nag') ){
154
+ if( !empty($_GET['disable_dbem_ms_update_nag']) ){
155
+ delete_site_option('dbem_ms_update_nag');
156
+ }else{
157
?>
158
<div id="em_page_error" class="updated">
159
+ <p><?php echo sprintf(__('MultiSite options have moved <a href="%s">here</a>. <a href="%s">Dismiss message</a>','dbem'),admin_url().'network/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].'&amp;disable_dbem_ms_update_nag=1'); ?></p>
160
</div>
161
+ <?php
162
+ }
163
+ }
164
+
165
+ if( is_super_admin() && get_option('dbem_migrate_images_nag') ){
166
+ if( !empty($_GET['disable_dbem_migrate_images_nag']) ){
167
+ delete_site_option('dbem_migrate_images_nag');
168
+ }else{
169
+ ?>
170
+ <div id="em_page_error" class="updated">
171
+ <p><?php echo sprintf(__('Whilst they will still appear using placeholders, you need to <a href="%s">migrate your location and event images</a> in order for them to appear in your edit forms and media library. <a href="%s">Dismiss message</a>','dbem'),admin_url().'edit.php?post_type=event&page=events-manager-options&em_migrate_images=1&_wpnonce='.wp_create_nonce('em_migrate_images'), em_add_get_params($_SERVER['REQUEST_URI'], array('disable_dbem_migrate_images_nag' => 1))); ?></p>
172
+ </div>
173
+ <?php
174
}
175
}
176
}
177
//Warn about EM page edit
178
if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
179
+ $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' );
180
$notice = "<div class='error'><p>$message</p></div>";
181
echo $notice;
182
}
183
+ echo $EM_Notices;
184
}
185
+ add_action ( 'admin_notices', 'em_admin_warnings', 100 );
186
187
/**
188
* 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.
192
* @param int $page
193
* @param int $pagesToShow
194
* @return string
195
+ * @uses paginate_links()
196
+ * @uses add_query_arg()
197
*/
198
+ function em_admin_paginate($total, $limit, $page=1, $vars=false){
199
$return = '<div class="tablenav-pages">';
200
+ $events_nav = paginate_links( array(
201
+ 'base' => add_query_arg( 'pno', '%#%' ),
202
+ 'format' => '',
203
+ 'total' => ceil($total / $limit),
204
+ 'current' => $page,
205
+ 'add_args' => $vars
206
+ ));
207
+ $return .= sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s', 'dbem') . ' </span>%s',
208
number_format_i18n( ( $page - 1 ) * $limit + 1 ),
209
number_format_i18n( min( $page * $limit, $total ) ),
210
+ number_format_i18n( $total ),
211
+ $events_nav
212
);
213
$return .= '</div>';
214
+ return apply_filters('em_admin_paginate',$return,$total,$limit,$page,$vars);
215
}
216
217
/**
219
*/
220
function em_admin_load_styles() {
221
add_thickbox();
222
+ wp_enqueue_style('em-ui-css', plugins_url('includes/css/jquery-ui-1.8.13.custom.css',dirname(__FILE__)));
223
+ wp_enqueue_style('events-manager-admin', plugins_url('includes/css/events_manager_admin.css',dirname(__FILE__)));
224
}
225
226
/**
227
+ * Settings link in the plugins page menu
228
+ * @param array $links
229
+ * @param string $file
230
+ * @return array
231
*/
232
+ function em_set_plugin_meta($links, $file) {
233
+ $plugin = plugin_basename(__FILE__);
234
+ // create link
235
+ if ($file == $plugin) {
236
+ return array_merge(
237
+ $links,
238
+ array( sprintf( '<a href="'.EM_ADMIN_URL.'&amp;page=events-manager-options">%s</a>', __('Settings', 'dbem') ) )
239
+ );
240
+ }
241
+ return $links;
242
+ }
243
+ //add_filter( 'plugin_row_meta', 'em_set_plugin_meta', 10, 2 );
244
245
+ function em_plugin_action_links($actions, $file, $plugin_data) {
246
+ $actions['settings'] = sprintf( '<a href="'.EM_ADMIN_URL.'&amp;page=events-manager-options">%s</a>', __('Settings', 'dbem') );
247
+ if( is_multisite() ){
248
+ $uninstall_url = admin_url().'network/admin.php?page=events-manager-options&amp;action=uninstall&amp;_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
249
+ }else{
250
+ $uninstall_url = EM_ADMIN_URL.'&amp;page=events-manager-options&amp;action=uninstall&amp;_wpnonce='.wp_create_nonce('em_uninstall_'.get_current_user_id().'_wpnonce');
251
+ }
252
+ $actions['uninstall'] = '<span class="delete"><a href="'.$uninstall_url.'" class="delete">'.__('Uninstall','dbem').'</a></span>';
253
+ return $actions;
254
}
255
+ add_filter( 'plugin_action_links_events-manager/events-manager.php', 'em_plugin_action_links', 10, 3 );
256
?>
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></