if (!empty($_GET["artist"])) { $sql[] = "track_artist_id = {$_GET['artist']}"; } if (count($sql) > 0) { return " WHERE " . implode(" AND ", $sql); } return ""; } $dbQuery = array("artists" => WT_Artist::all()); # GENERATE LIST $list = new WT_List(); $list->set_columns('events', array('cb' => '', 'album_id-col' => 'ID', 'album_title-col' => 'Title', 'album_artist' => 'Artist', 'album_label' => 'Label')); # GENERATE LIST $list = new WT_List(); $list->set_columns('events', array('cb' => '', 'track_id-col' => 'ID', 'track_title-col' => 'Title', 'track_albums' => 'Albums', 'track_artist' => 'Artist', 'track_label' => 'Label')); $list->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM " . WORDTOUR_TRACKS . " as t LEFT JOIN " . WORDTOUR_ARTISTS . " as a ON a.artist_id = t.track_artist_id " . get_query_mode_sql() . " ORDER BY t.track_title ASC", $_GET['paged']); ?> <div class="wrap"> <h2>Tracks</h2> </div> <form method="get" action="<?php echo admin_url("admin.php"); ?> "> <input type="hidden" name="page" value="<?php echo $page; ?> "></input> <?php
function render_edit_rows_page(&$event_id, &$page) { global $wpdb, $wt_msg; $dbQuery = array("all" => "SELECT count(*) FROM " . WORDTOUR_EVENTS . " AS e", "published" => "SELECT count(*) FROM " . WORDTOUR_EVENTS . " AS e WHERE e.event_published = 1", "upcoming" => "SELECT count(*) FROM " . WORDTOUR_EVENTS . " AS e WHERE e.event_published = 1 AND e.event_start_date >= CURDATE()", "archive" => "SELECT count(*) FROM " . WORDTOUR_EVENTS . " AS e WHERE e.event_published = 1 AND e.event_start_date < CURDATE()", "unpublished" => "SELECT count(*) FROM " . WORDTOUR_EVENTS . " AS e WHERE e.event_published = 0", "artists" => WT_Artist::all(), "tour" => WT_Tour::all(), "status" => get_all_status(), "venues" => WT_Venue::all(), "date" => $wpdb->get_results("SELECT \n\t\t\t\t\t\t\t\t\t\t DISTINCT YEAR(event_start_date) AS year,\n\t\t\t\t\t\t\t\t\t\t MONTH(event_start_date) AS month, \n\t\t\t\t\t\t\t\t\t\t MONTHNAME(event_start_date) AS month_name \n\t\t\t\t\t\t\t\t\t\t FROM " . WORDTOUR_EVENTS . " WHERE event_published = 1 ORDER BY event_start_date DESC", "ARRAY_A")); # GENERATE LIST $list = new WT_List(); $list->set_columns('events', array('event_check' => '', 'event_id' => 'ID', 'event_date' => 'Date', 'event_location' => 'Location', 'event_status' => 'Status', 'artist' => 'Artist', 'artists' => 'Additional Artists', 'tour' => 'Tour', 'extra_info' => ' ')); $list->get_results("SELECT SQL_CALC_FOUND_ROWS * \n\t\tFROM " . WORDTOUR_EVENTS . " AS e LEFT JOIN " . WORDTOUR_VENUES . " AS v \n\t\tON e.event_venue_id = v.venue_id \n\t\tLEFT JOIN " . WORDTOUR_EVENTS_META . " AS m \n\t\tON e.event_meta_id = m.meta_id\n\t\tLEFT JOIN " . WORDTOUR_ARTISTS . " AS a\n\t\tON e.event_artist_id = a.artist_id\n\t\tLEFT JOIN " . WORDTOUR_TOUR . " AS t\n\t\tON e.event_tour_id = t.tour_id \n\t\t " . get_query_mode_sql() . " \n\t\tORDER BY e.event_start_date DESC,e.id,e.event_is_headline", $_GET['paged']); global $_wt_options; ?> <div class="wrap"> <h2>Events</h2> </div> <ul class="subsubsub" style='float:none;'> <?php link_query_html("all", "All", admin_url("admin.php?page={$page}"), "event_date", $dbQuery["all"], 0); link_query_html("published", "Published", admin_url("admin.php?page={$page}"), "event_date", $dbQuery["published"], 1); link_query_html("upcoming", "Upcoming", admin_url("admin.php?page={$page}"), "event_date", $dbQuery["upcoming"], 0); link_query_html("archive", "Archive", admin_url("admin.php?page={$page}"), "event_date", $dbQuery["archive"], 0); link_query_html("unpublished", "Unpublished", admin_url("admin.php?page={$page}"), "event_date", $dbQuery["unpublished"], 0, 0); ?> </ul> <form method="get" action="<?php echo admin_url("admin.php?page={$page}"); ?> "> <input type="hidden" name="page" value="<?php echo $page; ?> "></input> <input type="hidden" name="event_date" value="<?php echo $_GET["event_date"]; ?> "></input> <select name="date"> <option value="">Show All Dates</option> <?php foreach ($dbQuery["date"] as $date) { echo "<option " . ($date["year"] . $date["month"] == $_GET["date"] ? "selected" : "") . " value=\"" . $date["year"] . $date["month"] . "\">" . $date["month_name"] . " " . $date["year"] . "</option>"; } ?> </select> <?php echo generate_select_html('', 'venue', array_associate_val_to_key($dbQuery["venues"], "venue_id", "venue_name"), $_GET["venue"], array("value" => "", "text" => "Show All Venues")); echo generate_select_html('', 'status', $dbQuery["status"], $_GET["status"], array("value" => "", "text" => "Show All Status")); echo generate_select_html('', 'artist', array_associate_val_to_key($dbQuery["artists"], "artist_id", "artist_name"), $_GET["artist"], array("value" => "", "text" => "Show All Artists")); echo generate_select_html('', 'tour', array_associate_val_to_key($dbQuery["tour"], "tour_id", "tour_name"), $_GET["tour"], array("value" => "", "text" => "Show All Tour")); ?> <input class="button-secondary" type="submit" value="Filter"/> </form> <div style="margin-right:15px;margin-bottom:15px;margin-top:15px;"> <div class="wordtour-alert wordtour-alert-error" style="margin-left:0px;margin-right:0px;"></div> <div class="wordtour-toolbar ui-corner-all" style="margin-left:0px;margin-right:0px;overflow:hidden;"> <div class="ui-helper-clearfix"> <div title="Add New Event" id="wordtour-button-add"></div> <div title="Delete Event" id="wordtour-button-delete"></div> <div class="navigation tablenav"> <?php if ($list->is_paging()) { ?> <div class="tablenav-pages"> <?php $list->render_paging(); ?> </div> <?php } ?> </div> </div> </div> <?php $list->render("events-list", "event_rows"); }
function get_query_mode_sql() { $sql = array(); if (!empty($_GET["artist"])) { $sql[] = "album_artist_id = {$_GET['artist']}"; } if (count($sql) > 0) { return " WHERE " . implode(" AND ", $sql); } return ""; } $dbQuery = array("artists" => WT_Artist::all()); # GENERATE LIST $list = new WT_List(); $list->set_columns('events', array('cb' => '', 'album_id-col' => 'ID', 'album_order-col' => 'Order', 'album_title-col' => 'Title', 'album_artist' => 'Artist', 'album_label' => 'Label')); $list->get_results("SELECT SQL_CALC_FOUND_ROWS * FROM " . WORDTOUR_ALBUMS . " as al LEFT JOIN " . WORDTOUR_ARTISTS . " as a ON a.artist_id = al.album_artist_id " . get_query_mode_sql() . " ORDER BY al.album_title ASC", $_GET['paged']); ?> <div class="wrap"> <h2>Albums</h2> </div> <form method="get" action="<?php echo admin_url("admin.php"); ?> "> <input type="hidden" name="page" value="<?php echo $page; ?> "></input> <?php