Пример #1
0
 /**
  * Form method
  *
  * @param  mixed $instance
  * @return void
  */
 public function form($instance)
 {
     // PHPLeague_Tools
     $tools = new PHPLeague_Tools();
     // Get all leagues in the database
     global $wpdb;
     $leagues = $wpdb->get_results($wpdb->prepare("SELECT id, name, year FROM {$wpdb->league} ORDER BY year DESC, name ASC", ARRAY_A));
     // Get leagues list
     $leagues_list = array();
     foreach ($leagues as $item) {
         $year = (int) $item->year;
         $leagues_list[$item->name][$item->id] = $year . '/' . substr($year + 1, 2);
     }
     // Display the dropdown list with selected league
     echo $tools->select(esc_attr($this->get_field_name('league_id')), $leagues_list, (int) $instance['league_id'], array('id' => esc_attr($this->get_field_id('league_id'))));
 }
Пример #2
0
            <p><?php 
_e('Display all fixtures for a chosen league or only those for a team into that particular league.', 'phpleague');
?>
</p>
        </div>
        <!-- fixture panel -->
        <div id="fixture_panel" class="panel"><br />
            <table style="border: 0;" cellpadding="5">
                <tr>
                    <td><label for="fixture_id"><?php 
_e('Fixture', 'phpleague');
?>
</label></td>
                    <td>
                        <?php 
echo $tools->select('fixture_id', $fixtures_list, '', array('id' => 'fixture_id', 'style' => 'width: 200px;'));
?>
                    </td>
                </tr>
            </table>
        </div>
        <!-- clubs panel -->
        <div id="clubs_panel" class="panel"><br />
            <table style="border: 0;" cellpadding="5">
                <tr>
                    <td><label for="club_id"><?php 
_e('Club', 'phpleague');
?>
</label></td>
                    <td>
                        <select id="club_id" name="club_id" style="width: 200px;">