Beispiel #1
0
 /**
  * update points for given team
  *
  * @param int $team_id
  * @return none
  */
 function saveStandings($team_id)
 {
     global $wpdb, $leaguemanager;
     $this->league = $league = parent::getLeague($this->league_id);
     if ($league->point_rule != 'manual') {
         $this->num_done = $this->getNumDoneMatches($team_id);
         $this->num_won = $this->getNumWonMatches($team_id);
         $this->num_draw = $this->getNumDrawMatches($team_id);
         $this->num_lost = $this->getNumLostMatches($team_id);
         $points['plus'] = $this->calculatePoints($team_id, 'plus');
         $points['minus'] = $this->calculatePoints($team_id, 'minus');
         $points2 = array('plus' => 0, 'minus' => 0);
         $points2 = apply_filters('team_points2_' . $league->sport, $team_id);
         $diff = $points2['plus'] - $points2['minus'];
         $wpdb->query($wpdb->prepare("UPDATE {$wpdb->leaguemanager_teams} SET `points_plus` = '%s', `points_minus` = '%s', `points2_plus` = '%d', `points2_minus` = '%d', `done_matches` = '%d', `won_matches` = '%d', `draw_matches` = '%d', `lost_matches` = '%d', `diff` = '%d' WHERE `id` = '%d'", $points['plus'], $points['minus'], $points2['plus'], $points2['minus'], $this->num_done, $this->num_won, $this->num_draw, $this->num_lost, $diff, $team_id));
         do_action('leaguemanager_save_standings_' . $league->sport, $team_id);
     }
 }