public function retrieve() { global $wpdb, $_wt_options; $id = $this->id; $data = null; if ($id) { $data = $wpdb->get_results($wpdb->prepare("SELECT \n\t\t\t\t* \n\t\t\t\tFROM " . WORDTOUR_EVENTS . " AS e \n\t\t\t\tLEFT JOIN " . WORDTOUR_VENUES . " AS v \n\t\t\t\tON e.event_venue_id = v.venue_id \n\t\t\t\tLEFT JOIN " . WORDTOUR_ARTISTS . " AS a\n\t\t\t\tON e.event_artist_id = a.artist_id \n\t\t\t\tLEFT JOIN " . WORDTOUR_TOUR . " AS t\n\t\t\t\tON e.event_tour_id = t.tour_id \n\t\t\t\tLEFT JOIN " . WORDTOUR_EVENTS_META . " AS m ON e.event_meta_id = m.meta_id\n\t\t\t\tWHERE e.event_id = {$id} ORDER BY id ASC"), "ARRAY_A"); if (is_array($data)) { $event = $data[0]; $event["event_more_artists"] = array(); foreach ($data as $e) { if (!$e["event_is_headline"]) { $event["event_more_artists"][] = array("id" => $e["artist_id"], "name" => $e["artist_name"]); } } $event_wpdb = clone $wpdb; $this->meta_id = $event["event_meta_id"]; $social = new WT_Social(); $fbstatus = $social->get_by_event($this->id, "fbstatus"); $ebstatus = $social->get_by_event($this->id, "ebevent"); $fbevent = $social->get_by_event($this->id, "fbevent"); $twitter = $social->get_by_event($this->id, "twitter"); $post = $social->get_by_event($this->id, "post"); $data = array_merge($data, array("post_ref_id" => $post ? admin_url("post.php?action=edit&post={$post['social_ref_id']}") : 0, "facebook_event_id" => $fbevent ? $fbevent["social_ref_id"] : 0, "twitter_status_date" => $twitter ? $twitter["social_publish_time"] : 0, "facebook_status_date" => $fbstatus ? $fbstatus["social_publish_time"] : 0, "eventbrite_status_date" => $ebstatus ? $ebstatus["social_publish_time"] : 0, "eventbrite_event_id" => $ebstatus ? $ebstatus["social_ref_id"] : 0)); $event["event_thumbnail"] = get_attachment_data($this->get_thumbnail("event")); $event["event_videos"] = $this->get_videos("event"); $event["event_gallery"] = $this->get_gallery("event"); $event["event_category"] = $this->get_category("event"); $event["event_genre"] = $this->get_genre("event"); } } //$this->db_result("error",$event_wpdb,array("msg"=>"Can't retrieve event(<i>Missing event id</i>)")); return parent::retrieve($event); }
public function retrieve() { global $wpdb, $_wt_options; $tour_id = $this->id; $tour = null; if ($tour_id) { $tour = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_TOUR . " WHERE tour_id={$tour_id}"), "ARRAY_A"); if ($tour) { $tour = array_merge($tour, array("is_default" => $_wt_options->options("default_tour") == $tour_id ? 1 : 0, "tour_thumbnail" => get_attachment_data($this->get_thumbnail("tour")), "tour_videos" => $this->get_videos("tour"), "tour_gallery" => $this->get_gallery("tour"), "tour_category" => $this->get_category("tour"), "tour_genre" => $this->get_genre("tour"))); } } return parent::retrieve($tour); }
public function retrieve() { global $wpdb, $_wt_options; $track_id = $this->id; $track = null; if ($track_id) { $track = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_TRACKS . " AS t LEFT JOIN " . WORDTOUR_ARTISTS . " AS a ON t.track_artist_id = a.artist_id WHERE t.track_id={$track_id}"), "ARRAY_A"); if ($track) { $track["track_thumbnail"] = get_attachment_data($this->get_thumbnail("track")); $track["track_genre"] = $this->get_genre("track"); } } return parent::retrieve($track); }
public function retrieve() { global $wpdb, $_wt_options; $album_id = $this->id; $album = null; if ($album_id) { $album = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_ALBUMS . " AS t LEFT JOIN " . WORDTOUR_ARTISTS . " AS a ON t.album_artist_id = a.artist_id WHERE t.album_id={$album_id}"), "ARRAY_A"); if ($album) { $album["album_thumbnail"] = get_attachment_data($this->get_thumbnail("album")); $album["album_tracks"] = $this->get_tracks(); $album["album_genre"] = $this->get_genre("album"); } } return parent::retrieve($album); }
public function retrieve() { global $wpdb, $_wt_options; $id = $this->id; $data = null; if ($id) { $data = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_VENUES . " WHERE venue_id={$id}"), "ARRAY_A"); if ($data) { $data["is_default"] = $_wt_options->options("default_venue") == $id ? 1 : 0; $data["venue_thumbnail"] = get_attachment_data($this->get_thumbnail("venue")); $data["venue_videos"] = $this->get_videos("venue"); $data["venue_gallery"] = $this->get_gallery("venue"); $data["venue_category"] = $this->get_category("venue"); } } return parent::retrieve($data); }
public function retrieve() { global $wpdb, $_wt_options; $artist_id = $this->id; $artist = null; if ($artist_id) { $artist = $wpdb->get_row($wpdb->prepare("SELECT * FROM " . WORDTOUR_ARTISTS . " WHERE artist_id={$artist_id}"), "ARRAY_A"); if ($artist) { $artist["is_default"] = $_wt_options->options("default_artist") == $artist_id ? 1 : 0; $artist["artist_thumbnail"] = get_attachment_data($this->get_thumbnail("artist")); $artist["artist_videos"] = $this->get_videos("artist"); $artist["artist_gallery"] = $this->get_gallery("artist"); $artist["artist_category"] = $this->get_category("artist"); $artist["artist_genre"] = $this->get_genre("artist"); } } return parent::retrieve($artist); }