function get_tour_field() { echo '<select id="wt-sc-tour" name="tour" size="7" style="height:auto;width:100%;" MULTIPLE="true"> <option selected="true">All Tour</option>'; $tours = WT_Tour::all(); foreach ($tours as $tour) { echo "<option value=" . $tour["tour_id"] . ">" . $tour["tour_name"] . "</option>"; } echo '</select>'; }
public function template($data = null, $show_poster = 0, $show_artist_poster = 0) { global $_wt_options; if (!$data) { $data = $this->data; } $db = $this->dbprepere; // get artist info $artist = new WT_Artist($data["event_artist_id"]); $artist_data = $artist->template($data); // get venue info $venue = new WT_Venue($data["event_venue_id"]); $venue_data = $venue->template($data); // get tour info if ($data["event_tour_id"] > 0) { $tour = new WT_Tour($data["event_tour_id"]); $tour_data = $tour->template($data); } $event_poster_id = $data["event_thumbnail"] ? $data["event_thumbnail"]["id"] : $this->get_thumbnail("event"); $event_poster = $db->media_out($event_poster_id); if ($data["event_on_sale"] == "0000-00-00") { $onsale = ""; } else { $onsale_date = strtotime($data["event_on_sale"]); if ($onsale_date < time()) { $onsale = ""; } else { $onsale = $data["event_on_sale"]; } } $opening = array(); $opening_array = array(); if (is_array($data["event_more_artists"])) { foreach ($data["event_more_artists"] as $a) { $opening[] = ucwords($a["name"]); $a["url"] = $db->link_out(wt_get_permalink("artist", $a["id"], array("%name%" => $a["name"]))); $opening_array[] = $a; } $opening = implode(", ", $opening); } $genre = $this->get_genre_tpl("event"); $google_map_str = wt_get_map_str($data); $tpl = array("show_comments" => $db->int_out($data["comment_status"]), "show_rsvp" => $db->int_out($data["rsvp_status"]), "show_gallery" => $db->int_out($data["gallery_status"]), "show_flickr" => $db->int_out($data["flickr_status"]), "date" => $db->date_display($data["event_start_date"]), "date_raw" => $data["event_start_date"], "genre" => implode(", ", $genre), "genre_array" => $genre, "artists" => $db->str_out($opening, 1), "artists_array" => $opening_array, "opening" => $db->str_out($data["event_opening_act"], 1), "onsale" => $onsale, "time" => $db->time_out($data["event_start_time"]), "end_date_raw" => $data["event_end_date"], "end_date" => $db->date_display($data["event_end_date"]), "end_time" => $db->time_out($data["event_end_time"]), "status" => $data["event_status"], "description" => $db->html_out($data["event_notes"]), "short_description" => $db->html_teaser_out($data["event_notes"]), "title" => $db->str_out($data["event_title"], 1), "type" => !empty($data["event_type"]) ? $db->str_out(ucwords($data["event_type"]), 1) : "", "artist" => $artist_data, "tour" => $tour_data, "venue" => $venue_data, "poster" => $event_poster, "tickets" => $db->link_out($data["tkts_url"]), "phone" => $db->str_out($data["tkts_phone"]), "admission" => $db->str_out($data["tkts_price"]), "comments" => $db->int_out($data["comment_count"]), "rsvp" => $db->int_out($data["rsvp_count"]), "url" => $db->link_out(wt_get_permalink("event", $data["event_id"], array("%date%" => $data["event_start_date"], "%name%" => $data["venue_name"]))), "machinetag" => $machinetag); return $tpl; }
public function tours($atts = null, $content = null, $code = "") { global $wpdb, $_wt_options; require_once WT_PLUGIN_PATH . 'admin/template.php'; require_once WT_PLUGIN_PATH . 'admin/handlers.php'; require_once WT_PLUGIN_PATH . 'dwoo/dwooAutoload.php'; $dwoo = new Dwoo(); # CONFIG PARAMS $attr = shortcode_atts(self::$tour_default, $atts); # TEMPLATE #ARTIST $artist_to_show = empty($attr["artist"]) ? 0 : explode(",", $attr["artist"]); #TOUR $tour_to_show = empty($attr["tour"]) ? 0 : explode(",", $attr["tour"]); #ORDER $order = strtolower($attr["order_by"]) == "name" ? "tour_name" : "tour_order"; #DIRECTION $direction = strtoupper($attr["direction"]) == "ASC" ? "ASC" : "DESC"; #START WITH $start_with = $attr["start_with"]; $theme_file_name = empty($attr["theme_file_name"]) ? 0 : $attr["theme_file_name"]; #TOUR $tours_to_show = empty($attr["tour"]) ? 0 : explode(",", $attr["tour"]); #EXCLUDE TOUR $tours_to_hide = empty($attr["exclude"]) ? 0 : explode(",", $attr["exclude"]); #ARTIST $artists_to_show = empty($attr["artist"]) ? 0 : explode(",", $attr["artist"]); #GENRE $genre_to_show = empty($attr["genre"]) ? 0 : explode(",", $attr["genre"]); #ORDER $order = strtolower($attr["order_by"]) == "name" ? "tour_name" : "tour_order"; #DIRECTION $direction = strtoupper($attr["direction"]) == "ASC" ? "ASC" : "DESC"; #START WITH $start_with = $attr["start_with"]; #TYPE $tour_genre = !empty($attr["genre"]) ? $attr["genre"] : 0; #LIMIT $limit = $attr["limit"] && is_numeric($attr["limit"]) ? " LIMIT {$attr['limit']} " : ""; $tours = 0; # GET RESULTS $conds = array(); $conds_str = ""; if (!empty($start_with)) { $conds[] = "UPPER(tour.tour_name) LIKE UPPER('{$start_with}%')"; } if ($tours_to_show) { $conds[] = $this->columns_sql("tour.tour_id", $tours_to_show); } if ($tours_to_hide) { $conds[] = $this->columns_sql("tour.tour_id", $tours_to_hide, null, "!="); } if ($tour_genre) { $conds_str .= " JOIN wp_wtr_attachment AS att ON tour.tour_id = att.attachment_target_id"; $conds[] = "att.attachment_target='tour'"; $conds[] = "att.attachment_type='genre'"; $conds[] = $this->columns_sql("att.attachment_info", $genre_to_show); } if (count($conds) > 0) { $conds_str .= " WHERE " . implode(" AND ", $conds); } $tours = $wpdb->get_results("SELECT * FROM " . WORDTOUR_TOUR . " as tour {$conds_str} GROUP BY tour.tour_id ORDER BY {$order} {$direction} {$limit}", "ARRAY_A"); if ($artists_to_show) { // get all ids of tour $tours_to_show = array(); foreach ($tours as $tour) { $tours_to_show[] = $tour["tour_id"]; } $conds = array(); $conds[] = $this->columns_sql("event.event_tour_id", $tours_to_show); $conds[] = $this->columns_sql("event.event_artist_id", $artists_to_show); if (count($conds) > 0) { $conds_str .= " WHERE " . implode(" AND ", $conds); } $artist_tours = $wpdb->get_results("SELECT event.event_tour_id FROM " . WORDTOUR_EVENTS . " as event {$conds_str}", "ARRAY_A"); $tours_to_show = array(); foreach ($artist_tours as $artist_tour) { $tours_to_show[] = $artist_tour["event_tour_id"]; } $tours_to_show = array_unique($tours_to_show); $new_tours = array(); foreach ($tours as $tour) { if (in_array($tour["tour_id"], $tours_to_show)) { $new_tours[] = $tour; } } $tours = $new_tours; } $tpl = array(); if ($tours) { foreach ($tours as $tour) { $t = new WT_Tour($tour["tour_id"]); $tpl["data"][] = $t->template($tour); } } else { $tpl["data"] = 0; } include WT_PLUGIN_PATH . 'theme/layout.renderer.php'; return $html; }
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 tour_rows($rows) { global $wpdb; if (!$rows) { ?> <tr class="empty"> <td colspan="3"><p>No Tours Found</p></td> </tr> <?php } else { ?> <?php $tour = new WT_Tour(); foreach ($rows as $row) { echo get_tour_row_html($tour->db_out($row)); } } }
?> <div class="wordtour-selectable"> <?php foreach ($artists as $value) { $artist = $artistObj->db_out($value); echo "<a class='ui-selectee' href='#'><strong>{$artist['artist_name']}</strong></a>"; } ?> </div> <?php } if ($_GET["page"] == "all_tour") { $tours = WT_Tour::all(); $tourObj = new WT_Tour(); ?> <div class="wordtour-selectable"> <?php foreach ($tours as $value) { $tour = $tourObj->db_out($value); echo "<a class='ui-selectee' href='#'><strong>{$tour['tour_name']}</strong></a>"; } ?> </div> <?php } if ($_GET["page"] == "venues") { $is_default = $_wt_options->options("default_venue") == $venue_id ? 1 : 0;
function wt_get_tour($artist_id = 0, $order = "order") { $order = $order == "order" ? "tour_order" : "tour_name"; $data = array(); if ($artist_id) { $data = WT_Tour::all_by_artist($artist_id, $order); } else { $data = WT_Tour::all($order); } foreach ($data as $key => $value) { $data[$key] = WT_Tour::tpl(WT_Tour::db_out($value)); } return $data; }
if ($id) { $tour = new WT_Tour($id); $tour->set_default(""); $tour->db_response("json"); } break; case "delete_tour": unset($_POST["action"]); $tour = new WT_Tour($_POST["tour_id"]); $tour->delete($_POST["_nonce"]); $tour->db_response("json"); break; case "delete_all_tour": unset($_POST["action"]); if ($_POST["id"]) { $tour = new WT_Tour(); $tour->delete_all(json_decode(stripslashes($_POST["id"])), $_POST["_nonce"]); $tour->db_response("json"); } break; // GALLERY // GALLERY case "get_gallery": $gallery = new WT_Gallery($_POST["gallery_id"]); if (!empty($_POST["gallery_id"])) { $gallery->retrieve(); } else { $gallery->defaults(); } echo json_encode($gallery->db_out(null, 0)); break;