Events Manager - Version 3.0

Version Description

Download this release

Release Info

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

Code changes from version 2.2.2 to 3.0

Files changed (220) hide show
  1. admin/admin.php +163 -0
  2. admin/bookings.php +84 -0
  3. admin/categories.php +174 -0
  4. admin/event.php +564 -0
  5. admin/events.php +286 -0
  6. admin/functions.php +64 -0
  7. admin/locations-search.php +38 -0
  8. admin/locations.php +296 -0
  9. admin/options.php +259 -0
  10. admin/people.php +123 -0
  11. admin/support.php +41 -0
  12. ajax.php +53 -0
  13. bookings.php +164 -0
  14. classes/booking.php +139 -0
  15. classes/bookings.php +196 -0
  16. classes/calendar.php +324 -0
  17. classes/category.php +18 -0
  18. classes/event.php +797 -0
  19. classes/events.php +249 -0
  20. classes/location.php +279 -0
  21. classes/locations.php +37 -0
  22. classes/mailer.php +74 -0
  23. classes/map.php +61 -0
  24. classes/object.php +224 -0
  25. classes/people.php +25 -0
  26. classes/person.php +117 -0
  27. {phpmailer → classes/phpmailer}/class.phpmailer.php +0 -0
  28. {phpmailer → classes/phpmailer}/class.smtp.php +0 -0
  29. {phpmailer → classes/phpmailer}/language/phpmailer.lang-br.php +0 -0
  30. {phpmailer → classes/phpmailer}/language/phpmailer.lang-ca.php +0 -0
  31. {phpmailer → classes/phpmailer}/language/phpmailer.lang-cz.php +0 -0
  32. {phpmailer → classes/phpmailer}/language/phpmailer.lang-de.php +0 -0
  33. {phpmailer → classes/phpmailer}/language/phpmailer.lang-dk.php +0 -0
  34. {phpmailer → classes/phpmailer}/language/phpmailer.lang-en.php +0 -0
  35. {phpmailer → classes/phpmailer}/language/phpmailer.lang-es.php +0 -0
  36. {phpmailer → classes/phpmailer}/language/phpmailer.lang-fi.php +0 -0
  37. {phpmailer → classes/phpmailer}/language/phpmailer.lang-fo.php +0 -0
  38. {phpmailer → classes/phpmailer}/language/phpmailer.lang-fr.php +0 -0
  39. {phpmailer → classes/phpmailer}/language/phpmailer.lang-hu.php +0 -0
  40. {phpmailer → classes/phpmailer}/language/phpmailer.lang-it.php +0 -0
  41. {phpmailer → classes/phpmailer}/language/phpmailer.lang-ja.php +0 -0
  42. {phpmailer → classes/phpmailer}/language/phpmailer.lang-nl.php +0 -0
  43. {phpmailer → classes/phpmailer}/language/phpmailer.lang-no.php +0 -0
  44. {phpmailer → classes/phpmailer}/language/phpmailer.lang-pl.php +0 -0
  45. {phpmailer → classes/phpmailer}/language/phpmailer.lang-ro.php +0 -0
  46. {phpmailer → classes/phpmailer}/language/phpmailer.lang-ru.php +0 -0
  47. {phpmailer → classes/phpmailer}/language/phpmailer.lang-se.php +0 -0
  48. {phpmailer → classes/phpmailer}/language/phpmailer.lang-tr.php +0 -0
  49. classes/recurrence.php +89 -0
  50. dbem-recurrence.php +0 -267
  51. dbem.js +0 -86
  52. dbem_UI_helpers.php +0 -93
  53. dbem_calendar.php +0 -496
  54. dbem_events.php +0 -2358
  55. dbem_global_map.js +0 -108
  56. dbem_locations.php +0 -726
  57. dbem_people.php +0 -223
  58. dbem_rsvp.php +0 -391
  59. dbem_single_location_map.js +0 -32
  60. dbem_widgets.php +0 -194
  61. em-bugs.txt +59 -0
  62. events-manager.php +205 -679
  63. events.php +123 -0
  64. functions.php +148 -0
  65. events_manager.css → includes/css/events_manager.css +33 -5
  66. includes/css/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  67. includes/css/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  68. includes/css/images/ui-bg_flat_10_000000_40x100.png +0 -0
  69. includes/css/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  70. includes/css/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  71. includes/css/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  72. includes/css/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  73. includes/css/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  74. includes/css/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  75. includes/css/images/ui-icons_222222_256x240.png +0 -0
  76. includes/css/images/ui-icons_228ef1_256x240.png +0 -0
  77. includes/css/images/ui-icons_ef8c08_256x240.png +0 -0
  78. includes/css/images/ui-icons_ffd27a_256x240.png +0 -0
  79. includes/css/images/ui-icons_ffffff_256x240.png +0 -0
  80. includes/css/jquery-ui-1.7.3.custom.css +344 -0
  81. includes/css/jquery-ui-1.8.5.custom.css +419 -0
  82. {images → includes/images}/baloon.png +0 -0
  83. {images → includes/images}/calendar-16.png +0 -0
  84. {images → includes/images}/calendar-32.png +0 -0
  85. includes/js/em_admin.js +217 -0
  86. includes/js/em_calendar_ajax.js +7 -0
  87. includes/js/em_maps.js +73 -0
  88. includes/js/em_ui.js +27 -0
  89. includes/js/i18n/jquery-ui-i18n.js +1199 -0
  90. includes/js/i18n/jquery.ui.datepicker-af.js +23 -0
  91. includes/js/i18n/jquery.ui.datepicker-ar.js +24 -0
  92. includes/js/i18n/jquery.ui.datepicker-az.js +23 -0
  93. includes/js/i18n/jquery.ui.datepicker-bg.js +24 -0
  94. includes/js/i18n/jquery.ui.datepicker-bs.js +23 -0
  95. js/jquery-ui-datepicker/i18n/ui.datepicker-ca.js → includes/js/i18n/jquery.ui.datepicker-ca.js +12 -11
  96. includes/js/i18n/jquery.ui.datepicker-cs.js +23 -0
  97. includes/js/i18n/jquery.ui.datepicker-da.js +23 -0
  98. includes/js/i18n/jquery.ui.datepicker-de.js +23 -0
  99. includes/js/i18n/jquery.ui.datepicker-el.js +23 -0
  100. includes/js/i18n/jquery.ui.datepicker-en-GB.js +23 -0
  101. includes/js/i18n/jquery.ui.datepicker-eo.js +23 -0
  102. js/jquery-ui-datepicker/i18n/ui.datepicker-es.js → includes/js/i18n/jquery.ui.datepicker-es.js +13 -12
  103. includes/js/i18n/jquery.ui.datepicker-et.js +23 -0
  104. includes/js/i18n/jquery.ui.datepicker-eu.js +23 -0
  105. includes/js/i18n/jquery.ui.datepicker-fa.js +23 -0
  106. js/jquery-ui-datepicker/i18n/ui.datepicker-fi.js → includes/js/i18n/jquery.ui.datepicker-fi.js +12 -13
  107. includes/js/i18n/jquery.ui.datepicker-fo.js +23 -0
  108. includes/js/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
  109. includes/js/i18n/jquery.ui.datepicker-fr.js +23 -0
  110. js/jquery-ui-datepicker/i18n/ui.datepicker-he.js → includes/js/i18n/jquery.ui.datepicker-he.js +13 -12
  111. includes/js/i18n/jquery.ui.datepicker-hr.js +23 -0
  112. includes/js/i18n/jquery.ui.datepicker-hu.js +23 -0
  113. js/jquery-ui-datepicker/i18n/ui.datepicker-hy.js → includes/js/i18n/jquery.ui.datepicker-hy.js +11 -10
  114. includes/js/i18n/jquery.ui.datepicker-id.js +23 -0
  115. js/jquery-ui-datepicker/i18n/ui.datepicker-is.js → includes/js/i18n/jquery.ui.datepicker-is.js +11 -10
  116. includes/js/i18n/jquery.ui.datepicker-it.js +23 -0
  117. includes/js/i18n/jquery.ui.datepicker-ja.js +23 -0
  118. includes/js/i18n/jquery.ui.datepicker-ko.js +23 -0
  119. includes/js/i18n/jquery.ui.datepicker-kz.js +23 -0
  120. includes/js/i18n/jquery.ui.datepicker-lt.js +23 -0
  121. js/jquery-ui-datepicker/i18n/ui.datepicker-lv.js → includes/js/i18n/jquery.ui.datepicker-lv.js +12 -14
  122. includes/js/i18n/jquery.ui.datepicker-ms.js +23 -0
  123. includes/js/i18n/jquery.ui.datepicker-nl.js +23 -0
  124. includes/js/i18n/jquery.ui.datepicker-no.js +23 -0
  125. includes/js/i18n/jquery.ui.datepicker-pl.js +23 -0
  126. includes/js/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
  127. includes/js/i18n/jquery.ui.datepicker-ro.js +26 -0
  128. js/jquery-ui-datepicker/i18n/ui.datepicker-ru.js → includes/js/i18n/jquery.ui.datepicker-ru.js +11 -10
  129. js/jquery-ui-datepicker/i18n/ui.datepicker-sk.js → includes/js/i18n/jquery.ui.datepicker-sk.js +11 -10
  130. includes/js/i18n/jquery.ui.datepicker-sl.js +24 -0
  131. includes/js/i18n/jquery.ui.datepicker-sq.js +23 -0
  132. includes/js/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
  133. includes/js/i18n/jquery.ui.datepicker-sr.js +23 -0
  134. includes/js/i18n/jquery.ui.datepicker-sv.js +23 -0
  135. includes/js/i18n/jquery.ui.datepicker-ta.js +23 -0
  136. js/jquery-ui-datepicker/i18n/ui.datepicker-th.js → includes/js/i18n/jquery.ui.datepicker-th.js +11 -10
  137. js/jquery-ui-datepicker/i18n/ui.datepicker-tr.js → includes/js/i18n/jquery.ui.datepicker-tr.js +11 -10
  138. js/jquery-ui-datepicker/i18n/ui.datepicker-uk.js → includes/js/i18n/jquery.ui.datepicker-uk.js +12 -11
  139. includes/js/i18n/jquery.ui.datepicker-vi.js +23 -0
  140. js/jquery-ui-datepicker/i18n/ui.datepicker-zh-CN.js → includes/js/i18n/jquery.ui.datepicker-zh-CN.js +11 -10
  141. includes/js/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
  142. js/jquery-ui-datepicker/i18n/ui.datepicker-zh-TW.js → includes/js/i18n/jquery.ui.datepicker-zh-TW.js +10 -10
  143. includes/js/jquery-ui-1.8.5/jquery-ui-1.8.5.custom.min.js +160 -0
  144. {js → includes/js}/timeentry/jquery.timeentry-de.js +0 -0
  145. {js → includes/js}/timeentry/jquery.timeentry-es.js +0 -0
  146. {js → includes/js}/timeentry/jquery.timeentry-fr.js +0 -0
  147. {js → includes/js}/timeentry/jquery.timeentry-hu.js +0 -0
  148. {js → includes/js}/timeentry/jquery.timeentry-it.js +0 -0
  149. {js → includes/js}/timeentry/jquery.timeentry-nl.js +0 -0
  150. {js → includes/js}/timeentry/jquery.timeentry-pl.js +0 -0
  151. {js → includes/js}/timeentry/jquery.timeentry-pt.js +0 -0
  152. {js → includes/js}/timeentry/jquery.timeentry-ro.js +0 -0
  153. {js → includes/js}/timeentry/jquery.timeentry-ru.js +0 -0
  154. {js → includes/js}/timeentry/jquery.timeentry-sk.js +0 -0
  155. {js → includes/js}/timeentry/jquery.timeentry-sv.js +0 -0
  156. {js → includes/js}/timeentry/jquery.timeentry-tr.js +0 -0
  157. {js → includes/js}/timeentry/jquery.timeentry-zh-CN.js +0 -0
  158. {js → includes/js}/timeentry/jquery.timeentry.compat-1.2.6.js +0 -0
  159. {js → includes/js}/timeentry/jquery.timeentry.css +0 -0
  160. {js → includes/js}/timeentry/jquery.timeentry.ent +0 -0
  161. {js → includes/js}/timeentry/jquery.timeentry.js +0 -0
  162. {js → includes/js}/timeentry/jquery.timeentry.min.js +0 -0
  163. {js → includes/js}/timeentry/jquery.timeentry.pack.js +0 -0
  164. {js → includes/js}/timeentry/timeEntry.png +0 -0
  165. {js → includes/js}/timeentry/timeEntry2.png +0 -0
  166. {js → includes/js}/timeentry/timeEntry3.png +0 -0
  167. {js → includes/js}/timeentry/timeEntry4.png +0 -0
  168. {js → includes/js}/timeentry/timeEntry5.png +0 -0
  169. {js → includes/js}/timeentry/timeEntry6.png +0 -0
  170. {langs → includes/langs}/dbem-cs_CZ.mo +0 -0
  171. {langs → includes/langs}/dbem-cs_CZ.po +0 -0
  172. {langs → includes/langs}/dbem-de_DE.mo +0 -0
  173. {langs → includes/langs}/dbem-es_ES.mo +0 -0
  174. {langs → includes/langs}/dbem-es_ES.po +0 -0
  175. {langs → includes/langs}/dbem-it_IT.mo +0 -0
  176. {langs → includes/langs}/dbem-it_IT.po +0 -0
  177. {langs → includes/langs}/dbem-pt_BR.mo +0 -0
  178. {langs → includes/langs}/dbem-pt_BR.po +0 -0
  179. {langs → includes/langs}/dbem-sv_SE.mo +0 -0
  180. {langs → includes/langs}/dbem-sv_SE.po +0 -0
  181. includes/sample-placeholers/event-single.html +63 -0
  182. install.php +485 -0
  183. js/jquery-autocomplete/changelog.txt +0 -20
  184. js/jquery-autocomplete/jquery.autocomplete.css +0 -48
  185. js/jquery-autocomplete/jquery.autocomplete.min.js +0 -15
  186. js/jquery-autocomplete/jquery.autocomplete.pack.js +0 -13
  187. js/jquery-autocomplete/lib/jquery.ajaxQueue.js +0 -116
  188. js/jquery-autocomplete/lib/jquery.bgiframe.min.js +0 -10
  189. js/jquery-autocomplete/todo +0 -166
  190. js/jquery-ui-datepicker/i18n/ui.datepicker-ar.js +0 -23
  191. js/jquery-ui-datepicker/i18n/ui.datepicker-bg.js +0 -22
  192. js/jquery-ui-datepicker/i18n/ui.datepicker-cs.js +0 -22
  193. js/jquery-ui-datepicker/i18n/ui.datepicker-da.js +0 -22
  194. js/jquery-ui-datepicker/i18n/ui.datepicker-de.js +0 -22
  195. js/jquery-ui-datepicker/i18n/ui.datepicker-fr.js +0 -22
  196. js/jquery-ui-datepicker/i18n/ui.datepicker-hu.js +0 -22
  197. js/jquery-ui-datepicker/i18n/ui.datepicker-id.js +0 -22
  198. js/jquery-ui-datepicker/i18n/ui.datepicker-it.js +0 -22
  199. js/jquery-ui-datepicker/i18n/ui.datepicker-ja.js +0 -22
  200. js/jquery-ui-datepicker/i18n/ui.datepicker-ko.js +0 -22
  201. js/jquery-ui-datepicker/i18n/ui.datepicker-lt.js +0 -25
  202. js/jquery-ui-datepicker/i18n/ui.datepicker-nl.js +0 -21
  203. js/jquery-ui-datepicker/i18n/ui.datepicker-no.js +0 -23
  204. js/jquery-ui-datepicker/i18n/ui.datepicker-pl.js +0 -22
  205. js/jquery-ui-datepicker/i18n/ui.datepicker-pt-BR.js +0 -22
  206. js/jquery-ui-datepicker/i18n/ui.datepicker-ro.js +0 -22
  207. js/jquery-ui-datepicker/i18n/ui.datepicker-sv.js +0 -22
  208. js/jquery-ui-datepicker/ui.datepicker.css +0 -213
  209. js/jquery-ui-datepicker/ui.datepicker.js +0 -1674
  210. locations-search.php +0 -37
  211. locations.php +77 -0
  212. marcus-extras.php +0 -388
  213. phpmailer/dbem_phpmailer.php +0 -47
  214. readme.txt +30 -15
  215. rss.php +54 -0
  216. shortcode.php +95 -0
  217. template-tags-depreciated.php +125 -0
  218. template-tags.php +86 -0
  219. widgets/calendar.php +52 -0
  220. widgets/events.php +87 -0
