} 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; case "insert_album": $album = new WT_Album(); $album->insert($_POST); $album->db_response("json"); break; case "update_album": $album = new WT_Album($_POST["album_id"]); $album->update($_POST); $album->db_response("json"); break;
public function single($page = 0, $id) { if ($page && $id) { require_once ABSPATH . "wp-load.php"; require_once WT_PLUGIN_PATH . "admin/template.php"; require_once WT_PLUGIN_PATH . "admin/handlers.php"; $dwoo = new Dwoo(); switch ($page) { case "event": $event_id = $id; if ($event_id) { $event = new WT_Event($event_id); $event->retrieve(); } break; case "artist": $artist_id = $id; if ($artist_id) { $artist = new WT_Artist($artist_id); $artist->retrieve(); } break; case "tour": $tour_id = $id; if ($tour_id) { $tour = new WT_Tour($tour_id); $tour->retrieve(); } break; case "venue": $venue_id = $id; if ($venue_id) { $venue = new WT_Venue($venue_id); $venue->retrieve(); } break; case "album": $album_id = $id; if ($album_id) { $album = new WT_Album($album_id); $album->retrieve(); } break; } $tpl = new WT_Theme(); include $tpl->single_path(); exit; } }
public function similar($data = 0) { global $wpdb; $result = array(); try { if (!$data) { $data = $this->data["album_genre"]; } $artist_id = $this->data["album_artist_id"]; $album_id = $this->data["album_id"]; if ($data) { $genres = array(); foreach ($data as $genre) { $genres[] = "att.attachment_info='{$genre['0']}'"; } if (count($genres)) { $genre_sql = "(" . implode(" OR ", $genres) . ")"; $sql = "SELECT * FROM " . WORDTOUR_ALBUMS . " as album \n\t\t\t\t\t\t\tJOIN " . WORDTOUR_ATTACHMENT . " AS att ON album.album_id = att.attachment_target_id \n\t\t\t\t\t\t\tAND att.attachment_target='album' AND att.attachment_type='genre' AND album.album_id != {$album_id} \n\t\t\t\t\t\t\tAND {$genre_sql} GROUP BY album.album_id ORDER BY album.album_title LIMIT 5"; $albums = $wpdb->get_results($sql, "ARRAY_A"); $albums_obj = new WT_Album(); foreach ($albums as $album) { $albums_obj->id = $album["album_id"]; $albums_obj->retrieve(); $result[] = $albums_obj->template(); } } } } catch (Exception $e) { return array(); } return $result; }