Ejemplo n.º 1
0
 private function q_track()
 {
     $v = $this->view;
     $track_id = Track::get_id($v['artist'] . ' -  ' . $v['title']);
     if ($track_id) {
         $results = Vote::get_votes_by_track_id($track_id);
         $votes = array();
         foreach ($results as $result) {
             $result['nick_link'] = '<a href="' . $this->link_url(array('music_query' => 'nick', 'nick' => $result['nick'])) . '">' . esc_html($result['nick']) . '</a>';
             $votes[] = $result;
         }
         $cols = array('time_utc' => 'Time (UTC)', 'nick_link' => 'Nick', 'value' => 'Vote Value');
         $t = Track::get($track_id);
         //$stream_title = (Track::get( $track_id ))->stream_title;
         $stream_title = $t->stream_title;
         ob_start();
         include PLUGIN_DIR . 'views/results_votes_for_track.php';
         return ob_get_clean();
     } else {
         $results = Track::search($v['artist'], $v['title']);
         $tracks = array();
         foreach ($results as $result) {
             $result['artist_link'] = '<a href="' . $this->link_url(array('music_query' => 'track', 'artist' => $result['artist'])) . '">' . esc_html($result['artist']) . '</a>';
             $result['title_link'] = '<a href="' . $this->link_url(array('music_query' => 'track', 'artist' => $result['artist'], 'title' => $result['title'])) . '">' . esc_html($result['title']) . '</a>';
             $tracks[] = $result;
         }
         $cols = array('artist_link' => 'Artist', 'title_link' => 'Title', 'play_count' => 'Play Count', 'vote_count' => 'Vote Count', 'vote_total' => 'Vote Total');
         $title = array();
         if ($v['artist']) {
             $title[] = 'Artist "' . $v['artist'] . '"';
         }
         if ($v['title']) {
             $title[] = 'Title "' . $v['title'] . '"';
         }
         $title = implode(', ', $title);
         ob_start();
         include PLUGIN_DIR . 'views/results_track_search.php';
         return ob_get_clean();
     }
 }