function gigpress_tours() { global $wpdb; if (isset($_POST['gpaction']) && $_POST['gpaction'] == "add") { require_once 'handlers.php'; $result = gigpress_add_tour(); } if (isset($_POST['gpaction']) && $_POST['gpaction'] == "update") { require_once 'handlers.php'; $result = gigpress_update_tour(); } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "delete") { require_once 'handlers.php'; gigpress_delete_tour(); } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "undo") { require_once 'handlers.php'; gigpress_undo('tour'); } $url_args = isset($_GET['gp-page']) ? '&gp-page=' . $_GET['gp-page'] : ''; ?> <div class="wrap gigpress gp-tours"> <?php screen_icon('gigpress'); ?> <h2><?php _e("Tours", "gigpress"); ?> </h2> <p><?php _e("A tour is simply a named collection of shows that you want to group together.", "gigpress"); ?> </p> <?php if (isset($_GET['gpaction']) && $_GET['gpaction'] == "edit" || is_array($result) && $result['editing'] == TRUE) { // Load the previous show info into the edit form, and so forth $tour_id = isset($_REQUEST['tour_id']) ? $wpdb->prepare('%d', $_REQUEST['tour_id']) : ''; $tour_name = gigpress_db_out($wpdb->get_var("SELECT tour_name from " . GIGPRESS_TOURS . " WHERE tour_id = " . $tour_id)); if ($tour_name) { $submit = '<span class="submit"><input type="submit" name="Submit" class="button-primary" value="' . __("Update tour", "gigpress") . '" /></span> ' . __("or", "gigpress") . ' <a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-tours' . $url_args . '">' . __("cancel", "gigpress") . '</a>'; ?> <h3><?php _e("Edit this tour", "gigpress"); ?> </h3> <form method="post" action="<?php bloginfo('wpurl'); ?> /wp-admin/admin.php?page=gigpress-tours<?php echo $url_args; ?> "> <input type="hidden" name="tour_id" value="<?php echo $tour_id; ?> " /> <input type="hidden" name="gpaction" value="update" /> <?php } else { ?> <div id="message" class="error fade"><p><?php _e("Sorry, but we had trouble loading that tour for editing.", "gigpress"); ?> </p></div> <h3><?php _e("Add a tour", "gigpress"); ?> </h3> <?php } } else { $tour_name = ''; $submit = '<span class="submit"><input type="submit" name="Submit" class="button-primary" value="' . __("Add tour", "gigpress") . '" /></span>'; ?> <h3><?php _e("Add a tour", "gigpress"); ?> </h3> <form method="post" action="<?php bloginfo('wpurl'); ?> /wp-admin/admin.php?page=gigpress-tours<?php echo $url_args; ?> "> <input type="hidden" name="gpaction" value="add" /> <?php } wp_nonce_field('gigpress-action'); ?> <table class="form-table gp-table"> <tr> <th scope="row"><label for="tour_name"><?php _e("Tour name", "gigpress"); ?> :</label></th> <td><input name="tour_name" id="tour_name" type="text" size="48" value="<?php echo $tour_name; ?> " /> <?php echo $submit; ?> </td> </tr> </table> </form> <h3><?php _e("All tours", "gigpress"); ?> </h3> <div class="tablenav"> <div class="alignleft"> <p><?php _e("Note that deleting a tour will <strong>NOT</strong> delete the shows associated with that tour.", "gigpress"); ?> </p> </div> <?php // Get all tours from the DB $tours = fetch_gigpress_tours(); if ($tours) { $pagination_args['page'] = 'gigpress-tours'; $pagination = gigpress_admin_pagination(count($tours), 20, $pagination_args); if ($pagination) { $tours = array_slice($tours, $pagination['offset'], $pagination['records_per_page']); echo $pagination['output']; } } ?> </div> <table class="widefat"> <thead> <tr> <th scope="col" class="gp-tiny">ID</th> <th scope="col"><?php _e("Tour name", "gigpress"); ?> </th> <th scope="col" class="gp-centre"><?php _e("Number of shows", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </thead> <tbody> <?php if ($tours) { foreach ($tours as $tour) { if ($n = $wpdb->get_var("SELECT count(*) FROM " . GIGPRESS_SHOWS . " WHERE show_tour_id = " . $tour->tour_id . " AND show_status != 'deleted'")) { $count = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&tour_id=' . $tour->tour_id . '">' . $n . '</a>'; } else { $count = 0; } ++$i; $style = $i % 2 ? '' : ' class="alternate"'; ?> <tr<?php echo $style; ?> > <td class="gp-tiny"><?php echo $tour->tour_id; ?> </td> <td><?php echo wptexturize($tour->tour_name); ?> </td> <td class="gp-centre"><?php echo $count; ?> </td> <td class="gp-centre"> <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-tours&gpaction=edit&tour_id=' . $tour->tour_id . $url_args; ?> " class="edit"><?php _e("Edit", "gigpress"); ?> </a> | <a href="<?php echo wp_nonce_url(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-tours&gpaction=delete&tour_id=' . $tour->tour_id . $url_args, 'gigpress-action'); ?> " class="delete"><?php _e("Delete", "gigpress"); ?> </a> </td> </tr> <?php $num++; } } else { ?> <tr><td colspan="4"><strong><?php _e("No tours in the database", "gigpress"); ?> </strong></td></tr> <?php } ?> </tbody> <tfoot> <tr> <th scope="col" class="gp-tiny">ID</th> <th scope="col"><?php _e("Tour name", "gigpress"); ?> </th> <th scope="col" class="gp-centre"><?php _e("Number of shows", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </tfoot> </table> <div class="tablenav"> <?php if ($pagination) { echo $pagination['output']; } ?> </div> </div> <?php }
function gigpress_venues() { global $wpdb, $gpo; if (isset($_POST['gpaction']) && $_POST['gpaction'] == "add") { require_once 'handlers.php'; $result = gigpress_add_venue(); } if (isset($_POST['gpaction']) && $_POST['gpaction'] == "update") { require_once 'handlers.php'; $result = gigpress_update_venue(); } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "delete") { require_once 'handlers.php'; gigpress_delete_venue(); } $url_args = isset($_GET['gp-page']) ? '&gp-page=' . $_GET['gp-page'] : ''; ?> <div class="wrap gigpress gp-venues"> <?php screen_icon('gigpress'); ?> <h2><?php _e("Venues", "gigpress"); ?> </h2> <?php $venue_id = isset($_REQUEST['venue_id']) ? $wpdb->prepare('%d', $_REQUEST['venue_id']) : ''; // Check our context to determine what we're populating if (is_array($result)) { // This means we $_POSTed and there were errors $venue_name = gigpress_db_out($_POST['venue_name']); $venue_city = gigpress_db_out($_POST['venue_city']); $venue_address = gigpress_db_out($_POST['venue_address']); $venue_country = $_POST['venue_country']; $venue_url = gigpress_db_out($_POST['venue_url']); $venue_phone = gigpress_db_out($_POST['venue_phone']); } elseif (isset($_GET['gpaction']) && $_GET['gpaction'] == "edit") { // Just loaded for editing $venuedata = $wpdb->get_results("\n\t\t\tSELECT * from " . GIGPRESS_VENUES . " WHERE venue_id = " . $venue_id . " LIMIT 1\n\t\t"); if ($venuedata) { foreach ($venuedata as $venue) { $venue_name = gigpress_db_out($venue->venue_name); $venue_city = gigpress_db_out($venue->venue_city); $venue_address = gigpress_db_out($venue->venue_address); $venue_country = $venue->venue_country; $venue_url = gigpress_db_out($venue->venue_url); $venue_phone = gigpress_db_out($venue->venue_phone); } } else { $load_error = '<div id="message" class="error fade"><p>' . __("Sorry, but we had trouble loading that venue for editing.", "gigpress") . '</div>'; } } else { // New venue entry $venue_name = $venue_city = $venue_address = $venue_url = $venue_phone = $load_error = ''; $venue_country = $gpo['default_country']; } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "edit" && $venuedata || is_array($result) && $result['editing'] == TRUE) { ?> <h3><?php _e("Edit this venue", "gigpress"); ?> </h3> <form method="post" action="<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=gigpress-venues" . $url_args; ?> "> <input type="hidden" name="gpaction" value="update" /> <input type="hidden" name="venue_id" value="<?php echo $venue_id; ?> " /> <?php } else { ?> <?php if ($load_error) { echo $load_error; } ?> <h3><?php _e("Add an venue", "gigpress"); ?> </h3> <form method="post" action="<?php echo get_bloginfo('wpurl') . "/wp-admin/admin.php?page=gigpress-venues" . $url_args; ?> "> <input type="hidden" name="gpaction" value="add" /> <?php } ?> <?php wp_nonce_field('gigpress-action'); ?> <table class="form-table gp-table"> <tr> <th scope="row"><label for="venue_name"><?php _e("Venue name", "gigpress"); ?> :<span class="gp-required">*</span></label></th> <td><input type="text" size="48" name="venue_name" id="venue_name" value="<?php echo $venue_name; ?> "<?php if ($result['venue_name']) { echo ' class="gigpress-error"'; } ?> /></td> </tr> <tr> <th scope="row"><label for="venue_city"><?php _e("Venue city", "gigpress"); ?> :<span class="gp-required">*</span></label></th> <td><input type="text" size="48" name="venue_city" id="venue_city" value="<?php echo $venue_city; ?> "<?php if ($result['venue_city']) { echo ' class="gigpress-error"'; } ?> /></td> </tr> <tr> <th scope="row"><label for="venue_address"><?php _e("Venue address", "gigpress"); ?> :</label></th> <td><input type="text" size="48" name="venue_address" id="venue_address" value="<?php echo $venue_address; ?> " /></td> </tr> <tr> <th scope="row"><label for="venue_country"><?php _e("Venue country", "gigpress"); ?> :</label></th> <td> <select name="venue_country" id="venue_country"> <?php global $gp_countries; foreach ($gp_countries as $code => $name) { $sel = $code == $venue_country ? ' selected="selected"' : ''; echo '<option value="' . $code . '"' . $sel . '>' . $name . '</option>'; } ?> </select> </td> </tr> <tr> <th scope="row"><label for="venue_url"><?php _e("Venue website", "gigpress"); ?> :</label></th> <td><input type="text" size="48" name="venue_url" id="venue_url" value="<?php echo $venue_url; ?> " /></td> </tr> <tr> <th scope="row"><label for="venue_phone"><?php _e("Venue phone", "gigpress"); ?> :</label></th> <td><input type="text" size="48" name="venue_phone" id="venue_phone" value="<?php echo $venue_phone; ?> " /></td> </tr> <tr> <td> </td> <td> <?php if (isset($_GET['gpaction']) && $_GET['gpaction'] == "edit" || is_array($result) && $result['editing'] == TRUE) { ?> <span class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e("Update venue", "gigpress"); ?> " /></span> <?php _e("or", "gigpress"); ?> <a href="<?php bloginfo('wpurl'); ?> /wp-admin/admin.php?page=gigpress-venues<?php echo $url_args; ?> "><?php _e("cancel", "gigpress"); ?> </a> <?php } else { ?> <span class="submit"><input type="submit" name="Submit" class="button-primary" value="<?php _e("Add venue", "gigpress"); ?> " /></span> <?php } ?> </td> </tr> </table> </form> <h3><?php _e("All venues", "gigpress"); ?> </h3> <div class="tablenav"> <div class="alignleft"> <p><?php _e("Note that you cannot delete a venue while it has shows in the database.", "gigpress"); ?> </p> </div> <?php $venue_count = $wpdb->get_var("SELECT COUNT(*) FROM " . GIGPRESS_VENUES); if ($venue_count) { $pagination_args['page'] = 'gigpress-venues'; $pagination = gigpress_admin_pagination($venue_count, 15, $pagination_args); if ($pagination) { echo $pagination['output']; } } $limit = isset($_GET['gp-page']) ? $pagination['offset'] . ',' . $pagination['records_per_page'] : 15; ?> <div class="clear"></div> </div> <table class="widefat"> <thead> <tr> <th scope="col" class="gp-tiny">ID</th> <th scope="col"><?php _e("Name", "gigpress"); ?> </th> <th scope="col"><?php _e("City", "gigpress"); ?> </th> <th scope="col"><?php _e("Address", "gigpress"); ?> </th> <th scope="col"><?php _e("Country", "gigpress"); ?> </th> <th scope="col"><?php _e("Phone", "gigpress"); ?> </th> <th scope="col" class="gp-centre"><?php _e("Number of shows", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </thead> <tbody> <?php $venues = $wpdb->get_results("SELECT * FROM " . GIGPRESS_VENUES . " ORDER BY venue_name ASC LIMIT " . $limit); if ($venues) { foreach ($venues as $venue) { if ($n = $wpdb->get_var("SELECT count(*) FROM " . GIGPRESS_SHOWS . " WHERE show_venue_id = " . $venue->venue_id . " AND show_status != 'deleted'")) { $count = '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&venue_id=' . $venue->venue_id . '">' . $n . '</a>'; } else { $count = 0; } $venuedata = gigpress_prepare($venue, 'venue'); ++$i; $style = $i % 2 ? '' : ' class="alternate"'; // Print out our rows. ?> <tr<?php echo $style; ?> > <td class="gp-tiny"><?php echo $venuedata['venue_id']; ?> </td> <td><?php echo $venuedata['venue']; ?> </td> <td><?php echo $venuedata['city']; ?> </td> <td><?php echo $venuedata['address']; ?> </td> <td><?php echo $venuedata['country']; ?> </td> <td><?php echo $venuedata['venue_phone']; ?> </td> <td class="gp-centre"><?php echo $count; ?> </td> <td class="gp-centre"> <a href="<?php echo get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-venues&gpaction=edit&venue_id=' . $venue->venue_id . $url_args; ?> " class="edit"><?php _e("Edit", "gigpress"); ?> </a> <?php if (!$count) { ?> | <a href="<?php echo wp_nonce_url(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-venues&gpaction=delete&venue_id=' . $venue->venue_id . $url_args, 'gigpress-action'); ?> " class="delete"><?php _e("Delete", "gigpress"); ?> </a><?php } ?> </td> </tr> <?php } } else { // We don't have any venues, so let's say so ?> <tr><td colspan="7"><strong><?php _e("No venues in the database", "gigpress"); ?> </strong></td></tr> <?php } ?> </tbody> <tfoot> <tr> <th scope="col" class="gp-tiny">ID</th> <th scope="col"><?php _e("Name", "gigpress"); ?> </th> <th scope="col"><?php _e("City", "gigpress"); ?> </th> <th scope="col"><?php _e("Address", "gigpress"); ?> </th> <th scope="col"><?php _e("Country", "gigpress"); ?> </th> <th scope="col"><?php _e("Phone", "gigpress"); ?> </th> <th scope="col" class="gp-centre"><?php _e("Number of shows", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </tfoot> </table> <div class="tablenav"> <?php if ($pagination) { echo $pagination['output']; } ?> </div> </div> <?php }
function gigpress_admin_shows() { if (isset($_REQUEST['gpaction']) && $_REQUEST['gpaction'] == "delete") { require_once 'handlers.php'; gigpress_delete_show(); } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "undo") { require_once 'handlers.php'; gigpress_undo('show'); } if (isset($_POST['gpaction']) && $_POST['gpaction'] == "update") { require_once 'handlers.php'; gigpress_update_show(); } if (isset($_GET['gpaction']) && $_GET['gpaction'] == "trash") { require_once 'handlers.php'; gigpress_empty_trash(); } global $wpdb, $gpo; // Checks for filtering and pagination $url_args = ''; $further_where = ''; $pagination_args = array(); switch ($_GET['scope']) { case 'upcoming': $condition = ">= '" . GIGPRESS_NOW . "'"; $url_args .= '&scope=upcoming'; $pagination_args['scope'] = 'upcoming'; break; case 'past': $condition = "< '" . GIGPRESS_NOW . "'"; $url_args .= '&scope=past'; $pagination_args['scope'] = 'past'; break; default: $condition = 'IS NOT NULL'; } global $current_user; get_currentuserinfo(); switch ($_GET['sort']) { case 'asc': $sort = 'ASC'; update_usermeta($current_user->ID, 'gigpress_sort', $sort); break; case 'desc': $sort = 'DESC'; update_usermeta($current_user->ID, 'gigpress_sort', $sort); break; } if (!isset($_GET['sort'])) { if (!($sort = get_usermeta($current_user->ID, 'gigpress_sort'))) { $sort = 'DESC'; update_usermeta($current_user->ID, 'gigpress_sort', $sort); } } if (isset($_GET['gp-page'])) { $url_args .= '&gp-page=' . $_GET['gp-page']; } if (isset($_GET['artist_id']) && $_GET['artist_id'] != '-1') { $further_where .= ' AND s.show_artist_id = ' . $wpdb->prepare('%d', $_GET['artist_id']) . ' '; $pagination_args['artist_id'] = $_GET['artist_id']; $url_args .= '&artist_id=' . $_GET['artist_id']; } if (isset($_GET['tour_id']) && $_GET['tour_id'] != '-1') { $further_where .= ' AND s.show_tour_id = ' . $wpdb->prepare('%d', $_GET['tour_id']) . ' '; $pagination_args['tour_id'] = $_GET['tour_id']; $url_args .= '&tour_id=' . $_GET['tour_id']; } if (isset($_GET['venue_id']) && $_GET['venue_id'] != '-1') { $further_where .= ' AND s.show_venue_id = ' . $wpdb->prepare('%d', $_GET['venue_id']) . ' '; $pagination_args['venue_id'] = $_GET['venue_id']; $url_args .= '&venue_id=' . $_GET['venue_id']; } // Build pagination $show_count = $wpdb->get_var("SELECT COUNT(*) FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_expire " . $condition . " AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $further_where . "ORDER BY show_date " . $sort . ",show_time " . $sort); if ($show_count) { $pagination_args['page'] = 'gigpress-shows'; $pagination = gigpress_admin_pagination($show_count, 10, $pagination_args); } $limit = isset($_GET['gp-page']) ? $pagination['offset'] . ',' . $pagination['records_per_page'] : 10; // Build the query $shows = $wpdb->get_results("\n\t\tSELECT * FROM " . GIGPRESS_ARTISTS . " AS a, " . GIGPRESS_VENUES . " as v, " . GIGPRESS_SHOWS . " AS s LEFT JOIN " . GIGPRESS_TOURS . " AS t ON s.show_tour_id = t.tour_id WHERE show_expire " . $condition . " AND show_status != 'deleted' AND s.show_artist_id = a.artist_id AND s.show_venue_id = v.venue_id " . $further_where . "ORDER BY show_date " . $sort . ",show_expire " . $sort . ",show_time " . $sort . " LIMIT " . $limit); ?> <div class="wrap gigpress"> <?php screen_icon('gigpress'); ?> <h2><?php _e("Shows", "gigpress"); ?> </h2> <ul class="subsubsub"> <?php $all = $wpdb->get_var("SELECT COUNT(show_id) FROM " . GIGPRESS_SHOWS . " WHERE show_status != 'deleted'"); $upcoming = $wpdb->get_var("SELECT count(show_id) FROM " . GIGPRESS_SHOWS . " WHERE show_expire >= '" . GIGPRESS_NOW . "' AND show_status != 'deleted'"); $past = $wpdb->get_var("SELECT count(show_id) FROM " . GIGPRESS_SHOWS . " WHERE show_expire < '" . GIGPRESS_NOW . "' AND show_status != 'deleted'"); echo '<li><a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows"'; if (!isset($_GET['scope'])) { echo ' class="current"'; } echo '>' . __("All", "gigpress") . '</a> <span class="count">(' . $all . ')</span> | </li>'; echo '<li><a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&scope=upcoming"'; if (isset($_GET['scope']) && $_GET['scope'] == 'upcoming') { echo ' class="current"'; } echo '>' . __("Upcoming", "gigpress") . '</a> <span class="count">(' . $upcoming . ')</span> | </li>'; echo '<li><a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&scope=past"'; if (isset($_GET['scope']) && $_GET['scope'] == 'past') { echo ' class="current"'; } echo '>' . __("Past", "gigpress") . '</a> <span class="count">(' . $past . ')</span></li>'; ?> </ul> <div class="tablenav"> <div class="alignleft"> <form action="" method="get"> <div> <input type="hidden" name="page" value="gigpress-shows" /> <?php if (isset($_GET['scope'])) { ?> <input type="hidden" name="scope" value="<?php echo $_GET['scope']; ?> " /> <?php } ?> <select name="artist_id"> <option value="-1"><?php _e("View all artists", "gigpress"); ?> </option> <?php $artistdata = fetch_gigpress_artists(); if ($artistdata) { foreach ($artistdata as $artist) { $selected = isset($_GET['artist_id']) && $_GET['artist_id'] == $artist->artist_id ? ' selected="selected"' : ''; echo '<option value="' . $artist->artist_id . '"' . $selected . '>' . gigpress_db_out($artist->artist_name) . '</option>'; } } else { echo '<option value="-1">' . __("No artists in the database", "gigpress") . '</option>'; } ?> </select> <select name="tour_id"> <option value="-1"><?php _e("View all tours", "gigpress"); ?> </option> <?php $tourdata = fetch_gigpress_tours(); if ($tourdata) { foreach ($tourdata as $tour) { $selected = isset($_GET['tour_id']) && $_GET['tour_id'] == $tour->tour_id ? ' selected="selected"' : ''; echo '<option value="' . $tour->tour_id . '"' . $selected . '>' . gigpress_db_out($tour->tour_name) . '</option>'; } } else { echo '<option value="-1">' . __("No tours in the database", "gigpress") . '</option>'; } ?> </select> <select name="venue_id"> <option value="-1"><?php _e("View all venues", "gigpress"); ?> </option> <?php $venuedata = fetch_gigpress_venues(); if ($venuedata) { foreach ($venuedata as $venue) { $selected = isset($_GET['venue_id']) && $_GET['venue_id'] == $venue->venue_id ? ' selected="selected"' : ''; echo '<option value="' . $venue->venue_id . '"' . $selected . '>' . gigpress_db_out($venue->venue_name) . '</option>'; } } else { echo '<option value="-1">' . __("No venues in the database", "gigpress") . '</option>'; } ?> </select> <select name="sort"> <option value="desc"<?php if ($sort == 'DESC') { echo ' selected="selected"'; } ?> ><?php _e("Descending", "gigpress"); ?> </option> <option value="asc"<?php if ($sort == 'ASC') { echo ' selected="selected"'; } ?> ><?php _e("Ascending", "gigpress"); ?> </option> </select> <input type="submit" value="Filter" class="button-secondary" /> </div> </form> </div> <?php if ($pagination) { echo $pagination['output']; } ?> <div class="clear"></div> </div> <form action="" method="post"> <?php wp_nonce_field('gigpress-action'); ?> <input type="hidden" name="gpaction" value="delete" /> <table class="widefat"> <thead> <tr> <th scope="col" class="column-cb check-column"><input type="checkbox" /></th> <th scope="col"><?php _e("Date", "gigpress"); ?> </th> <th scope="col"><?php _e("Artist", "gigpress"); ?> </th> <th scope="col"><?php _e("City", "gigpress"); ?> </th> <th scope="col"><?php _e("Venue", "gigpress"); ?> </th> <th scope="col"><?php _e("Country", "gigpress"); ?> </th> <th scope="col"><?php _e("Tour", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </thead> <tfoot> <tr> <th scope="col" class="column-cb check-column"><input type="checkbox" /></th> <th scope="col"><?php _e("Date", "gigpress"); ?> </th> <th scope="col"><?php _e("Artist", "gigpress"); ?> </th> <th scope="col"><?php _e("City", "gigpress"); ?> </th> <th scope="col"><?php _e("Venue", "gigpress"); ?> </th> <th scope="col"><?php _e("Country", "gigpress"); ?> </th> <th scope="col"><?php _e("Tour", "gigpress"); ?> </th> <th class="gp-centre" scope="col"><?php _e("Actions", "gigpress"); ?> </th> </tr> </tfoot> <tbody> <?php // Do we have dates? if ($shows != FALSE) { foreach ($shows as $show) { $showdata = gigpress_prepare($show, 'admin'); ?> <tr class="<?php echo 'gigpress-' . $showdata['status']; ?> "> <th scope="row" class="check-column"><input type="checkbox" name="show_id[]" value="<?php echo $show->show_id; ?> " /></th> <td><span class="gigpress-date"><?php echo $showdata['date']; if ($showdata['end_date']) { echo ' - ' . $showdata['end_date']; } ?> </span> </td> <td><?php echo $showdata['artist']; ?> </td> <td><?php echo $showdata['city']; ?> </td> <td><?php echo $showdata['venue']; if ($showdata['address']) { echo ' (' . $showdata['address'] . ')'; } ?> </td> <td><?php echo $showdata['country']; ?> </td> <td><?php echo $showdata['tour']; ?> </td> <td class="gp-centre"> <a href="<?php bloginfo('wpurl'); ?> /wp-admin/admin.php?page=gigpress/gigpress.php&gpaction=edit&show_id=<?php echo $show->show_id; ?> " class="edit" title="<?php _e("Edit", "gigpress"); ?> "><?php _e("Edit", "gigpress"); ?> </a> | <a href="<?php bloginfo('wpurl'); ?> /wp-admin/admin.php?page=gigpress/gigpress.php&gpaction=copy&show_id=<?php echo $show->show_id; ?> " class="edit" title="<?php _e("Copy", "gigpress"); ?> "><?php _e("Copy", "gigpress"); ?> </a> </td> </tr> <tr class="<?php echo 'alternate' . ' gigpress-' . $showdata['status']; ?> "> <td colspan="8"><small> <?php if ($showdata['time']) { echo $showdata['time'] . '. '; } if ($showdata['price']) { echo __("Price", "gigpress") . ': ' . $showdata['price'] . '. '; } if ($showdata['admittance']) { echo $showdata['admittance'] . '. '; } if ($showdata['ticket_link']) { echo $showdata['ticket_link'] . '. '; } if ($showdata['ticket_phone']) { echo __('Box office', "gigpress") . ': ' . $showdata['ticket_phone'] . '. '; } echo $showdata['notes'] . ' '; echo $showdata['related_edit']; ?> </small></td> </tr> <?php } // end foreach } else { // No results from the query ?> <tr><td colspan="8"><?php _e("Sorry, no shows to display based on your criteria.", "gigpress"); ?> </td></tr> <?php } ?> </tbody> </table> <div class="tablenav"> <div class="alignleft"> <input type="submit" value="<?php _e('Trash selected shows', 'gigpress'); ?> " class="button-secondary" /> <?php if ($tour_count = $wpdb->get_var("SELECT count(*) FROM " . GIGPRESS_TOURS . " WHERE tour_status = 'deleted'")) { $tours = $tour_count; } else { $tours = 0; } if ($show_count = $wpdb->get_var("SELECT count(*) FROM " . GIGPRESS_SHOWS . " WHERE show_status = 'deleted'")) { $shows = $show_count; } else { $shows = 0; } if ($tour_count || $show_count) { echo '<small>' . __("You have", "gigpress") . ' <strong>' . $shows . ' ' . __("shows", "gigpress") . '</strong> ' . __("and", "gigpress") . ' <strong>' . $tours . ' ' . __("tours", "gigpress") . '</strong> ' . __("in your trash", "gigpress") . '.'; if ($shows != 0 || $tours != 0) { echo ' <a href="' . wp_nonce_url(get_bloginfo('wpurl') . '/wp-admin/admin.php?page=gigpress-shows&gpaction=trash' . $url_args, 'gigpress-action') . '">' . __("Take out the trash now", "gigpress") . '</a>.'; } echo '</small>'; } ?> </div> <?php if ($pagination) { echo $pagination['output']; } ?> </div> </form> </div> <?php }