Events Manager - Version 3.0.97

Version Description

  • correcting wrong version update
Download this release

Release Info

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

Code changes from version 3.0.96 to 3.0.97

Files changed (104) hide show
  1. admin/bookings/em-cancelled.php +132 -135
  2. admin/bookings/em-confirmed.php +139 -142
  3. admin/bookings/em-events.php +178 -177
  4. admin/bookings/em-pending.php +154 -159
  5. admin/bookings/em-person.php +149 -151
  6. admin/bookings/em-rejected.php +132 -135
  7. admin/em-admin.php +265 -162
  8. admin/em-bookings.php +287 -368
  9. admin/em-categories.php +176 -176
  10. admin/em-docs.php +192 -196
  11. admin/em-event.php +626 -724
  12. admin/em-events.php +241 -243
  13. admin/em-help.php +51 -51
  14. admin/em-locations-search.php +2 -6
  15. admin/em-locations.php +267 -263
  16. admin/em-options.php +443 -492
  17. admin/em-people.php +124 -9
  18. buddypress/bp-em-activity.php +0 -106
  19. buddypress/bp-em-admin.php +0 -65
  20. buddypress/bp-em-core.php +0 -175
  21. buddypress/bp-em-notifications.php +0 -157
  22. buddypress/bp-em-templatetags.php +0 -7
  23. buddypress/screens/attending.php +0 -40
  24. buddypress/screens/my-events.php +0 -65
  25. buddypress/screens/my-locations.php +0 -72
  26. buddypress/screens/profile.php +0 -54
  27. buddypress/screens/settings.php +0 -56
  28. classes/em-booking.php +378 -543
  29. classes/em-bookings.php +487 -595
  30. classes/em-calendar.php +365 -367
  31. classes/em-categories.php +156 -157
  32. classes/em-category.php +151 -175
  33. classes/em-event.php +1005 -1156
  34. classes/em-events.php +253 -300
  35. classes/em-location.php +306 -387
  36. classes/em-locations.php +212 -220
  37. classes/em-mailer.php +79 -79
  38. classes/em-map.php +59 -59
  39. classes/em-notices.php +0 -170
  40. classes/em-object.php +485 -553
  41. classes/em-people.php +128 -66
  42. classes/em-permalinks.php +0 -200
  43. classes/em-person.php +153 -68
  44. classes/em-recurrence.php +89 -0
  45. classes/em-ticket-booking.php +0 -209
  46. classes/em-ticket.php +0 -333
  47. classes/em-tickets-bookings.php +0 -261
  48. classes/em-tickets.php +0 -204
  49. classes/phpmailer/class.phpmailer.php +1506 -1506
  50. classes/phpmailer/class.smtp.php +1045 -1045
  51. classes/phpmailer/language/phpmailer.lang-br.php +21 -21
  52. classes/phpmailer/language/phpmailer.lang-ca.php +21 -21
  53. classes/phpmailer/language/phpmailer.lang-cz.php +23 -23
  54. classes/phpmailer/language/phpmailer.lang-de.php +23 -23
  55. classes/phpmailer/language/phpmailer.lang-dk.php +23 -23
  56. classes/phpmailer/language/phpmailer.lang-en.php +23 -23
  57. classes/phpmailer/language/phpmailer.lang-es.php +22 -22
  58. classes/phpmailer/language/phpmailer.lang-fi.php +22 -22
  59. classes/phpmailer/language/phpmailer.lang-fo.php +25 -25
  60. classes/phpmailer/language/phpmailer.lang-fr.php +24 -24
  61. classes/phpmailer/language/phpmailer.lang-hu.php +22 -22
  62. classes/phpmailer/language/phpmailer.lang-it.php +28 -28
  63. classes/phpmailer/language/phpmailer.lang-nl.php +22 -22
  64. classes/phpmailer/language/phpmailer.lang-no.php +23 -23
  65. classes/phpmailer/language/phpmailer.lang-pl.php +23 -23
  66. classes/phpmailer/language/phpmailer.lang-ro.php +23 -23
  67. classes/phpmailer/language/phpmailer.lang-ru.php +23 -23
  68. classes/phpmailer/language/phpmailer.lang-se.php +23 -23
  69. classes/phpmailer/language/phpmailer.lang-tr.php +24 -24
  70. em-actions.php +0 -241
  71. em-ajax.php +101 -0
  72. em-bookings.php +162 -262
  73. em-debug.php +0 -46
  74. em-events.php +164 -185
  75. em-functions.php +270 -305
  76. em-ical.php +0 -80
  77. em-install.php +605 -457
  78. em-rss.php +38 -40
  79. em-shortcode.php +145 -145
  80. em-template-tags-depreciated.php +179 -179
  81. em-template-tags.php +155 -155
  82. events-manager.php +267 -384
  83. includes/css/events_manager.css +150 -126
  84. includes/css/events_manager_admin.css +75 -103
  85. includes/images/close.png +0 -0
  86. includes/js/em_admin.js +77 -196
  87. includes/js/em_maps.js +91 -90
  88. includes/js/em_ui.js +1 -13
  89. includes/langs/events-manager.pot +1014 -1547
  90. includes/{sample-placeholders → sample-placeholers}/booking-email.html +30 -30
  91. includes/{sample-placeholders → sample-placeholers}/event-single.html +81 -81
  92. readme.txt +6 -3
  93. templates/buddypress/events/my-events.php +0 -191
  94. templates/buddypress/locations/my-locations.php +0 -86
  95. templates/forms/events/attributes-box.php +0 -14
  96. templates/forms/events/bookings-box.php +0 -46
  97. templates/forms/events/categories-box.php +0 -25
  98. templates/forms/events/editor.php +0 -201
  99. templates/forms/events/recurrence-box.php +0 -64
  100. templates/forms/locations/editor.php +0 -117
  101. templates/placeholders/attendees.php +0 -12
  102. widgets/em-calendar.php +68 -68
  103. widgets/em-events.php +163 -163
  104. widgets/em-locations.php +96 -96
