Example #1
0
 public function widget($args, $instance)
 {
     extract($args);
     $db = new KKL_DB();
     $league_id = $instance['league'];
     if (!$league_id) {
         $context = KKL::getContext();
         $league = $context['league'];
     } else {
         $league = $db->getLeague($league_id);
     }
     $seasons = $db->getSeasonsByLeague($league->id);
     foreach ($seasons as $season) {
         $season->link = KKL::getLink('league', array('league' => $league->code, 'season' => date('Y', strtotime($season->start_date))));
     }
     if (!empty($seasons)) {
         $title = apply_filters('widget_title', $instance['title']);
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title . $title . $after_title;
         }
         echo $this->tpl->render('widgets/other_seasons.tpl', array('seasons' => $seasons));
         echo $after_widget;
     }
 }
Example #2
0
 public function widget($args, $instance)
 {
     extract($args);
     $db = new KKL_DB();
     $leagues = $db->getInactiveLeagues();
     foreach ($leagues as $league) {
         $season = $db->getSeason($league->current_season);
         $league->link = KKL::getLink('league', array('league' => $league->code, 'season' => date('Y', strtotime($season->start_date))));
     }
     if (!empty($leagues)) {
         $title = apply_filters('widget_title', $instance['title']);
         echo $before_widget;
         if (!empty($title)) {
             echo $before_title . $title . $after_title;
         }
         echo $this->tpl->render('widgets/other_leagues.tpl', array('leagues' => $leagues));
         echo $after_widget;
     }
 }
Example #3
0
 public function widget($args, $instance)
 {
     extract($args);
     $title = apply_filters('widget_title', $instance['title']);
     echo $before_widget;
     if (!empty($title)) {
         echo $before_title . $title . $after_title;
     }
     $db = new KKL_DB();
     $league_id = $instance['league'];
     if (!$league_id) {
         $context = KKL::getContext();
         $league_id = $context['league']->id;
         if (!$league_id) {
             $team = $context['team'];
             if ($team) {
                 $current_team = $db->getCurrentTeamForClub($team->club_id);
                 $data = $db->getGamesForTeam($current_team->id);
                 echo $this->tpl->render('widgets/upcoming_games.tpl', array('schedule' => $data, 'display_result' => true));
             } else {
                 $data = $db->getAllUpcomingGames();
                 $games = array();
                 $leagues = array();
                 foreach ($data as $game) {
                     $leagues[$game->league_id] = true;
                     $games[$game->league_id][] = $game;
                 }
                 foreach (array_keys($leagues) as $league_id) {
                     $league = $db->getLeague($league_id);
                     echo $this->tpl->render('widgets/upcoming_games.tpl', array('schedule' => $games[$league_id], 'league' => $league));
                 }
             }
         } else {
             $data = $db->getUpcomingGames($league_id);
             echo $this->tpl->render('widgets/upcoming_games.tpl', array('schedule' => $data));
         }
     }
     echo $after_widget;
 }
Example #4
0
<?php

$kkl = new KKL();
$team = get_query_var('team');
$context = $kkl->getContextByTeamCode($team);
KKL::setContext($context);
/*
Template Name: Team Detail
*/
get_header();
?>

<section class="contentWrapper">
  <div class="container">
    <div class="row">

      <div class="span5 teamDetail">
        <?php 
get_template_part('loop', 'team');
?>
      </div><!-- .content -->

      <aside class="span2">
        <ul><?php 
dynamic_sidebar('kkl_teamdetail_sidebar');
?>
</ul>
        <ul><?php 
