function eme_categories_edit_layout($message = "") { $category_id = intval($_GET['category_id']); $category = eme_get_category($category_id); $layout = "\n <div class='wrap'>\n <div id='icon-edit' class='icon32'>\n <br />\n </div>\n \n <h1>" . __('Edit category', 'eme') . "</h1>"; if ($message != "") { $layout .= "\n <div id='message' class='updated fade below-h1' style='background-color: rgb(255, 251, 204);'>\n <p>{$message}</p>\n </div>"; } $layout .= "\n <div id='ajax-response'></div>\n\n <form name='edit_category' id='edit_category' method='post' action='" . admin_url("admin.php?page=eme-categories") . "' class='validate'>\n <input type='hidden' name='eme_admin_action' value='do_editcategory' />\n <input type='hidden' name='category_id' value='" . $category['category_id'] . "' />"; $layout .= "\n <table class='form-table'>\n <tr class='form-field form-required'>\n <th scope='row' valign='top'><label for='category_name'>" . __('Category name', 'eme') . "</label></th>\n <td><input name='category_name' id='category_name' type='text' value='" . eme_sanitize_html($category['category_name']) . "' size='40' /><br />\n " . __('The name of the category', 'eme') . "</td>\n </tr>\n <tr class='form-field form-required'>\n <th scope='row' valign='top'><label for='description'>" . __('Category description', 'eme') . "</label></th>\n <td><textarea name='description' id='description' rows='5' />" . eme_sanitize_html($category['description']) . "</textarea><br />\n " . __('The description of the category', 'eme') . "</td>\n </tr>\n </table>\n <p class='submit'><input type='submit' class='button-primary' name='submit' value='" . __('Update category', 'eme') . "' /></p>\n </form>\n </div>\n "; echo $layout; }
function eme_events_table($message = "", $scope = "future") { global $eme_timezone; if (!empty($message)) { echo "<div id='message' class='updated fade'><p>" . eme_trans_sanitize_html($message) . "</p></div>"; } //$list_limit = get_option('eme_events_admin_limit'); //if ($list_limit<5 || $list_limit>200) { // $list_limit=20; // update_option('eme_events_admin_limit',$list_limit); //} //$offset = isset($_GET['offset']) ? intval($_GET['offset']) : 0; //$events = eme_get_events ( $limit+1, "future", "ASC", $offset ); $o_category = isset($_GET['category']) ? intval($_GET['category']) : 0; $status = isset($_GET['event_status']) ? intval($_GET['event_status']) : ''; if (!empty($status)) { $extra_conditions = 'event_status = ' . $status; } else { $extra_conditions = ''; } //$events = eme_get_events ( 0, $scope, "ASC", $offset, "", $o_category, '', '', 1, '', 0, $extra_conditions); $events = eme_get_events(0, $scope, "ASC", 0, "", $o_category, '', '', 1, '', 0, $extra_conditions); $events_count = count($events); $scope_names = array(); $scope_names['past'] = __('Past events', 'eme'); $scope_names['all'] = __('All events', 'eme'); $scope_names['future'] = __('Future events', 'eme'); ?> <div class="wrap"> <div id="icon-events" class="icon32"><br /> </div> <h1><?php echo $scope_names[$scope]; ?> </h1> <?php admin_show_warnings(); ?> <!--<div id='new-event' class='switch-tab'><a href="<?php echo admin_url("admin.php?page=events-manager&eme_admin_action=edit_event"); ?> ><?php _e('New Event ...', 'eme'); ?> </a></div>--> <?php $event_status_array = eme_status_array(); ?> <div class="tablenav"> <form id="posts-filter" action="" method="get"> <input type='hidden' name='page' value='events-manager' /> <select name="scope"> <?php foreach ($scope_names as $key => $value) { $selected = ""; if ($key == $scope) { $selected = "selected='selected'"; } echo "<option value='{$key}' {$selected}>{$value}</option> "; } ?> </select> <select id="event_status" name="event_status"> <option value="0"><?php _e('Event Status', 'eme'); ?> </option> <?php foreach ($event_status_array as $event_status_key => $event_status_value) { ?> <option value="<?php echo $event_status_key; ?> " <?php if (isset($_GET['event_status']) && $_GET['event_status'] == $event_status_key) { echo 'selected="selected"'; } ?> ><?php echo $event_status_value; ?> </option> <?php } ?> </select> <select name="category"> <option value='0'><?php _e('All categories', 'eme'); ?> </option> <?php $categories = eme_get_categories(); foreach ($categories as $category) { $selected = ""; if ($o_category == $category['category_id']) { $selected = "selected='selected'"; } echo "<option value='" . $category['category_id'] . "' {$selected}>" . $category['category_name'] . "</option>"; } ?> </select> <input id="post-query-submit" class="button-secondary" type="submit" value="<?php _e('Filter'); ?> " /> </form> <?php if ($events_count > 0) { ?> <form id="eme_events_listform" action="" method="get"> <input type='hidden' name='page' value='events-manager' /> <select name="eme_admin_action"> <option value="-1" selected="selected"><?php _e('Bulk Actions'); ?> </option> <option value="deleteEvents"><?php _e('Delete selected events', 'eme'); ?> </option> <option value="deleteRecurrence"><?php _e('Delete selected recurrent events', 'eme'); ?> </option> <option value="publicEvents"><?php _e('Publish selected events', 'eme'); ?> </option> <option value="privateEvents"><?php _e('Make selected events private', 'eme'); ?> </option> <option value="draftEvents"><?php _e('Make selected events draft', 'eme'); ?> </option> </select> <input type="submit" value="<?php _e('Apply'); ?> " name="doaction2" id="doaction2" class="button-secondary action" /> <div class="clear"></div> <br /> <table class="widefat hover stripe" id="eme_admin_events"> <thead> <tr> <th class='manage-column column-cb check-column' scope='col'><input class='select-all' type="checkbox" value='1' /></th> <th><?php _e('ID', 'eme'); ?> </th> <th><?php _e('Name', 'eme'); ?> </th> <th><?php _e('Status', 'eme'); ?> </th> <th><?php _e('Copy', 'eme'); ?> </th> <th><?php _e('Location', 'eme'); ?> </th> <th><?php _e('Date and time', 'eme'); ?> </th> <th><?php _e('Recurrence info', 'eme'); ?> </th> </tr> </thead> <tbody> <?php $eme_date_obj = new ExpressiveDate(null, $eme_timezone); $today = $eme_date_obj->getDate(); foreach ($events as $event) { $localised_start_date = eme_localised_date($event['event_start_date'] . " " . $event['event_start_time'] . " " . $eme_timezone); $localised_start_time = eme_localised_time($event['event_start_date'] . " " . $event['event_start_time'] . " " . $eme_timezone); $localised_end_date = eme_localised_date($event['event_end_date'] . " " . $event['event_end_time'] . " " . $eme_timezone); $localised_end_time = eme_localised_time($event['event_end_date'] . " " . $event['event_end_time'] . " " . $eme_timezone); $datasort_startstring = strtotime($event['event_start_date'] . " " . $event['event_start_time'] . " " . $eme_timezone); $location_summary = ""; if (isset($event['location_id']) && $event['location_id']) { $location = eme_get_location($event['location_id']); $location_summary = "<b>" . eme_trans_sanitize_html($location['location_name']) . "</b><br />" . eme_trans_sanitize_html($location['location_address']) . " - " . eme_trans_sanitize_html($location['location_town']); } $style = ""; if ($event['event_start_date'] < $today) { $style = "style ='background-color: #FADDB7;'"; } ?> <tr <?php echo "{$style}"; ?> > <td><input type='checkbox' class='row-selector' value='<?php echo $event['event_id']; ?> ' name='events[]' /></td> <td><?php echo $event['event_id']; ?> </td> <td><strong> <a class="row-title" href="<?php echo admin_url("admin.php?page=events-manager&eme_admin_action=edit_event&event_id=" . $event['event_id']); ?> " title="<?php _e('Edit event', 'eme'); ?> "><?php echo eme_trans_sanitize_html($event['event_name']); ?> </a> </strong> <?php $categories = explode(',', $event['event_category_ids']); foreach ($categories as $cat) { $category = eme_get_category($cat); if ($category) { echo "<br /><span title='" . __('Category', 'eme') . ": " . eme_trans_sanitize_html($category['category_name']) . "'>" . eme_trans_sanitize_html($category['category_name']) . "</span>"; } } if ($event['event_rsvp']) { $booked_seats = eme_get_booked_seats($event['event_id']); $available_seats = eme_get_available_seats($event['event_id']); $pending_seats = eme_get_pending_seats($event['event_id']); $total_seats = $event['event_seats']; if (eme_is_multi($event['event_seats'])) { $available_seats_string = $available_seats . ' (' . eme_convert_array2multi(eme_get_available_multiseats($event['event_id'])) . ')'; $pending_seats_string = $pending_seats . ' (' . eme_convert_array2multi(eme_get_pending_multiseats($event['event_id'])) . ')'; $total_seats_string = eme_get_multitotal($total_seats) . ' (' . $event['event_seats'] . ')'; } else { $available_seats_string = $available_seats; $pending_seats_string = $pending_seats; $total_seats_string = $total_seats; } if ($pending_seats > 0) { echo "<br />" . __('RSVP Info: ', 'eme') . __('Free: ', 'eme') . $available_seats_string . ", " . __('Pending: ', 'eme') . $pending_seats_string . ", " . __('Max: ', 'eme') . $total_seats_string; } else { echo "<br />" . __('RSVP Info: ', 'eme') . __('Free: ', 'eme') . $available_seats_string . ", " . __('Max: ', 'eme') . $total_seats_string; } if ($booked_seats > 0 || $pending_seats > 0) { $printable_address = admin_url("admin.php?page=eme-people&eme_admin_action=booking_printable&event_id=" . $event['event_id']); $csv_address = admin_url("admin.php?page=eme-people&eme_admin_action=booking_csv&event_id=" . $event['event_id']); echo " (<a id='booking_printable_" . $event['event_id'] . "' href='{$printable_address}'>" . __('Printable view', 'eme') . "</a>)"; echo " (<a id='booking_csv_" . $event['event_id'] . "' href='{$csv_address}'>" . __('CSV export', 'eme') . "</a>)"; } } ?> </td> <td> <?php if (isset($event_status_array[$event['event_status']])) { echo $event_status_array[$event['event_status']]; $event_url = eme_event_url($event); if ($event['event_status'] == STATUS_DRAFT) { echo "<br /> <a href='{$event_url}'>" . __('Preview event', 'eme') . "</a>"; } else { echo "<br /> <a href='{$event_url}'>" . __('View event', 'eme') . "</a>"; } } ?> </td> <td> <a href="<?php echo admin_url("admin.php?page=events-manager&eme_admin_action=duplicate_event&event_id=" . $event['event_id']); ?> " title="<?php _e('Duplicate this event', 'eme'); ?> "><img src='<?php echo EME_PLUGIN_URL . "images/copy_24.png"; ?> '/></a> </td> <td> <?php echo $location_summary; ?> </td> <td data-sort="<?php echo $datasort_startstring; ?> "> <?php echo $localised_start_date; if ($localised_end_date != '' && $localised_end_date != $localised_start_date) { echo " - " . $localised_end_date; } ?> <br /> <?php if ($event['event_properties']['all_day'] == 1) { _e('All day', 'eme'); } else { echo "{$localised_start_time} - {$localised_end_time}"; } ?> </td> <td> <?php if ($event['recurrence_id']) { $recurrence_desc = eme_get_recurrence_desc($event['recurrence_id']); ?> <b><?php echo $recurrence_desc; ?> <br /> <a href="<?php echo admin_url("admin.php?page=events-manager&eme_admin_action=edit_recurrence&recurrence_id=" . $event['recurrence_id']); ?> "><?php print sprintf(__('Edit Recurrence ID %d', 'eme'), $event['recurrence_id']); ?> </a></b> <?php } ?> </td> </tr> <?php } ?> </tbody> </table> </form> <?php } else { echo "<div id='events-admin-no-events'>" . get_option('eme_no_events_message') . "</div></div>"; } ?> <script type="text/javascript"> jQuery(document).ready( function() { jQuery('#eme_admin_events').dataTable( { "dom": 'Blfrtip', "colReorder": true, <?php $locale_code = get_locale(); $locale_file = EME_PLUGIN_DIR . "js/jquery-datatables/i18n/{$locale_code}.json"; $locale_file_url = EME_PLUGIN_URL . "js/jquery-datatables/i18n/{$locale_code}.json"; if ($locale_code != "en_US" && file_exists($locale_file)) { ?> "language": { "url": "<?php echo $locale_file_url; ?> " }, <?php } ?> "stateSave": true, "pagingType": "full", "columnDefs": [ { "sortable": false, "targets": [0,4,7] } ], "buttons": [ 'csv', 'print', { extend: 'colvis', columns: ':not(:first-child)' } ] } ); } ); </script> </div> </div> <?php }