Ejemplo n.º 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;
     }
 }