dynamic_sidebar('kkl_global_sidebar');
?>
</ul>
Example #5
0
    require_once dirname(__FILE__) . '/KKL/Backend/KKL_Admin_Page.php';
    require_once dirname(__FILE__) . '/KKL/Backend/KKL_League_Admin_Page.php';
    require_once dirname(__FILE__) . '/KKL/Backend/KKL_Club_Admin_Page.php';
    require_once dirname(__FILE__) . '/KKL/Backend/KKL_GameDay_Admin_Page.php';
    require_once dirname(__FILE__) . '/KKL/Backend/KKL_Match_Admin_Page.php';
    require_once dirname(__FILE__) . '/KKL/Backend/KKL_Season_Admin_Page.php';
    require_once dirname(__FILE__) . '/KKL/Backend/KKL_Team_Admin_Page.php';
    require_once dirname(__FILE__) . '/KKL/Backend/KKL_Location_Admin_Page.php';
    require_once dirname(__FILE__) . '/KKL/Tasks/NewGameDay.php';
    $options = array();
    new KKL_League_Admin_Page(__FILE__, $options);
    new KKL_Club_Admin_Page(__FILE__, $options);
    new KKL_GameDay_Admin_Page(__FILE__, $options);
    new KKL_Match_Admin_Page(__FILE__, $options);
    new KKL_Season_Admin_Page(__FILE__, $options);
    new KKL_Team_Admin_Page(__FILE__, $options);
    new KKL_Location_Admin_Page(__FILE__, $options);
}
scb_init('scb_framework_init');
$kkl = new KKL();
$kkl->init();
add_action('kkl_update_game_days', array('KKL_Tasks_NewGameDay', 'execute'));
if (!wp_next_scheduled('kkl_update_game_days')) {
    wp_schedule_event(time(), 'hourly', 'kkl_update_game_days');
}
add_action('plugins_loaded', 'kkl_load_textdomain');
function kkl_load_textdomain()
{
    load_plugin_textdomain('kkl-ligatool', false, dirname(plugin_basename(__FILE__)) . '/lang/');
}
add_filter('set-screen-option', array('KKLBackend', 'set_screen_options'), 10, 3);
Example #6
0
 public static function setContext($context)
 {
     self::$context = $context;
 }
Example #7
0
 public static function gameDayPager($atts, $content, $tag)
 {
     global $kkl_twig;
     $db = new KKL_DB();
     $context = KKL::getContext();
     $day = $context['game_day'];
     $league = $context['league'];
     $season = $context['season'];
     $prev = $db->getPreviousGameDay($day);
     if (!$prev) {
         $day->isFirst = true;
     } else {
         $prev->link = KKL::getLink('league', array('league' => $league->code, 'season' => date('Y', strtotime($season->start_date)), 'game_day' => $prev->number));
     }
     $next = $db->getNextGameDay($day);
     if (!$next) {
         $day->isLast = true;
     } else {
         $next->link = KKL::getLink('league', array('league' => $league->code, 'season' => date('Y', strtotime($season->start_date)), 'game_day' => $next->number));
     }
     return $kkl_twig->render('shortcodes/gameday_pager.tpl', array('context' => $context, 'prev' => $prev, 'day' => $day, 'next' => $next));
 }
Example #8
0
<?php

$overview = false;
$league = get_query_var('league');
$season = get_query_var('season');
$game_day = get_query_var('game_day');
$KKL = new KKL();
if ($league && $season && $game_day) {
    $context = $KKL->getContextByLeagueAndSeasonAndGameDay($league, $season, $game_day);
} else {
    if ($league && $season) {
        $context = $KKL->getContextByLeagueAndSeason($league, $season, $game_day);
    } else {
        if ($league) {
            $context = $KKL->getContextByLeague($league, $season, $game_day);
        } else {
            $overview = true;
        }
    }
}
$KKL->setContext($context);
/*
Template Name: Spielplan
*/
get_header();
?>

<section class="kkl-content">
  <div class="container">
    <div class="row">
      
Example #9
0
        $league->teams = $db->getTeamsForSeason($league->season->id);
        foreach ($league->teams as $team) {
            $club = $db->getClub($team->club_id);
            if (!$team->logo) {
                $team->logo = $club->logo;
                if (!$club->logo) {
                    $team->logo = "https://www.kickerligakoeln.de/wp-content/themes/kkl_2/img/kkl-logo_172x172.png";
                }
            } else {
                $team->logo = "/images/team/" . $team->logo;
            }
            // HACK
            $team->link = KKL::getLink('club', array('club' => $club->short_name));
        }
        $day = $db->getGameDay($league->season->current_game_day);
        $league->link = KKL::getLink('league', array('league' => $league->code, 'season' => date('Y', strtotime($league->season->start_date)), 'game_day' => $day->number));
        $leagues[] = $league;
    }
    echo json_encode($leagues);
    die;
}
?>
?>
<?php 
get_header();
?>

<section class="kkl-content">
		<div class="container">
			<div class="row">