Events Manager - Version 3.0.96

Version Description

  • fixed js hook bug, you must now bind your function to the document's custom em_maps_locations_hook and em_maps_location_hook event triggers using jquery
  • fixed tinymce bug with linking which cropped up in 3.1 due to new WP linking window.
  • event_date_modified now properly updated
Download this release

Release Info

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

Code changes from version 3.0.95 to 3.0.96

Files changed (75) hide show
  1. admin/bookings/em-cancelled.php +16 -13
  2. admin/bookings/em-confirmed.php +19 -16
  3. admin/bookings/em-events.php +4 -5
  4. admin/bookings/em-pending.php +27 -22
  5. admin/bookings/em-person.php +12 -10
  6. admin/bookings/em-rejected.php +17 -14
  7. admin/em-admin.php +16 -117
  8. admin/em-bookings.php +137 -56
  9. admin/em-categories.php +3 -3
  10. admin/em-docs.php +8 -4
  11. admin/em-event.php +296 -198
  12. admin/em-events.php +56 -54
  13. admin/em-locations-search.php +6 -2
  14. admin/em-locations.php +68 -72
  15. admin/em-options.php +81 -32
  16. admin/em-people.php +9 -124
  17. buddypress/bp-em-activity.php +106 -0
  18. buddypress/bp-em-admin.php +65 -0
  19. buddypress/bp-em-core.php +175 -0
  20. buddypress/bp-em-notifications.php +157 -0
  21. buddypress/bp-em-templatetags.php +7 -0
  22. buddypress/screens/attending.php +40 -0
  23. buddypress/screens/my-events.php +65 -0
  24. buddypress/screens/my-locations.php +72 -0
  25. buddypress/screens/profile.php +54 -0
  26. buddypress/screens/settings.php +56 -0
  27. classes/em-booking.php +229 -64
  28. classes/em-bookings.php +222 -114
  29. classes/em-calendar.php +367 -365
  30. classes/em-categories.php +19 -18
  31. classes/em-category.php +55 -31
  32. classes/em-event.php +243 -87
  33. classes/em-events.php +69 -22
  34. classes/em-location.php +152 -71
  35. classes/em-locations.php +35 -27
  36. classes/em-notices.php +170 -0
  37. classes/em-object.php +78 -10
  38. classes/em-people.php +9 -71
  39. classes/em-permalinks.php +200 -0
  40. classes/em-person.php +43 -128
  41. classes/em-recurrence.php +0 -89
  42. classes/em-ticket-booking.php +209 -0
  43. classes/em-ticket.php +333 -0
  44. classes/em-tickets-bookings.php +261 -0
  45. classes/em-tickets.php +204 -0
  46. em-actions.php +241 -0
  47. em-ajax.php +0 -101
  48. em-bookings.php +248 -148
  49. em-debug.php +46 -0
  50. em-events.php +39 -18
  51. em-functions.php +72 -37
  52. em-ical.php +80 -0
  53. em-install.php +178 -319
  54. em-rss.php +5 -2
  55. events-manager.php +174 -57
  56. includes/css/events_manager.css +9 -33
  57. includes/css/events_manager_admin.css +29 -1
  58. includes/images/close.png +0 -0
  59. includes/js/em_admin.js +196 -77
  60. includes/js/em_maps.js +90 -90
  61. includes/js/em_ui.js +13 -1
  62. includes/langs/events-manager.pot +1547 -1014
  63. includes/{sample-placeholers → sample-placeholders}/booking-email.html +0 -0
  64. includes/{sample-placeholers → sample-placeholders}/event-single.html +0 -0
  65. readme.txt +8 -3
  66. templates/buddypress/events/my-events.php +191 -0
  67. templates/buddypress/locations/my-locations.php +86 -0
  68. templates/forms/events/attributes-box.php +14 -0
  69. templates/forms/events/bookings-box.php +46 -0
  70. templates/forms/events/categories-box.php +25 -0
  71. templates/forms/events/editor.php +201 -0
  72. templates/forms/events/recurrence-box.php +64 -0
  73. templates/forms/locations/editor.php +117 -0
  74. templates/placeholders/attendees.php +12 -0
  75. widgets/em-events.php +4 -4
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'>
@@ -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
?>
@@ -89,23 +92,23 @@ 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 +124,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'>
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
?>
92
<?php
93
$rowno = 0;
94
$event_count = 0;
95
+ foreach ($EM_Bookings->bookings as $EM_Booking) {
96
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
97
$rowno++;
98
?>
99
<tr>
100
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
101
+ <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->display_name ?></a></td>
102
+ <td><?php echo $EM_Booking->person->user_email ?></td>
103
<td><?php echo $EM_Booking->person->phone ?></td>
104
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
105
<td>
106
<?php
107
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
108
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
109
?>
110
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
111
+ <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/View','dbem'); ?></a> |
112
<a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a>
113
</td>
114
</tr>
124
<?php _e('No cancelled bookings.', 'dbem'); ?>
125
<?php endif; ?>
126
</form>
127
+ <?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
128
<div class='tablenav'>
129
<?php echo $bookings_nav; ?>
130
<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'>
@@ -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
?>
@@ -90,29 +93,29 @@ 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 +130,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'>
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
?>
93
<?php
94
$rowno = 0;
95
$event_count = 0;
96
+ foreach ($EM_Bookings->bookings as $EM_Booking) {
97
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
98
$rowno++;
99
?>
100
<tr>
101
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
102
+ <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person_id; ?>"><?php echo $EM_Booking->person->display_name ?></a></td>
103
+ <td><?php echo $EM_Booking->person->user_email ?></td>
104
<td><?php echo $EM_Booking->person->phone ?></td>
105
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
106
+ <td>
107
<?php
108
$unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'booking_id'=>$EM_Booking->id));
109
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->id));
110
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
111
?>
112
+ <?php if( current_user_can('manage_bookings') ): ?>
113
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
114
<?php else: ?>
115
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
116
<?php endif; ?>
117
+ <span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
118
+ <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/View','dbem'); ?></a>
119
</td>
120
</tr>
121
<?php
130
<?php _e('No confirmed bookings.', 'dbem'); ?>
131
<?php endif; ?>
132
</form>
133
+ <?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
134
<div class='tablenav'>
135
<?php echo $bookings_nav; ?>
136
<div class="clear"></div>
admin/bookings/em-events.php CHANGED
@@ -77,8 +77,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
?>
@@ -131,9 +130,9 @@ function em_bookings_events_table() {
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 +161,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;
77
-->
78
<?php
79
if ( $events_count >= $limit ) {
80
+ $events_nav = em_admin_paginate( $events_count, $limit, $page, array('em_ajax'=>0, 'em_obj'=>'em_bookings_events_table'));
81
echo $events_nav;
82
}
83
?>
130
<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>
131
</strong>
132
&ndash;
133
+ <?php _e("Booked Spaces",'dbem') ?>: <?php echo $event->get_bookings()->get_booked_spaces()."/".$event->get_spaces() ?>
134
<?php if( get_option('dbem_bookings_approval') == 1 ) : ?>
135
+ | <?php _e("Pending",'dbem') ?>: <?php echo $event->get_bookings()->get_pending_spaces(); ?>
136
<?php endif; ?>
137
</td>
138
161
<div class="alignleft actions">
162
<br class='clear' />
163
</div>
164
+ <?php if (!empty($events_nav) && $events_count >= $limit ) : ?>
165
<div class="tablenav-pages">
166
<?php
167
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'>
@@ -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
?>
@@ -94,7 +97,7 @@ function em_bookings_pending_table($event_id = false){
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>
@@ -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>
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'>
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
?>
97
<input class='select-all' type="checkbox" value='1' />
98
</th>
99
<th class='manage-column' scope='col'>Booker</th>
100
+ <?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
101
<th class='manage-column' scope="col">Event</th>
102
<?php endif; ?>
103
<th class='manage-column' scope='col'>E-mail</th>
110
<?php
111
$rowno = 0;
112
$event_count = 0;
113
+ foreach ($EM_Bookings->bookings as $EM_Booking) {
114
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
115
$rowno++;
116
?>
117
<tr>
118
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
119
+ <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->display_name ?></a></td>
120
+ <?php if( !is_object($EM_Event) && !is_object($EM_Ticket) ): ?>
121
<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>
122
<?php endif; ?>
123
+ <td><?php echo $EM_Booking->person->user_email ?></td>
124
<td><?php echo $EM_Booking->person->phone ?></td>
125
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
126
<td>
127
<?php
128
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
129
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'booking_id'=>$EM_Booking->id));
130
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
131
?>
132
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
133
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
134
+ <span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
135
+ <a class="em-bookings-edit" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit/View','dbem'); ?></a>
136
</td>
137
</tr>
138
<?php
147
<?php _e('No pending bookings.', 'dbem'); ?>
148
<?php endif; ?>
149
</form>
150
+ <?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
151
<div class='tablenav'>
152
<?php echo $bookings_nav; ?>
153
<div class="clear"></div>
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){
@@ -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
?>
@@ -96,13 +95,13 @@ 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>
@@ -112,17 +111,20 @@ function em_bookings_person_table(){
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){
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
?>
95
$event_count = 0;
96
foreach ($bookings as $EM_Booking) {
97
$EM_Event = $events[$EM_Booking->event_id];
98
+ if( $EM_Event->can_manage('edit_events','edit_others_events') && ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
99
$rowno++;
100
?>
101
<tr>
102
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
103
<td><a class="row-title" href="<?php 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>
104
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
105
<td><?php echo $EM_Booking->status_array[$EM_Booking->status]; ?>
106
</td>
107
<td>
111
$reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'bookings'=>$EM_Booking->id));
112
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'bookings'=>$EM_Booking->id));
113
?>
114
+ <?php if( get_option('dbem_bookings_approval') && ($EM_Booking->status == 0 ) ): ?>
115
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
116
<?php endif; ?>
117
+ <?php if( get_option('dbem_bookings_approval') && $EM_Booking->status == 1 ): ?>
118
<a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
119
<?php endif; ?>
120
+ <?php if( $EM_Booking->status == 2 ): ?>
121
+ <a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Restore','dbem'); ?></a> |
122
+ <?php endif; ?>
123
<?php if( $EM_Booking->status == 0 || $EM_Booking->status == 1 ): ?>
124
<a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
125
<?php endif; ?>
126
+ <a class="em-bookings-edit" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit/View','dbem'); ?></a> |
127
+ <span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span>
128
</td>
129
</tr>
130
<?php
139
<?php _e('No confirmed bookings.', 'dbem'); ?>
140
<?php endif; ?>
141
</form>
142
+ <?php if( !empty($bookings_nav) && $bookings >= $limit ) : ?>
143
<div class='tablenav'>
144
<?php echo $bookings_nav; ?>
145
<div class="clear"></div>
admin/bookings/em-rejected.php CHANGED
@@ -5,7 +5,7 @@
5
* @param int $event_id
6
*/
7
function em_bookings_rejected_table(){
8
- global $EM_Event, $wpdb, $current_user;
9
10
$action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
11
$action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
@@ -14,12 +14,16 @@ function em_bookings_rejected_table(){
14
$page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
15
$offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
16
17
- if( is_object($EM_Event) ){
18
- $bookings = $EM_Event->get_bookings()->get_rejected_bookings();
19
}else{
20
- return false;
21
}
22
- $bookings_count = (is_array($bookings)) ? count($bookings):0;
23
?>
24
<div class='wrap em_bookings_pending_table em_obj'>
25
<form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
@@ -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
?>
@@ -89,24 +92,24 @@ 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 +124,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'>
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
?>
92
<?php
93
$rowno = 0;
94
$event_count = 0;
95
+ foreach ($EM_Bookings->bookings as $EM_Booking) {
96
if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
97
$rowno++;
98
?>
99
<tr>
100
<th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
101
+ <td><a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;person_id=<?php echo $EM_Booking->person->ID; ?>"><?php echo $EM_Booking->person->display_name ?></a></td>
102
+ <td><?php echo $EM_Booking->person->user_email ?></td>
103
<td><?php echo $EM_Booking->person->phone ?></td>
104
+ <td><?php echo $EM_Booking->get_spaces() ?></td>
105
<td>
106
<?php
107
$approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'booking_id'=>$EM_Booking->id));
108
$delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'booking_id'=>$EM_Booking->id));
109
?>
110
<a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
111
+ <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/View','dbem'); ?></a> |
112
+ <span class="trash"><a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a></span> |
113
</td>
114
</tr>
115
<?php
124
<?php _e('No rejected bookings.', 'dbem'); ?>
125
<?php endif; ?>
126
</form>
127
+ <?php if( !empty($bookings_nav) && $EM_Bookings >= $limit ) : ?>
128
<div class='tablenav'>
129
<?php echo $bookings_nav; ?>
130
<div class="clear"></div>
admin/em-admin.php CHANGED
@@ -9,7 +9,7 @@ function em_admin_warnings() {
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
@@ -74,14 +74,21 @@ add_action ( 'admin_notices', 'em_admin_warnings' );
74
* @return string
75
* @uses em_paginate()
76
*/
77
- function em_admin_paginate($link, $total, $limit, $page=1, $pagesToShow=5){
78
$return = '<div class="tablenav-pages">';
79
- $return .= sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>',
80
- number_format_i18n( ( $page - 1 ) * $limit + 1 ),
81
- number_format_i18n( min( $page * $limit, $total ) ),
82
- number_format_i18n( $total )
83
- );
84
- $return .= em_paginate($link, $total, $limit, $page, $pagesToShow);
85
$return .= '</div>';
86
return $return;
87
}
@@ -144,118 +151,10 @@ function em_admin_general_script() {
144
?>
145
<script type="text/javascript">
146
//<![CDATA[
147
- // TODO: make more general, to support also latitude and longitude (when added)
148
-
149
jQuery(document).ready( function($) {
150
-
151
- function updateIntervalDescriptor () {
152
- $(".interval-desc").hide();
153
- var number = "-plural";
154
- if ($('input#recurrence-interval').val() == 1 || $('input#recurrence-interval').val() == "")
155
- number = "-singular"
156
- var descriptor = "span#interval-"+$("select#recurrence-frequency").val()+number;
157
- $(descriptor).show();
158
- }
159
- function updateIntervalSelectors () {
160
- $('p.alternate-selector').hide();
161
- $('p#'+ $('select#recurrence-frequency').val() + "-selector").show();
162
- }
163
- function updateShowHideRsvp () {
164
- if($('input#rsvp-checkbox').attr("checked")) {
165
- $("div#rsvp-data").fadeIn();
166
- } else {
167
- $("div#rsvp-data").hide();
168
- }
169
- }
170
- function updateShowHideRecurrence () {
171
- if( $('input#event-recurrence').attr("checked")) {
172
- $("#event_recurrence_pattern").fadeIn();
173
- $("#event-date-explanation").hide();
174
- $("#recurrence-dates-explanation").show();
175
- $("h3#recurrence-dates-title").show();
176
- $("h3#event-date-title").hide();
177
- } else {
178
- $("#event_recurrence_pattern").hide();
179
- $("#recurrence-dates-explanation").hide();
180
- $("#event-date-explanation").show();
181
- $("h3#recurrence-dates-title").hide();
182
- $("h3#event-date-title").show();
183
- }
184
- }
185
- $("#recurrence-dates-explanation").hide();
186
- $("#localised-date").show();
187
- $("#localised-end-date").show();
188
-
189
- $("#date-to-submit").hide();
190
- $("#end-date-to-submit").hide();
191
-
192
$("#start-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?> });
193
$("#end-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?>});
194
-
195
- $('input.select-all').change(function(){
196
- if($(this).is(':checked'))
197
- $('input.row-selector').attr('checked', true);
198
- else
199
- $('input.row-selector').attr('checked', false);
200
- });
201
-
202
- updateIntervalDescriptor();
203
- updateIntervalSelectors();
204
- updateShowHideRecurrence();
205
- updateShowHideRsvp();
206
- $('input#event-recurrence').change(updateShowHideRecurrence);
207
- $('input#rsvp-checkbox').change(updateShowHideRsvp);
208
-
209
- // recurrency elements
210
- $('input#recurrence-interval').keyup(updateIntervalDescriptor);
211
- $('select#recurrence-frequency').change(updateIntervalDescriptor);
212
- $('select#recurrence-frequency').change(updateIntervalSelectors);
213
-
214
- // hiding or showing notes according to their content
215
- $('.postbox h3').prepend('<a class="togbox">+</a> ');
216
- $('#event_notes h3').click( function() {
217
- $(this).parent().first().toggleClass('closed');
218
- });
219
-
220
- // users cannot submit the event form unless some fields are filled
221
- function validateEventForm(){
222
- errors = "";
223
- var recurring = $("input[@name=repeated_event]:checked").val();
224
- requiredFields= new Array('event_name', 'localised_event_date', 'location_name','location_address','location_town');
225
- var localisedRequiredFields = {
226
- 'event_name':"<?php _e ( 'Name', 'dbem' )?>",
227
- 'localised_event_date':"<?php _e ( 'Date', 'dbem' )?>",
228
- 'location_name':"<?php _e ( 'Location', 'dbem' )?>",
229
- 'location_address':"<?php _e ( 'Address', 'dbem' )?>",
230
- 'location_town':"<?php _e ( 'Town', 'dbem' )?>"
231
- };
232
- missingFields = new Array;
233
- for (var i in requiredFields) {
234
- if ($("input[@name=" + requiredFields[i]+ "]").val() == 0) {
235
- missingFields.push(localisedRequiredFields[requiredFields[i]]);
236
- $("input[@name=" + requiredFields[i]+ "]").css('border','2px solid red');
237
- } else {
238
- $("input[@name=" + requiredFields[i]+ "]").css('border','1px solid #DFDFDF');
239
- }
240
- }
241
-
242
- // alert('ciao ' + recurring+ " end: " + $("input[@name=localised_event_end_date]").val());
243
- if (missingFields.length > 0) {
244
- errors = "<?php _e ( 'Some required fields are missing:', 'dbem' )?> " + missingFields.join(", ") + ".\n";
245
- }
246
- if(recurring && $("input[@name=localised_event_end_date]").val() == "") {
247
- errors = errors + "<?php _e ( 'Since the event is repeated, you must specify an end date', 'dbem' )?>.";
248
- $("input[@name=localised_event_end_date]").css('border','2px solid red');
249
- } else {
250
- $("input[@name=localised_event_end_date]").css('border','1px solid #DFDFDF');
251
- }
252
- if(errors != "") {
253
- alert(errors);
254
- return false;
255
- }
256
- return true;
257
- }
258
- $('#event-form').bind("submit", validateEventForm);
259
});
260
//]]>
261
</script>
9
$events_page_id = get_option ( 'dbem_events_page' );
10
$dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';
11
12
+ if( current_user_can('activate_plugins') ){
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
74
* @return string
75
* @uses em_paginate()
76
*/
77
+ function em_admin_paginate($total, $limit, $page=1, $vars=false){
78
$return = '<div class="tablenav-pages">';
79
+ $events_nav = paginate_links( array(
80
+ 'base' => add_query_arg( 'pno', '%#%' ),
81
+ 'format' => '',
82
+ 'total' => ceil($total / $limit),
83
+ 'current' => $page,
84
+ 'add_args' => $vars
85
+ ));
86
+ $return .= sprintf( '<span class="displaying-num">' . __( 'Displaying %s&#8211;%s of %s' ) . '</span>%s',
87
+ number_format_i18n( ( $page - 1 ) * $limit + 1 ),
88
+ number_format_i18n( min( $page * $limit, $total ) ),
89
+ number_format_i18n( $total ),
90
+ $events_nav
91
+ );
92
$return .= '</div>';
93
return $return;
94
}
151
?>
152
<script type="text/javascript">
153
//<![CDATA[
154
+ // TODO: make more general, to support also latitude and longitude (when added)
155
jQuery(document).ready( function($) {
156
$("#start-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?> });
157
$("#end-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?>});
158
});
159
//]]>
160
</script>
admin/em-bookings.php CHANGED
@@ -64,6 +64,8 @@ function em_bookings_page(){
64
em_bookings_person();
65
}elseif( !empty($_REQUEST['event_id']) ){
66
em_bookings_event();
67
}else{
68
em_bookings_dashboard();
69
}
@@ -81,12 +83,13 @@ 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
}
@@ -97,7 +100,7 @@ function em_bookings_dashboard(){
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
@@ -117,7 +120,7 @@ function em_bookings_event(){
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; ?>
@@ -129,7 +132,7 @@ function em_bookings_event(){
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,10 +142,61 @@ 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
*/
@@ -163,24 +217,84 @@ 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' ); ?>
@@ -206,7 +320,7 @@ function em_bookings_single(){
206
</div>
207
</div>
208
<br style="clear:both;" />
209
- <?php do_action('em_bookings_single_footer'); ?>
210
</div>
211
<?php
212
@@ -224,8 +338,11 @@ 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 +351,19 @@ 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
?>
64
em_bookings_person();
65
}elseif( !empty($_REQUEST['event_id']) ){
66
em_bookings_event();
67
+ }elseif( !empty($_REQUEST['ticket_id']) ){
68
+ em_bookings_ticket();
69
}else{
70
em_bookings_dashboard();
71
}
83
<h2>
84
<?php _e('Event Bookings Dashboard', 'dbem'); ?>
85
</h2>
86
+ <?php if( get_option('dbem_bookings_approval')): ?>
87
<h2><?php _e('Pending Bookings','dbem'); ?></h2>
88
<?php em_bookings_pending_table(); ?>
89
<?php endif; ?>
90
<h2><?php _e('Events With Bookings Enabled','dbem'); ?></h2>
91
<?php em_bookings_events_table(); ?>
92
+ <?php do_action('em_bookings_dashboard'); ?>
93
</div>
94
<?php
95
}
100
function em_bookings_event(){
101
global $EM_Event,$EM_Person;
102
//check that user can access this page
103
+ if( is_object($EM_Event) && !$EM_Event->can_manage('manage_bookings','manage_others_bookings') ){
104
?>
105
<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>
106
<?php
120
<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>
121
<div>
122
<p><strong><?php _e('Event Name','dbem'); ?></strong> : <?php echo ($EM_Event->name); ?></p>
123
+ <p><strong>Availability :</strong> <?php echo $EM_Event->get_bookings()->get_booked_spaces() . '/'. $EM_Event->get_spaces() ." ". __('Spaces confirmed','dbem'); ?></p>
124
<p>
125
<strong><?php _e('Date','dbem'); ?></strong> :
126
<?php echo $localised_start_date; ?>
132
<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>
133
</p>
134
</div>
135
+ <?php if( get_option('dbem_bookings_approval')): ?>
136
<h2><?php _e('Pending Bookings','dbem'); ?></h2>
137
<?php em_bookings_pending_table(); ?>
138
<?php endif; ?>
142
<?php em_bookings_rejected_table(); ?>
143
<h2><?php _e('Cancelled Bookings','dbem'); ?></h2>
144
<?php em_bookings_cancelled_table(); ?>
145
+ <?php do_action('em_bookings_event_footer', $EM_Event); ?>
146
</div>
147
<?php
148
}
149
150
+ /**
151
+ * Shows a ticket view
152
+ */
153
+ function em_bookings_ticket(){
154
+ global $EM_Ticket;
155
+ $EM_Event = $EM_Ticket->get_event();
156
+ //check that user can access this page
157
+ if( is_object($EM_Ticket) && !$EM_Ticket->can_manage() ){
158
+ ?>
159
+ <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>
160
+ <?php
161
+ return false;
162
+ }
163
+ ?>
164
+ <div class='wrap'>
165
+ <div id='icon-users' class='icon32'>
166
+ <br/>
167
+ </div>
168
+ <h2>
169
+ <?php echo sprintf(__('Ticket for %s', 'dbem'), "'{$EM_Event->name}'"); ?>
170
+ <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>
171
+ <a href="admin.php?page=events-manager-bookings&event_id=<?php echo $EM_Event->id; ?>" class="button add-new-h2"><?php _e('View Event Bookings','dbem') ?></a>
172
+ </h2>
173
+ <div>
174
+ <table>
175
+ <tr><td><?php echo __('Name','dbem'); ?></td><td></td><td><?php echo $EM_Ticket->name; ?></td></tr>
176
+ <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>
177
+ <tr><td><?php echo __('Price','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->price) ? $EM_Ticket->price : '-'; ?></td></tr>
178
+ <tr><td><?php echo __('Spaces','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->spaces) ? $EM_Ticket->spaces : '-'; ?></td></tr>
179
+ <tr><td><?php echo __('Min','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->min) ? $EM_Ticket->min : '-'; ?></td></tr>
180
+ <tr><td><?php echo __('Max','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->max) ? $EM_Ticket->max : '-'; ?></td></tr>
181
+ <tr><td><?php echo __('Start','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->start) ? $EM_Ticket->start : '-'; ?></td></tr>
182
+ <tr><td><?php echo __('End','dbem'); ?></td><td></td><td><?php echo ($EM_Ticket->end) ? $EM_Ticket->end : '-'; ?></td></tr>
183
+ </table>
184
+ </div>
185
+ <?php if( get_option('dbem_bookings_approval')): ?>
186
+ <h2><?php _e('Pending Bookings','dbem'); ?></h2>
187
+ <?php em_bookings_pending_table(); ?>
188
+ <?php endif; ?>
189
+ <h2><?php _e('Confirmed Bookings','dbem'); ?></h2>
190
+ <?php em_bookings_confirmed_table(); ?>
191
+ <h2><?php _e('Rejected Bookings','dbem'); ?></h2>
192
+ <?php em_bookings_rejected_table(); ?>
193
+ <h2><?php _e('Cancelled Bookings','dbem'); ?></h2>
194
+ <?php em_bookings_cancelled_table(); ?>
195
+ <?php do_action('em_bookings_ticket_footer', $EM_Ticket); ?>
196
+ </div>
197
+ <?php
198
+ }
199
+
200
/**
201
* Shows a single booking for a single person.
202
*/
217
<h2>
218
<?php _e('Edit Booking', 'dbem'); ?>
219
</h2>
220
+ <div id="poststuff" class="metabox-holder">
221
<div id="post-body">
222
<div id="post-body-content">
223
+ <div id="em-booking-details" class="stuffbox">
224
+ <h3>
225
+ <?php _e ( 'Event Details', 'dbem' ); ?>
226
+ </h3>
227
+ <div class="inside">
228
+ <?php
229
+ $EM_Event = $EM_Booking->get_event();
230
+ $localised_start_date = date_i18n('D d M Y', $EM_Event->start);
231
+ $localised_end_date = date_i18n('D d M Y', $EM_Event->end);
232
+ ?>
233
+ <table>
234
+ <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>
235
+ <tr>
236
+ <td><strong><?php _e('Date/Time','dbem'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td>
237
+ <td>
238
+ <?php echo $localised_start_date; ?>
239
+ <?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
240
+ <?php echo substr ( $EM_Event->start_time, 0, 5 ) . " - " . substr ( $EM_Event->end_time, 0, 5 ); ?>
241
+ </td>
242
+ </tr>
243
+ </table>
244
+ </div>
245
+ </div>
246
+ <div id="em-booking-details" class="stuffbox">
247
+ <h3>
248
+ <?php _e ( 'Personal Details', 'dbem' ); ?>
249
+ </h3>
250
+ <div class="inside">
251
+ <?php echo $EM_Booking->get_person()->display_summary(); ?>
252
+ </div>
253
+ </div>
254
+ <div id="em-booking-details" class="stuffbox">
255
<h3>
256
<?php _e ( 'Booking Details', 'dbem' ); ?>
257
</h3>
258
<div class="inside">
259
+ <?php
260
+ $EM_Event = $EM_Booking->get_event();
261
+ $localised_start_date = date_i18n('D d M Y', $EM_Event->start);
262
+ $localised_end_date = date_i18n('D d M Y', $EM_Event->end);
263
+ ?>
264
+ <table class="em-tickets-bookings-table" cellspacing="0" cellpadding="0">
265
+ <thead>
266
+ <tr>
267
+ <th><?php _e('Ticket Type','dbem'); ?></th>
268
+ <th><?php _e('Spaces','dbem'); ?></th>
269
+ <th><?php _e('Price','dbem'); ?></th>
270
+ </tr>
271
+ </thead>
272
+ <tbody>
273
+ <?php foreach($EM_Booking->get_tickets_bookings()->tickets_bookings as $EM_Ticket_Booking): ?>
274
+ <tr>
275
+ <td class="ticket-type"><a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;ticket_id=<?php echo $EM_Ticket_Booking->get_ticket()->id ?>"><?php echo $EM_Ticket_Booking->get_ticket()->name ?></a></td>
276
+ <td><?php echo $EM_Ticket_Booking->get_spaces(); ?></td>
277
+ <td><?php echo $EM_Ticket_Booking->get_price(); ?></td>
278
+ </tr>
279
+ <?php endforeach; ?>
280
+ </tbody>
281
+ <tfoot>
282
+ <tr>
283
+ <th><?php _e('Totals','dbem'); ?></th>
284
+ <th><?php echo $EM_Booking->get_spaces(); ?></th>
285
+ <th><?php echo $EM_Booking->get_price(); ?></th>
286
+ </tr>
287
+ </tfoot>
288
+ </table>
289
+ <table cellspacing="0" cellpadding="0">
290
+ <tr><td><strong><?php _e('Comment','dbem'); ?>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></td><td><?php echo $EM_Booking->comment; ?></td></tr>
291
+ <?php foreach( $EM_Booking->get_custom() as $custom_option ){
292
+ ?><tr><td><strong><?php echo $custom_option['name'] ?></strong></td><td><?php echo $custom_option['value'] ?></td></tr><?php
293
+ }
294
+ ?>
295
+ </table>
296
</div>
297
+ </div>
298
<div id="event_name" class="stuffbox">
299
<h3>
300
<?php _e ( 'Booking Notes', 'dbem' ); ?>
320
</div>
321
</div>
322
<br style="clear:both;" />
323
+ <?php do_action('em_bookings_single_footer', $EM_Booking); ?>
324
</div>
325
<?php
326
338
</div>
339
<h2>
340
<?php _e('Manage Person\'s Booking', 'dbem'); ?>
341
+ <?php if( current_user_can('edit_users') ) : ?>
342
+ <a href="user-edit.php?user_id=<?php echo $EM_Person->ID; ?>" class="button add-new-h2"><?php _e('Edit User','dbem') ?></a>
343
+ <?php endif; ?>
344
</h2>
345
+ <?php do_action('em_bookings_person_header'); ?>
346
<div id="poststuff" class="metabox-holder has-right-sidebar">
347
<div id="post-body">
348
<div id="post-body-content">
351
<?php _e ( 'Personal Details', 'dbem' ); ?>
352
</h3>
353
<div class="inside">
354
+ <?php echo $EM_Person->display_summary(); ?>
355
</div>
356
</div>
357
</div>
358
</div>
359
</div>
360
<br style="clear:both;" />
361
+ <?php do_action('em_bookings_person_body_1'); ?>
362
<h3><?php _e('Past And Present Bookings','dbem'); ?></h3>
363
<?php em_bookings_person_table(); ?>
364
+ <?php do_action('em_bookings_person_footer', $EM_Person); ?>
365
</div>
366
<?php
367
}
368
369
?>
admin/em-categories.php CHANGED
@@ -35,7 +35,7 @@ function em_admin_categories_page() {
35
em_categories_table_layout($message);
36
}
37
}else{
38
- em_categories_table_layout($message);
39
}
40
}
41
@@ -136,9 +136,9 @@ function em_categories_edit_layout($message = "") {
136
$EM_Category = new EM_Category();
137
}
138
//check that user can access this page
139
- if( is_object($EM_Category) && !$EM_Category->can_manage() ){
140
?>
141
- <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>
142
<?php
143
return;
144
}
35
em_categories_table_layout($message);
36
}
37
}else{
38
+ em_categories_table_layout();
39
}
40
}
41
136
$EM_Category = new EM_Category();
137
}
138
//check that user can access this page
139
+ if( is_object($EM_Category) && !$EM_Category->can_manage('edit_categories') ){
140
?>
141
+ <div class="wrap"><h2><?php _e('Unauthorized Access','dbem'); ?></h2><p><?php implode('<br/>',$EM_Category->get_errors()); ?></p></div>
142
<?php
143
return;
144
}
admin/em-docs.php CHANGED
@@ -99,8 +99,10 @@ function em_docs_init(){
99
'#_REMOVEBOOKINGFORM' => array( 'desc' => 'Adds a form which allows the visitors to remove their booking.' ),
100
'#_BOOKINGFORM' => array( 'desc' => 'Adds a both booking forms (add and remove).' ),
101
'#_AVAILABLESPACES' => array( 'desc' => 'Shows available spaces for the event.' ),
102
- '#_BOOKEDSPACES' => array( 'desc' => 'Shows the amount of currently booked seats for the event.' ),
103
- '#_SPACES' => array( 'desc' => 'Shows the total spaces for the event.' )
104
)
105
),
106
'Contact Details' => array(
@@ -158,7 +160,9 @@ function em_docs_init(){
158
)
159
)
160
),
161
- )
162
);
163
}
164
}
@@ -175,7 +179,7 @@ function em_docs_placeholders($atts){
175
foreach($data as $sectionTitle => $details) : ?>
176
<div>
177
<h3><?php echo $sectionTitle; ?></h3>
178
- <?php if($details['desc'] != ''): ?>
179
<p><?php echo $details['desc']; ?></p>
180
<?php endif; ?>
181
<dl>
99
'#_REMOVEBOOKINGFORM' => array( 'desc' => 'Adds a form which allows the visitors to remove their booking.' ),
100
'#_BOOKINGFORM' => array( 'desc' => 'Adds a both booking forms (add and remove).' ),
101
'#_AVAILABLESPACES' => array( 'desc' => 'Shows available spaces for the event.' ),
102
+ '#_BOOKEDSPACES' => array( 'desc' => 'Shows the amount of currently booked spaces for the event.' ),
103
+ '#_PENDINGSPACES' => array( 'desc' => 'Shows the amount of pending spaces for the event.' ),
104
+ '#_SPACES' => array( 'desc' => 'Shows the total spaces for the event.' ),
105
+ '#_ATTENDEES' => array( 'desc' => 'Shows the list of user avatars attending events.' )
106
)
107
),
108
'Contact Details' => array(
160
)
161
)
162
),
163
+ ),
164
+ //TODO add capabilites explanations
165
+ 'capabilities' => array()
166
);
167
}
168
}
179
foreach($data as $sectionTitle => $details) : ?>
180
<div>
181
<h3><?php echo $sectionTitle; ?></h3>
182
+ <?php if( !empty($details['desc']) ): ?>
183
<p><?php echo $details['desc']; ?></p>
184
<?php endif; ?>
185
<dl>
admin/em-event.php CHANGED
@@ -3,38 +3,10 @@ function em_admin_event_actions(){
3
if( current_user_can(EM_MIN_CAPABILITY) && !empty($_GET['page']) && $_GET['page'] == 'events-manager-event' && !empty($_REQUEST ['action']) ){
4
global $wpdb;
5
global $EM_Event;
6
-
7
//if dealing with new event, we still want an event object
8
if( !is_object($EM_Event) ){
9
$EM_Event = new EM_Event();
10
}
11
-
12
- // UPDATE or CREATE action
13
- if ($_REQUEST['action'] == 'save') {
14
- $validation = $EM_Event->get_post();
15
- if ( $validation ) { //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
16
- //Save
17
- if( $EM_Event->save() ) {
18
- $page = !empty($_REQUEST['pno']) ? $_REQUEST['pno']:'';
19
- $scope = !empty($_REQUEST['scope']) ? $_REQUEST['scope']:'';
20
- wp_redirect( get_bloginfo('wpurl').'/wp-admin/admin.php?page=events-manager&p='.$page.'&scope='.$scope.'&message='.urlencode($EM_Event->feedback_message));
21
- }
22
- }//errors added automatically to event global object
23
- }
24
-
25
- //Copy the event
26
- if ($_REQUEST['action'] == 'duplicate') {
27
- global $EZSQL_ERROR;
28
- $EM_Event = $EM_Event->duplicate();
29
- if( $EM_Event === false ){
30
- $redirect_url = em_add_get_params($_SERVER['HTTP_REFERER'], array('error' => __('There was an error duplicating the event. Try again maybe?', 'dbem'), 'message'=>''), false);
31
- wp_redirect($redirect_url);
32
- }else{
33
- $page = !empty($_REQUEST['pno']) ? $_REQUEST['pno']:'';
34
- $scope = !empty($_REQUEST['scope']) ? $_REQUEST['scope']:'';
35
- wp_redirect( get_bloginfo('wpurl').'/wp-admin/admin.php?page=events-manager-event&event_id='.$EM_Event->id.'&p='.$page.'&scope='.$scope.'&message='.urlencode($EM_Event->feedback_message));
36
- }
37
- }
38
}
39
}
40
add_action('admin_init', 'em_admin_event_actions');
@@ -45,13 +17,13 @@ add_action('admin_init', 'em_admin_event_actions');
45
* @return null
46
*/
47
function em_admin_event_page() {
48
- global $EM_Event, $current_user;
49
- global $localised_date_formats;
50
51
//check that user can access this page
52
- if( is_object($EM_Event) && !$EM_Event->can_manage() ){
53
?>
54
- <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>
55
<?php
56
return false;
57
}
@@ -93,49 +65,22 @@ function em_admin_event_page() {
93
94
$days_names = array (1 => __ ( 'Mon' ), 2 => __ ( 'Tue' ), 3 => __ ( 'Wed' ), 4 => __ ( 'Thu' ), 5 => __ ( 'Fri' ), 6 => __ ( 'Sat' ), 0 => __ ( 'Sun' ) );
95
?>
96
- <?php if ( count($EM_Event->errors) > 0 || !empty($_GET['error']) ) : ?>
97
- <div id='message' class='error '>
98
- <p>
99
- <?php if( count($EM_Event->errors) ){ ?>
100
- <strong><?php echo __( "Ach, there's a problem here:", "dbem" ) ?></strong><br /><br />
101
- <?php echo implode('<br />', $EM_Event->errors); ?>
102
- <?php } else { echo $_GET['error']; } ?>
103
- </p>
104
- </div>
105
- <?php endif; ?>
106
- <?php if ( !empty($EM_Event->feedback_message) || !empty($_GET['message']) ) : ?>
107
- <div id='message' class='updated fade'>
108
- <p><?php echo !empty($EM_Event->feedback_message) ? $EM_Event->feedback_message : $_GET['message']; ?></p>
109
- </div>
110
- <?php endif; ?>
111
<form id="event-form" method="post" action="">
112
<div class="wrap">
113
<div id="icon-events" class="icon32"><br /></div>
114
<h2><?php echo $title; ?></h2>
115
- <?php if ( $EM_Event->is_recurrence() || $EM_Event->is_recurring() ) : ?>
116
- <p id='recurrence_warning'>
117
- <?php
118
- //TODO better warning system when changing a recurring event (e.g. when removing recurrences).
119
- if ( $EM_Event->is_recurring() ) {
120
- _e ( 'WARNING: This is a recurring event.', 'dbem' );
121
- echo "<br />";
122
- _e ( 'Modifying these data all the events linked to this recurrence will be rescheduled', 'dbem' );
123
- echo " ";
124
- _e ( 'and all booking information will be deleted!', 'dbem' );
125
- } elseif ( $EM_Event->is_recurrence() ) {
126
- //TODO Terminology confusing with methods, maybe worth changing?
127
- _e ( 'WARNING: This is a recurrence.', 'dbem' );
128
- echo "<br />";
129
- _e ( 'If you change these data and save, this will become an independent event.', 'dbem' );
130
- }
131
- ?>
132
- </p>
133
<?php endif; ?>
134
<div id="poststuff" class="metabox-holder has-right-sidebar">
135
<!-- SIDEBAR -->
136
<div id="side-info-column" class='inner-sidebar'>
137
<div id='side-sortables'>
138
- <?php if(get_option('dbem_recurrence_enabled')) : ?>
139
<!-- START recurrence postbox -->
140
<div class="postbox ">
141
<div class="handlediv" title="Fare clic per cambiare."><br />
@@ -218,57 +163,37 @@ function em_admin_event_page() {
218
<?php endif; ?>
219
<?php if(get_option('dbem_rsvp_enabled')) : ?>
220
<!-- START RSVP -->
221
- <?php if ( em_verify_admin() ): ?>
222
<div class="postbox ">
223
<div class="handlediv" title="Fare clic per cambiare."><br />
224
</div>
225
- <h3 class='hndle'><span>
226
- <?php _e ( 'Contact Person', 'dbem' ); ?>
227
- </span></h3>
228
<div class="inside">
229
- <p><?php _e('Contact','dbem'); ?>
230
- <?php
231
- wp_dropdown_users ( array ('name' => 'event_contactperson_id', 'show_option_none' => __ ( "Select...", 'dbem' ), 'selected' => $EM_Event->contactperson_id ) );
232
- ?>
233
- </p>
234
</div>
235
</div>
236
<?php else: ?>
237
- <input type="hidden" name="event_contactperson_id" value="<?php get_current_user_id() ?>" />
238
<?php endif; ?>
239
- <div class="postbox ">
240
<div class="handlediv" title="Fare clic per cambiare."><br />
241
</div>
242
- <h3 class='hndle'><span><?php _e('RSVP','dbem'); ?></span></h3>
243
<div class="inside">
244
- <p>
245
- <input id="rsvp-checkbox" name='event_rsvp' value='1' type='checkbox' <?php echo ($EM_Event->rsvp) ? 'checked="checked"' : ''; ?> />
246
- <?php _e ( 'Enable registration for this event', 'dbem' )?>
247
- </p>
248
- <div id='rsvp-data'>
249
- <?php
250
- if ($EM_Event->contactperson_id != NULL){
251
- $selected = $EM_Event->contactperson_id;
252
- }else{
253
- $selected = '0';
254
- }
255
- ?>
256
- <p>
257
- <?php _e ( 'Spaces','dbem' ); ?> :
258
- <input id="seats-input" type="text" name="event_seats" size='5' value="<?php echo $EM_Event->seats ?>" />
259
- </p>
260
<!-- START RSVP Stats -->
261
<?php
262
- if ($EM_Event->rsvp ) {
263
- $available_seats = $EM_Event->get_bookings()->get_available_seats();
264
- $booked_seats = $EM_Event->get_bookings()->get_booked_seats();
265
266
if ( count($EM_Event->get_bookings()->bookings) > 0 ) {
267
?>
268
<div class='wrap'>
269
- <p><strong><?php echo __('Available Spaces','dbem').': '.$EM_Event->get_bookings()->get_available_seats(); ?></strong></p>
270
- <p><strong><?php echo __('Confirmed Spaces','dbem').': '.$EM_Event->get_bookings()->get_booked_seats(); ?></strong></p>
271
- <p><strong><?php echo __('Pending Spaces','dbem').': '.$EM_Event->get_bookings()->get_pending_seats(); ?></strong></p>
272
</div>
273
274
<br class='clear'/>
@@ -288,7 +213,6 @@ function em_admin_event_page() {
288
<p><em><?php _e('No responses yet!')?></em></p>
289
<?php
290
}
291
- }
292
?>
293
<!-- END RSVP Stats -->
294
</div>
@@ -345,12 +269,8 @@ function em_admin_event_page() {
345
</div>
346
</div>
347
<div id="event_start_date" class="stuffbox">
348
- <h3 id='event-date-title'>
349
- <?php _e ( 'Event date', 'dbem' ); ?>
350
- </h3>
351
- <h3 id='recurrence-dates-title'>
352
- <?php _e ( 'Recurrence dates', 'dbem' ); ?>
353
- </h3>
354
<div class="inside">
355
<input id="localised-date" type="text" name="localised_event_date" style="display: none;" />
356
<input id="date-to-submit" type="text" name="event_start_date" value="<?php echo $EM_Event->start_date ?>" style="background: #FCFFAA" />
@@ -388,9 +308,9 @@ function em_admin_event_page() {
388
<?php _e ( 'Coordinates', 'dbem' ); ?>
389
</h3>
390
<div class="inside">
391
- <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $EM_Event->latitude; ?>' size='15' />
392
-
393
- <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $EM_Event->longitude; ?>' size='15' />
394
</div>
395
</div>
396
<div id="location_info" class="stuffbox">
@@ -400,7 +320,7 @@ function em_admin_event_page() {
400
<div class="inside">
401
<table id="dbem-location-data">
402
<tr>
403
- <td style="padding-right:20px">
404
<table>
405
<?php if($use_select_for_locations) : ?>
406
<tr>
@@ -411,9 +331,8 @@ function em_admin_event_page() {
411
$locations = EM_Locations::get();
412
foreach($locations as $location) {
413
$selected = "";
414
- if( is_object($EM_Event->location) ) {
415
- if ($EM_Event->location->id == $location->id)
416
- $selected = "selected='selected' ";
417
}
418
?>
419
<option value="<?php echo $location->id ?>" title="<?php echo "{$location->latitude},{$location->longitude}" ?>" <?php echo $selected ?>><?php echo $location->name; ?></option>
@@ -428,22 +347,43 @@ function em_admin_event_page() {
428
<tr>
429
<th><?php _e ( 'Name:' )?></th>
430
<td>
431
<input id="location-name" type="text" name="location_name" value="<?php echo htmlspecialchars($EM_Event->location->name, ENT_QUOTES); ?>" />
432
- <p><?php _e ( 'Select a location for your event', 'dbem' )?></p>
433
</td>
434
</tr>
435
<tr>
436
<th><?php _e ( 'Address:' )?>&nbsp;</th>
437
<td>
438
- <input id="location-address" type="text" name="location_address" value="<?php echo htmlspecialchars($EM_Event->location->address, ENT_QUOTES); ; ?>" />
439
- <p><?php _e ( 'The address of the location where the event takes place. Example: 21, Dominick Street', 'dbem' )?></p>
440
</td>
441
</tr>
442
<tr>
443
- <th><?php _e ( 'Town:' )?>&nbsp;</th>
444
<td>
445
- <input id="location-town" type="text" name="location_town" value="<?php echo htmlspecialchars($EM_Event->location->town, ENT_QUOTES); ?>" />
446
- <p><?php _e ( 'The town where the location is located. If you\'re using the Google Map integration and want to avoid geotagging ambiguities include the country in the town field. Example: Verona, Italy.', 'dbem' )?></p>
447
</td>
448
</tr>
449
<?php endif; ?>
@@ -461,7 +401,7 @@ function em_admin_event_page() {
461
</table>
462
</div>
463
</div>
464
- <div id="event_notes" class="postbox">
465
<h3>
466
<?php _e ( 'Details', 'dbem' ); ?>
467
</h3>
@@ -474,107 +414,229 @@ function em_admin_event_page() {
474
</div>
475
</div>
476
477
<?php if(get_option('dbem_attributes_enabled')) : ?>
478
- <div id="event_attributes" class="postbox">
479
<h3>
480
<?php _e ( 'Attributes', 'dbem' ); ?>
481
</h3>
482
<div class="inside">
483
<?php
484
- //We also get a list of attribute names and create a ddm list (since placeholders are fixed)
485
- $formats =
486
- get_option ( 'dbem_event_list_item_format' ).
487
- get_option ( 'dbem_event_page_title_format' ).
488
- get_option ( 'dbem_full_calendar_event_format' ).
489
- get_option ( 'dbem_location_baloon_format' ).
490
- get_option ( 'dbem_location_event_list_item_format' ).
491
- get_option ( 'dbem_location_page_title_format' ).
492
- get_option ( 'dbem_map_text_format' ).
493
- get_option ( 'dbem_rss_description_format' ).
494
- get_option ( 'dbem_rss_title_format' ).
495
- get_option ( 'dbem_single_event_format' ).
496
- get_option ( 'dbem_single_location_format' ).
497
- get_option ( 'dbem_placeholders_custom' );
498
- //We now have one long string of formats, get all the attribute placeholders
499
- preg_match_all('/#_ATT\{.+?\}(\{.+?\})?/', $formats, $placeholders);
500
- //Now grab all the unique attributes we can use in our event.
501
- $attributes = array();
502
- foreach($placeholders[0] as $result) {
503
- $attribute = substr( substr($result, 0, strpos($result, '}')), 6 );
504
- if( !in_array($attribute, $attributes) ){
505
- $attributes[] = $attribute ;
506
- }
507
- }
508
?>
509
<div class="wrap">
510
<?php if( count( $attributes ) > 0 ) : ?>
511
- <h2>Attributes</h2>
512
- <p>Add attributes here</p>
513
<table class="form-table">
514
<thead>
515
<tr valign="top">
516
<td><strong>Attribute Name</strong></td>
517
<td><strong>Value</strong></td>
518
</tr>
519
- </thead>
520
- <tfoot>
521
- <tr valign="top">
522
- <td colspan="3"><a href="#" id="mtm_add_tag">Add new tag</a></td>
523
- </tr>
524
- </tfoot>
525
<tbody id="mtm_body">
526
<?php
527
$count = 1;
528
- if( is_array($EM_Event->attributes) and count($EM_Event->attributes) > 0){
529
- foreach( $EM_Event->attributes as $name => $value){
530
- ?>
531
- <tr valign="top" id="mtm_<?php echo $count ?>">
532
- <td scope="row">
533
- <select name="mtm_<?php echo $count ?>_ref">
534
- <?php
535
- if( !in_array($name, $attributes) ){
536
- echo "<option value='$name'>$name (".__('Not defined in templates', 'dbem').")</option>";
537
- }
538
- foreach( $attributes as $attribute ){
539
- if( $attribute == $name ) {
540
- echo "<option selected='selected'>$attribute</option>";
541
- }else{
542
- echo "<option>$attribute</option>";
543
- }
544
- }
545
- ?>
546
- </select>
547
- <a href="#" rel="<?php echo $count ?>">Remove</a>
548
- </td>
549
- <td>
550
- <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" />
551
- </td>
552
- </tr>
553
- <?php
554
- $count++;
555
- }
556
- }else{
557
?>
558
- <tr valign="top" id="mtm_<?php echo $count ?>">
559
- <td scope="row">
560
- <select name="mtm_<?php echo $count ?>_ref">
561
- <?php
562
- foreach( $attributes as $attribute ){
563
- echo "<option>$attribute</option>";
564
- }
565
- ?>
566
- </select>
567
- <a href="#" rel="<?php echo $count ?>">Remove</a>
568
- </td>
569
<td>
570
- <input type="text" name="mtm_<?php echo $count ?>_name" />
571
</td>
572
</tr>
573
<?php
574
}
575
?>
576
</tbody>
577
</table>
578
<?php else : ?>
579
<p>
580
<?php _e('In order to use attributes, you must define some in your templates, otherwise they\'ll never show. Go to Events > Settings to add attribute placeholders.', 'dbem'); ?>
@@ -593,11 +655,35 @@ function em_admin_event_page() {
593
</p>
594
<input type="hidden" name="p" value="<?php echo ( !empty($_REQUEST['pno']) ) ? $_REQUEST['pno']:''; ?>" /><a>
595
<input type="hidden" name="scope" value="<?php echo ( !empty($_REQUEST['scope']) ) ? $_REQUEST['scope']:'' ?>" /></a>
596
- <input type="hidden" name="action" value="save" />
597
</div>
598
</div>
599
</div>
600
</form>
601
<script type="text/javascript">
602
jQuery(document).ready( function($) {
603
<?php if( $EM_Event->is_recurring() ): ?>
@@ -609,16 +695,28 @@ function em_admin_event_page() {
609
}
610
});
611
<?php endif; ?>
612
- <?php if( $EM_Event->rsvp == 1 ): ?>
613
//RSVP Warning
614
- $('#rsvp-checkbox').click( function(event){
615
if( !this.checked ){
616
- confirmation = confirm('<?php _e('Are you sure you want to disable bookings? If you do this and save, you will lose all previous bookings. If you wish to prevent further bookings, reduce the number of seats available to the amount of bookings you currently have', 'dbem'); ?>');
617
if( confirmation == false ){
618
event.preventDefault();
619
}
620
}
621
});
622
<?php endif; ?>
623
});
624
</script>
3
if( current_user_can(EM_MIN_CAPABILITY) && !empty($_GET['page']) && $_GET['page'] == 'events-manager-event' && !empty($_REQUEST ['action']) ){
4
global $wpdb;
5
global $EM_Event;
6
//if dealing with new event, we still want an event object
7
if( !is_object($EM_Event) ){
8
$EM_Event = new EM_Event();
9
}
10
}
11
}
12
add_action('admin_init', 'em_admin_event_actions');
17
* @return null
18
*/
19
function em_admin_event_page() {
20
+ global $EM_Event, $current_user, $EM_Notices, $localised_date_formats;
21
+ //$EM_Event->get_bookings()->get_tickets()->get_ticket_bookings(); print_r($EM_Event);die();
22
23
//check that user can access this page
24
+ if( is_object($EM_Event) && !$EM_Event->can_manage('edit_events','edit_others_events') ){
25
?>
26
+ <div class="wrap"><h2><?php _e('Unauthorized Access','dbem'); ?></h2><p><?php echo sprintf(__('You do not have the rights to manage this %s.','dbem'),__('Event','dbem')); ?></p></div>
27
<?php
28
return false;
29
}
65
66
$days_names = array (1 => __ ( 'Mon' ), 2 => __ ( 'Tue' ), 3 => __ ( 'Wed' ), 4 => __ ( 'Thu' ), 5 => __ ( 'Fri' ), 6 => __ ( 'Sat' ), 0 => __ ( 'Sun' ) );
67
?>
68
+ <?php echo $EM_Notices; ?>
69
+
70
<form id="event-form" method="post" action="">
71
<div class="wrap">
72
<div id="icon-events" class="icon32"><br /></div>
73
<h2><?php echo $title; ?></h2>
74
+ <?php if ( count($EM_Event->warnings) > 0 ) : ?>
75
+ <?php foreach($EM_Event->warnings as $warning): ?>
76
+ <p class="warning"><?php echo $warning; ?></p>
77
+ <?php endforeach; ?>
78
<?php endif; ?>
79
<div id="poststuff" class="metabox-holder has-right-sidebar">
80
<!-- SIDEBAR -->
81
<div id="side-info-column" class='inner-sidebar'>
82
<div id='side-sortables'>
83
+ <?php if(get_option('dbem_recurrence_enabled') && ($EM_Event->is_recurrence() || $EM_Event->is_recurring() || $EM_Event->id == '')) : ?>
84
<!-- START recurrence postbox -->
85
<div class="postbox ">
86
<div class="handlediv" title="Fare clic per cambiare."><br />
163
<?php endif; ?>
164
<?php if(get_option('dbem_rsvp_enabled')) : ?>
165
<!-- START RSVP -->
166
+ <?php if ( current_user_can('edit_others_events') ): ?>
167
<div class="postbox ">
168
<div class="handlediv" title="Fare clic per cambiare."><br />
169
</div>
170
+ <h3 class='hndle'><span><?php _e ( 'Event Owner/Contact Person', 'dbem' ); ?></span></h3>
171
<div class="inside">
172
+ <?php
173
+ wp_dropdown_users ( array ('name' => 'event_owner', 'show_option_none' => __ ( "Select...", 'dbem' ), 'selected' => $EM_Event->owner ) );
174
+ ?>
175
</div>
176
</div>
177
<?php else: ?>
178
+ <input type="hidden" name="event_owner" value="<?php get_current_user_id() ?>" />
179
<?php endif; ?>
180
+ <div class="postbox " id='rsvp-data'>
181
<div class="handlediv" title="Fare clic per cambiare."><br />
182
</div>
183
+ <h3 class='hndle'><span><?php _e('Bookings Stats','dbem'); ?></span></h3>
184
<div class="inside">
185
+ <div>
186
<!-- START RSVP Stats -->
187
<?php
188
+ $available_spaces = $EM_Event->get_bookings()->get_available_spaces();
189
+ $booked_spaces = $EM_Event->get_bookings()->get_booked_spaces();
190
191
if ( count($EM_Event->get_bookings()->bookings) > 0 ) {
192
?>
193
<div class='wrap'>
194
+ <p><strong><?php echo __('Available Spaces','dbem').': '.$EM_Event->get_bookings()->get_available_spaces(); ?></strong></p>
195
+ <p><strong><?php echo __('Confirmed Spaces','dbem').': '.$EM_Event->get_bookings()->get_booked_spaces(); ?></strong></p>
196
+ <p><strong><?php echo __('Pending Spaces','dbem').': '.$EM_Event->get_bookings()->get_pending_spaces(); ?></strong></p>
197
</div>
198
199
<br class='clear'/>
213
<p><em><?php _e('No responses yet!')?></em></p>
214
<?php
215
}
216
?>
217
<!-- END RSVP Stats -->
218
</div>
269
</div>
270
</div>
271
<div id="event_start_date" class="stuffbox">
272
+ <h3 id='event-date-title'><?php _e ( 'Event date', 'dbem' ); ?></h3>
273
+ <h3 id='recurrence-dates-title'><?php _e ( 'Recurrence dates', 'dbem' ); ?></h3>
274
<div class="inside">
275
<input id="localised-date" type="text" name="localised_event_date" style="display: none;" />
276
<input id="date-to-submit" type="text" name="event_start_date" value="<?php echo $EM_Event->start_date ?>" style="background: #FCFFAA" />
308
<?php _e ( 'Coordinates', 'dbem' ); ?>
309
</h3>
310
<div class="inside">
311
+ <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $EM_Event->get_location()->latitude; ?>' size='15' />
312
-
313
+ <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $EM_Event->get_location()->longitude; ?>' size='15' />
314
</div>
315
</div>
316
<div id="location_info" class="stuffbox">
320
<div class="inside">
321
<table id="dbem-location-data">
322
<tr>
323
+ <td style="padding-right:20px; width:100%;">
324
<table>
325
<?php if($use_select_for_locations) : ?>
326
<tr>
331
$locations = EM_Locations::get();
332
foreach($locations as $location) {
333
$selected = "";
334
+ if ($EM_Event->get_location()->id == $location->id){
335
+ $selected = "selected='selected' ";
336
}
337
?>
338
<option value="<?php echo $location->id ?>" title="<?php echo "{$location->latitude},{$location->longitude}" ?>" <?php echo $selected ?>><?php echo $location->name; ?></option>
347
<tr>
348
<th><?php _e ( 'Name:' )?></th>
349
<td>
350
+ <input id='location-id' name='location_id' type='hidden' value='<?php echo $EM_Event->get_location()->id; ?>' size='15' />
351
<input id="location-name" type="text" name="location_name" value="<?php echo htmlspecialchars($EM_Event->location->name, ENT_QUOTES); ?>" />
352
+ <p><?php _e ( 'Create a location or start typing to search a previously created location.', 'dbem' )?></p>
353
</td>
354
</tr>
355
<tr>
356
<th><?php _e ( 'Address:' )?>&nbsp;</th>
357
<td>
358
+ <input id="location-address" type="text" name="location_address" value="<?php echo htmlspecialchars($EM_Event->location->address, ENT_QUOTES); ; ?>" /> <?php echo $required; ?>
359
</td>
360
</tr>
361
<tr>
362
+ <th><?php _e ( 'City/Town:' )?>&nbsp;</th>
363
<td>
364
+ <input id="location-town" type="text" name="location_town" value="<?php echo htmlspecialchars($EM_Event->location->town, ENT_QUOTES); ?>" /> <?php echo $required; ?>
365
+ </td>
366
+ </tr>
367
+ <tr>
368
+ <th><?php _e ( 'State/County:' )?>&nbsp;</th>
369
+ <td>
370
+ <input id="location-state" type="text" name="location_state" value="<?php echo htmlspecialchars($EM_Event->location->state, ENT_QUOTES); ?>" />
371
+ </td>
372
+ </tr>
373
+ <tr>
374
+ <th><?php _e ( 'Postcode:' )?>&nbsp;</th>
375
+ <td>
376
+ <input id="location-postcode" type="text" name="location_postcode" value="<?php echo htmlspecialchars($EM_Event->location->postcode, ENT_QUOTES); ?>" />
377
+ </td>
378
+ </tr>
379
+ <tr>
380
+ <th><?php _e ( 'Country:' )?>&nbsp;</th>
381
+ <td>
382
+ <select id="location-country" name="location_country">
383
+ <?php foreach(em_get_countries(__('none selected','dbem')) as $country_key => $country_name): ?>
384
+ <option value="<?php echo $country_key; ?>" <?php echo ( $EM_Event->location->country === $country_key || ($EM_Event->location->country == '' && $EM_Event->location->id == '' && get_option('dbem_location_default_country')==$country_key) ) ? 'selected="selected"':''; ?>><?php echo $country_name; ?></option>
385
+ <?php endforeach; ?>
386
+ </select> <?php echo $required; ?>
387
</td>
388
</tr>
389
<?php endif; ?>
401
</table>
402
</div>
403
</div>
404
+ <div id="event_notes" class="stuffbox">
405
<h3>
406
<?php _e ( 'Details', 'dbem' ); ?>
407
</h3>
414
</div>
415
</div>
416
417
+ <?php if(get_option('dbem_rsvp_enabled')) : ?>
418
+ <div id="event-bookings" class="stuffbox">
419
+ <h3><span><?php _e('Bookings/Registration','dbem'); ?></span></h3>
420
+ <div class="inside">
421
+ <div class="wrap">
422
+ <p>
423
+ <input id="event-rsvp" name='event_rsvp' value='1' type='checkbox' <?php echo ($EM_Event->rsvp) ? 'checked="checked"' : ''; ?> />
424
+ <?php _e ( 'Enable registration for this event', 'dbem' )?>
425
+ </p>
426
+ <br />
427
+ <div id="event-tickets" style="<?php echo ($EM_Event->rsvp) ? '':'display:none;' ?>">
428
+ <p><strong><?php _e('Tickets','dbem'); ?></strong></p>
429
+ <p><em><?php _e('You have single or multiple tickets, where certain tickets become availalble under certain conditions, e.g. early bookings, group discounts, maximum bookings per ticket, etc.', 'dbem'); ?></em></p>
430
+ <table class="form-table">
431
+ <thead>
432
+ <tr valign="top">
433
+ <th class="ticket-status">&nbsp;</th>
434
+ <th><?php _e('Ticket Name','dbem'); ?></th>
435
+ <th><?php _e('Price','dbem'); ?></th>
436
+ <th><?php _e('Min/Max','dbem'); ?></th>
437
+ <th><?php _e('Start/End','dbem'); ?></th>
438
+ <th><?php _e('Avail. Spaces','dbem'); ?></th>
439
+ <th><?php _e('Booked Spaces','dbem'); ?></th>
440
+ <th>&nbsp;</th>
441
+ </tr>
442
+ </thead>
443
+ <tfoot>
444
+ <tr valign="top">
445
+ <td colspan="6">
446
+ <a href="#" id="em-tickets-add" rel="#em-tickets-form"><?php _e('Add new ticket','dbem'); ?></a>
447
+ </td>
448
+ </tr>
449
+ </tfoot>
450
+ <tbody id="em-tickets-body">
451
+ <?php
452
+ $EM_Tickets = $EM_Event->get_bookings()->get_tickets();
453
+ if( count($EM_Tickets->tickets) > 0 ){
454
+ $count = 1;
455
+ foreach( $EM_Tickets->tickets as $EM_Ticket){
456
+ ?>
457
+ <tr valign="top" id="em-tickets-row-<?php echo $count ?>" class="em-tickets-row">
458
+ <td class="ticket-status"><span class="<?php echo ($EM_Ticket->is_available()) ? 'ticket_on':'ticket_off'; ?>"></span></td>
459
+ <td class="ticket-name"><span class="ticket_name"><?php echo $EM_Ticket->name ?></span><br /><span class="ticket_description"></span></td>
460
+ <td class="ticket-price">
461
+ <span class="ticket_price"><?php echo ($EM_Ticket->price) ? $EM_Ticket->price : __('Free','dbem'); ?></span>
462
+ </td>
463
+ <td class="ticket-limit">
464
+ <span class="ticket_min">
465
+ <?php echo ( !empty($EM_Ticket->min) ) ? $EM_Ticket->min:'-'; ?>
466
+ </span> /
467
+ <span class="ticket_max"><?php echo ( !empty($EM_Ticket->max) ) ? $EM_Ticket->max:'-'; ?></span>
468
+ </td>
469
+ <td class="ticket-time">
470
+ <span class="ticket_start"><?php echo ( !empty($EM_Ticket->start) ) ? date($localised_date_format, $EM_Ticket->start_timestamp):''; ?></span> -
471
+ <span class="ticket_end"><?php echo ( !empty($EM_Ticket->end) ) ? date($localised_date_format, $EM_Ticket->end_timestamp):''; ?></span>
472
+ </td>
473
+ <td class="ticket-qty">
474
+ <span class="ticket_available_spaces"><?php echo $EM_Ticket->get_available_spaces(); ?></span>/
475
+ <span class="ticket_spaces">
476
+ <?php
477
+ if( $EM_Ticket->get_spaces() ){
478
+ echo $EM_Ticket->get_spaces();
479
+ echo ($EM_Ticket->spaces_limit) ? '':'*';
480
+ }else{
481
+ echo '-';
482
+ }
483
+ ?>
484
+ </span>
485
+ </td>
486
+ <td class="ticket-booked-spaces">
487
+ <span class="ticket_booked_spaces"><?php echo $EM_Ticket->get_booked_spaces(); ?></span>
488
+ </td>
489
+ <td class="ticket-actions">
490
+ <a href="#" class="ticket-actions-edit"><?php _e('Edit','dbem'); ?></a>
491
+ <?php if( count($EM_Ticket->get_bookings()->bookings) == 0 ): ?>
492
+ | <a href="<?php bloginfo('wpurl'); ?>/wp-load.php" class="ticket-actions-delete"><?php _e('Delete','dbem'); ?></a>
493
+ <?php else: ?>
494
+ | <a href="<?php bloginfo('wpurl'); ?>/wp-admin/admin.php?page=events-manager-bookings&ticket_id=<?php echo $EM_Ticket->id ?>"><?php _e('View Bookings','dbem'); ?></a>
495
+ <?php endif; ?>
496
+
497
+ <input type="hidden" class="ticket_id" name="em_tickets[<?php echo $count; ?>][ticket_id]" value="<?php echo $EM_Ticket->id ?>" />
498
+ <input type="hidden" class="ticket_name" name="em_tickets[<?php echo $count; ?>][ticket_name]" value="<?php echo $EM_Ticket->name ?>" />
499
+ <input type="hidden" class="ticket_description" name="em_tickets[<?php echo $count; ?>][ticket_description]" value="<?php echo $EM_Ticket->description ?>" />
500
+ <input type="hidden" class="ticket_price" name="em_tickets[<?php echo $count; ?>][ticket_price]" value="<?php echo $EM_Ticket->price ?>" />
501
+ <input type="hidden" class="ticket_spaces" name="em_tickets[<?php echo $count; ?>][ticket_spaces]" value="<?php echo $EM_Ticket->spaces ?>" />
502
+ <input type="hidden" class="ticket_start" name="em_tickets[<?php echo $count; ?>][ticket_start]" value="<?php echo ( !empty($EM_Ticket->start) ) ? date("Y-m-d H:i", $EM_Ticket->start_timestamp):''; ?>" />
503
+ <input type="hidden" class="ticket_end" name="em_tickets[<?php echo $count; ?>][ticket_end]" value="<?php echo ( !empty($EM_Ticket->end) ) ? date("Y-m-d H:i", $EM_Ticket->end_timestamp):''; ?>" />
504
+ <input type="hidden" class="ticket_min" name="em_tickets[<?php echo $count; ?>][ticket_min]" value="<?php echo $EM_Ticket->min ?>" />
505
+ <input type="hidden" class="ticket_max" name="em_tickets[<?php echo $count; ?>][ticket_max]" value="<?php echo $EM_Ticket->max ?>" />
506
+ </td>
507
+ </tr>
508
+ <?php
509
+ $count++;
510
+ }
511
+ }else{
512
+ ?>
513
+ <tr valign="top" id="em-tickets-row-1" class="em-tickets-row">
514
+ <td class="ticket-status"><span class="ticket_off"></span></td>
515
+ <td class="ticket-name"><span class="ticket_name">Free Ticket</span><br><span class="ticket_description"></span></td>
516
+ <td class="ticket-price"><span class="ticket_price">Free</span></td>
517
+ <td class="ticket-limit"><span class="ticket_min">-</span> / <span class="ticket_max">-</span></td>
518
+ <td class="ticket-time"><span class="ticket_start"></span> - <span class="ticket_end"></span></td>
519
+ <td class="ticket-qty"><span class="ticket_available_spaces">10</span>/<span class="ticket_spaces">10</span></td>
520
+ <td class="ticket-booked-spaces"><span class="ticket_booked_spaces">0</span></td>
521
+ <td class="ticket-actions">
522
+ <a href="#" class="ticket-actions-edit">Edit</a>| <a href="http://wordpress.lan/wp-load.php" class="ticket-actions-delete">Delete</a>
523
+ <input type="hidden" class="ticket_id" name="em_tickets[1][ticket_id]" value="">
524
+ <input type="hidden" class="ticket_name" name="em_tickets[1][ticket_name]" value="Free Ticket">
525
+ <input type="hidden" class="ticket_description" name="em_tickets[1][ticket_description]" value="">
526
+ <input type="hidden" class="ticket_price" name="em_tickets[1][ticket_price]" value="">
527
+ <input type="hidden" class="ticket_spaces" name="em_tickets[1][ticket_spaces]" value="10">
528
+ <input type="hidden" class="ticket_start" name="em_tickets[1][ticket_start]" value="">
529
+ <input type="hidden" class="ticket_end" name="em_tickets[1][ticket_end]" value="">
530
+ <input type="hidden" class="ticket_min" name="em_tickets[1][ticket_min]" value="">
531
+ <input type="hidden" class="ticket_max" name="em_tickets[1][ticket_max]" value="">
532
+ </td>
533
+ </tr>
534
+ <?php
535
+ }
536
+ ?>
537
+ </tbody>
538
+ </table>
539
+ <table style="display:none; visibility:hidden;">
540
+ <tr valign="top" id="em-tickets-template">
541
+ <td class="ticket-status"><span class="ticket_new"></span></td>
542
+ <td class="ticket-name"><span class="ticket_name"></span><br /><span class="ticket_description"></span></td>
543
+ <td class="ticket-price"><span class="ticket_price"></span></td>
544
+ <td class="ticket-limit"><span class="ticket_min"></span> / <span class="ticket_max"></span></td>
545
+ <td class="ticket-time"><span class="ticket_start"></span> - <span class="ticket_end"></span></td>
546
+ <td class="ticket-qty"><span class="ticket_available_spaces">0</span>/<span class="ticket_spaces"></span></td>
547
+ <td class="ticket-booked-spaces"><span class="ticket_booked_spaces">0</span></td>
548
+ <td class="ticket-actions">
549
+ <a href="#" class="ticket-actions-edit"><?php _e('Edit','dbem'); ?></a> | <a href="<?php bloginfo('wpurl'); ?>/wp-load.php" class="ticket-actions-delete"><?php _e('Delete','dbem'); ?></a>
550
+ <input type="hidden" class="ticket_id" />
551
+ <input type="hidden" class="ticket_name" />
552
+ <input type="hidden" class="ticket_description" />
553
+ <input type="hidden" class="ticket_price" />
554
+ <input type="hidden" class="ticket_spaces" />
555
+ <input type="hidden" class="ticket_start" />
556
+ <input type="hidden" class="ticket_end" />
557
+ <input type="hidden" class="ticket_min" />
558
+ <input type="hidden" class="ticket_max" />
559
+ </td>
560
+ </tr>
561
+ </table>
562
+ </div>
563
+ </div>
564
+ </div>
565
+ </div>
566
+ <?php endif; ?>
567
+
568
<?php if(get_option('dbem_attributes_enabled')) : ?>
569
+ <div id="event_attributes" class="stuffbox">
570
<h3>
571
<?php _e ( 'Attributes', 'dbem' ); ?>
572
</h3>
573
<div class="inside">
574
<?php
575
+ $attributes = em_get_attributes();
576
+ $has_depreciated = false;
577
?>
578
<div class="wrap">
579
<?php if( count( $attributes ) > 0 ) : ?>
580
<table class="form-table">
581
<thead>
582
<tr valign="top">
583
<td><strong>Attribute Name</strong></td>
584
<td><strong>Value</strong></td>
585
</tr>
586
+ </thead>
587
<tbody id="mtm_body">
588
<?php
589
$count = 1;
590
+ foreach( $attributes as $name){
591
?>
592
+ <tr valign="top" id="em_attribute_<?php echo $count ?>">
593
+ <td scope="row"><?php echo $name ?></td>
594
<td>
595
+ <input type="text" name="em_attributes[<?php echo $name ?>]" value="<?php echo array_key_exists($name, $EM_Event->attributes) ? htmlspecialchars($EM_Event->attributes[$name], ENT_QUOTES):''; ?>" />
596
</td>
597
</tr>
598
<?php
599
+ $count++;
600
+ }
601
+ if($count == 1){
602
+ ?>
603
+ <tr><td colspan="2"><?php echo sprintf(__("You don't have any custom attributes defined in any of your Events Manager template settings. Please add them the <a href='%s'>settings page</a>",'dbem'),get_bloginfo('wpurl')."/wp-admin/admin.php?page=events-manager-options"); ?></td></tr>
604
+ <?php
605
+ }
606
+ ?>
607
+ </tbody>
608
+ </table>
609
+ <?php if( count(array_diff(array_keys($EM_Event->attributes), $attributes)) > 0 ): ?>
610
+ <p><strong><?php _e('Depreciated Attributes')?></strong></p>
611
+ <p><em><?php _e("If you see any attributes under here, that means they're not used in Events Manager anymore. To add them, you need to add the custom attribute again to a formatting option in the settings page. To remove any of these depreciated attributes, give it a blank value and save.") ?></em></p>
612
+ <table class="form-table">
613
+ <thead>
614
+ <tr valign="top">
615
+ <td><strong>Attribute Name</strong></td>
616
+ <td><strong>Value</strong></td>
617
+ </tr>
618
+ </thead>
619
+ <tbody id="mtm_body">
620
+ <?php
621
+ if( is_array($EM_Event->attributes) and count($EM_Event->attributes) > 0){
622
+ foreach( $EM_Event->attributes as $name => $value){
623
+ if( !in_array($name, $attributes) ){
624
+ ?>
625
+ <tr valign="top" id="em_attribute_<?php echo $count ?>">
626
+ <td scope="row"><?php echo $name ?></td>
627
+ <td>
628
+ <input type="text" name="em_attributes[<?php echo $name ?>]" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" />
629
+ </td>
630
+ </tr>
631
+ <?php
632
+ $count++;
633
+ }
634
+ }
635
}
636
?>
637
</tbody>
638
</table>
639
+ <?php endif; ?>
640
<?php else : ?>
641
<p>
642
<?php _e('In order to use attributes, you must define some in your templates, otherwise they\'ll never show. Go to Events > Settings to add attribute placeholders.', 'dbem'); ?>
655
</p>
656
<input type="hidden" name="p" value="<?php echo ( !empty($_REQUEST['pno']) ) ? $_REQUEST['pno']:''; ?>" /><a>
657
<input type="hidden" name="scope" value="<?php echo ( !empty($_REQUEST['scope']) ) ? $_REQUEST['scope']:'' ?>" /></a>
658
+ <input type="hidden" name="event_id" value="<?php echo $EM_Event->id; ?>" />
659
+ <input type="hidden" name="_wpnonce" value="<?php echo wp_create_nonce('wpnonce_event_save'); ?>" />
660
+ <input type="hidden" name="action" value="event_save" />
661
</div>
662
</div>
663
</div>
664
</form>
665
+ <div id="em-tickets-form">
666
+ <h4><?php _e('Create a ticket', 'dbem'); ?></h4>
667
+ <form action="" method="post">
668
+ <div><label><?php _e('Name','dbem'); ?></label><input type="text" name="ticket_name" /></div>
669
+ <div><label><?php _e('Description','dbem') ?></label><br /><textarea name="ticket_description"></textarea></div>
670
+ <div><label><?php _e('Price','dbem') ?></label><input type="text" name="ticket_price" /></div>
671
+ <div>
672
+ <label><?php _e('Available ticket spaces','dbem') ?></label><input type="text" name="ticket_spaces" /><br />
673
+ <em><?php _e('If left blank, spaces are determined by event limit.','dbem'); ?></em>
674
+ </div><br />
675
+ <div><label><?php _e('Start date of ticket availability','dbem') ?></label><input type="hidden" name="ticket_start" /><input type="text" name="ticket_start_pub" /></div>
676
+ <div><label><?php _e('End date of ticket availability','dbem') ?></label><input type="hidden" name="ticket_end" /><input type="text" name="ticket_end_pub" /></div>
677
+ <div><label><?php _e('Minimum tickets required per booking','dbem') ?></label><input type="text" name="ticket_min" /></div>
678
+ <div><label><?php _e('Maximum tickets required per booking','dbem') ?></label><input type="text" name="ticket_max" /></div>
679
+ <p class="submit">
680
+ <input type="hidden" name="ticket_id" />
681
+ <input type="hidden" name="event_id" />
682
+ <input type="hidden" name="prev_slot" />
683
+ <input type="submit" value="<?php _e('Add Ticket','dbem'); ?>" />
684
+ </p>
685
+ </form>
686
+ </div>
687
<script type="text/javascript">
688
jQuery(document).ready( function($) {
689
<?php if( $EM_Event->is_recurring() ): ?>
695
}
696
});
697
<?php endif; ?>
698
+ <?php if( get_option('dbem_rsvp_enabled') ): ?>
699
//RSVP Warning
700
+ $('#event-rsvp').click( function(event){
701
if( !this.checked ){
702
+ confirmation = confirm('<?php _e('Are you sure you want to disable bookings? If you do this and save, you will lose all previous bookings. If you wish to prevent further bookings, reduce the number of spaces available to the amount of bookings you currently have', 'dbem'); ?>');
703
if( confirmation == false ){
704
event.preventDefault();
705
+ }else{
706
+ $('#event-tickets').hide();
707
+ $("div#rsvp-data").hide();
708
}
709
+ }else{
710
+ $('#event-tickets').fadeIn();
711
+ $("div#rsvp-data").fadeIn();
712
}
713
});
714
+
715
+ if($('input#event-rsvp').attr("checked")) {
716
+ $("div#rsvp-data").fadeIn();
717
+ } else {
718
+ $("div#rsvp-data").hide();
719
+ }
720
<?php endif; ?>
721
});
722
</script>
admin/em-events.php CHANGED
@@ -6,54 +6,44 @@
6
*/
7
function em_admin_events_page() {
8
//TODO Simplify panel for events, use form flags to detect certain actions (e.g. submitted, etc)
9
- global $wpdb;
10
- global $EM_Event;
11
- $action = ( !empty($_GET ['action']) ) ? $_GET ['action']:'';
12
- $order = ( !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
13
- $limit = ( !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
14
- $page = ( !empty($_GET['pno']) ) ? $_GET['pno']:1;
15
$offset = ( $page > 1 ) ? ($page-1)*$limit : 0;
16
$scope_names = array (
17
'past' => __ ( 'Past events', 'dbem' ),
18
'all' => __ ( 'All events', 'dbem' ),
19
'future' => __ ( 'Future events', 'dbem' )
20
);
21
- $scope = ( !empty($_GET ['scope']) && array_key_exists($_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
22
- $selectedEvents = ( !empty($_GET ['events']) ) ? $_GET ['events']:'';
23
24
- // DELETE action
25
- if ( $action == 'deleteEvents' && EM_Object::array_is_numeric($selectedEvents) ) {
26
- EM_Events::delete( $selectedEvents );
27
- }
28
29
- // No action, only showing the events list
30
- switch ($scope) {
31
- case "past" :
32
- $title = __ ( 'Past Events', 'dbem' );
33
-<