public function venues($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::$venue_default, $atts); $theme_file_name = empty($attr["theme_file_name"]) ? 0 : $attr["theme_file_name"]; #VENUE $venues_to_show = empty($attr["venue"]) ? 0 : explode(",", $attr["venue"]); #EXCLUDE VENUES $venues_to_hide = empty($attr["exclude"]) ? 0 : explode(",", $attr["exclude"]); #GENRE $genre_to_show = empty($attr["genre"]) ? 0 : explode(",", $attr["genre"]); #ORDER $order = strtolower($attr["order_by"]) == "name" ? "venue_name" : "venue_order"; #DIRECTION $direction = strtoupper($attr["direction"]) == "ASC" ? "ASC" : "DESC"; #START WITH $start_with = $attr["start_with"]; #TYPE $venue_genre = !empty($attr["genre"]) ? $attr["genre"] : 0; #LIMIT $limit = $attr["limit"] && is_numeric($attr["limit"]) ? " LIMIT {$attr['limit']} " : ""; #COUNTRY $country = !empty($attr["country"]) ? $attr["country"] : 0; $venues = 0; # GET RESULTS $conds = array(); $conds_str = ""; if (!empty($start_with)) { $conds[] = "UPPER(venue.venue_name) LIKE UPPER('{$start_with}%')"; } if ($venues_to_show) { $conds[] = $this->columns_sql("venue.venue_id", $venues_to_show); } if ($venues_to_hide) { $conds[] = $this->columns_sql("venue.venue_id", $venues_to_hide, null, "!="); } if ($country) { $conds[] = "UPPER(venue.venue_country) = '" . strtoupper($country) . "'"; } if ($venue_genre) { $conds_str .= " JOIN wp_wtr_attachment AS att ON venue.venue_id = att.attachment_target_id"; $conds[] = "att.attachment_target='venue'"; $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); } $venues = $wpdb->get_results("SELECT * FROM " . WORDTOUR_VENUES . " as venue {$conds_str} GROUP BY venue.venue_id ORDER BY {$order} {$direction} {$limit}", "ARRAY_A"); $tpl = array(); if ($venues) { foreach ($venues as $venue) { $v = new WT_Venue($venue["venue_id"]); $tpl["data"][] = $v->template($venue); } } else { $tpl["data"] = array(); } include WT_PLUGIN_PATH . 'theme/layout.renderer.php'; return $html; }
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; }
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 venue_rows($rows) { global $wpdb; if (!$rows) { ?> <tr class="empty"> <td colspan="5"><p>No Venues Found</p></td> </tr> <?php return; } else { ?> <?php $venue = new WT_Venue(); foreach ($rows as $row) { echo get_venue_row_html($venue->db_out($row)); } } }
$states = get_states(); ?> <div class="wordtour-selectable"> <?php foreach ($states as $code => $name) { echo "<a class='ui-selectee' href='{$name}'><strong>{$name}</strong></a>"; } ?> </div> <?php } if ($_GET["page"] == "all_venues") { $venues = WT_Venue::all(); $venueObj = new WT_Venue(); ?> <div class="wordtour-selectable"> <?php foreach ($venues as $value) { $venue = $venueObj->db_out($value); $address = array(); if (!empty($venue["venue_city"])) { $address[] = $venue["venue_city"]; } if (!empty($venue["venue_state"])) { $address[] = $venue["venue_state"]; } if (!empty($venue["venue_country"])) { $address[] = $venue["venue_country"]; }
public function import($artist_id = 0) { $results = array(); if (!$artist_id || empty($artist_id)) { $this->is_valid_response('{"error": {"error_type": "Artist Missing", "error_message": "Can\\"t import events without an artist"}}'); } else { // get list of all venues $venues = wt_file_get_contents("http://www.eventbrite.com/json/user_list_venues?app_key={$this->app_key}&user_key={$this->user_key}"); $venues_parents = array(); if ($this->is_valid_response($venues)) { $social = new WT_Social(); try { if (!$this->response["venues"]) { throw new Exception("Connection Error"); } foreach ($this->response["venues"] as $v) { $venue_id = 0; $social_regist = $social->get_by_ref_id($v["venue"]["id"], "venue", "ebvenue"); if (!$social_regist) { $venue_params = array("_nonce" => wp_create_nonce(WT_Venue::NONCE_INSERT), "venue_name" => $v["venue"]["name"], "venue_city" => $v["venue"]["city"], "venue_country" => get_country_by_code($v["venue"]["country_code"]), "venue_state" => get_state_by_code($v["venue"]["region"]), "venue_zip" => $v["venue"]["postal_code"], "venue_address" => $v["venue"]["address"], "venue_tour_status" => 1, "venue_gallery_status" => 1, "venue_video_status" => 1, "venue_flickr_status" => 1, "venue_post_status" => 1); $venue = new WT_Venue(); $venue->insert($venue_params, 0); if ($venue->data) { $venue_id = $venue->data["venue_id"]; $social->insert(wp_create_nonce(WT_SOCIAL::NONCE_INSERT), "ebvenue", $venue->data["venue_id"], $v["venue"]["id"], "venue"); } else { $results["venues"][] = array("venue" => $v["venue"], "msg" => $venue->db_response()); } } else { $venue_id = $social_regist["social_parent_id"]; } if ($venue_id) { $venues_parents[$v["venue"]["id"]] = $venue_id; } } $events = wt_file_get_contents("http://www.eventbrite.com/json/user_list_events?app_key={$this->app_key}&user_key={$this->user_key}"); if ($this->is_valid_response($events)) { if (!$this->response["events"]) { throw new Exception("Connection Error"); } foreach ($this->response["events"] as $e) { if ($e["event"]["status"] != "Canceled") { $social_regist = $social->get_by_ref_id($e["event"]["id"], "event", "ebevent"); if (!$social_regist) { $event_params = array("_nonce" => wp_create_nonce(WT_Event::NONCE_INSERT), "event_title" => $e["event"]["title"], "event_notes" => $e["event"]["description"], "event_start_date" => mysql2date("Y-m-d", $e["event"]["start_date"]), "event_start_time" => mysql2date("H:i:s", $e["event"]["start_date"]), "event_end_date" => mysql2date("Y-m-d", $e["event"]["end_date"]), "event_end_time" => mysql2date("H:i:s", $e["event"]["end_date"]), "event_venue_id" => $venues_parents[$e["event"]["venue"]["id"]], "event_artist_id" => $artist_id, "event_published" => 1, 'event_status' => $e["event"]["status"] == "Canceled" ? "cancelled" : "active", "tkts_url" => $e["event"]["url"], "tkts_price" => $e["ticket"]["price"] . $e["ticket"]["currency"], 'comment_status' => 1, 'rsvp_status' => 1, 'gallery_status' => 1, 'flickr_status' => 1, 'post_status' => 1, 'video_status' => 1); $event = new WT_Event(); $event->insert($event_params, 0); if ($event->data) { $event_id = $event->data["event_id"]; $social->insert(wp_create_nonce(WT_SOCIAL::NONCE_INSERT), "ebevent", $event->data["event_id"], $e["event"]["id"], "event"); } else { $results["events"][] = array("event" => $e["event"], "msg" => $event->db_response()); } } } } $this->response = array("type" => "success", "log" => $results); return 1; } } catch (Exception $e) { $this->is_valid_response(0); } } } $this->response = array("type" => "error", "log" => $this->response); }
$venue->delete_all(json_decode(stripslashes($_POST["id"])), $_POST["_nonce"]); $venue->db_response("json"); } break; case "default_venue": $id = $_POST["venue_id"]; if ($id) { $venue = new WT_Venue($id); $venue->set_default(1); $venue->db_response("json"); } break; case "remove_default_venue": $id = $_POST["venue_id"]; if ($id) { $venue = new WT_Venue($id); $venue->set_default(""); $venue->db_response("json"); } break; // ALBUM // ALBUM case "get_album": $album = new WT_Album($_POST["album_id"]); if (!empty($_POST["album_id"])) { $album->retrieve(); } else { $album->defaults(); } echo json_encode($album->db_out(null, 0)); break;