admin/admin.php ADDED
@@ -0,0 +1,163 @@
1
+ <?php
2
+ //Admin javascript and style loading
3
+
4
+ /**
5
+ * Called by admin_print_scripts-(hook|page) action, created when adding menu items in events-manager.php
6
+ */
7
+ function em_admin_load_scripts(){
8
+ if( get_option('dbem_gmap_is_active') ){
9
+ wp_enqueue_script('em-google-maps', 'http://maps.google.com/maps/api/js?sensor=false');
10
+ }
11
+ wp_enqueue_script('em-timeentry', WP_PLUGIN_URL.'/events-manager/includes/js/timeentry/jquery.timeentry.js', array('jquery'));
12
+ //Load the UI items, currently date picker and autocomplete plus dependencies
13
+ //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'));
14
+ wp_enqueue_script('em-ui-js', WP_PLUGIN_URL.'/events-manager/includes/js/em_ui.js', array('jquery', 'jquery-ui-core'));
15
+ //Date Picker Locale
16
+ $locale_code = substr ( get_locale (), 0, 2 );
17
+ $locale_file = "/events-manager/includes/js/i18n/jquery.ui.datepicker-$locale_code.js";
18
+ if ( file_exists(WP_PLUGIN_DIR.$locale_file) ) {
19
+ wp_enqueue_script("em-ui-datepicker-$locale_code", WP_PLUGIN_URL.$locale_file, array('em-ui-js'));
20
+ }
21
+ wp_enqueue_script('em-script', WP_PLUGIN_URL.'/events-manager/includes/js/em_admin.js', array('em-ui-js'));
22
+ }
23
+
24
+ /**
25
+ * Called by admin_print_styles-(hook|page) action, created when adding menu items in events-manager.php
26
+ */
27
+ function em_admin_load_styles() {
28
+ wp_enqueue_style('em-ui-css', WP_PLUGIN_URL.'/events-manager/includes/css/jquery-ui-1.7.3.custom.css');
29
+ wp_enqueue_style('events-manager-admin', WP_PLUGIN_URL.'/events-manager/includes/css/events_manager.css');
30
+ }
31
+
32
+ /**
33
+ * Loads script inline due to insertion of php values
34
+ */
35
+ function em_admin_general_script() {
36
+ //TODO clean script up, remove dependency of php so it can be moved to js file.
37
+ // Check if the locale is there and loads it
38
+ $locale_code = substr ( get_locale (), 0, 2 );
39
+ $show24Hours = 'true';
40
+ // Setting 12 hours format for those countries using it
41
+ if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
42
+ $show24Hours = 'false';
43
+ ?>
44
+ <script type="text/javascript">
45
+ //<![CDATA[
46
+ // TODO: make more general, to support also latitude and longitude (when added)
47
+
48
+ jQuery(document).ready( function($) {
49
+
50
+ function updateIntervalDescriptor () {
51
+ $(".interval-desc").hide();
52
+ var number = "-plural";
53
+ if ($('input#recurrence-interval').val() == 1 || $('input#recurrence-interval').val() == "")
54
+ number = "-singular"
55
+ var descriptor = "span#interval-"+$("select#recurrence-frequency").val()+number;
56
+ $(descriptor).show();
57
+ }
58
+ function updateIntervalSelectors () {
59
+ $('p.alternate-selector').hide();
60
+ $('p#'+ $('select#recurrence-frequency').val() + "-selector").show();
61
+ }
62
+ function updateShowHideRsvp () {
63
+ if($('input#rsvp-checkbox').attr("checked")) {
64
+ $("div#rsvp-data").fadeIn();
65
+ } else {
66
+ $("div#rsvp-data").hide();
67
+ }
68
+ }
69
+ function updateShowHideRecurrence () {
70
+ if( $('input#event-recurrence').attr("checked")) {
71
+ $("#event_recurrence_pattern").fadeIn();
72
+ $("#event-date-explanation").hide();
73
+ $("#recurrence-dates-explanation").show();
74
+ $("h3#recurrence-dates-title").show();
75
+ $("h3#event-date-title").hide();
76
+ } else {
77
+ $("#event_recurrence_pattern").hide();
78
+ $("#recurrence-dates-explanation").hide();
79
+ $("#event-date-explanation").show();
80
+ $("h3#recurrence-dates-title").hide();
81
+ $("h3#event-date-title").show();
82
+ }
83
+ }
84
+ $("#recurrence-dates-explanation").hide();
85
+ $("#localised-date").show();
86
+ $("#localised-end-date").show();
87
+
88
+ $("#date-to-submit").hide();
89
+ $("#end-date-to-submit").hide();
90
+
91
+ $("#start-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?> });
92
+ $("#end-time").timeEntry({spinnerImage: '', show24Hours: <?php echo $show24Hours; ?>});
93
+
94
+ $('input.select-all').change(function(){
95
+ if($(this).is(':checked'))
96
+ $('input.row-selector').attr('checked', true);
97
+ else
98
+ $('input.row-selector').attr('checked', false);
99
+ });
100
+
101
+ updateIntervalDescriptor();
102
+ updateIntervalSelectors();
103
+ updateShowHideRecurrence();
104
+ updateShowHideRsvp();
105
+ $('input#event-recurrence').change(updateShowHideRecurrence);
106
+ $('input#rsvp-checkbox').change(updateShowHideRsvp);
107
+
108
+ // recurrency elements
109
+ $('input#recurrence-interval').keyup(updateIntervalDescriptor);
110
+ $('select#recurrence-frequency').change(updateIntervalDescriptor);
111
+ $('select#recurrence-frequency').change(updateIntervalSelectors);
112
+
113
+ // hiding or showing notes according to their content
114
+ $('.postbox h3').prepend('<a class="togbox">+</a> ');
115
+ $('#event_notes h3').click( function() {
116
+ $(this).parent().first().toggleClass('closed');
117
+ });
118
+
119
+ // users cannot submit the event form unless some fields are filled
120
+ function validateEventForm(){
121
+ errors = "";
122
+ var recurring = $("input[@name=repeated_event]:checked").val();
123
+ requiredFields= new Array('event_name', 'localised_event_date', 'location_name','location_address','location_town');
124
+ var localisedRequiredFields = {
125
+ 'event_name':"<?php _e ( 'Name', 'dbem' )?>",
126
+ 'localised_event_date':"<?php _e ( 'Date', 'dbem' )?>",
127
+ 'location_name':"<?php _e ( 'Location', 'dbem' )?>",
128
+ 'location_address':"<?php _e ( 'Address', 'dbem' )?>",
129
+ 'location_town':"<?php _e ( 'Town', 'dbem' )?>"
130
+ };
131
+ missingFields = new Array;
132
+ for (var i in requiredFields) {
133
+ if ($("input[@name=" + requiredFields[i]+ "]").val() == 0) {
134
+ missingFields.push(localisedRequiredFields[requiredFields[i]]);
135
+ $("input[@name=" + requiredFields[i]+ "]").css('border','2px solid red');
136
+ } else {
137
+ $("input[@name=" + requiredFields[i]+ "]").css('border','1px solid #DFDFDF');
138
+ }
139
+ }
140
+
141
+ // alert('ciao ' + recurring+ " end: " + $("input[@name=localised_event_end_date]").val());
142
+ if (missingFields.length > 0) {
143
+ errors = "<?php _e ( 'Some required fields are missing:', 'dbem' )?> " + missingFields.join(", ") + ".\n";
144
+ }
145
+ if(recurring && $("input[@name=localised_event_end_date]").val() == "") {
146
+ errors = errors + "<?php _e ( 'Since the event is repeated, you must specify an end date', 'dbem' )?>.";
147
+ $("input[@name=localised_event_end_date]").css('border','2px solid red');
148
+ } else {
149
+ $("input[@name=localised_event_end_date]").css('border','1px solid #DFDFDF');
150
+ }
151
+ if(errors != "") {
152
+ alert(errors);
153
+ return false;
154
+ }
155
+ return true;
156
+ }
157
+ $('#eventForm').bind("submit", validateEventForm);
158
+ });
159
+ //]]>
160
+ </script>
161
+ <?php
162
+ }
163
+ ?>
admin/bookings.php ADDED
@@ -0,0 +1,84 @@
1
+ <?php
2
+ /**
3
+ * Check if there's any actions to take for bookings
4
+ * @return null
5
+ */
6
+ function dbem_admin_actions_bookings() {
7
+ global $dbem_form_add_message;
8
+ global $dbem_form_delete_message;
9
+ global $wpdb;
10
+
11
+ //DELETE Bookings
12
+ if( $_POST['secondaryAction'] == 'delete_bookings' ){
13
+ if( EM_Object::array_is_numeric($_GET['bookings']) && count($_GET['bookings']) > 0 ){
14
+ $bookings = $_GET['bookings'];
15
+ $sql = "DELETE FROM ". $wpdb->prefix.BOOKINGS_TBNAME ." WHERE booking_id = ". implode(' OR booking_id = ', $bookings);
16
+ $wpdb->query($sql);
17
+ $dbem_form_delete_message = __('Bookings deleted', 'dbem');
18
+ }
19
+ }
20
+ }
21
+ add_action('init','dbem_admin_actions_bookings');
22
+
23
+ /**
24
+ * Shows table of bookings for an event
25
+ * @return null
26
+ */
27
+ function dbem_bookings_table() {
28
+ global $EM_Event;
29
+ ?>
30
+ <form id='bookings-filter' method='get' action='<?php bloginfo('wpurl') ?>/wp-admin/edit.php'>
31
+ <input type='hidden' name='page' value='events-manager/events-manager.php'/>
32
+ <input type='hidden' name='action' value='edit_event'/>
33
+ <input type='hidden' name='event_id' value='<?php echo $EM_Event->id ?>'/>
34
+ <input type='hidden' name='secondaryAction' value='delete_bookings'/>
35
+ <div class='wrap'>
36
+ <h2>Bookings</h2>
37
+ <table id='dbem-bookings-table' class='widefat post fixed'>
38
+ <thead>
39
+ <tr>
40
+ <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>
41
+ <th class='manage-column ' scope='col'>Booker</th>
42
+ <th scope='col'>E-mail</th>
43
+ <th scope='col'>Phone number</th>
44
+ <th scope='col'>Seats</th>
45
+ </tr>
46
+ </thead>
47
+ <tbody>
48
+ <?php
49
+ foreach ($EM_Event->bookings->bookings as $EM_Booking) {
50
+ ?>
51
+ <tr>
52
+ <td><input type='checkbox' value='<?php echo $EM_Booking->id ?>' name='bookings[]'/></td>
53
+ <td><?php echo $EM_Booking->name ?></td>
54
+ <td><?php echo $EM_Booking->email ?></td>
55
+ <td><?php echo $EM_Booking->phone ?></td>
56
+ <td><?php echo $EM_Booking->seats ?></td>
57
+ </tr>
58
+ <?php
59
+ }
60
+ ?>
61
+ </tbody>
62
+ <tfoot>
63
+ <tr>
64
+ <th scope='row' colspan='4'>Booked seats:</th>
65
+ <td class='booking-result' id='booked-seats'><?php echo $EM_Event->bookings->get_booked_seats() ?></td>
66
+ </tr>
67
+ <tr>
68
+ <th scope='row' colspan='4'>Available seats:</th>
69
+ <td class='booking-result' id='available-seats'><?php echo $EM_Event->bookings->get_booked_seats() ?></td>
70
+ </tr>
71
+ </tfoot>
72
+ </table>
73
+ </div>
74
+ <div class='tablenav'>
75
+ <div class='alignleft actions'>
76
+ <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>
77
+ <br class='clear'/>
78
+ </div>
79
+ <br class='clear'/>
80
+ </div>
81
+ </form>
82
+ <?php
83
+ }
84
+ ?>
admin/categories.php ADDED
@@ -0,0 +1,174 @@
1
+ <?php
2
+ function dbem_categories_subpanel() {
3
+ global $wpdb;
4
+
5
+ if(isset($_GET['action']) && $_GET['action'] == "edit") {
6
+ // edit category
7
+ dbem_categories_edit_layout();
8
+ } else {
9
+ // Insert/Update/Delete Record
10
+ $categories_table = $wpdb->prefix.DBEM_CATEGORIES_TBNAME;
11
+ if( isset($_POST['action']) && $_POST['action'] == "edit" ) {
12
+ // category update required
13
+ $category = array();
14
+ $category['category_name'] = $_POST['category_name'];
15
+ $validation_result = $wpdb->update( $categories_table, $category, array('category_id' => $_POST['category_ID']) );
16
+ } elseif( isset($_POST['action']) && $_POST['action'] == "add" ) {
17
+ // Add a new category
18
+ $category = array();
19
+ $category['category_name'] = $_POST['category_name'];
20
+ $validation_result = $wpdb->insert($categories_table, $category);
21
+ } elseif( isset($_POST['action']) && $_POST['action'] == "delete" ) {
22
+ // Delete category or multiple
23
+ $categories = $_POST['categories'];
24
+ if(is_array($categories)){
25
+ //Run the query if we have an array of category ids with at least one value
26
+ if( EM_Object::array_is_numeric($categories) ){
27
+ $validation_result = $wpdb->query( "DELETE FROM $categories_table WHERE category_id =". implode(" OR category_id =", $categories) );
28
+ }else{
29
+ $validation_result = false;
30
+ $message = "Couldn't delete the categories. Incorrect category IDs supplied. Please try agian.";
31
+ }
32
+ }
33
+ }
34
+ //die(print_r($_POST));
35
+ if ( is_numeric($validation_result) ) {
36
+ $message = (isset($message)) ? $message : __("Successfully {$_POST['action']}ed category", "dbem");
37
+ dbem_categories_table_layout($message);
38
+ } elseif ( $validation_result === false ) {
39
+ $message = (isset($message)) ? $message : __("There was a problem {$_POST['action']}ing your category, please try again.");
40
+ dbem_categories_table_layout($message);
41
+ } else {
42
+ // no action, just a categories list
43
+ dbem_categories_table_layout();
44
+ }
45
+ }
46
+ }
47
+
48
+ function dbem_categories_table_layout($message = "") {
49
+ $categories = EM_Category::get();
50
+ $destination = get_bloginfo('url')."/wp-admin/admin.php";
51
+ ?>
52
+ <div class='wrap nosubsub'>
53
+ <div id='icon-edit' class='icon32'>
54
+ <br/>
55
+ </div>
56
+ <h2><?php echo __('Categories', 'dbem') ?></h2>
57
+
58
+ <?php if($message != "") : ?>
59
+ <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
60
+ <p><?php echo $message ?></p>
61
+ </div>
62
+ <?php endif; ?>
63
+
64
+ <div id='col-container'>
65
+ <!-- begin col-right -->
66
+ <div id='col-right'>
67
+ <div class='col-wrap'>
68
+ <form id='bookings-filter' method='post' action='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=events-manager-categories'>
69
+ <input type='hidden' name='action' value='delete'/>
70
+ <?php if (count($categories)>0) : ?>
71
+ <table class='widefat'>
72
+ <thead>
73
+ <tr>
74
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
75
+ <th><?php echo __('ID', 'dbem') ?></th>
76
+ <th><?php echo __('Name', 'dbem') ?></th>
77
+ </tr>
78
+ </thead>
79
+ <tfoot>
80
+ <tr>
81
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
82
+ <th><?php echo __('ID', 'dbem') ?></th>
83
+ <th><?php echo __('Name', 'dbem') ?></th>
84
+ </tr>
85
+ </tfoot>
86
+ <tbody>
87
+ <?php foreach ($categories as $this_category) : ?>
88
+ <tr>
89
+ <td><input type='checkbox' class ='row-selector' value='<?php echo $this_category['category_id'] ?>' name='categories[]'/></td>
90
+ <td><a href='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=events-manager-categories&amp;action=edit&amp;category_ID=<?php echo $this_category['category_id'] ?>'><?php echo htmlspecialchars($this_category['category_id'], ENT_QUOTES); ?></a></td>
91
+ <td><a href='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=events-manager-categories&amp;action=edit&amp;category_ID=<?php echo $this_category['category_id'] ?>'><?php echo htmlspecialchars($this_category['category_name'], ENT_QUOTES); ?></a></td>
92
+ </tr>
93
+ <?php endforeach; ?>
94
+ </tbody>
95
+
96
+ </table>
97
+
98
+ <div class='tablenav'>
99
+ <div class='alignleft actions'>
100
+ <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>
101
+ <br class='clear'/>
102
+ </div>
103
+ <br class='clear'/>
104
+ </div>
105
+ <?php else: ?>
106
+ <p><?php echo __('No categories have been inserted yet!', 'dbem'); ?></p>
107
+ <?php endif; ?>
108
+ </form>
109
+ </div>
110
+ </div>
111
+ <!-- end col-right -->
112
+
113
+ <!-- begin col-left -->
114
+ <div id='col-left'>
115
+ <div class='col-wrap'>
116
+ <div class='form-wrap'>
117
+ <div id='ajax-response'>
118
+ <h3><?php echo __('Add category', 'dbem') ?></h3>
119
+ <form name='add' id='add' method='post' action='admin.php?page=events-manager-categories' class='add:the-list: validate'>
120
+ <input type='hidden' name='action' value='add' />
121
+ <div class='form-field form-required'>
122
+ <label for='category_name'><?php echo __('Category name', 'dbem') ?></label>
123
+ <input id='category-name' name='category_name' id='category_name' type='text' size='40' />
124
+ <p><?php echo __('The name of the category', 'dbem'); ?></p>
125
+ </div>
126
+ <p class='submit'><input type='submit' class='button' name='submit' value='<?php echo __('Add category', 'dbem') ?>' /></p>
127
+ </form>
128
+ </div>
129
+ </div>
130
+ </div>
131
+ </div>
132
+ <!-- end col-left -->
133
+ </div>
134
+ </div>
135
+ <?php
136
+ }
137
+
138
+
139
+ function dbem_categories_edit_layout($message = "") {
140
+ $category_id = $_GET['category_ID'];
141
+ $category = EM_Category::get($category_id);
142
+ ?>
143
+ <div class='wrap'>
144
+ <div id='icon-edit' class='icon32'>
145
+ <br/>
146
+ </div>
147
+
148
+ <h2><?php echo __('Edit category', 'dbem') ?></h2>
149
+
150
+ <?php if($message != "") : ?>
151
+ <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
152
+ <p><?php echo $message ?></p>
153
+ </div>
154
+ <?php endif; ?>
155
+
156
+ <div id='ajax-response'></div>
157
+
158
+ <form name='editcat' id='editcat' method='post' action='admin.php?page=events-manager-categories' class='validate'>
159
+ <input type='hidden' name='action' value='edit' />
160
+ <input type='hidden' name='category_ID' value='<?php echo $category['category_id'] ?>'/>
161
+
162
+ <table class='form-table'>
163
+ <tr class='form-field form-required'>
164
+ <th scope='row' valign='top'><label for='category_name'><?php echo __('Category name', 'dbem') ?></label></th>
165
+ <td><input name='category_name' id='category-name' type='text' value='<?php echo $category['category_name'] ?>' size='40' /><br />
166
+ <?php echo __('The name of the category', 'dbem') ?></td>
167
+ </tr>
168
+ </table>
169
+ <p class='submit'><input type='submit' class='button-primary' name='submit' value='<?php echo __('Update category', 'dbem') ?>' /></p>
170
+ </form>
171
+ </div>
172
+ <?php
173
+ }
174
+ ?>
admin/event.php ADDED
@@ -0,0 +1,564 @@
1
+ <?php
2
+ function dbem_new_event_page() {
3
+ global $EM_Event;
4
+ $title = __ ( "Insert New Event", 'dbem' );
5
+ $EM_Event = new EM_Event(); //Empty event
6
+ dbem_event_form ( $title );
7
+ }
8
+
9
+ /**
10
+ * Generates Event Admin page, for adding and updating a single (or recurring) event.
11
+ * @param $title
12
+ * @return null
13
+ */
14
+ function dbem_event_form( $title ) {
15
+ global $EM_Event;
16
+ global $localised_date_formats;
17
+ $use_select_for_locations = get_option('dbem_use_select_for_locations');
18
+ // change prefix according to event/recurrence
19
+ $pref = "event_";
20
+ $form_destination = "edit.php?page=events-manager/events-manager.php&amp;action=update_event&amp;event_id=" . $EM_Event->id;
21
+
22
+ $locale_code = substr ( get_locale (), 0, 2 );
23
+ $localised_date_format = $localised_date_formats [$locale_code];
24
+
25
+ //FIXME time useage is very flimsy imho
26
+ $hours_locale_regexp = "H:i";
27
+ // Setting 12 hours format for those countries using it
28
+ if (preg_match ( "/en|sk|zh|us|uk/", $locale_code ))
29
+ $hours_locale_regexp = "h:iA";
30
+
31
+ $days_names = array (1 => __ ( 'Mon' ), 2 => __ ( 'Tue' ), 3 => __ ( 'Wed' ), 4 => __ ( 'Thu' ), 5 => __ ( 'Fri' ), 6 => __ ( 'Sat' ), 7 => __ ( 'Sun' ) );
32
+ ?>
33
+ <form id="eventForm" method="post" action="<?php echo $form_destination; ?>">
34
+ <div class="wrap">
35
+ <div id="icon-events" class="icon32"><br /></div>
36
+ <h2><?php echo $title; ?></h2>
37
+ <?php if ( $EM_Event->is_recurrence() || $EM_Event->is_recurring() ) : ?>
38
+ <p id='recurrence_warning'>
39
+ <?php
40
+ //TODO better warning system when changing a recurring event (e.g. when removing recurrences).
41
+ if ( $EM_Event->is_recurring() ) {
42
+ _e ( 'WARNING: This is a recurring event.', 'dbem' );
43
+ echo "<br />";
44
+ _e ( 'Modifying these data all the events linked to this recurrence will be rescheduled', 'dbem' );
45
+ echo " ";
46
+ _e ( 'and all booking information will be deleted!', 'dbem' );
47
+ } elseif ( $EM_Event->is_recurrence() ) {
48
+ //TODO Terminology confusing with methods, maybe worth changing?
49
+ _e ( 'WARNING: This is a recurrence.', 'dbem' );
50
+ echo "<br />";
51
+ _e ( 'If you change these data and save, this will become an independent event.', 'dbem' );
52
+ }
53
+ ?>
54
+ </p>
55
+ <?php endif; ?>
56
+ <div id="poststuff" class="metabox-holder has-right-sidebar">
57
+ <!-- SIDEBAR -->
58
+ <div id="side-info-column" class='inner-sidebar'>
59
+ <div id='side-sortables'>
60
+ <?php if(get_option('dbem_recurrence_enabled')) : ?>
61
+ <!-- START recurrence postbox -->
62
+ <div class="postbox ">
63
+ <div class="handlediv" title="Fare clic per cambiare."><br />
64
+ </div>
65
+ <h3 class='hndle'><span>
66
+ <?php _e ( "Recurrence", 'dbem' ); ?>
67
+ </span></h3>
68
+ <div class="inside">
69
+ <?php //TODO add js warning if rescheduling, since all bookings are deleted ?>
70
+ <?php if ( !$EM_Event->id || $EM_Event->is_recurring() ) : ?>
71
+ <p>
72
+ <input id="event-recurrence" type="checkbox" name="repeated_event" value="1" <?php echo ( $EM_Event->is_recurring() ) ? 'checked="checked"':'' ; ?> />
73
+ <?php _e ( 'Repeated event', 'dbem' ); ?>
74
+ </p>
75
+ <div id="event_recurrence_pattern">
76
+ <p>
77
+ Frequency:
78
+ <select id="recurrence-frequency" name="recurrence_freq">
79
+ <?php
80
+ $freq_options = array ("daily" => __ ( 'Daily', 'dbem' ), "weekly" => __ ( 'Weekly', 'dbem' ), "monthly" => __ ( 'Monthly', 'dbem' ) );
81
+ dbem_option_items ( $freq_options, $EM_Event->freq );
82
+ ?>
83
+ </select>
84
+ </p>
85
+ <p>
86
+ <?php _e ( 'Every', 'dbem' )?>
87
+ <input id="recurrence-interval" name='recurrence_interval' size='2' value='<?php echo $EM_Event->interval ; ?>' />
88
+ <span class='interval-desc' id="interval-daily-singular">
89
+ <?php _e ( 'day', 'dbem' )?>
90
+ </span> <span class='interval-desc' id="interval-daily-plural">
91
+ <?php _e ( 'days', 'dbem' ) ?>
92
+ </span> <span class='interval-desc' id="interval-weekly-singular">
93
+ <?php _e ( 'week', 'dbem' )?>
94
+ </span> <span class='interval-desc' id="interval-weekly-plural">
95
+ <?php _e ( 'weeks', 'dbem' )?>
96
+ </span> <span class='interval-desc' id="interval-monthly-singular">
97
+ <?php _e ( 'month', 'dbem' )?>
98
+ </span> <span class='interval-desc' id="interval-monthly-plural">
99
+ <?php _e ( 'months', 'dbem' )?>
100
+ </span>
101
+ </p>
102
+ <p class="alternate-selector" id="weekly-selector">
103
+ <?php
104
+ $saved_bydays = ($EM_Event->is_recurring()) ? explode ( ",", $EM_Event->byday ) : array();
105
+ dbem_checkbox_items ( 'recurrence_bydays[]', $days_names, $saved_bydays );
106
+ ?>
107
+ </p>
108
+ <p class="alternate-selector" id="monthly-selector">
109
+ <?php _e ( 'Every', 'dbem' )?>
110
+ <select id="monthly-modifier" name="recurrence_byweekno">
111
+ <?php
112
+ $weekno_options = array ("1" => __ ( 'first', 'dbem' ), '2' => __ ( 'second', 'dbem' ), '3' => __ ( 'third', 'dbem' ), '4' => __ ( 'fourth', 'dbem' ), '-1' => __ ( 'last', 'dbem' ) );
113
+ dbem_option_items ( $weekno_options, $EM_Event->byweekno );
114
+ ?>
115
+ </select>
116
+ <select id="recurrence-weekday" name="recurrence_byday">
117
+ <?php dbem_option_items ( $days_names, $EM_Event->byday ); ?>
118
+ </select>
119
+ &nbsp;
120
+ </p>
121
+ </div>
122
+ <p id="recurrence-tip">
123
+ <?php _e ( 'Check if your event happens more than once according to a regular pattern', 'dbem' )?>
124
+ </p>
125
+ <?php elseif( $EM_Event->is_recurrence() ) : ?>
126
+ <p>
127
+ <?php echo $EM_Event->get_recurrence_description(); ?>
128
+ <br />
129
+ <a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_event&amp;event_id=<?php echo $EM_Event->recurrence_id; ?>">
130
+ <?php _e ( 'Reschedule', 'dbem' ); ?>
131
+ </a>
132
+ <input type="hidden" name="recurrence_id" value="<?php echo $EM_Event->recurrence_id; ?>" />
133
+ </p>
134
+ <?php else : ?>
135
+ <p><?php _e ( 'This is\'t a recurrent event', 'dbem' ) ?></p>
136
+ <?php endif; ?>
137
+ </div>
138
+ </div>
139
+ <!-- END recurrence postbox -->
140
+ <?php endif; ?>
141
+ <?php if(get_option('dbem_rsvp_enabled')) : ?>
142
+ <!-- START RSVP -->
143
+ <div class="postbox ">
144
+ <div class="handlediv" title="Fare clic per cambiare."><br />
145
+ </div>
146
+ <h3 class='hndle'><span>
147
+ <?php _e ( 'Contact Person', 'dbem' ); ?>
148
+ </span></h3>
149
+ <div class="inside">
150
+ <p><?php _e('Contact','dbem'); ?>
151
+ <?php wp_dropdown_users ( array ('name' => 'event_contactperson_id', 'show_option_none' => __ ( "Select...", 'dbem' ), 'selected' => $EM_Event->contactperson_id ) ); ?>
152
+ </p>
153
+ </div>
154
+ </div>
155
+ <div class="postbox ">
156
+ <div class="handlediv" title="Fare clic per cambiare."><br />
157
+ </div>
158
+ <h3 class='hndle'><span><?php _e('RSVP','dbem'); ?></span></h3>
159
+ <div class="inside">
160
+ <p>
161
+ <input id="rsvp-checkbox" name='event_rsvp' value='1' type='checkbox' <?php echo ($EM_Event->rsvp) ? 'checked="checked"' : ''; ?> />
162
+ <?php _e ( 'Enable registration for this event', 'dbem' )?>
163
+ </p>
164
+ <div id='rsvp-data'>
165
+ <?php
166
+ if ($EM_Event->contactperson_id != NULL){
167
+ $selected = $EM_Event->contactperson_id;
168
+ }else{
169
+ $selected = '0';
170
+ }
171
+ ?>
172
+ <p>
173
+ <?php _e ( 'Spaces','dbem' ); ?> :
174
+ <input id="seats-input" type="text" name="event_seats" size='5' value="<?php echo $EM_Event->seats ?>" />
175
+ </p>
176
+ <!-- START RSVP Stats -->
177
+ <?php
178
+ if ($EM_Event->rsvp ) {
179
+ $EM_Event->get_bookings(); //Load bookings since we'll display this info later.
180
+ $available_seats = $EM_Event->bookings->get_available_seats();
181
+ $booked_seats = $EM_Event->bookings->get_booked_seats();
182
+
183
+ if ( count($EM_Event->bookings->bookings) > 0 ) {
184
+ ?>
185
+ <div class='wrap'>
186
+ <h4><?php echo $booked_seats ?> <?php echo __('responses so far') ?></h4>
187
+
188
+ <table id='dbem-bookings-table-<?php echo $EM_Event->id ?>' class='widefat post fixed'>
189
+ <thead>
190
+ <tr>
191
+ <th class='manage-column column-cb check-column' scope='col'>&nbsp;</th>
192
+ <th class='manage-column ' scope='col'><?php _e('Responder', 'dbem') ?></th>
193
+ <th scope='col'><?php _e('Spaces', 'dbem') ?></th>
194
+ </tr>
195
+ </thead>
196
+ <tfoot>
197
+ <tr>
198
+ <th scope='row' colspan='2'><?php _e('Booked spaces','dbem') ?>:</th><td class='booking-result' id='booked-seats'><?php echo $booked_seats ?></td></tr>
199
+ <tr><th scope='row' colspan='2'><?php _e('Available spaces','dbem') ?>:</th><td class='booking-result' id='available-seats'><?php echo $available_seats ?></td>
200
+ </tr>
201
+ </tfoot>
202
+ <tbody>
203
+ <?php
204
+ foreach ($EM_Event->bookings->bookings as $EM_Booking) {
205
+ ?>
206
+ <tr id='booking-<?php echo $EM_Booking->id ?>'>
207
+ <td>
208
+ <?php if($EM_Booking->comment) : ?>
209
+ <img src='../wp-content/plugins/events-manager/includes/images/baloon.png' title='<?php _e('Comment:','dbem'); ?> <?php echo $EM_Booking->comment ?>' alt='comment'/>
210
+ <?php endif; ?>
211
+ <a id='booking-check-<?php echo $EM_Booking->id ?>' class='bookingdelbutton'>X</a>
212
+ </td>
213
+ <td><a title='<?php echo $EM_Booking->person->email ?> - <?php echo $EM_Booking->person->phone ?>'><?php echo $EM_Booking->person->name ?></a></td>
214
+ <td><?php echo $EM_Booking->seats ?></td>
215
+ </tr>
216
+ <?php
217
+ }
218
+ ?>
219
+ </tbody>
220
+ </table>
221
+ </div>
222
+
223
+ <br class='clear'/>
224
+
225
+ <div id='major-publishing-actions'>
226
+ <div id='publishing-action'>
227
+ <a id='printable' target='_blank' href='<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=people&action=printable&event_id=".$EM_Event->id ?>'><?php _e('Printable view','dbem')?></a>
228
+ <br class='clear'/>
229
+ </div>
230
+ <br class='clear'/>
231
+ </div>
232
+ <?php
233
+ } else {
234
+ ?>
235
+ <p><em><?php _e('No responses yet!')?></em></p>
236
+ <?php
237
+ }
238
+ }
239
+ ?>
240
+ <!-- END RSVP Stats -->
241
+ </div>
242
+ </div>
243
+ </div>
244
+ <!-- END RSVP -->
245
+ <?php endif; ?>
246
+ <?php if(get_option('dbem_categories_enabled')) :?>
247
+ <!-- START Categories -->
248
+ <div class="postbox ">
249
+ <div class="handlediv" title="Fare clic per cambiare."><br />
250
+ </div>
251
+ <h3 class='hndle'><span>
252
+ <?php _e ( 'Category', 'dbem' ); ?>
253
+ </span></h3>
254
+ <div class="inside">
255
+ <p><?php _e ( 'Category:', 'dbem' ); ?>
256
+ <select name="event_category_id">
257
+ <?php
258
+ $categories = EM_Category::get();
259
+ foreach ( $categories as $category ){
260
+ $selected = ($category['category_id'] == $EM_Event->category_id) ? "selected='selected'": '';
261
+ ?>
262
+ <option value="<?php echo $category['category_id'] ?>" <?php echo $selected ?>>
263
+ <?php echo $category['category_name'] ?>
264
+ </option>
265
+ <?php
266
+ } ?>
267
+ </select>
268
+ </p>
269
+ </div>
270
+ </div>
271
+ <!-- END Categories -->
272
+ <?php endif; ?>
273
+ </div>
274
+ </div>
275
+ <!-- END OF SIDEBAR -->
276
+ <div id="post-body">
277
+ <div id="post-body-content">
278
+ <div id="event_name" class="stuffbox">
279
+ <h3>
280
+ <?php _e ( 'Name', 'dbem' ); ?>
281
+ </h3>
282
+ <div class="inside">
283
+ <input type="text" name="event_name" value="<?php echo htmlspecialchars($EM_Event->name,ENT_QUOTES); ?>" />
284
+ <br />
285
+ <?php _e ( 'The event name. Example: Birthday party', 'dbem' )?>
286
+ </div>
287
+ </div>
288
+ <div id="event_start_date" class="stuffbox">
289
+ <h3 id='event-date-title'>
290
+ <?php _e ( 'Event date', 'dbem' ); ?>
291
+ </h3>
292
+ <h3 id='recurrence-dates-title'>
293
+ <?php _e ( 'Recurrence dates', 'dbem' ); ?>
294
+ </h3>
295
+ <div class="inside">
296
+ <input id="localised-date" type="text" name="localised_event_date" style="display: none;" />
297
+ <input id="date-to-submit" type="text" name="event_start_date" value="<?php echo $EM_Event->start_date ?>" style="background: #FCFFAA" />
298
+ <input id="localised-end-date" type="text" name="localised_event_end_date" style="display: none;" />
299
+ <input id="end-date-to-submit" type="text" name="event_end_date" value="<?php echo $EM_Event->end_date ?>" style="background: #FCFFAA" />
300
+ <br />
301
+ <span id='event-date-explanation'>
302
+ <?php
303
+ _e ( 'The event date.', 'dbem' );
304
+ /* Marcus Begin Edit */
305
+ echo " ";
306
+ _e ( 'When not reoccurring, this event spans between the beginning and end date.', 'dbem' );
307
+ /* Marcus End Edit */
308
+ ?>
309
+ </span>
310
+ <span id='recurrence-dates-explanation'>
311
+ <?php _e ( 'The recurrence beginning and end date.', 'dbem' ); ?>
312
+ </span>
313
+ </div>
314
+ </div>
315
+ <div id="event_end_day" class="stuffbox">
316
+ <h3>
317
+ <?php _e ( 'Event time', 'dbem' ); ?>
318
+ </h3>
319
+ <div class="inside">
320
+ <input id="start-time" type="text" size="8" maxlength="8" name="event_start_time" value="<?php echo date( $hours_locale_regexp, strtotime($EM_Event->start_time) ); ?>" />
321
+ -
322
+ <input id="end-time" type="text" size="8" maxlength="8" name="event_end_time" value="<?php echo date( $hours_locale_regexp, strtotime($EM_Event->end_time) ); ?>" />
323
+ <br />
324
+ <?php _e ( 'The time of the event beginning and end', 'dbem' )?>.
325
+ </div>
326
+ </div>
327
+ <div id="location_coordinates" class="stuffbox" style='display: none;'>
328
+ <h3>
329
+ <?php _e ( 'Coordinates', 'dbem' ); ?>
330
+ </h3>
331
+ <div class="inside">
332
+ <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $EM_Event->latitude; ?>' size='15' />
333
+ -
334
+ <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $EM_Event->longitude; ?>' size='15' />
335
+ </div>
336
+ </div>
337
+ <div id="location_info" class="stuffbox">
338
+ <h3>
339
+ <?php _e ( 'Location', 'dbem' ); ?>
340
+ </h3>
341
+ <div class="inside">
342
+ <table id="dbem-location-data">
343
+ <tr>
344
+ <td style="padding-right:20px">
345
+ <table>
346
+ <?php if($use_select_for_locations) : ?>
347
+ <tr>
348
+ <th><?php _e('Location:','dbem') ?></th>
349
+ <td>
350
+ <select name="location-select-id" id='location-select-id' size="1">
351
+ <?php
352
+ $locations = EM_Locations::get();
353
+ foreach($locations as $location) {
354
+ $selected = "";
355
+ if( is_object($EM_Event->location) ) {
356
+ if ($EM_Event->location->id == $location->id)
357
+ $selected = "selected='selected' ";
358
+ }
359
+ ?>
360
+ <option value="<?php echo $location->id ?>" title="<?php echo "{$location->latitude},{$location->longitude}" ?>" <?php echo $selected ?>><?php echo $location->name; ?></option>
361
+ <?php
362
+ }
363
+ ?>
364
+ </select>
365
+ <p><?php _e ( 'The name of the location where the event takes place. You can use the name of a venue, a square, etc', 'dbem' )?></p>
366
+ </td>
367
+ </tr>
368
+ <?php else : ?>
369
+ <tr>
370
+ <th><?php _e ( 'Name:' )?></th>
371
+ <td>
372
+ <input id="location-name" type="text" name="location_name" value="<?php echo htmlspecialchars($EM_Event->location->name, ENT_QUOTES); ?>" />
373
+ <p><?php _e ( 'Select a location for your event', 'dbem' )?></p>
374
+ </td>
375
+ </tr>
376
+ <tr>
377
+ <th><?php _e ( 'Address:' )?>&nbsp;</th>
378
+ <td>
379
+ <input id="location-address" type="text" name="location_address" value="<?php echo htmlspecialchars($EM_Event->location->address, ENT_QUOTES); ; ?>" />
380
+ <p><?php _e ( 'The address of the location where the event takes place. Example: 21, Dominick Street', 'dbem' )?></p>
381
+ </td>
382
+ </tr>
383
+ <tr>
384
+ <th><?php _e ( 'Town:' )?>&nbsp;</th>
385
+ <td>
386
+ <input id="location-town" type="text" name="location_town" value="<?php echo htmlspecialchars($EM_Event->location->town, ENT_QUOTES); ?>" />
387
+ <p><?php _e ( 'The town where the location is located. If you\'re using the Google Map integration and want to avoid geotagging ambiguities include the country in the town field. Example: Verona, Italy.', 'dbem' )?></p>
388
+ </td>
389
+ </tr>
390
+ <?php endif; ?>
391
+ </table>
392
+ </td>
393
+ <?php if ( get_option ( 'dbem_gmap_is_active' ) ) : ?>
394
+ <td width="400">
395
+ <div id='em-map-404' style='width: 400px; vertical-align:middle; text-align: center;'>
396
+ <p><em><?php _e ( 'Location not found', 'dbem' ); ?></em></p>
397
+ </div>
398
+ <div id='em-map' style='width: 400px; height: 300px; display: none;'></div>
399
+ </td>
400
+ <?php endif; ?>
401
+ </tr>
402
+ </table>
403
+ </div>
404
+ </div>
405
+ <div id="event_notes" class="postbox">
406
+ <h3>
407
+ <?php _e ( 'Details', 'dbem' ); ?>
408
+ </h3>
409
+ <div class="inside">
410
+ <div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
411
+ <?php the_editor($EM_Event->notes ); ?>
412
+ </div>
413
+ <br />
414
+ <?php _e ( 'Details about the event', 'dbem' )?>
415
+ </div>
416
+ </div>
417
+
418
+ <?php if(get_option('dbem_attributes_enabled')) : ?>
419
+ <div id="event_attributes" class="postbox">
420
+ <h3>
421
+ <?php _e ( 'Attributes', 'dbem' ); ?>
422
+ </h3>
423
+ <div class="inside">
424
+ <?php
425
+ //We also get a list of attribute names and create a ddm list (since placeholders are fixed)
426
+ $formats =
427
+ get_option ( 'dbem_event_list_item_format' ).
428
+ get_option ( 'dbem_event_page_title_format' ).
429
+ get_option ( 'dbem_full_calendar_event_format' ).
430
+ get_option ( 'dbem_location_baloon_format' ).
431
+ get_option ( 'dbem_location_event_list_item_format' ).
432
+ get_option ( 'dbem_location_page_title_format' ).
433
+ get_option ( 'dbem_map_text_format' ).
434
+ get_option ( 'dbem_rss_description_format' ).
435
+ get_option ( 'dbem_rss_title_format' ).
436
+ get_option ( 'dbem_single_event_format' ).
437
+ get_option ( 'dbem_single_location_format' );
438
+ //We now have one long string of formats, get all the attribute placeholders
439
+ preg_match_all('/#_ATT\{.+?\}(\{.+?\})?/', $formats, $placeholders);
440
+ //Now grab all the unique attributes we can use in our event.
441
+ $attributes = array();
442
+ foreach($placeholders[0] as $result) {
443
+ $attribute = substr( substr($result, 0, strpos($result, '}')), 6 );
444
+ if( !in_array($attribute, $attributes) ){
445
+ $attributes[] = $attribute ;
446
+ }
447
+ }
448
+ ?>
449
+ <div class="wrap">
450
+ <?php if( count( $attributes ) > 0 ) : ?>
451
+ <h2>Attributes</h2>
452
+ <p>Add attributes here</p>
453
+ <table class="form-table">
454
+ <thead>
455
+ <tr valign="top">
456
+ <td><strong>Attribute Name</strong></td>
457
+ <td><strong>Value</strong></td>
458
+ </tr>
459
+ </thead>
460
+ <tfoot>
461
+ <tr valign="top">
462
+ <td colspan="3"><a href="#" id="mtm_add_tag">Add new tag</a></td>
463
+ </tr>
464
+ </tfoot>
465
+ <tbody id="mtm_body">
466
+ <?php
467
+ $count = 1;
468
+ if( is_array($EM_Event->attributes) and count($EM_Event->attributes) > 0){
469
+ foreach( $EM_Event->attributes as $name => $value){
470
+ ?>
471
+ <tr valign="top" id="mtm_<?php echo $count ?>">
472
+ <td scope="row">
473
+ <select name="mtm_<?php echo $count ?>_ref">
474
+ <?php
475
+ if( !in_array($name, $attributes) ){
476
+ echo "<option value='$name'>$name (".__('Not defined in templates', 'dbem').")</option>";
477
+ }
478
+ foreach( $attributes as $attribute ){
479
+ if( $attribute == $name ) {
480
+ echo "<option selected='selected'>$attribute</option>";
481
+ }else{
482
+ echo "<option>$attribute</option>";
483
+ }
484
+ }
485
+ ?>
486
+ </select>
487
+ <a href="#" rel="<?php echo $count ?>">Remove</a>
488
+ </td>
489
+ <td>
490
+ <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" />
491
+ </td>
492
+ </tr>
493
+ <?php
494
+ $count++;
495
+ }
496
+ }else{
497
+ ?>
498
+ <tr valign="top" id="mtm_<?php echo $count ?>">
499
+ <td scope="row">
500
+ <select name="mtm_<?php echo $count ?>_ref">
501
+ <?php
502
+ foreach( $attributes as $attribute ){
503
+ echo "<option>$attribute</option>";
504
+ }
505
+ ?>
506
+ </select>
507
+ <a href="#" rel="<?php echo $count ?>">Remove</a>
508
+ </td>
509
+ <td>
510
+ <input type="text" name="mtm_<?php echo $count ?>_name" value="<?php echo htmlspecialchars($value, ENT_QUOTES); ?>" />
511
+ </td>
512
+ </tr>
513
+ <?php
514
+ }
515
+ ?>
516
+ </tbody>
517
+ </table>
518
+ <?php else : ?>
519
+ <p>
520
+ <?php _e('In order to use attributes, you must define some in your templates, otherwise they\'ll never show. Go to Events > Settings to add attribute placeholders.', 'dbem'); ?>
521
+ </p>
522
+ <script>
523
+ jQuery(document).ready(function($){ $('#event_attributes').addClass('closed'); });
524
+ </script>
525
+ <?php endif; ?>
526
+ </div>
527
+ </div>
528
+ </div>
529
+ <?php endif; ?>
530
+ </div>
531
+ <p class="submit">
532
+ <input type="submit" name="events_update" value="<?php _e ( 'Submit Event', 'dbem' ); ?> &raquo;" />
533
+ </p>
534
+ </div>
535
+ </div>
536
+ </div>
537
+ </form>
538
+ <script type="text/javascript">
539
+ jQuery(document).ready( function($) {
540
+ <?php if( $EM_Event->is_recurring() ): ?>
541
+ //Recurrence Warnings
542
+ $('#eventForm').submit( function(event){
543
+ confirmation = confirm('<?php _e('Are you sure you want to reschedule this recurring event? If you do this, you will lose all booking information and the old recurring events will be deleted.', 'dbem'); ?>');
544
+ if( confirmation == false ){
545
+ event.preventDefault();
546
+ }
547
+ });
548
+ <?php endif; ?>
549
+ <?php if( $EM_Event->rsvp == 1 ): ?>
550
+ //RSVP Warning
551
+ $('#rsvp-checkbox').click( function(event){
552
+ if( !this.checked ){
553
+ confirmation = confirm('<?php _e('Are you sure you want to disable bookings? If you do this and save, you will lose all previous bookings. If you wish to prevent further bookings, reduce the number of seats available to the amount of bookings you currently have', 'dbem'); ?>');
554
+ if( confirmation == false ){
555
+ event.preventDefault();
556
+ }
557
+ }
558
+ });
559
+ <?php endif; ?>
560
+ });
561
+ </script>
562
+ <?php
563
+ }
564
+ ?>
admin/events.php ADDED
@@ -0,0 +1,286 @@
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 dbem_events_subpanel() {
8
+ //TODO Simplify panel for events, use form flags to detect certain actions (e.g. submitted, etc)
9
+ global $wpdb;
10
+ global $EM_Event;
11
+ $action = $_GET ['action'];
12
+ $action2 = $_GET ['action2'];
13
+ $event_ID = $_GET ['event_id'];
14
+ $recurrence_ID = $_GET ['recurrence_id'];
15
+ $scope = ($_GET ['scope'] != '') ? $_GET['scope']:'future';
16
+ $order = $_GET ['order']; //FIXME order not used consistently in admin area
17
+ $selectedEvents = $_GET ['events'];
18
+
19
+ if ($order == ""){
20
+ $order = "ASC";
21
+ }
22
+ $event_table_name = $wpdb->prefix . EVENTS_TBNAME;
23
+
24
+ // DELETE action
25
+ if ($action == 'deleteEvents') {
26
+ EM_Events::delete( $selectedEvents );
27
+ dbem_events_table ( EM_Events::get( array('scope'=>$scope) ), "Future events" );
28
+ }
29
+ // UPDATE or CREATE action
30
+ if ($action == 'update_event') {
31
+
32
+ if( !is_object($EM_Event) ){
33
+ $EM_Event = new EM_Event();
34
+ }
35
+ $validation = $EM_Event->get_post();
36
+ $title = ($EM_Event->is_recurring()) ? __( "Reschedule", 'dbem' )." '{$EM_Event->name}'" : "Edit event {$EM_Event->name}" ;
37
+ if ( $validation ) { //EM_Event gets the event if submitted via POST and validates it (safer than to depend on JS)
38
+ //Save
39
+ if( $EM_Event->save() ) {
40
+ ?>
41
+ <div id='message' class='updated fade'>
42
+ <p><?php echo $EM_Event->feedback_message ?></p>
43
+ </div>
44
+ <?php
45
+ dbem_events_table ( EM_Events::get( array('scope'=>$scope) ), "Future events" );
46
+ }else{
47
+ // saving unsuccessful
48
+ ?>
49
+ <div id='message' class='error '>
50
+ <p>
51
+ <?php echo "<strong>" . __( "Ach, there's a problem here:", "dbem" ) . "</strong><br /><br />" .implode('<br />', $EM_Event->errors); ?>
52
+ </p>
53
+ </div>
54
+ <?php
55
+ dbem_event_form ( $title );
56
+ }
57
+ } else {
58
+ // validation unsuccessful
59
+ ?>
60
+ <div id='message' class='error '>
61
+ <p><?php echo "<strong>" . __( "Ach, there's a problem here:", "dbem" ) . "</strong><br /><br />" . implode('<br />', $EM_Event->errors); ?></p>
62
+ </div>
63
+ <?php
64
+ dbem_event_form ( $title );
65
+ }
66
+ }
67
+
68
+ //Add or Edit Events
69
+ if ($action == 'edit_event') {
70
+ if( !is_object($EM_Event) ){
71
+ $EM_Event = new EM_Event();
72
+ $title = __ ( "Insert New Event", 'dbem' );
73
+ } else {
74
+ $title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
75
+ }
76
+ //Generate Event Form
77
+ dbem_event_form ( $title );
78
+ }
79
+
80
+ //Copy the event
81
+ if ($action == 'duplicate_event') {
82
+ global $EZSQL_ERROR;
83
+ if( $EM_Event->duplicate() ){
84
+ //Now we edit the duplicated item
85
+ $title = __ ( "Edit Event", 'dbem' ) . " '" . $EM_Event->name . "'";
86
+ echo "<div id='message' class='updated below-h2'>You are now editing the duplicated event.</div>";
87
+ dbem_event_form ( $title );
88
+ }else{
89
+ echo "<div class='error'><p>There was an error duplicating the event. Try again maybe?</div>";
90
+ dbem_events_table ( EM_Events::get(array('scope'=>$scope)), $title );
91
+ }
92
+ }
93
+
94
+ if ($action == "-1" || $action == "") {
95
+ // No action, only showing the events list
96
+ switch ($scope) {
97
+ case "past" :
98
+ $title = __ ( 'Past Events', 'dbem' );
99
+ break;
100
+ case "all" :
101
+ $title = __ ( 'All Events', 'dbem' );
102
+ break;
103
+ default :
104
+ $title = __ ( 'Future Events', 'dbem' );
105
+ $scope = "future";
106
+ }
107
+ $events = EM_Events::get( array('scope'=>$scope, 'order'=>$order ) );
108
+ dbem_events_table ( $events, $title );
109
+ }
110
+ }
111
+
112
+ function dbem_events_table($events, $title) {
113
+ $offset = ($_GET ['offset'] == '') ? 0 : $_GET ['offset'];
114
+ $limit = ($_GET ['limit'] > 0) ? $_GET['limit'] : 20;//Default limit
115
+ $scope_names = array (
116
+ 'past' => __ ( 'Past events', 'dbem' ),
117
+ 'all' => __ ( 'All events', 'dbem' ),
118
+ 'future' => __ ( 'Future events', 'dbem' )
119
+ );
120
+ $scope = ( array_key_exists( $_GET ['scope'], $scope_names) ) ? $_GET ['scope']:'future';
121
+ $events_count = count ( $events );
122
+
123
+ if (isset ( $_GET ['offset'] ))
124
+ $offset = $_GET ['offset'];
125
+
126
+ $use_events_end = get_option ( 'dbem_use_event_end' );
127
+ ?>
128
+ <div class="wrap">
129
+ <div id="icon-events" class="icon32"><br />
130
+ </div>
131
+ <h2><?php echo $title; ?></h2>
132
+ <?php
133
+ em_hello_to_new_user ();
134
+
135
+ $link = array ();
136
+ $link ['past'] = "<a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=past&amp;order=desc'>" . __ ( 'Past events', 'dbem' ) . "</a>";
137
+ $link ['all'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=all&amp;order=desc'>" . __ ( 'All events', 'dbem' ) . "</a>";
138
+ $link ['future'] = " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;scope=future'>" . __ ( 'Future events', 'dbem' ) . "</a>";
139
+ ?>
140
+
141
+ <form id="posts-filter" action="" method="get"><input type='hidden' name='page' value='events-manager/events-manager.php' />
142
+ <ul class="subsubsub">
143
+ <li><a href='edit.php' class="current"><?php _e ( 'Total', 'dbem' ); ?> <span
144
+ class="count">(<?php echo (count ( $events )); ?>)</span></a></li>
145
+ </ul>
146
+
147
+ <div class="tablenav">
148
+
149
+ <div class="alignleft actions">
150
+ <select name="action">
151
+ <option value="-1" selected="selected"><?php _e ( 'Bulk Actions' ); ?></option>
152
+ <option value="deleteEvents"><?php _e ( 'Delete selected','dbem' ); ?></option>
153
+ </select>
154
+ <input type="submit" value="<?php _e ( 'Apply' ); ?>" name="doaction2" id="doaction2" class="button-secondary action" />
155
+ <select name="scope">
156
+ <?php
157
+ foreach ( $scope_names as $key => $value ) {
158
+ $selected = "";
159
+ if ($key == $scope)
160
+ $selected = "selected='selected'";
161
+ echo "<option value='$key' $selected>$value</option> ";
162
+ }
163
+ ?>
164
+ </select>
165
+ <input id="post-query-submit" class="button-secondary" type="submit" value="<?php _e ( 'Filter' )?>" />
166
+ <?php
167
+ $events_nav = '';
168
+ $backward = ($offset - $limit < 0) ? 0 : $offset - $limit;
169
+ $forward = $offset + $limit;
170
+ if ($offset > 0)
171
+ $events_nav .= " <a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;limit=$limit&amp;scope=$scope&amp;offset=$backward'>&lt;&lt; ".__('Previous Page','dbem')."</a> ";
172
+ if ($events_count > $limit+$offset)
173
+ $events_nav .= "<a href='" . get_bloginfo ( 'wpurl' ) . "/wp-admin/edit.php?page=events-manager/events-manager.php&amp;limit=$limit&amp;scope=$scope&amp;offset=$forward'>".__('Next Page','dbem')." &gt;&gt;</a>";
174
+ echo $events_nav;
175
+ ?>
176
+ </div>
177
+ <div class="clear"></div>
178
+
179
+ <?php
180
+ if (empty ( $events )) {
181
+ // TODO localize
182
+ _e ( 'no events','dbem' );
183
+ } else {
184
+ ?>
185
+
186
+ <table class="widefat">
187
+ <thead>
188
+ <tr>
189
+ <th class='manage-column column-cb check-column' scope='col'>
190
+ <input class='select-all' type="checkbox" value='1' />
191
+ </th>
192
+ <th><?php _e ( 'Name', 'dbem' ); ?></th>
193
+ <th>&nbsp;</th>
194
+ <th><?php _e ( 'Location', 'dbem' ); ?></th>
195
+ <th colspan="2"><?php _e ( 'Date and time', 'dbem' ); ?></th>
196
+ </tr>
197
+ </thead>
198
+ <tbody>
199
+ <?php
200
+ $i = 1;
201
+ $rowno = 0;
202
+ foreach ( $events as $event ) {
203
+ if( $i >= $offset && $i <= $offset+$limit ) {
204
+ $rowno++;
205
+ $class = ($rowno % 2) ? ' class="alternate"' : '';
206
+ // FIXME set to american
207
+ $localised_start_date = mysql2date ( __ ( 'D d M Y' ), $event->start_date );
208
+ $localised_end_date = mysql2date ( __ ( 'D d M Y' ), $event->end_date );
209
+ $style = "";
210
+ $today = date ( "Y-m-d" );
211
+ $location_summary = "<b>" . $event->location->name . "</b><br/>" . $event->location->address . " - " . $event->location->town;
212
+ $category = EM_Category::get($event->id);
213
+
214
+ if ($event->start_date < $today && $event->end_date < $today){
215
+ $style = "style ='background-color: #FADDB7;'";
216
+ }
217
+ ?>
218
+ <tr <?php echo "$class $style"; ?>>
219
+
220
+ <td>
221
+ <input type='checkbox' class='row-selector' value='<?php echo $event->id; ?>' name='events[]' />
222
+ </td>
223
+ <td>
224
+ <strong>
225
+ <a class="row-title" href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_event&amp;event_id=<?php echo $event->id ?>"><?php echo ($event->name); ?></a>
226
+ </strong>
227
+ <?php if($category) : ?>
228
+ <br/><span title='<?php _e( 'Category', 'dbem' ).": ".$category['category_name'] ?>'><?php $category['category_name'] ?></span>
229
+ <?php endif; ?>
230
+ </td>
231
+ <td>
232
+ <a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=duplicate_event&amp;event_id=<?php echo $event->id; ?>" title="<?php _e ( 'Duplicate this event', 'dbem' ); ?>">
233
+ <strong>+</strong>
234
+ </a>
235
+ </td>
236
+ <td>
237
+ <?php echo $location_summary; ?>
238
+ </td>
239
+
240
+ <td>
241
+ <?php echo $localised_start_date; ?>
242
+ <?php echo ($localised_end_date != $localised_start_date) ? " - $localised_end_date":'' ?>
243
+ <br />
244
+ <?php
245
+ //TODO Should 00:00 - 00:00 be treated as an all day event?
246
+ echo substr ( $event->start_time, 0, 5 ) . " - " . substr ( $event->end_time, 0, 5 );
247
+ ?>
248
+ </td>
249
+ <td>
250
+ <?php
251
+ if ( $event->is_recurrence() ) {
252
+ ?>
253
+ <strong>
254
+ <?php echo $event->get_recurrence_description(); ?> <br />
255
+ <a href="<?php bloginfo ( 'wpurl' )?>/wp-admin/edit.php?page=events-manager/events-manager.php&amp;action=edit_event&amp;event_id=<?php echo $event->recurrence_id ?>"><?php _e ( 'Reschedule', 'dbem' ); ?></a>
256
+ </strong>
257
+ <?php
258
+ }
259
+ ?>
260
+ </td>
261
+ </tr>
262
+ <?php
263
+ }
264
+ $i ++;
265
+ }
266
+ ?>
267
+ </tbody>
268
+ </table>
269
+ <?php
270
+ } // end of table
271
+ ?>
272
+
273
+ <div class='tablenav'>
274
+ <div class="alignleft actions">
275
+ <?php echo $events_nav; ?>
276
+ <br class='clear' />
277
+ </div>
278
+ <br class='clear' />
279
+ </div>
280
+ </div>
281
+ </form>
282
+ </div>
283
+ <?php
284
+ }
285
+
286
+ ?>
admin/functions.php ADDED
@@ -0,0 +1,64 @@
1
+ <?php
2
+ /*Random Admin Functions*/
3
+
4
+ //This adds the tinymce editor
5
+ function dbem_tinymce(){
6
+ add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 );
7
+ wp_enqueue_script('post');
8
+ if ( user_can_richedit() )
9
+ wp_enqueue_script('editor');
10
+ add_thickbox();
11
+ wp_enqueue_script('media-upload');
12
+ wp_enqueue_script('word-count');
13
+ wp_enqueue_script('quicktags');
14
+ }
15
+ add_action ( 'admin_init', 'dbem_tinymce' );
16
+
17
+ // ADMIN CSS for debug
18
+ function dbem_admin_css() {
19
+ $css = "
20
+ <style type='text/css'>
21
+ .debug{
22
+ color: green;
23
+ background: #B7F98C;
24
+ margin: 15px;
25
+ padding: 10px;
26
+ border: 1px solid #629948;
27
+ }
28
+ .switch-tab {
29
+ background: #aaa;
30
+ width: 100px;
31
+ float: right;
32
+ text-align: center;
33
+ margin: 3px 1px 0 5px;
34
+ padding: 2px;
35
+ }
36
+ .switch-tab a {
37
+ color: #fff;
38
+ text-decoration: none;
39
+ }
40
+ .switch-tab a:hover {
41
+ color: #D54E21;
42
+
43
+ }
44
+ #events-pagination {
45
+ text-align: center;
46
+
47
+ }
48
+ #events-pagination a {
49
+ margin: 0 20px 0 20px;
50
+ text-decoration: none;
51
+ width: 80px;
52
+ padding: 3px 0;
53
+ background: #FAF4B7;
54
+ border: 1px solid #ccc;
55
+ border-top: none;
56
+ }
57
+ #new-event {
58
+ float: left;
59
+
60
+ }
61
+ </style>";
62
+ echo $css;
63
+ }
64
+ add_action ( 'admin_print_scripts', 'dbem_admin_css' );
admin/locations-search.php ADDED
@@ -0,0 +1,38 @@
1
+ <?php
2
+ /*
3
+ * This page will search for either a specific location via GET "id" variable
4
+ * or will search for events by name via the GET "q" variable.
5
+ */
6
+ require_once('../../../../wp-load.php');
7
+
8
+ global $wpdb;
9
+
10
+ $locations_table = $wpdb->prefix . LOCATIONS_TBNAME;
11
+
12
+ $term = (isset($_GET['term'])) ? '%'.$_GET['term'].'%' : '%'.$_GET['q'].'%';
13
+ $sql = $wpdb->prepare("
14
+ SELECT
15
+ Concat( location_name, ', ', location_address, ', ', location_town) AS `label`,
16
+ location_name AS `value`,
17
+ location_address AS `address`,
18
+ location_town AS `town`,
19
+ location_id AS `id`
20
+ FROM $locations_table
21
+ WHERE ( `location_name` LIKE %s ) LIMIT 10
22
+ ", $term);
23
+
24
+ $locations_array = $wpdb->get_results($sql);
25
+
26
+ echo EM_Object::json_encode($locations_array);
27
+ /*
28
+ $return_string_array = array();
29
+ foreach($locations_array as $location){
30
+ $return_string_class = array();
31
+ foreach($location as $key => $value ){
32
+ $return_string_class[] = "$key : '".addslashes($value)."'";
33
+ }
34
+ $return_string_array[] = '{'. implode(',', $return_string_class) .'}';
35
+ }
36
+ echo '['. implode(',', $return_string_array) .']';
37
+ */
38
+ ?>
admin/locations.php ADDED
@@ -0,0 +1,296 @@
1
+ <?php
2
+ function dbem_intercept_locations_actions() {
3
+ if(isset($_GET['page']) && $_GET['page'] == "locations") {
4
+ if(isset($_GET['doaction2']) && $_GET['doaction2'] == "Delete") {
5
+ if(isset($_GET['action2']) && $_GET['action2'] == "delete") {
6
+ $locations = $_GET['locations'];
7
+ foreach($locations as $location_id) {
8
+ dbem_delete_location($location_id);
9
+ }
10
+ }
11
+ }
12
+ }
13
+ }
14
+ add_action('init', 'dbem_intercept_locations_actions');
15
+
16
+ /**
17
+ * Looks at the request values, saves/updates and then displays the right menu in the admin
18
+ * @return null
19
+ */
20
+ function dbem_locations_page() {
21
+ //TODO EM_Location is globalized, use it fully here
22
+ global $EM_Location;
23
+ if(isset($_GET['action']) && $_GET['action'] == "edit") {
24
+ // edit location
25
+ dbem_admin_location();
26
+ } else {
27
+ if(isset($_POST['action']) && $_POST['action'] == "editedlocation") {
28
+ // location update required
29
+ $EM_Location->get_post();
30
+ $validation_result = $EM_Location->validate();
31
+ if ( $validation_result ) {
32
+ $EM_Location->save();
33
+ $message = __('The location has been updated.', 'dbem');
34
+ $locations = EM_Locations::get();
35
+ dbem_admin_locations($locations, null, $message);
36
+ } else {
37
+ $message = $validation_result;
38
+ dbem_admin_location($message);
39
+ }
40
+ } elseif(isset($_POST['action']) && $_POST['action'] == "addlocation") {
41
+ $EM_Location = new EM_Location();
42
+ $EM_Location->get_post();
43
+ $validation_result = $EM_Location->validate();
44
+ if ($validation_result) {
45
+ $EM_Location->save();
46
+ ?>
47
+ <div id='message' class='updated fade below-h2' style='background-color: rgb(255, 251, 204);'>
48
+ <p><?php _e('The location has been added.', 'dbem') ?></p>
49
+ </div>
50
+ <?php
51
+ $locations = EM_Locations::get();
52
+ dbem_admin_locations($locations, null);
53
+ } else {
54
+ ?>
55
+ <div id='message' class='error '>
56
+ <p>
57
+ <strong><?php _e( "Ach, there's a problem here:", "dbem" ) ?></strong><br /><br /><?php echo implode('<br />', $EM_Location->errors); ?>
58
+ </p>
59
+ </div>
60
+ <?php
61
+ $locations = EM_Locations::get();
62
+ dbem_admin_locations($locations, $EM_Location, $message);
63
+ }
64
+ } else {
65
+ // no action, just a locations list
66
+ $locations = EM_Locations::get();
67
+ dbem_admin_locations($locations, $message);
68
+ }
69
+ }
70
+ }
71
+
72
+ function dbem_admin_locations($locations, $new_location, $message = "") {
73
+ $destination = get_bloginfo('wpurl')."/wp-admin/admin.php";
74
+ $new_location = (get_class($new_location) == 'EM_Location') ? $new_location->to_array() : array();
75
+ ?>
76
+ <div class='wrap'>
77
+ <div id='icon-edit' class='icon32'>
78
+ <br/>
79
+ </div>
80
+ <h2><?php _e('Locations', 'dbem'); ?></h2>
81
+
82
+ <div id='col-container'>
83
+ <div id='col-right'>
84
+ <div class='col-wrap'>
85
+ <form id='bookings-filter' method='get' action='<?php echo $destination ?>'>
86
+ <input type='hidden' name='page' value='locations'/>
87
+ <input type='hidden' name='action' value='addlocation'/>
88
+
89
+ <?php if (count($locations)>0) : ?>
90
+ <table class='widefat'>
91
+ <thead>
92
+ <tr>
93
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
94
+ <th><?php echo __('Name', 'dbem') ?></th>
95
+ <th><?php echo __('Address', 'dbem') ?></th>
96
+ <th><?php echo __('Town', 'dbem') ?></th>
97
+ </tr>
98
+ </thead>
99
+ <tfoot>
100
+ <tr>
101
+ <th class='manage-column column-cb check-column' scope='col'><input type='checkbox' class='select-all' value='1'/></th>
102
+ <th><?php echo __('Name', 'dbem') ?></th>
103
+ <th><?php echo __('Address', 'dbem') ?></th>
104
+ <th><?php echo __('Town', 'dbem') ?></th>
105
+ </tr>
106
+ </tfoot>
107
+ <tbody>
108
+ <?php foreach ($locations as $location) : ?>
109
+ <tr>
110
+ <td><input type='checkbox' class ='row-selector' value='<?php echo $location->id ?>' name='locations[]'/></td>
111
+ <td><a href='<?php echo get_bloginfo('wpurl') ?>/wp-admin/admin.php?page=locations&amp;action=edit&amp;location_id=<?php echo $location->id ?>'><?php echo $location->name ?></a></td>
112
+ <td><?php echo $location->address ?></td>
113
+ <td><?php echo $location->location_town ?></td>
114
+ </tr>
115
+ <?php endforeach; ?>
116
+ </tbody>
117
+
118
+ </table>
119
+
120
+ <div class='tablenav'>
121
+ <div class='alignleft actions'>
122
+ <input type='hidden' name='action2' value='delete'/>
123
+ <input class='button-secondary action' type='submit' name='doaction2' value='Delete'/>
124
+ <br class='clear'/>
125
+ </div>
126
+ <br class='clear'/>
127
+ </div>
128
+ <?php else: ?>
129
+ <p><?php echo __('No venues have been inserted yet!', 'dbem') ?></p>
130
+ <?php endif; ?>
131
+ </form>
132
+ </div>
133
+ </div> <!-- end col-right -->
134
+
135
+ <div id='col-left'>
136
+ <div class='col-wrap'>
137
+ <div class='form-wrap'>
138
+ <div id='ajax-response'/>
139
+ <h3><?php echo __('Add location', 'dbem') ?></h3>
140
+ <form enctype='multipart/form-data' name='addlocation' id='locationForm' method='post' action='admin.php?page=locations' class='add:the-list: validate'>
141
+ <input type='hidden' name='action' value='addlocation' />
142
+ <div class='form-field form-required'>
143
+ <label for='location_name'><?php echo __('Location name', 'dbem') ?></label>
144
+ <input id='location-name' name='location_name' id='location_name' type='text' value='<?php echo $new_location['location_name'] ?>' size='40' />
145
+ <p><?php echo __('The name of the location', 'dbem') ?>.</p>
146
+ </div>
147
+
148
+ <div class='form-field'>
149
+ <label for='location_address'><?php echo __('Location address', 'dbem') ?></label>
150
+ <input id='location-address' name='location_address' id='location_address' type='text' value='<?php echo $new_location['location_address'] ?>' size='40' />
151
+ <p><?php echo __('The address of the location', 'dbem') ?>.</p>
152
+ </div>
153
+
154
+ <div class='form-field '>
155
+ <label for='location_town'><?php echo __('Location town', 'dbem') ?></label>
156
+ <input id='location-town' name='location_town' id='location_town' type='text' value='<?php echo $new_location['location_town'] ?>' size='40' />
157
+ <p><?php echo __('The town of the location', 'dbem') ?>.</p>
158
+ </div>
159
+
160
+ <div class='form-field' style='display:none;'>
161
+ <label for='location_latitude'>LAT</label>
162
+ <input id='location-latitude' name='location_latitude' type='text' value='<?php echo $new_location['location_latitude'] ?>' size='40' />
163
+ </div>
164
+ <div class='form-field' style='display:none;'>
165
+ <label for='location_longitude'>LONG</label>
166
+ <input id='location-longitude' name='location_longitude' type='text' value='<?php echo $new_location['location_longitude'] ?>' size='40' />
167
+ </div>
168
+
169
+ <?php if ( get_option('dbem_gmap_is_active') ) : ?>
170
+ <div class="events-map">
171
+ <div id='em-map-404' style='width: 450px; vertical-align:middle; text-align: center;'>
172
+ <p><em><?php _e ( 'Location not found', 'dbem' ); ?></em></p>
173
+ </div>
174
+ <div id='em-map' style='width: 450px; height: 350px; display: none;'></div>
175
+ <br style='clear:both;' />
176
+ </div>
177
+ <?php endif; ?>
178
+
179
+ <div class='form-field'>
180
+ <label for='location_image'><?php echo __('Location image', 'dbem') ?></label>
181
+ <input id='location-image' name='location_image' id='location_image' type='file' size='35' />
182
+ <p><?php echo __('Select an image to upload', 'dbem') ?>.</p>
183
+ </div>
184
+
185
+ <div id="poststuff">
186
+ <label for='location_description'><?php _e('Location description', 'dbem') ?></label>
187 <