// along with this program. If not, see <http://www.gnu.org/licenses/>. // Part 2 of update player ranks for team. include 'php/session.php'; include 'php/checklogged.php'; include 'php/opendatabase.php'; include 'php/club.php'; include 'php/rank.php'; include 'php/player.php'; include 'php/team.php'; include 'php/teammemb.php'; include 'php/match.php'; include 'php/matchdate.php'; include 'php/game.php'; try { $team = new Team(); $team->frompost(); $team->fetchdets(); } catch (TeamException $e) { $mess = $e->getMessage(); include 'php/wrongentry.php'; exit(0); } $membs = $team->list_members(); $n = 0; foreach ($membs as $m) { $m->fetchdets(); $r = $_POST["rank{$n}"]; if (strlen($r) == 0) { $mess = "Confused about team member ranks"; include 'php/wrongentry.php'; exit(0);
include 'php/game.php'; include 'php/sortrank.php'; include 'php/news.php'; include 'php/params.php'; include 'php/hcp_message.php'; include 'php/mailalloc.php'; $pars = new Params(); $pars->fetchvalues(); $mtch = new Match(); try { $mtch->frompost(); $mtch->fetchdets(); $mtch->fetchteams(); $mtch->fetchgames(); $Myteam = new Team(); $Myteam->frompost(); if ($Myteam->is_same($mtch->Hteam)) { $Myteam = $mtch->Hteam; $Histeam = $mtch->Ateam; } else { $Myteam = $mtch->Ateam; $Histeam = $mtch->Hteam; } } catch (MatchException $e) { $mess = $e->getMessage(); include 'php/wrongentry.php'; exit(0); } catch (TeamException $e) { $mess = $e->getMessage(); include 'php/wrongentry.php'; exit(0);
$mess = "No team name?"; include 'php/wrongentry.php'; exit(0); } $team = new Team($teamname); checkname($team); $team->Description = $teamdescr; $team->Division = $teamdiv; $team->Captain = new Player($captfirst, $captlast); $team->create(); $Title = "Team {$team->display_name()} created OK"; break; default: try { $origteam = new Team(); $origteam->frompost(); $origteam->fetchdets(); } catch (TeamException $e) { $mess = $e->getMessage(); include 'php/wrongentry.php'; exit(0); } // Check name changes $newteam = new Team($teamname); if (!$origteam->is_same($newteam)) { checkname($newteam); $origteam->updatename($newteam); } $origteam->Description = $teamdescr; $origteam->Division = $teamdiv; $origteam->Captain = new Player($captfirst, $captlast);