admin/bookings/em-cancelled.php CHANGED
@@ -1,136 +1,133 @@
1
- <?php
2
- /**
3
- * Generates a "widget" table of confirmed bookings for a specific event.
4
- *
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']:'';
12
- $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
13
- $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
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'>
30
- <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
31
- <!--
32
- <ul class="subsubsub">
33
- <li>
34
- <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
35
- </li>
36
- </ul>
37
- <p class="search-box">
38
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
39
- <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
40
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
41
- </p>
42
- -->
43
- <?php if ( $bookings_count >= $limit ) : ?>
44
- <div class='tablenav'>
45
- <!--
46
- <div class="alignleft actions">
47
- <select name="action">
48
- <option value="-1" selected="selected">
49
- <?php _e('Bulk Actions'); ?>
50
- </option>
51
- <option value="approve">
52
- <?php _e('Approve', 'dbem'); ?>
53
- </option>
54
- <option value="decline">
55
- <?php _e('Decline', 'dbem'); ?>
56
- </option>
57
- </select>
58
- <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
59
- </div>
60
- -->
61
- <!--
62
- <div class="view-switch">
63
- <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
64
- </div>
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
- ?>
72
- <div class="clear"></div>
73
- </div>
74
- <?php endif; ?>
75
- <div class="clear"></div>
76
- <?php if( $bookings_count > 0 ): ?>
77
- <div class='table-wrap'>
78
- <table id='dbem-bookings-table' class='widefat post fixed'>
79
- <thead>
80
- <tr>
81
- <th class='manage-column column-cb check-column' scope='col'>
82
- <input class='select-all' type="checkbox" value='1' />
83
- </th>
84
- <th class='manage-column' scope='col'>Booker</th>
85
- <th class='manage-column' scope='col'>E-mail</th>
86
- <th class='manage-column' scope='col'>Phone number</th>
87
- <th class='manage-column' scope='col'>Spaces</th>
88
- <th class='manage-column' scope='col'>&nbsp;</th>
89
- </tr>
90
- </thead>
91
- <tbody>
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>
115
- <?php
116
- }
117
- $event_count++;
118
- }
119
- ?>
120
- </tbody>
121
- </table>
122
- </div>
123
- <?php else: ?>
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>
131
- </div>
132
- <?php endif; ?>
133
- </div>
134
- <?php
135
- }
136
?>
1
+ <?php
2
+ /**
3
+ * Generates a "widget" table of confirmed bookings for a specific event.
4
+ *
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']:'';
12
+ $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
13
+ $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
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'>
26
+ <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
27
+ <!--
28
+ <ul class="subsubsub">
29
+ <li>
30
+ <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
31
+ </li>
32
+ </ul>
33
+ <p class="search-box">
34
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
35
+ <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
36
+ <input type="submit" value="<?php _e('Search'); ?>" class="button" />
37
+ </p>
38
+ -->
39
+ <?php if ( $bookings_count >= $limit ) : ?>
40
+ <div class='tablenav'>
41
+ <!--
42
+ <div class="alignleft actions">
43
+ <select name="action">
44
+ <option value="-1" selected="selected">
45
+ <?php _e('Bulk Actions'); ?>
46
+ </option>
47
+ <option value="approve">
48
+ <?php _e('Approve', 'dbem'); ?>
49
+ </option>
50
+ <option value="decline">
51
+ <?php _e('Decline', 'dbem'); ?>
52
+ </option>
53
+ </select>
54
+ <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
55
+ </div>
56
+ -->
57
+ <!--
58
+ <div class="view-switch">
59
+ <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
60
+ </div>
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
+ ?>
69
+ <div class="clear"></div>
70
+ </div>
71
+ <?php endif; ?>
72
+ <div class="clear"></div>
73
+ <?php if( $bookings_count > 0 ): ?>
74
+ <div class='table-wrap'>
75
+ <table id='dbem-bookings-table' class='widefat post fixed'>
76
+ <thead>
77
+ <tr>
78
+ <th class='manage-column column-cb check-column' scope='col'>
79
+ <input class='select-all' type="checkbox" value='1' />
80
+ </th>
81
+ <th class='manage-column' scope='col'>Booker</th>
82
+ <th class='manage-column' scope='col'>E-mail</th>
83
+ <th class='manage-column' scope='col'>Phone number</th>
84
+ <th class='manage-column' scope='col'>Spaces</th>
85
+ <th class='manage-column' scope='col'>&nbsp;</th>
86
+ </tr>
87
+ </thead>
88
+ <tbody>
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>
112
+ <?php
113
+ }
114
+ $event_count++;
115
+ }
116
+ ?>
117
+ </tbody>
118
+ </table>
119
+ </div>
120
+ <?php else: ?>
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>
128
+ </div>
129
+ <?php endif; ?>
130
+ </div>
131
+ <?php
132
+ }
133
?>
admin/bookings/em-confirmed.php CHANGED
@@ -1,143 +1,140 @@
1
- <?php
2
-
3
- /**
4
- * Generates a "widget" table of confirmed bookings for a specific event.
5
- *
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']:'';
13
- $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
14
- $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
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'>
31
- <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
32
- <!--
33
- <ul class="subsubsub">
34
- <li>
35
- <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
36
- </li>
37
- </ul>
38
- <p class="search-box">
39
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
40
- <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
41
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
42
- </p>
43
- -->
44
- <?php if ( $bookings_count >= $limit ) : ?>
45
- <div class='tablenav'>
46
- <!--
47
- <div class="alignleft actions">
48
- <select name="action">
49
- <option value="-1" selected="selected">
50
- <?php _e('Bulk Actions'); ?>
51
- </option>
52
- <option value="approve">
53
- <?php _e('Approve', 'dbem'); ?>
54
- </option>
55
- <option value="decline">
56
- <?php _e('Decline', 'dbem'); ?>
57
- </option>
58
- </select>
59
- <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
60
- </div>
61
- -->
62
- <!--
63
- <div class="view-switch">
64
- <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
65
- </div>
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
- ?>
73
- <div class="clear"></div>
74
- </div>
75
- <?php endif; ?>
76
- <div class="clear"></div>
77
- <?php if( $bookings_count > 0 ): ?>
78
- <div class='table-wrap'>
79
- <table id='dbem-bookings-table' class='widefat post fixed'>
80
- <thead>
81
- <tr>
82
- <th class='manage-column column-cb check-column' scope='col'>
83
- <input class='select-all' type="checkbox" value='1' />
84
- </th>
85
- <th class='manage-column' scope='col'>Booker</th>
86
- <th class='manage-column' scope='col'>E-mail</th>
87
- <th class='manage-column' scope='col'>Phone number</th>
88
- <th class='manage-column' scope='col'>Spaces</th>
89
- <th class='manage-column' scope='col'>&nbsp;</th>
90
- </tr>
91
- </thead>
92
- <tbody>
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
122
- }
123
- $event_count++;
124
- }
125
- ?>
126
- </tbody>
127
- </table>
128
- </div>
129
- <?php else: ?>
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>
137
- </div>
138
- <?php endif; ?>
139
- </div>
140
- <?php
141
-
142
- }
143
?>
1
+ <?php
2
+
3
+ /**
4
+ * Generates a "widget" table of confirmed bookings for a specific event.
5
+ *
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']:'';
13
+ $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
14
+ $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
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'>
27
+ <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
28
+ <!--
29
+ <ul class="subsubsub">
30
+ <li>
31
+ <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
32
+ </li>
33
+ </ul>
34
+ <p class="search-box">
35
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
36
+ <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
37
+ <input type="submit" value="<?php _e('Search'); ?>" class="button" />
38
+ </p>
39
+ -->
40
+ <?php if ( $bookings_count >= $limit ) : ?>
41
+ <div class='tablenav'>
42
+ <!--
43
+ <div class="alignleft actions">
44
+ <select name="action">
45
+ <option value="-1" selected="selected">
46
+ <?php _e('Bulk Actions'); ?>
47
+ </option>
48
+ <option value="approve">
49
+ <?php _e('Approve', 'dbem'); ?>
50
+ </option>
51
+ <option value="decline">
52
+ <?php _e('Decline', 'dbem'); ?>
53
+ </option>
54
+ </select>
55
+ <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
56
+ </div>
57
+ -->
58
+ <!--
59
+ <div class="view-switch">
60
+ <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
61
+ </div>
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
+ ?>
70
+ <div class="clear"></div>
71
+ </div>
72
+ <?php endif; ?>
73
+ <div class="clear"></div>
74
+ <?php if( $bookings_count > 0 ): ?>
75
+ <div class='table-wrap'>
76
+ <table id='dbem-bookings-table' class='widefat post fixed'>
77
+ <thead>
78
+ <tr>
79
+ <th class='manage-column column-cb check-column' scope='col'>
80
+ <input class='select-all' type="checkbox" value='1' />
81
+ </th>
82
+ <th class='manage-column' scope='col'>Booker</th>
83
+ <th class='manage-column' scope='col'>E-mail</th>
84
+ <th class='manage-column' scope='col'>Phone number</th>
85
+ <th class='manage-column' scope='col'>Spaces</th>
86
+ <th class='manage-column' scope='col'>&nbsp;</th>
87
+ </tr>
88
+ </thead>
89
+ <tbody>
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
119
+ }
120
+ $event_count++;
121
+ }
122
+ ?>
123
+ </tbody>
124
+ </table>
125
+ </div>
126
+ <?php else: ?>
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>
134
+ </div>
135
+ <?php endif; ?>
136
+ </div>
137
+ <?php
138
+
139
+ }
140
?>
admin/bookings/em-events.php CHANGED
@@ -1,178 +1,179 @@
1
- <?php
2
-
3
- /**
4
- * Determines whether to show event page or events page, and saves any updates to the event or events
5
- * @return null
6
- */
7
- function em_bookings_events_table() {
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
-
12
- $scope_names = array (
13
- 'past' => __ ( 'Past events', 'dbem' ),
14
- 'all' => __ ( 'All events', 'dbem' ),
15
- 'future' => __ ( 'Future events', 'dbem' )
16
- );
17
-
18
- $action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_events_table' );
19
- $action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
20
- $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
21
- $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
22
- $page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
23
- $offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
24
- $scope = ( $action_scope && !empty($_GET ['scope']) && array_key_exists($_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
25
-
26
- // No action, only showing the events list
27
- switch ($scope) {
28
- case "past" :
29
- $title = __ ( 'Past Events', 'dbem' );
30
- break;
31
- case "all" :
32
- $title = __ ( 'All Events', 'dbem' );
33
- break;
34
- default :
35
- $title = __ ( 'Future Events', 'dbem' );
36
- $scope = "future";
37
- }
38
- $events = EM_Events::get( array('scope'=>$scope, 'limit'=>0, 'order'=>$order, 'rsvp'=>true ) );
39
- $events_count = count ( $events );
40
-
41
- $use_events_end = get_option ( 'dbem_use_event_end' );
42
- ?>
43
- <div class="wrap em_bookings_events_table em_obj">
44
- <form id="posts-filter" action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="get">
45
- <input type="hidden" name="em_obj" value="em_bookings_events_table" />
46
- <?php if(!empty($_GET['page'])): ?>
47
- <input type='hidden' name='page' value='events-manager-bookings' />
48
- <?php endif; ?>
49
- <ul class="subsubsub">
50
- <li><a href='#' class="current"><?php _e ( 'Total', 'dbem' ); ?> <span class="count">(<?php echo (count ( $events )); ?>)</span></a></li>
51
- </ul>
52
- <div class="tablenav">
53
- <div class="alignleft actions">
54
- <!--
55
- <select name="action">
56
- <option value="-1" selected="selected"><?php _e ( 'Bulk Actions' ); ?></option>
57
- <option value="deleteEvents"><?php _e ( 'Delete selected','dbem' ); ?></option>
58
- </select>
59
- <input type="submit" value="<?php _e ( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
60
- -->
61
- <select name="scope">
62
- <?php
63
- foreach ( $scope_names as $key => $value ) {
64
- $selected = "";
65
- if ($key == $scope)
66
- $selected = "selected='selected'";
67
- echo "<option value='$key' $selected>$value</option> ";
68
- }
69
- ?>
70
- </select>
71
- <input id="post-query-submit" class="button-secondary" type="submit" value="<?php _e ( 'Filter' )?>" />
72
- </div>
73
- <!--
74
- <div class="view-switch">
75
- <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
76
- </div>
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
- ?>
84
- <br class="clear" />
85
- </div>
86
-
87
- <?php
88
- if (empty ( $events )) {
89
- // TODO localize
90
- _e ( 'no events','dbem' );
91
- } else {
92
- ?>
93
- <div class='table-wrap'>
94
- <table class="widefat">
95
- <thead>
96
- <tr>
97
- <th class='manage-column column-cb check-column' scope='col'>
98
- <input class='select-all' type="checkbox" value='1' />
99
- </th>
100
- <th><?php _e ( 'Event', 'dbem' ); ?></th>
101
- <th><?php _e ( 'Date and time', 'dbem' ); ?></th>
102
- </tr>
103
- </thead>
104
- <tbody>
105
- <?php
106
- $rowno = 0;
107
- $event_count = 0;
108
- foreach ( $events as $event ) {
109
- /* @var $event EM_Event */
110
- if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
111
- $rowno++;
112
- $class = ($rowno % 2) ? ' class="alternate"' : '';
113
- // FIXME set to american
114
- $localised_start_date = date_i18n('D d M Y', $event->start);
115
- $localised_end_date = date_i18n('D d M Y', $event->end);
116
- $style = "";
117
- $today = date ( "Y-m-d" );
118
-
119
- if ($event->start_date < $today && $event->end_date < $today){
120
- $style = "style ='background-color: #FADDB7;'";
121
- }
122
- ?>
123
- <tr <?php echo "$class $style"; ?>>
124
-
125
- <td>
126
- <input type='checkbox' class='row-selector' value='<?php echo $event->id; ?>' name='events[]' />
127
- </td>
128
- <td>
129
- <strong>
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
-
139
- <td>
140
- <?php echo $localised_start_date; ?>
141
- <?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
142
- &ndash;
143
- <?php
144
- //TODO Should 00:00 - 00:00 be treated as an all day event?
145
- echo substr ( $event->start_time, 0, 5 ) . " - " . substr ( $event->end_time, 0, 5 );
146
- ?>
147
- </td>
148
- </tr>
149
- <?php
150
- }
151
- $event_count++;
152
- }
153
- ?>
154
- </tbody>
155
- </table>
156
- </div>
157
- <?php
158
- } // end of table
159
- ?>
160
- <div class='tablenav'>
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;
168
- ?>
169
- </div>
170
- <?php endif; ?>
171
- <br class='clear' />
172
- </div>
173
- </form>
174
- </div>
175
- <?php
176
- }
177
-
178
?>
1
+ <?php
2
+
3
+ /**
4
+ * Determines whether to show event page or events page, and saves any updates to the event or events
5
+ * @return null
6
+ */
7
+ function em_bookings_events_table() {
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
+
12
+ $scope_names = array (
13
+ 'past' => __ ( 'Past events', 'dbem' ),
14
+ 'all' => __ ( 'All events', 'dbem' ),
15
+ 'future' => __ ( 'Future events', 'dbem' )
16
+ );
17
+
18
+ $action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_events_table' );
19
+ $action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
20
+ $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
21
+ $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
22
+ $page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
23
+ $offset = ( $action_scope && $page > 1 ) ? ($page-1)*$limit : 0;
24
+ $scope = ( $action_scope && !empty($_GET ['scope']) && array_key_exists($_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
25
+
26
+ // No action, only showing the events list
27
+ switch ($scope) {
28
+ case "past" :
29
+ $title = __ ( 'Past Events', 'dbem' );
30
+ break;
31
+ case "all" :
32
+ $title = __ ( 'All Events', 'dbem' );
33
+ break;
34
+ default :
35
+ $title = __ ( 'Future Events', 'dbem' );
36
+ $scope = "future";
37
+ }
38
+ $events = EM_Events::get( array('scope'=>$scope, 'limit'=>0, 'order'=>$order, 'rsvp'=>true ) );
39
+ $events_count = count ( $events );
40
+
41
+ $use_events_end = get_option ( 'dbem_use_event_end' );
42
+ ?>
43
+ <div class="wrap em_bookings_events_table em_obj">
44
+ <form id="posts-filter" action="<?php echo $_SERVER['REQUEST_URI'] ?>" method="get">
45
+ <input type="hidden" name="em_obj" value="em_bookings_events_table" />
46
+ <?php if(!empty($_GET['page'])): ?>
47
+ <input type='hidden' name='page' value='events-manager-bookings' />
48
+ <?php endif; ?>
49
+ <ul class="subsubsub">
50
+ <li><a href='#' class="current"><?php _e ( 'Total', 'dbem' ); ?> <span class="count">(<?php echo (count ( $events )); ?>)</span></a></li>
51
+ </ul>
52
+ <div class="tablenav">
53
+ <div class="alignleft actions">
54
+ <!--
55
+ <select name="action">
56
+ <option value="-1" selected="selected"><?php _e ( 'Bulk Actions' ); ?></option>
57
+ <option value="deleteEvents"><?php _e ( 'Delete selected','dbem' ); ?></option>
58
+ </select>
59
+ <input type="submit" value="<?php _e ( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
60
+ -->
61
+ <select name="scope">
62
+ <?php
63
+ foreach ( $scope_names as $key => $value ) {
64
+ $selected = "";
65
+ if ($key == $scope)
66
+ $selected = "selected='selected'";
67
+ echo "<option value='$key' $selected>$value</option> ";
68
+ }
69
+ ?>
70
+ </select>
71
+ <input id="post-query-submit" class="button-secondary" type="submit" value="<?php _e ( 'Filter' )?>" />
72
+ </div>
73
+ <!--
74
+ <div class="view-switch">
75
+ <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
76
+ </div>
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
+ ?>
85
+ <br class="clear" />
86
+ </div>
87
+
88
+ <?php
89
+ if (empty ( $events )) {
90
+ // TODO localize
91
+ _e ( 'no events','dbem' );
92
+ } else {
93
+ ?>
94
+ <div class='table-wrap'>
95
+ <table class="widefat">
96
+ <thead>
97
+ <tr>
98
+ <th class='manage-column column-cb check-column' scope='col'>
99
+ <input class='select-all' type="checkbox" value='1' />
100
+ </th>
101
+ <th><?php _e ( 'Event', 'dbem' ); ?></th>
102
+ <th><?php _e ( 'Date and time', 'dbem' ); ?></th>
103
+ </tr>
104
+ </thead>
105
+ <tbody>
106
+ <?php
107
+ $rowno = 0;
108
+ $event_count = 0;
109
+ foreach ( $events as $event ) {
110
+ /* @var $event EM_Event */
111
+ if( ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
112
+ $rowno++;
113
+ $class = ($rowno % 2) ? ' class="alternate"' : '';
114
+ // FIXME set to american
115
+ $localised_start_date = date_i18n('D d M Y', $event->start);
116
+ $localised_end_date = date_i18n('D d M Y', $event->end);
117
+ $style = "";
118
+ $today = date ( "Y-m-d" );
119
+
120
+ if ($event->start_date < $today && $event->end_date < $today){
121
+ $style = "style ='background-color: #FADDB7;'";
122
+ }
123
+ ?>
124
+ <tr <?php echo "$class $style"; ?>>
125
+
126
+ <td>
127
+ <input type='checkbox' class='row-selector' value='<?php echo $event->id; ?>' name='events[]' />
128
+ </td>
129
+ <td>
130
+ <strong>
131
+ <a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;event_id=<?php echo $event->id ?>"><?php echo ($event->name); ?></a>
132
+ </strong>
133
+ &ndash;
134
+ <?php _e("Booked Seats",'dbem') ?>: <?php echo $event->get_bookings()->get_booked_seats()."/".$event->seats ?>
135
+ <?php if( get_option('dbem_bookings_approval') == 1 ) : ?>
136
+ | <?php _e("Pending",'dbem') ?>: <?php echo $event->get_bookings()->get_pending_seats(); ?>
137
+ <?php endif; ?>
138
+ </td>
139
+
140
+ <td>
141
+ <?php echo $localised_start_date; ?>
142
+ <?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
143
+ &ndash;
144
+ <?php
145
+ //TODO Should 00:00 - 00:00 be treated as an all day event?
146
+ echo substr ( $event->start_time, 0, 5 ) . " - " . substr ( $event->end_time, 0, 5 );
147
+ ?>
148
+ </td>
149
+ </tr>
150
+ <?php
151
+ }
152
+ $event_count++;
153
+ }
154
+ ?>
155
+ </tbody>
156
+ </table>
157
+ </div>
158
+ <?php
159
+ } // end of table
160
+ ?>
161
+ <div class='tablenav'>
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;
169
+ ?>
170
+ </div>
171
+ <?php endif; ?>
172
+ <br class='clear' />
173
+ </div>
174
+ </form>
175
+ </div>
176
+ <?php
177
+ }
178
+
179
?>
admin/bookings/em-pending.php CHANGED
@@ -1,160 +1,155 @@
1
- <?php
2
-
3
- /**
4
- * Generates a "widget" table of pending bookings with some quick admin operation options.
5
- * If event id supplied then only pending bookings for that event will show.
6
- *
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;
14
- }
15
-
16
- $action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_pending_table' );
17
- $action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
18
- $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
19
- $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
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'>
45
- <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
46
- <!--
47
- <ul class="subsubsub">
48
- <li>
49
- <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
50
- </li>
51
- </ul>
52
- <p class="search-box">
53
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
54
- <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
55
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
56
- </p>
57
- -->
58
- <?php if ( $bookings_count >= $limit ) : ?>
59
- <div class='tablenav'>
60
- <!--
61
- <div class="alignleft actions">
62
- <select name="action">
63
- <option value="-1" selected="selected">
64
- <?php _e('Bulk Actions'); ?>
65
- </option>
66
- <option value="approve">
67
- <?php _e('Approve', 'dbem'); ?>
68
- </option>
69
- <option value="decline">
70
- <?php _e('Decline', 'dbem'); ?>
71
- </option>
72
- </select>
73
- <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
74
- </div>
75
- -->
76
- <!--
77
- <div class="view-switch">
78
- <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
79
- </div>
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
- ?>
87
- <div class="clear"></div>
88
- </div>
89
- <?php endif; ?>
90
- <div class="clear"></div>
91
- <?php if( $bookings_count > 0 ): ?>
92
- <div class='table-wrap'>
93
- <table id='dbem-bookings-table' class='widefat post fixed'>
94
- <thead>
95
- <tr>
96
- <th class='manage-column column-cb check-column' scope='col'>
97
- <input class='select-all' type="checkbox" value='1' />
98
- </th>
99
- <th class='manage-column' scope='col'>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>
104
- <th class='manage-column' scope='col'>Phone number</th>
105
- <th class='manage-column' scope='col'>Spaces</th>
106
- <th class='manage-column' scope='col'>&nbsp;</th>
107
- </tr>
108
- </thead>
109
- <tbody>
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
139
- }
140
- $event_count++;
141
- }
142
- ?>
143
- </tbody>
144
- </table>
145
- </div>
146
- <?php else: ?>
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>
154
- </div>
155
- <?php endif; ?>
156
- </div>
157
- <?php
158
-
159
- }
160
?>
1
+ <?php
2
+
3
+ /**
4
+ * Generates a "widget" table of pending bookings with some quick admin operation options.
5
+ * If event id supplied then only pending bookings for that event will show.
6
+ *
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;
14
+ }
15
+
16
+ $action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_pending_table' );
17
+ $action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
18
+ $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
19
+ $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
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'>
41
+ <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
42
+ <!--
43
+ <ul class="subsubsub">
44
+ <li>
45
+ <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
46
+ </li>
47
+ </ul>
48
+ <p class="search-box">
49
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
50
+ <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
51
+ <input type="submit" value="<?php _e('Search'); ?>" class="button" />
52
+ </p>
53
+ -->
54
+ <?php if ( $bookings_count >= $limit ) : ?>
55
+ <div class='tablenav'>
56
+ <!--
57
+ <div class="alignleft actions">
58
+ <select name="action">
59
+ <option value="-1" selected="selected">
60
+ <?php _e('Bulk Actions'); ?>
61
+ </option>
62
+ <option value="approve">
63
+ <?php _e('Approve', 'dbem'); ?>
64
+ </option>
65
+ <option value="decline">
66
+ <?php _e('Decline', 'dbem'); ?>
67
+ </option>
68
+ </select>
69
+ <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
70
+ </div>
71
+ -->
72
+ <!--
73
+ <div class="view-switch">
74
+ <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
75
+ </div>
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
+ ?>
84
+ <div class="clear"></div>
85
+ </div>
86
+ <?php endif; ?>
87
+ <div class="clear"></div>
88
+ <?php if( $bookings_count > 0 ): ?>
89
+ <div class='table-wrap'>
90
+ <table id='dbem-bookings-table' class='widefat post fixed'>
91
+ <thead>
92
+ <tr>
93
+ <th class='manage-column column-cb check-column' scope='col'>
94
+ <input class='select-all' type="checkbox" value='1' />
95
+ </th>
96
+ <th class='manage-column' scope='col'>Booker</th>
97
+ <?php if( !is_object($EM_Event) ): ?>
98
+ <th class='manage-column' scope="col">Event</th>
99
+ <?php endif; ?>
100
+ <th class='manage-column' scope='col'>E-mail</th>
101
+ <th class='manage-column' scope='col'>Phone number</th>
102
+ <th class='manage-column' scope='col'>Spaces</th>
103
+ <th class='manage-column' scope='col'>&nbsp;</th>
104
+ </tr>
105
+ </thead>
106
+ <tbody>
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
134
+ }
135
+ $event_count++;
136
+ }
137
+ ?>
138
+ </tbody>
139
+ </table>
140
+ </div>
141
+ <?php else: ?>
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>
149
+ </div>
150
+ <?php endif; ?>
151
+ </div>
152
+ <?php
153
+
154
+ }
155
?>
admin/bookings/em-person.php CHANGED
@@ -1,152 +1,150 @@
1
- <?php
2
-
3
- /**
4
- * Generates a "widget" table of confirmed bookings for a specific event.
5
- *
6
- * @param int $event_id
7
- */
8
- function em_bookings_person_table(){
9
- global $wpdb, $current_user,$EM_Person;
10
- if(!is_object($EM_Person)){
11
- return false;
12
- }
13
- $action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
14
- $action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
15
- $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
16
- $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
17
- $page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
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){
25
- $event_ids[] = $EM_Booking->event_id;
26
- }
27
- $events = EM_Events::get($event_ids);
28
- }
29
- ?>
30
- <div class='wrap em_bookings_pending_table em_obj'>
31
- <form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
32
- <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
33
- <!--
34
- <ul class="subsubsub">
35
- <li>
36
- <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
37
- </li>
38
- </ul>
39
- <p class="search-box">
40
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
41
- <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
42
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
43
- </p>
44
- -->
45
- <?php if ( $bookings_count >= $limit ) : ?>
46
- <div class='tablenav'>
47
- <!--
48
- <div class="alignleft actions">
49
- <select name="action">
50
- <option value="-1" selected="selected">
51
- <?php _e('Bulk Actions'); ?>
52
- </option>
53
- <option value="approve">
54
- <?php _e('Approve', 'dbem'); ?>
55
- </option>
56
- <option value="decline">
57
- <?php _e('Decline', 'dbem'); ?>
58
- </option>
59
- </select>
60
- <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
61
- </div>
62
- -->
63
- <!--
64
- <div class="view-switch">
65
- <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
66
- </div>
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
- ?>
74
- <div class="clear"></div>
75
- </div>
76
- <?php endif; ?>
77
- <div class="clear"></div>
78
- <?php if( $bookings_count > 0 ): ?>
79
- <div class='table-wrap'>
80
- <table id='dbem-bookings-table' class='widefat post fixed'>
81
- <thead>
82
- <tr>
83
- <th class='manage-column column-cb check-column' scope='col'>
84
- <input class='select-all' type="checkbox" value='1' />
85
- </th>
86
- <th class='manage-column' scope='col'>Event</th>
87
- <th class='manage-column' scope='col'>Spaces</th>
88
- <th class='manage-column' scope='col'>Status</th>
89
- <th class='manage-column' scope='col'>&nbsp;</th>
90
- </tr>
91
- </thead>
92
- <tbody>
93
- <?php
94
- $rowno = 0;
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>
108
- <?php
109
- $unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'bookings'=>$EM_Booking->id));
110
- $approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'bookings'=>$EM_Booking->id));
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
131
- }
132
- $event_count++;
133
- }
134
- ?>
135
- </tbody>
136
- </table>
137
- </div>
138
- <?php else: ?>
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>
146
- </div>
147
- <?php endif; ?>
148
- </div>
149
- <?php
150
-
151
- }
152
?>
1
+ <?php
2
+
3
+ /**
4
+ * Generates a "widget" table of confirmed bookings for a specific event.
5
+ *
6
+ * @param int $event_id
7
+ */
8
+ function em_bookings_person_table(){
9
+ global $wpdb, $current_user,$EM_Person;
10
+ if(!is_object($EM_Person)){
11
+ return false;
12
+ }
13
+ $action_scope = ( !empty($_REQUEST['em_obj']) && $_REQUEST['em_obj'] == 'em_bookings_confirmed_table' );
14
+ $action = ( $action_scope && !empty($_GET ['action']) ) ? $_GET ['action']:'';
15
+ $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
16
+ $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
17
+ $page = ( $action_scope && !empty($_GET['pno']) ) ? $_GET['pno']:1;
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){
25
+ $event_ids[] = $EM_Booking->event_id;
26
+ }
27
+ $events = EM_Events::get($event_ids);
28
+ }
29
+ ?>
30
+ <div class='wrap em_bookings_pending_table em_obj'>
31
+ <form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
32
+ <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
33
+ <!--
34
+ <ul class="subsubsub">
35
+ <li>
36
+ <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
37
+ </li>
38
+ </ul>
39
+ <p class="search-box">
40
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
41
+ <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
42
+ <input type="submit" value="<?php _e('Search'); ?>" class="button" />
43
+ </p>
44
+ -->
45
+ <?php if ( $bookings_count >= $limit ) : ?>
46
+ <div class='tablenav'>
47
+ <!--
48
+ <div class="alignleft actions">
49
+ <select name="action">
50
+ <option value="-1" selected="selected">
51
+ <?php _e('Bulk Actions'); ?>
52
+ </option>
53
+ <option value="approve">
54
+ <?php _e('Approve', 'dbem'); ?>
55
+ </option>
56
+ <option value="decline">
57
+ <?php _e('Decline', 'dbem'); ?>
58
+ </option>
59
+ </select>
60
+ <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
61
+ </div>
62
+ -->
63
+ <!--
64
+ <div class="view-switch">
65
+ <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
66
+ </div>
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
+ ?>
75
+ <div class="clear"></div>
76
+ </div>
77
+ <?php endif; ?>
78
+ <div class="clear"></div>
79
+ <?php if( $bookings_count > 0 ): ?>
80
+ <div class='table-wrap'>
81
+ <table id='dbem-bookings-table' class='widefat post fixed'>
82
+ <thead>
83
+ <tr>
84
+ <th class='manage-column column-cb check-column' scope='col'>
85
+ <input class='select-all' type="checkbox" value='1' />
86
+ </th>
87
+ <th class='manage-column' scope='col'>Event</th>
88
+ <th class='manage-column' scope='col'>Spaces</th>
89
+ <th class='manage-column' scope='col'>Status</th>
90
+ <th class='manage-column' scope='col'>&nbsp;</th>
91
+ </tr>
92
+ </thead>
93
+ <tbody>
94
+ <?php
95
+ $rowno = 0;
96
+ $event_count = 0;
97
+ foreach ($bookings as $EM_Booking) {
98
+ $EM_Event = $events[$EM_Booking->event_id];
99
+ if( $EM_Event->can_manage() && ($rowno < $limit || empty($limit)) && ($event_count >= $offset || $offset === 0) ) {
100
+ $rowno++;
101
+ ?>
102
+ <tr>
103
+ <th scope="row" class="check-column" style="padding:7px 0px 7px;"><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></th>
104
+ <td><a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;event_id=<?php echo $EM_Event->id ?>"><?php echo ($EM_Event->name); ?></a></td>
105
+ <td><?php echo $EM_Booking->seats ?></td>
106
+ <td><?php echo $EM_Booking->status_array[$EM_Booking->status]; ?>
107
+ </td>
108
+ <td>
109
+ <?php
110
+ $unapprove_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_unapprove', 'bookings'=>$EM_Booking->id));
111
+ $approve_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_approve', 'bookings'=>$EM_Booking->id));
112
+ $reject_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_reject', 'bookings'=>$EM_Booking->id));
113
+ $delete_url = em_add_get_params($_SERVER['REQUEST_URI'], array('action'=>'bookings_delete', 'bookings'=>$EM_Booking->id));
114
+ ?>
115
+ <?php if( $EM_Booking->status == 0 || $EM_Booking->status == 2 ): ?>
116
+ <a class="em-bookings-approve" href="<?php echo $approve_url ?>"><?php _e('Approve','dbem'); ?></a> |
117
+ <?php endif; ?>
118
+ <?php if( $EM_Booking->status == 2 ): ?>
119
+ <a class="em-bookings-unapprove" href="<?php echo $unapprove_url ?>"><?php _e('Unapprove','dbem'); ?></a> |
120
+ <?php endif; ?>
121
+ <?php if( $EM_Booking->status == 0 || $EM_Booking->status == 1 ): ?>
122
+ <a class="em-bookings-reject" href="<?php echo $reject_url ?>"><?php _e('Reject','dbem'); ?></a> |
123
+ <?php endif; ?>
124
+ <a class="em-bookings-edit" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/admin.php?page=events-manager-bookings&amp;booking_id=<?php echo $EM_Booking->id; ?>"><?php _e('Edit'); ?></a> |
125
+ <a class="em-bookings-delete" href="<?php echo $delete_url ?>"><?php _e('Delete','dbem'); ?></a>
126
+ </td>
127
+ </tr>
128
+ <?php
129
+ }
130
+ $event_count++;
131
+ }
132
+ ?>
133
+ </tbody>
134
+ </table>
135
+ </div>
136
+ <?php else: ?>
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>
144
+ </div>
145
+ <?php endif; ?>
146
+ </div>
147
+ <?php
148
+
149
+ }
150
?>
admin/bookings/em-rejected.php CHANGED
@@ -1,136 +1,133 @@
1
- <?php
2
- /**
3
- * Generates a "widget" table of confirmed bookings for a specific event.
4
- *
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']:'';
12
- $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
13
- $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
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'>
30
- <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
31
- <!--
32
- <ul class="subsubsub">
33
- <li>
34
- <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
35
- </li>
36
- </ul>
37
- <p class="search-box">
38
- <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
39
- <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
40
- <input type="submit" value="<?php _e('Search'); ?>" class="button" />
41
- </p>
42
- -->
43
- <?php if ( $bookings_count >= $limit ) : ?>
44
- <div class='tablenav'>
45
- <!--
46
- <div class="alignleft actions">
47
- <select name="action">
48
- <option value="-1" selected="selected">
49
- <?php _e('Bulk Actions'); ?>
50
- </option>
51
- <option value="approve">
52
- <?php _e('Approve', 'dbem'); ?>
53
- </option>
54
- <option value="decline">
55
- <?php _e('Decline', 'dbem'); ?>
56
- </option>
57
- </select>
58
- <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
59
- </div>
60
- -->
61
- <!--
62
- <div class="view-switch">
63
- <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
64
- </div>
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
- ?>
72
- <div class="clear"></div>
73
- </div>
74
- <?php endif; ?>
75
- <div class="clear"></div>
76
- <?php if( $bookings_count > 0 ): ?>
77
- <div class='table-wrap'>
78
- <table id='dbem-bookings-table' class='widefat post fixed'>
79
- <thead>
80
- <tr>
81
- <th class='manage-column column-cb check-column' scope='col'>
82
- <input class='select-all' type="checkbox" value='1' />
83
- </th>
84
- <th class='manage-column' scope='col'>Booker</th>
85
- <th class='manage-column' scope='col'>E-mail</th>
86
- <th class='manage-column' scope='col'>Phone number</th>
87
- <th class='manage-column' scope='col'>Spaces</th>
88
- <th class='manage-column' scope='col'>&nbsp;</th>
89
- </tr>
90
- </thead>
91
- <tbody>
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
116
- }
117
- $event_count++;
118
- }
119
- ?>
120
- </tbody>
121
- </table>
122
- </div>
123
- <?php else: ?>
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>
131
- </div>
132
- <?php endif; ?>
133
- </div>
134
- <?php
135
- }
136
?>
1
+ <?php
2
+ /**
3
+ * Generates a "widget" table of confirmed bookings for a specific event.
4
+ *
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']:'';
12
+ $order = ( $action_scope && !empty($_GET ['order']) ) ? $_GET ['order']:'ASC';
13
+ $limit = ( $action_scope && !empty($_GET['limit']) ) ? $_GET['limit'] : 20;//Default limit
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'>
26
+ <input type="hidden" name="em_obj" value="em_bookings_pending_table" />
27
+ <!--
28
+ <ul class="subsubsub">
29
+ <li>
30
+ <a href='edit.php?post_type=post' class="current">All <span class="count">(1)</span></a> |
31
+ </li>
32
+ </ul>
33
+ <p class="search-box">
34
+ <label class="screen-reader-text" for="post-search-input"><?php _e('Search'); ?>:</label>
35
+ <input type="text" id="post-search-input" name="em_search" value="<?php echo (!empty($_GET['em_search'])) ? $_GET['em_search']:''; ?>" />
36
+ <input type="submit" value="<?php _e('Search'); ?>" class="button" />
37
+ </p>
38
+ -->
39
+ <?php if ( $bookings_count >= $limit ) : ?>
40
+ <div class='tablenav'>
41
+ <!--
42
+ <div class="alignleft actions">
43
+ <select name="action">
44
+ <option value="-1" selected="selected">
45
+ <?php _e('Bulk Actions'); ?>
46
+ </option>
47
+ <option value="approve">
48
+ <?php _e('Approve', 'dbem'); ?>
49
+ </option>
50
+ <option value="decline">
51
+ <?php _e('Decline', 'dbem'); ?>
52
+ </option>
53
+ </select>
54
+ <input type="submit" id="post-query-submit" value="Filter" class="button-secondary" />
55
+ </div>
56
+ -->
57
+ <!--
58
+ <div class="view-switch">
59
+ <a href="/wp-admin/edit.php?mode=list"><img class="current" id="view-switch-list" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="List View" alt="List View" name="view-switch-list" /></a> <a href="/wp-admin/edit.php?mode=excerpt"><img id="view-switch-excerpt" src="http://wordpress.lan/wp-includes/images/blank.gif" width="20" height="20" title="Excerpt View" alt="Excerpt View" name="view-switch-excerpt" /></a>
60
+ </div>
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
+ ?>
69
+ <div class="clear"></div>
70
+ </div>
71
+ <?php endif; ?>
72
+ <div class="clear"></div>
73
+ <?php if( $bookings_count > 0 ): ?>
74
+ <div class='table-wrap'>
75
+ <table id='dbem-bookings-table' class='widefat post fixed'>
76
+ <thead>
77
+ <tr>
78
+ <th class='manage-column column-cb check-column' scope='col'>
79
+ <input class='select-all' type="checkbox" value='1' />
80
+ </th>
81
+ <th class='manage-column' scope='col'>Booker</th>
82
+ <th class='manage-column' scope='col'>E-mail</th>
83
+ <th class='manage-column' scope='col'>Phone number</th>
84
+ <th class='manage-column' scope='col'>Spaces</th>
85
+ <th class='manage-column' scope='col'>&nbsp;</th>
86
+ </tr>
87
+ </thead>
88
+ <tbody>
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
113
+ }
114
+ $event_count++;
115
+ }
116
+ ?>
117
+ </tbody>
118
+ </table>
119
+ </div>
120
+ <?php else: ?>
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>
128
+ </div>
129
+ <?php endif; ?>
130
+ </div>
131
+ <?php
132
+ }
133
?>
admin/em-admin.php CHANGED
@@ -1,163 +1,266 @@
1
- <?php
2
- //Admin functions
3
-
4
- /**
5
- * Generate warnings and notices in the admin area
6
- */
7
- function em_admin_warnings() {
8
- //If we're editing the events page show hello to new user
9
- $events_page_id = get_option ( 'dbem_events_page' );
10
- $dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';
11
-
12
- if( 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
16
- update_option ( 'dbem_hello_to_user', 0 );
17
- }elseif ( get_option ( 'dbem_hello_to_user' ) == 1 && !empty($_GET['page']) && $_GET['page'] == 'events-manager-events' ) {
18
- $current_user = wp_get_current_user ();
19
- //FIXME update welcome msg with good links
20
- $advice = sprintf ( __ ( "<p>Hey, <strong>%s</strong>, welcome to <strong>Events Manager</strong>! We hope you like it around here.</p>
21
- <p>Now it's time to insert events lists through <a href='%s' title='Widgets page'>widgets</a>, <a href='%s' title='Template tags documentation'>template tags</a> or <a href='%s' title='Shortcodes documentation'>shortcodes</a>.</p>
22
- <p>By the way, have you taken a look at the <a href='%s' title='Change settings'>Settings page</a>? That's where you customize the way events and locations are displayed.</p>
23
- <p>What? Tired of seeing this advice? I hear you, <a href='%s' title='Don't show this advice again'>click here</a> and you won't see this again!</p>", 'dbem' ), $current_user->display_name, get_bloginfo ( 'url' ) . '/wp-admin/widgets.php', 'http://wp-events-plugin.com/documentation/template-tags/', 'http://wp-events-plugin.com/documentation/shortcodes/', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager&disable_hello_to_user=true' );
24
- ?>
25
- <div id="message" class="updated">
26
- <?php echo $advice; ?>
27
- </div>
28
- <?php
29
- }
30
-
31
- //If events page couldn't be created
32
- if( !empty($_GET['em_dismiss_admin_notice']) ){
33
- delete_option('dbem_admin_notice_'.$_GET['em_dismiss_admin_notice']);
34
- }else{
35
- if ( get_option('dbem_admin_notice_3.0.91') ){
36
- ?>
37
- <div class="updated">
38
- <p><?php echo sprintf ( __( '<strong>Events Manager has some new features!</strong><ul><li>Bookings can now be approved before they count towards your event\'s space allocations.</li><li>Events now have owners, and you can restrict users so they can only manage events/locations/categories they create.<br/><br/>These new permissions are enabled by default, but since you upgraded it has been disabled to maintain the previous plugin behaviour. You can re-enable it from the <a href="%s">settings page</a>. <a href="%s">Dismiss</a>', 'dbem'), get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_admin_notice=3.0.91' ); ?></p>
39
- </div>
40
- <?php
41
- }
42
- }
43
-
44
- //If events page couldn't be created
45
- if( !empty($_GET['em_dismiss_events_page']) ){
46
- update_option('dbem_dismiss_events_page',1);
47
- }else{
48
- if ( !get_page($events_page_id) && !get_option('dbem_dismiss_events_page') ){
49
- ?>
50
- <div id="em_page_error" class="updated">
51
- <p><?php echo sprintf ( __( 'Uh Oh! For some reason wordpress could not create an events page for you (or you just deleted it). Not to worry though, all you have to do is create an empty page, name it whatever you want, and select it as your events page in your <a href="%s">settings page</a>. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so <a href="%s">ignore this message</a>', 'dbem'), get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1' ); ?></p>
52
- </div>
53
- <?php
54
- }
55
- }
56
- }
57
- //Warn about EM page edit
58
- if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
59
- $message = sprintf ( __ ( "This page corresponds to <strong>Events Manager</strong> events page. Its content will be overriden by <strong>Events Manager</strong>. If you want to display your content, you can can assign another page to <strong>Events Manager</strong> in the the <a href='%s'>Settings</a>. ", 'dbem' ), 'admin.php?page=events-manager-options' );
60
- $notice = "<div class='error'><p>$message</p></div>";
61
- echo $notice;
62
- }
63
-
64
- }
65
- add_action ( 'admin_notices', 'em_admin_warnings' );
66
-
67
- /**
68
- * Creates a wp-admin style navigation. All this does is wrap some html around the em_paginate function result to make it style correctly in the admin area.
69
- * @param string $link
70
- * @param int $total
71
- * @param int $limit
72
- * @param int $page
73
- * @param int $pagesToShow
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
- }
95
-
96
- /**
97
- * Called by admin_print_scripts-(hook|page) action, created when adding menu items in events-manager.php
98
- */
99
- function em_admin_load_scripts(){
100
- //Load the UI items, currently date picker and autocomplete plus dependencies
101
- //wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/jquery-ui-1.8.5.custom.min.js', array('jquery', 'jquery-ui-core'));
102
- wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/em_ui.js', array('jquery', 'jquery-ui-core'));
103
-
104
- //Add maps
105
- if( get_option('dbem_gmap_is_active') ){
106
- wp_enqueue_script('em-google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
107
- }
108
- //Time Entry
109
- wp_enqueue_script('em-timeentry', WP_PLUGIN_URL.'/events-manager/includes/js/timeentry/jquery.timeentry.js', array('jquery'));
110
-
111
- //Date Picker Locale
112
- $locale_code = substr ( get_locale (), 0, 2 );
113
- $locale_file = "/events-manager/includes/js/i18n/jquery.ui.datepicker-$locale_code.js";
114
- if ( file_exists(WP_PLUGIN_DIR.$locale_file) ) {
115
- wp_enqueue_script("em-ui-datepicker-$locale_code", WP_PLUGIN_URL.$locale_file, array('em-ui-js'));
116
- }
117
- wp_enqueue_script('em-script', WP_PLUGIN_URL.'/events-manager/includes/js/em_admin.js', array('em-ui-js'));
118
-
119
- //TinyMCE Editor
120
- remove_filter('the_editor', 'qtrans_modifyRichEditor'); //qtranslate filter
121
- add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
122
- wp_enqueue_script('post');
123
- if ( user_can_richedit() )
124
- wp_enqueue_script('editor');
125
- add_thickbox();
126
- wp_enqueue_script('media-upload');
127
- wp_enqueue_script('word-count');
128
- wp_enqueue_script('quicktags');
129
- }
130
-
131
- /**
132
- * Called by admin_print_styles-(hook|page) action, created when adding menu items in events-manager.php
133
- */
134
- function em_admin_load_styles() {
135
- add_thickbox();
136
- wp_enqueue_style('em-ui-css', WP_PLUGIN_URL.'/events-manager/includes/css/jquery-ui-1.7.3.custom.css');
137
- wp_enqueue_style('events-manager-admin', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager_admin.css');
138
- }
139
-
140
- /**
141
- * Loads script inline due to insertion of php values
142
- */
143
- function em_admin_general_script() {
144
- //TODO clean script up, remove dependency of php so it can be moved to js file.
145
- // Check if the locale is there and loads it
146
- $locale_code = substr ( get_locale (), 0, 2 );
147
- $show24Hours = 'true';
148
- // Setting 12 hours format for those countries using it
149
- if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
150
- $show24Hours = 'false';
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>
161
- <?php
162
- }
163
?>
1
+ <?php
2
+ //Admin functions
3
+
4
+ /**
5
+ * Generate warnings and notices in the admin area
6
+ */
7
+ function em_admin_warnings() {
8
+ //If we're editing the events page show hello to new user
9
+ $events_page_id = get_option ( 'dbem_events_page' );
10
+ $dismiss_link_joiner = ( count($_GET) > 0 ) ? '&amp;':'?';
11
+
12
+ if( em_verify_admin() ){
13
+ //New User Intro
14
+ if (isset ( $_GET ['disable_hello_to_user'] ) && $_GET ['disable_hello_to_user'] == 'true'){
15
+ // Disable Hello to new user if requested
16
+ update_option ( 'dbem_hello_to_user', 0 );
17
+ }elseif ( get_option ( 'dbem_hello_to_user' ) == 1 && !empty($_GET['page']) && $_GET['page'] == 'events-manager-events' ) {
18
+ $current_user = wp_get_current_user ();
19
+ //FIXME update welcome msg with good links
20
+ $advice = sprintf ( __ ( "<p>Hey, <strong>%s</strong>, welcome to <strong>Events Manager</strong>! We hope you like it around here.</p>
21
+ <p>Now it's time to insert events lists through <a href='%s' title='Widgets page'>widgets</a>, <a href='%s' title='Template tags documentation'>template tags</a> or <a href='%s' title='Shortcodes documentation'>shortcodes</a>.</p>
22
+ <p>By the way, have you taken a look at the <a href='%s' title='Change settings'>Settings page</a>? That's where you customize the way events and locations are displayed.</p>
23
+ <p>What? Tired of seeing this advice? I hear you, <a href='%s' title='Don't show this advice again'>click here</a> and you won't see this again!</p>", 'dbem' ), $current_user->display_name, get_bloginfo ( 'url' ) . '/wp-admin/widgets.php', 'http://wp-events-plugin.com/documentation/template-tags/', 'http://wp-events-plugin.com/documentation/shortcodes/', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager&disable_hello_to_user=true' );
24
+ ?>
25
+ <div id="message" class="updated">
26
+ <?php echo $advice; ?>
27
+ </div>
28
+ <?php
29
+ }
30
+
31
+ //If events page couldn't be created
32
+ if( !empty($_GET['em_dismiss_admin_notice']) ){
33
+ delete_option('dbem_admin_notice_'.$_GET['em_dismiss_admin_notice']);
34
+ }else{
35
+ if ( get_option('dbem_admin_notice_3.0.91') ){
36
+ ?>
37
+ <div class="updated">
38
+ <p><?php echo sprintf ( __( '<strong>Events Manager has some new features!</strong><ul><li>Bookings can now be approved before they count towards your event\'s space allocations.</li><li>Events now have owners, and you can restrict users so they can only manage events/locations/categories they create.<br/><br/>These new permissions are enabled by default, but since you upgraded it has been disabled to maintain the previous plugin behaviour. You can re-enable it from the <a href="%s">settings page</a>. <a href="%s">Dismiss</a>', 'dbem'), get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_admin_notice=3.0.91' ); ?></p>
39
+ </div>
40
+ <?php
41
+ }
42
+ }
43
+
44
+ //If events page couldn't be created
45
+ if( !empty($_GET['em_dismiss_events_page']) ){
46
+ update_option('dbem_dismiss_events_page',1);
47
+ }else{
48
+ if ( !get_page($events_page_id) && !get_option('dbem_dismiss_events_page') ){
49
+ ?>
50
+ <div id="em_page_error" class="updated">
51
+ <p><?php echo sprintf ( __( 'Uh Oh! For some reason wordpress could not create an events page for you (or you just deleted it). Not to worry though, all you have to do is create an empty page, name it whatever you want, and select it as your events page in your <a href="%s">settings page</a>. Sorry for the extra step! If you know what you are doing, you may have done this on purpose, if so <a href="%s">ignore this message</a>', 'dbem'), get_bloginfo ( 'url' ) . '/wp-admin/admin.php?page=events-manager-options', $_SERVER['REQUEST_URI'].$dismiss_link_joiner.'em_dismiss_events_page=1' ); ?></p>
52
+ </div>
53
+ <?php
54
+ }
55
+ }
56
+ }
57
+ //Warn about EM page edit
58
+ if ( preg_match( '/(post|page).php/', $_SERVER ['SCRIPT_NAME']) && isset ( $_GET ['action'] ) && $_GET ['action'] == 'edit' && isset ( $_GET ['post'] ) && $_GET ['post'] == "$events_page_id") {
59
+ $message = sprintf ( __ ( "This page corresponds to <strong>Events Manager</strong> events page. Its content will be overriden by <strong>Events Manager</strong>. If you want to display your content, you can can assign another page to <strong>Events Manager</strong> in the the <a href='%s'>Settings</a>. ", 'dbem' ), 'admin.php?page=events-manager-options' );
60
+ $notice = "<div class='error'><p>$message</p></div>";
61
+ echo $notice;
62
+ }
63
+
64
+ }
65
+ add_action ( 'admin_notices', 'em_admin_warnings' );
66
+
67
+ /**
68
+ * Creates a wp-admin style navigation. All this does is wrap some html around the em_paginate function result to make it style correctly in the admin area.
69
+ * @param string $link
70
+ * @param int $total
71
+ * @param int $limit
72
+ * @param int $page
73
+ * @param int $pagesToShow
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
+ }
88
+
89
+ /**
90
+ * Called by admin_print_scripts-(hook|page) action, created when adding menu items in events-manager.php
91
+ */
92
+ function em_admin_load_scripts(){
93
+ //Load the UI items, currently date picker and autocomplete plus dependencies
94
+ //wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/jquery-ui-1.8.5.custom.min.js', array('jquery', 'jquery-ui-core'));
95
+ wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/em_ui.js', array('jquery', 'jquery-ui-core'));
96
+
97
+ //Add maps
98
+ if( get_option('dbem_gmap_is_active') ){
99
+ wp_enqueue_script('em-google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
100
+ }
101
+ //Time Entry
102
+ wp_enqueue_script('em-timeentry', WP_PLUGIN_URL.'/events-manager/includes/js/timeentry/jquery.timeentry.js', array('jquery'));
103
+
104
+ //Date Picker Locale
105
+ $locale_code = substr ( get_locale (), 0, 2 );
106
+ $locale_file = "/events-manager/includes/js/i18n/jquery.ui.datepicker-$locale_code.js";
107
+ if ( file_exists(WP_PLUGIN_DIR.$locale_file) ) {
108
+ wp_enqueue_script("em-ui-datepicker-$locale_code", WP_PLUGIN_URL.$locale_file, array('em-ui-js'));
109
+ }
110
+ wp_enqueue_script('em-script', WP_PLUGIN_URL.'/events-manager/includes/js/em_admin.js', array('em-ui-js'));
111
+
112
+ //TinyMCE Editor
113
+ remove_filter('the_editor', 'qtrans_modifyRichEditor'); //qtranslate filter
114
+ add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
115
+ add_action( 'admin_print_footer_scripts', 'wp_tiny_mce_preload_dialogs', 30 );
116
+ wp_enqueue_script('post');
117
+ if ( user_can_richedit() )
118
+ wp_enqueue_script('editor');
119
+
120
+ add_thickbox();
121
+ wp_enqueue_script('media-upload');
122
+ wp_enqueue_script('word-count');
123
+ wp_enqueue_script('quicktags');
124
+ }
125
+
126
+ /**
127
+ * Called by admin_print_styles-(hook|page) action, created when adding menu items in events-manager.php
128
+ */
129
+ function em_admin_load_styles() {
130
+ add_thickbox();
131
+ wp_enqueue_style('em-ui-css', WP_PLUGIN_URL.'/events-manager/includes/css/jquery-ui-1.7.3.custom.css');
132
+ wp_enqueue_style('events-manager-admin', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager_admin.css');
133
+ }
134
+
135
+ /**
136
+ * Loads script inline due to insertion of php values
137
+ */
138
+ function em_admin_general_script() {
139
+ //TODO clean script up, remove dependency of php so it can be moved to js file.
140
+ // Check if the locale is there and loads it
141
+ $locale_code = substr ( get_locale (), 0, 2 );
142
+ $show24Hours = 'true';
143
+ // Setting 12 hours format for those countries using it
144
+ if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
145
+ $show24Hours = 'false';
146
+ ?>
147
+ <script type="text/javascript">
148
+ //<![CDATA[
149
+ // TODO: make more general, to support also latitude and longitude (when added)
150
+
151
+ jQuery(document).ready( function($) {
152
+
153
+ function updateIntervalDescriptor () {
154
+ $(".interval-desc").hide();
155
+ var number = "-plural";
156
+ if ($('input#recurrence-interval').val() == 1 || $('input#recurrence-interval').val() == "")
157
+ number = "-singular"
158
+ var descriptor = "span#interval-"+$("select#recurrence-frequency").val()+number;
159
+ $(descriptor).show();
160
+ }
161
+ function updateIntervalSelectors () {
162
+ $('p.alternate-selector').hide();
163
+ $('p#'+ $('select#recurrence-frequency').val() + "-selector").show();
164
+ }
165
+ function updateShowHideRsvp () {
166
+ if($('input#rsvp-checkbox').attr("checked")) {
167
+ $("div#rsvp-data").fadeIn();
168
+ } else {
169
+ $("div#rsvp-data").hide();
170
+ }
171
+ }
172
+ function updateShowHideRecurrence () {
173
+ if( $('input#event-recurrence').attr("checked")) {
174
+ $("#event_recurrence_pattern").fadeIn();
175
+ $("#event-date-explanation").hide();
176
+ $("#recurrence-dates-explanation").show();
177
+ $("h3#recurrence-dates-title").show();
178
+ $("h3#event-date-title").hide();
179
+ } else {
180
+ $("#event_recurrence_pattern").hide();
181
+ $("#recurrence-dates-explanation").hide();
182
+ $("#event-date-explanation").show();
183
+ $("h3#recurrence-dates-title").hide();
184
+ $("h3#event-date-title").show();
185
+ }
186
+ }
187
+ $("#recurrence-dates-explanation").hide();
188
+ $("#localised-date").show();
189
+ $("#localised-end-date").show();
190
+
191
+ $("#date-to-submit").hide();
192
+ $("#end-date-to-submit").hide();
193
+
194
+ $("#start-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?> });
195
+ $("#end-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?>});
196
+
197
+ $('input.select-all').change(function(){
198
+ if($(this).is(':checked'))
199
+ $('input.row-selector').attr('checked', true);
200
+ else
201
+ $('input.row-selector').attr('checked', false);
202
+ });
203
+
204
+ updateIntervalDescriptor();
205
+ updateIntervalSelectors();
206
+ updateShowHideRecurrence();
207
+ updateShowHideRsvp();
208
+ $('input#event-recurrence').change(updateShowHideRecurrence);
209
+ $('input#rsvp-checkbox').change(updateShowHideRsvp);
210
+
211
+ // recurrency elements
212
+ $('input#recurrence-interval').keyup(updateIntervalDescriptor);
213
+ $('select#recurrence-frequency').change(updateIntervalDescriptor);
214
+ $('select#recurrence-frequency').change(updateIntervalSelectors);
215
+
216
+ // hiding or showing notes according to their content
217
+ $('.postbox h3').prepend('<a class="togbox">+</a> ');
218
+ $('#event_notes h3').click( function() {
219
+ $(this).parent().first().toggleClass('closed');
220
+ });
221
+
222
+ // users cannot submit the event form unless some fields are filled
223
+ function validateEventForm(){
224
+ errors = "";
225
+ var recurring = $("input[@name=repeated_event]:checked").val();
226
+ requiredFields= new Array('event_name', 'localised_event_date', 'location_name','location_address','location_town');
227
+ var localisedRequiredFields = {
228
+ 'event_name':"<?php _e ( 'Name', 'dbem' )?>",
229
+ 'localised_event_date':"<?php _e ( 'Date', 'dbem' )?>",
230
+ 'location_name':"<?php _e ( 'Location', 'dbem' )?>",
231
+ 'location_address':"<?php _e ( 'Address', 'dbem' )?>",
232
+ 'location_town':"<?php _e ( 'Town', 'dbem' )?>"
233
+ };
234
+ missingFields = new Array;
235
+ for (var i in requiredFields) {
236
+ if ($("input[@name=" + requiredFields[i]+ "]").val() == 0) {
237
+ missingFields.push(localisedRequiredFields[requiredFields[i]]);
238
+ $("input[@name=" + requiredFields[i]+ "]").css('border','2px solid red');
239
+ } else {
240
+ $("input[@name=" + requiredFields[i]+ "]").css('border','1px solid #DFDFDF');
241
+ }
242
+ }
243
+
244
+ // alert('ciao ' + recurring+ " end: " + $("input[@name=localised_event_end_date]").val());
245
+ if (missingFields.length > 0) {
246
+ errors = "<?php _e ( 'Some required fields are missing:', 'dbem' )?> " + missingFields.join(", ") + ".\n";
247
+ }
248
+ if(recurring && $("input[@name=localised_event_end_date]").val() == "") {
249
+ errors = errors + "<?php _e ( 'Since the event is repeated, you must specify an end date', 'dbem' )?>.";
250
+ $("input[@name=localised_event_end_date]").css('border','2px solid red');
251
+ } else {
252
+ $("input[@name=localised_event_end_date]").css('border','1px solid #DFDFDF');
253
+ }
254
+ if(errors != "") {
255
+ alert(errors);
256
+ return false;
257
+ }
258
+ return true;
259
+ }
260
+ $('#event-form').bind("submit", validateEventForm);
261
+ });
262
+ //]]>
263
+ </script>
264
+ <?php
265
+ }
266
?>
admin/em-bookings.php CHANGED
@@ -1,369 +1,288 @@
1
- <?php
2
- /**
3
- * Check if there's any admin-related actions to take for bookings. All actions are caught here.
4
- * @return null
5
- */
6
- function em_admin_actions_bookings() {
7
- global $dbem_form_add_message;
8
- global $dbem_form_delete_message;
9
- global $wpdb, $EM_Booking, $EM_Event;
10
-
11
- if( current_user_can(EM_MIN_CAPABILITY) && is_object($EM_Booking) && !empty($_REQUEST['action']) ) {
12
- if( $_REQUEST['action'] == 'bookings_delete' ){
13
- //Delete
14
- if( isset($_POST['booking_id']) ){
15
- $EM_Booking = new EM_Booking($_POST['booking_id']);
16
- $EM_Booking->delete();
17
- }
18
- }elseif( $_REQUEST['action'] == 'bookings_edit' ){
19
- //Edit Booking
20
- $validation = $EM_Booking->get_post();
21
- if ( $validation ) { //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
22
- //Save
23
- if( $EM_Booking->save() ) {
24
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
25
- }else{
26
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="error"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
27
- }
28
- }else{
29
- //TODO make errors clearer when saving person
30
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="error"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
31
- }
32
- add_action ( 'admin_notices', 'em_booking_save_notification' );
33
- }elseif( $_REQUEST['action'] == 'bookings_approve' || $_REQUEST['action'] == 'bookings_reject' || $_REQUEST['action'] == 'bookings_unapprove' ){
34
- //Booking Approvals
35
- $status_array = array('bookings_unapprove' => 0,'bookings_approve' => 1,'bookings_reject' => 2, 'bookings_cancel' => 3);
36
- if( $EM_Booking->set_status( $status_array[$_REQUEST['action']] ) ) {
37
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
38
- }else{
39
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="error"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
40
- }
41
- add_action ( 'admin_notices', 'em_booking_save_notification' );
42
- }elseif( $_REQUEST['action'] == 'bookings_add_note' ){
43
- $EM_Booking->add_note($_REQUEST['booking_note']);
44
- function em_booking_save_notification(){ global $EM_Booking; ?><div class="updated"><p><strong><?php echo $EM_Booking->feedback_message; ?></strong></p></div><?php }
45
- add_action ( 'admin_notices', 'em_booking_save_notification' );
46
- }
47
- }elseif( current_user_can(EM_MIN_CAPABILITY) && is_object($EM_Event) && !empty($_REQUEST['action']) ){
48
- if( $_REQUEST['action'] == 'export_csv' ){
49
- $EM_Event->get_bookings()->export_csv();
50
- exit();
51
- }
52
- }
53
- }
54
- add_action('admin_init','em_admin_actions_bookings',100);
55
-
56
- /**
57
- * Decide what content to show in the bookings section.
58
- */
59
- function em_bookings_page(){
60
- //First any actions take priority
61
- if( !empty($_REQUEST['booking_id']) ){
62
- em_bookings_single();
63
- }elseif( !empty($_REQUEST['person_id']) ){
64
- em_bookings_person();
65
- }elseif( !empty($_REQUEST['event_id']) ){
66
- em_bookings_event();
67
- }elseif( !empty($_REQUEST['ticket_id']) ){
68
- em_bookings_ticket();
69
- }else{
70
- em_bookings_dashboard();
71
- }
72
- }
73
-
74
- /**
75
- * Generates the bookings dashboard, showing information on all events
76
- */
77
- function em_bookings_dashboard(){
78
- ?>
79
- <div class='wrap'>
80
- <div id='icon-users' class='icon32'>
81
- <br/>
82
- </div>
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
- }
96
-
97
- /**
98
- * Shows all booking data for a single event
99
- */
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
107
- return false;
108
- }
109
- $localised_start_date = date_i18n('D d M Y', $EM_Event->start);
110
- $localised_end_date = date_i18n('D d M Y', $EM_Event->end);
111
- ?>
112
- <div class='wrap'>
113
- <div id='icon-users' class='icon32'>
114
- <br/>
115
- </div>
116
- <h2>
117
- <?php echo sprintf(__('Manage %s Bookings', 'dbem'), "'{$EM_Event->name}'"); ?>
118
- <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>
119
- </h2>
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; ?>
127
- <?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
128
- <?php echo substr ( $EM_Event->start_time, 0, 5 ) . " - " . substr ( $EM_Event->end_time, 0, 5 ); ?>
129
- </p>
130
- <p>
131
- <strong><?php _e('Location','dbem'); ?></strong> :
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; ?>
139
- <h2><?php _e('Confirmed Bookings','dbem'); ?></h2>
140
- <?php em_bookings_confirmed_table(); ?>
141
- <h2><?php _e('Rejected Bookings','dbem'); ?></h2>
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
- */
203
- function em_bookings_single(){
204
- global $EM_Booking;
205
- //check that user can access this page
206
- if( is_object($EM_Booking) && !$EM_Booking->can_manage() ){
207
- ?>
208
- <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>
209
- <?php
210
- return false;
211
- }
212
- ?>
213
- <div class='wrap'>
214
- <div id='icon-users' class='icon32'>
215
- <br/>
216
- </div>
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>