public function get_clubs_information() { $db = new PHPLeague_Database(); $clubs = $db->get_every_club(0, 999); $output = '<table id="phpleague">'; $output .= '<thead><tr><th>' . __('Club', 'phpleague') . '</th><th>' . __('Coach: ', 'phpleague') . '</th><th>' . __('Venue', 'phpleague') . '</th></tr><thead>'; $output .= '<tbody>'; foreach ($clubs as $club) { $info = $db->get_club_information($club->id); $output .= '<tr><td colspan="3"><hr /></td></tr>'; $output .= '<tr><td>' . esc_html($info->name) . '</td><td>' . esc_html($info->coach) . '</td><td>' . esc_html($info->venue) . '</td></tr>'; $output .= '<tr><td></td><td>' . esc_html($info->address) . '</td><td>' . esc_html($info->training_time) . '</td></tr>'; } $output .= '</tbody></table>'; return $output; }
/** * Show the club information. * * @param integer $id * @return string */ public function get_club_information($id = NULL) { global $wpdb; $db = new PHPLeague_Database(); // League not found in the database if ($db->is_club_unique($id, 'id') === TRUE) { return; } $info = $db->get_club_information($id); if ($info->creation == 0) { $creation = ''; } else { $creation = (int) $info->creation; } $output = '<table id="phpleague"><caption>' . esc_html($info->name) . __(' Factfile', 'phpleague') . '</caption><tbody>'; $output .= '<tr><th rows="2">' . __('Details', 'phpleague') . '</th></tr>'; $output .= '<tr><td><strong>' . __('Name: ', 'phpleague') . '</strong></td><td>' . esc_html($info->name) . '</td></tr>'; $output .= '<tr><td><strong>' . __('Coach: ', 'phpleague') . '</strong></td><td>' . esc_html($info->coach) . '</td></tr>'; $output .= '<tr><td><strong>' . __('Venue: ', 'phpleague') . '</strong></td><td>' . esc_html($info->venue) . '</td></tr>'; $output .= '<tr><td><strong>' . __('Website: ', 'phpleague') . '</strong></td><td><a href="' . esc_html($info->website) . '">' . esc_html($info->website) . '</a></td></tr>'; $output .= '<tr><td><strong>' . __('Creation: ', 'phpleague') . '</strong></td><td>' . $creation . '</td></tr>'; $output .= '</tbody></table>'; return $output; }