function get_item()
 {
     if ($this->item) {
         return $this->item;
     }
     if ($_GET['id']) {
         $db = new KKL_DB();
         $this->setItem($db->getLocation($_GET['id']));
     }
     return $this->item;
 }
 function column_location($item)
 {
     $db = new KKL_DB();
     $location = $db->getLocation($item['location']);
     return $location->title;
 }
Exemple #3
0
 public static function clubDetail($atts, $content, $tag)
 {
     global $kkl_twig;
     $db = new KKL_DB();
     $context = KKL::getContext();
     $contextClub = $context['club'];
     $contextClub->logo = $contextClub->logo;
     $seasonTeams = $db->getTeamsForClub($contextClub->id);
     $teams = array();
     foreach ($seasonTeams as $seasonTeam) {
         $seasonTeam->season = $db->getSeason($seasonTeam->season_id);
         $seasonTeam->season->league = $db->getLeague($seasonTeam->season->league_id);
         $ranking = $db->getRankingForLeagueAndSeasonAndGameDay($seasonTeam->season->league_id, $seasonTeam->season->id, $seasonTeam->season->current_game_day);
         $position = 1;
         foreach ($ranking as $rank) {
             if ($rank->team_id == $seasonTeam->id) {
                 $seasonTeam->scores = $rank;
                 $seasonTeam->scores->position = $position;
                 break;
             }
             $position++;
         }
         $seasonTeam->link = KKL::getLink('club', array('club' => $contextClub->short_name));
         $seasonTeam->schedule_link = KKL::getLink('schedule', array('league' => $seasonTeam->season->league->code, 'season' => date('Y', strtotime($seasonTeam->season->start_date)), 'team' => $seasonTeam->short_name));
         $teams[$seasonTeam->id] = $seasonTeam;
     }
     $currentTeam = $db->getCurrentTeamForClub($contextClub->id);
     $currentLocation = $db->getLocation($currentTeam->properties['location']);
     return $kkl_twig->render('shortcodes/club_detail.tpl', array('context' => $context, 'club' => $contextClub, 'teams' => $teams, 'current_location' => $currentLocation));
 }