function display_content() { $team = $this->get_item(); $db = new KKL_DB(); $seasons = $db->getSeasons(); $season_options = array("" => __('please_select', 'kkl-ligatool')); foreach ($seasons as $season) { $season_options[$season->id] = $season->name; } $clubs = $db->getClubs(); $club_options = array("" => __('please_select', 'kkl-ligatool')); foreach ($clubs as $club) { $club_options[$club->id] = $club->name; } $locations = $db->getLocations(); $location_options = array("" => __('please_select', 'kkl-ligatool')); foreach ($locations as $location) { $location_options[$location->id] = $location->title; } $leaguewinner_checked = $team->properties && array_key_exists('current_league_winner', $team->properties); if ($this->errors && $_POST['current_league_winner']) { $leaguewinner_checked = true; } $cupwinner_checked = $team->properties && array_key_exists('current_cup_winner', $team->properties); if ($this->errors && $_POST['current_cup_winner']) { $cupwinner_checked = true; } echo $this->form_table(array(array('type' => 'hidden', 'name' => 'id', 'value' => $team->id), array('title' => __('name', 'kkl-ligatool'), 'type' => 'text', 'name' => 'name', 'value' => $this->errors ? $_POST['name'] : $team->name, 'extra' => $this->errors['name'] ? array('style' => "border-color: red;") : array()), array('title' => __('url_code', 'kkl-ligatool'), 'type' => 'text', 'name' => 'short_name', 'value' => $this->errors ? $_POST['short_name'] : $team->short_name, 'extra' => $this->errors['short_name'] ? array('style' => "border-color: red;") : array()), array('title' => __('season', 'kkl-ligatool'), 'type' => 'select', 'name' => 'season', 'choices' => $season_options, 'selected' => $this->errors ? $_POST['season'] : $team->season_id, 'extra' => $this->errors['season'] ? array('style' => "border-color: red;") : array()), array('title' => __('club', 'kkl-ligatool'), 'type' => 'select', 'name' => 'club', 'choices' => $club_options, 'selected' => $this->errors ? $_POST['club'] : $team->club_id, 'extra' => $this->errors['club'] ? array('style' => "border-color: red;") : array()), array('title' => __('location', 'kkl-ligatool'), 'type' => 'select', 'name' => 'location', 'choices' => $location_options, 'selected' => $this->errors ? $_POST['location'] : $team->properties['location']), array('title' => __('current_league_winner', 'kkl-ligatool'), 'type' => 'checkbox', 'name' => 'current_league_winner', 'checked' => $leaguewinner_checked), array('title' => __('current_cup_winner', 'kkl-ligatool'), 'type' => 'checkbox', 'name' => 'current_cup_winner', 'checked' => $cupwinner_checked))); }
function display_content() { $day = $this->get_item(); $number_options = array("" => __('please_select', 'kkl-ligatool')); for ($i = 1; $i < 21; $i++) { $number_options[$i] = $i; } $db = new KKL_DB(); $seasons = $db->getSeasons(); $season_options = array("" => __('please_select', 'kkl-ligatool')); foreach ($seasons as $season) { $season_options[$season->id] = $season->name; } echo $this->form_table(array(array('type' => 'hidden', 'name' => 'id', 'value' => $day->id), array('title' => __('number', 'kkl-ligatool'), 'type' => 'select', 'name' => 'number', 'choices' => $number_options, 'selected' => $this->errors ? $_POST['season'] : $day->number, 'extra' => $this->errors['number'] ? array('style' => "border-color: red;") : array()), array('title' => __('season', 'kkl-ligatool'), 'type' => 'select', 'name' => 'season', 'choices' => $season_options, 'selected' => $this->errors ? $_POST['season'] : $day->season_id, 'extra' => $this->errors['season'] ? array('style' => "border-color: red;") : array()), array('title' => __('start_date', 'kkl-ligatool'), 'type' => 'text', 'name' => 'start_date', 'extra' => array('class' => 'datetimepicker'), 'value' => $this->cleanDate($day->fixture)), array('title' => __('end_date', 'kkl-ligatool'), 'type' => 'text', 'name' => 'end_date', 'extra' => array('class' => 'datetimepicker'), 'value' => $day->end))); }
function display_content() { $league = $this->get_item(); $db = new KKL_DB(); $seasons = $db->getSeasons(); $season_options = array("" => __('please_select', 'kkl-ligatool')); foreach ($seasons as $season) { $season_options[$season->id] = $season->name; } $active_checked = $league->active == 1; if ($this->errors && $_POST['active']) { $active_checked = true; } echo $this->form_table(array(array('type' => 'hidden', 'name' => 'id', 'value' => $league->id), array('title' => __('name', 'kkl-ligatool'), 'type' => 'text', 'name' => 'name', 'value' => $this->errors ? $_POST['name'] : $league->name, 'extra' => $this->errors['name'] ? array('style' => "border-color: red;") : array()), array('title' => __('url_code', 'kkl-ligatool'), 'type' => 'text', 'name' => 'url_code', 'value' => $this->errors ? $_POST['url_code'] : $league->code, 'extra' => $this->errors['url_code'] ? array('style' => "border-color: red;") : array()), array('title' => __('active', 'kkl-ligatool'), 'type' => 'checkbox', 'name' => 'active', 'checked' => $active_checked), array('title' => __('current_season', 'kkl-ligatool'), 'type' => 'select', 'name' => 'season', 'choices' => $season_options, 'selected' => $this->errors ? $_POST['season'] : $league->current_season, 'extra' => $this->errors['season'] ? array('style' => "border-color: red;") : array()))); }
function get_seasons() { if ($this->seasons) { return $this->seasons; } $db = new KKL_DB(); $seasons = $db->getSeasons(); $keyed = array(); foreach ($seasons as $season) { $keyed[$season->id] = $season; } $this->seasons = $keyed; return $keyed; }