/** * Top 100 tracks by vote * @param string[] $atts * @return string */ public function top_hundred($atts) { $top = Track::top_hundred_by_vote(); $out = array(); $out[] = "<p>"; $n = 1; $out = array(); foreach ($top as $result) { $out[] = "<b>#{$n}</b> " . esc_html($result['stream_title']) . " (score: " . $result['vote_total'] . ")<br />\n"; $n++; } $out[] = "</p>\n"; return implode($out); }
private function q_top_hundred() { $v = $this->view; $start_time = trim($v['start_date'] . ' ' . $v['start_time']); $end_time = trim($v['end_date'] . ' ' . $v['end_time']); $title = trim($start_time . ' – ' . $end_time); $results = Track::top_hundred_by_vote($start_time, $end_time); $votes = 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>'; $votes[] = $result; } $cols = array('artist_link' => 'Artist', 'title_link' => 'Title', 'vote_total' => 'Vote Total'); ob_start(); include PLUGIN_DIR . 'views/results_top_hundred.php'; return ob_get_clean(); }