Ejemplo n.º 1
0
 /**
  * Show one specific fixture.
  *
  * @param  integer $id_fixture
  * @return string
  */
 public function get_league_fixture($id_fixture)
 {
     global $wpdb;
     $db = new PHPLeague_Database();
     // Fixture not found in the database
     if ($db->is_fixture_exists((int) $id_fixture) === FALSE) {
         return;
     }
     $output = '<table id="phpleague"><tbody><tr>' . '<th>' . __('Date', 'phpleague') . '</th>' . '<th>' . __('Match', 'phpleague') . '</th>' . '<th class="centered">' . __('Score', 'phpleague') . '</th></tr>';
     foreach ($db->get_fixture_results((int) $id_fixture) as $row) {
         $output .= '<tr>';
         $output .= '<td>' . strftime("%a %e %b, %H:%M", strtotime($row->played)) . '</td>';
         $output .= '<td>' . esc_html($row->home_name) . ' - ' . esc_html($row->away_name) . '</td>';
         if (date('Y-m-d') >= $row->played) {
             $output .= '<td class="centered">' . $row->goal_home . ' - ' . $row->goal_away . '</td>';
         } else {
             $output .= '<td class="centered"> - </td>';
         }
         $output .= '</tr>';
     }
     $output .= '</tbody></table>';
     return $output;
 }