public function run() { DB::table('players')->delete(); Player::create(array('user_id' => 3, 'nom' => 'Bourdon', 'prenom' => 'Jean-Paul', 'nation_id' => 2, 'hcp' => 2.5, 'langue_id' => 1, 'club_id' => 2, 'statusplayer_id' => 1, 'sexe_id' => 1, 'naissance' => '1961-03-29', 'licence' => '344787')); DB::table('managers')->delete(); Manager::create(array('user_id' => 2, 'nom' => 'Bourdon', 'prenom' => 'Jean-Paul', 'statussocial_id' => 2, 'numtva' => 'BE48-2525-5262', 'adr1' => 'Chss de Nivelles, 41-1', 'cpost' => '7181', 'ville' => 'Arquennes', 'nation_id' => 2, 'langue_id' => 1)); }
public function run() { DB::table('Players')->delete(); DB::table('Questions')->delete(); DB::table('Questionnaires')->delete(); DB::table('Answers')->delete(); $kim = Questionnaire::create(array('name' => 'kim')); $frage1 = Question::create(array('question' => 'Das Spiel hat mir Spass gemacht', 'questionnaire_id' => $kim->id)); $playerJustus = Player::create(array('gender' => 'm', 'age' => '21', 'computer' => '4', 'game' => '3', 'questionnaire_id' => $kim->id)); $Testfrage = Answer::create(array('answer' => 'Test', 'player_id' => $playerJustus->id, 'question_id' => $frage1->id)); }
public function createUsersPlayersTest($nbPlayer = 2) { // Set Php Time Out ini_set('max_execution_time', 300); //300 seconds = 5 minutes // Suppression des Users & Players de Test $deletedUsers = User::where('email', 'LIKE', '%aa.be')->delete(); // Boucle $createdUsers = 0; $messageRetour = ''; for ($u = 1; $u <= $nbPlayer; $u++) { // 1-Auto Values $autoNom = 'Player-' . $u; $autoPrenom = 'player ' . $u; $autoMail = 'player_' . $u . '@aa.be'; // 2-Create User with role = Player (3) $user = new User(); $user->email = $autoMail; $user->password = '******'; $user->username = $autoNom; $user->password_confirmation = '1111'; $user->confirmation_code = md5(uniqid(mt_rand(), true)); $user->confirmed = 1; if (!$user->save()) { $messageRetour .= 'Unable to create user ' . $user->email; $messageRetour .= print_r($user->errors()); $messageRetour .= '<hr>'; } else { $messageRetour .= $u . ' Created user ' . $user->email; $messageRetour .= '<hr>'; $userRole = DB::table('roles')->where('name', '=', 'Player')->pluck('id'); $user->roles()->attach($userRole); // 3-Create Player $userId = $user->id; $autoNation = rand(2, 4); $autoHcp = rand(0, 360) / 10; $autoLangue = rand(1, 3); $autoClub = rand(2, 7); $autosexe = rand(1, 2); $autoLicence = 'TEST' . $u; $year = rand(1950, 2006); $month = rand(1, 12); $day = rand(1, 28); Player::create(array('user_id' => $userId, 'nom' => $autoNom, 'prenom' => $autoPrenom, 'nation_id' => $autoNation, 'hcp' => $autoHcp, 'langue_id' => $autoLangue, 'club_id' => $autoClub, 'statusplayer_id' => 1, 'sexe_id' => $autosexe, 'naissance' => Carbon::createFromDate($year, $month, $day), 'licence' => $autoLicence)); $createdUsers++; } } return $messageRetour; }
public function doAddPlayer($data, Form $form) { $player_exists = Player::get()->filter(array('FirstName' => $data['FirstName'], 'Surname' => $data['Surname']))->count() > 0 ? true : false; if ($player_exists) { // todo // add error message because player already exists return $this->redirectBack(); } else { $player = Player::create(); $player->FirstName = $data['FirstName']; $player->Surname = $data['Surname']; $player->write(); $redirectLink = $this->Link() . '?success=1'; return $this->redirect($redirectLink); } }
function createRotter($team_id, $race, $nr) { global $DEA; $pos_id = $DEA[$race]['players']['Rotter']['pos_id']; list($exitStatus, $pid) = Player::create($input = array('nr' => $nr, 'f_pos_id' => $pos_id, 'team_id' => $team_id, 'name' => "Rotter" . $nr), $opts = array('free' => true, 'force' => true)); if (!$exitStatus == Player::T_CREATE_SUCCESS) { $this->error = "Failed to add a rotter to the roster."; return false; } return true; }
<?php namespace bmtmgr; require_once dirname(__DIR__) . '/src/common.php'; utils\csrf_protect(); $u = user\check_current(); $u->require_perm('admin'); utils\require_get_params(['club_id', 'season_id']); utils\require_post_params(['firstname', 'lastname', 'gender']); $season = Season::by_id($_GET['season_id']); $club = User::by_id($_GET['club_id']); $name = \sprintf('%s, %s', $_POST['lastname'], $_POST['firstname']); $textid = \str_replace(' ', '_', $club->name . '-' . $_POST['firstname'] . ' ' . $_POST['lastname']); try { $player = Player::create($season->id, $club->id, $textid, $name, $_POST['gender']); $player->save(); } catch (utils\DuplicateEntryException $e) { render_ajax_error(sprintf('Ein Spieler mit der Id "%s" existiert bereits', $textid)); exit; } render_ajax('season/' . $season->id . '/club/' . $club->id . '/', ['player' => $player]);
public function __construct($player1Name, $player2Name) { $this->players[0] = $this->players[$player1Name] = Player::create($player1Name); $this->players[1] = $this->players[$player2Name] = Player::create($player2Name); $this->scoreTranslator = new ScoreTranslator(); }
private function _handleActions($ALLOW_EDIT) { global $coach; $team = $this; // Copy. Used instead of $this for readability. // No request sent? if (!isset($_POST['type']) || !$ALLOW_EDIT) { return false; } // Handle request. if (get_magic_quotes_gpc()) { $_POST['name'] = stripslashes(isset($_POST['name']) ? $_POST['name'] : ''); $_POST['skill'] = stripslashes(isset($_POST['skill']) ? $_POST['skill'] : ''); $_POST['thing'] = stripslashes(isset($_POST['thing']) ? $_POST['thing'] : ''); $_POST['teamtext'] = stripslashes(isset($_POST['teamtext']) ? $_POST['teamtext'] : ''); $_POST['txt'] = stripslashes(isset($_POST['txt']) ? $_POST['txt'] : ''); } $p = isset($_POST['player']) && $_POST['type'] != 'hire_player' ? new Player($_POST['player']) : null; switch ($_POST['type']) { case 'hire_player': list($exitStatus, $pid) = Player::create(array('nr' => $_POST['number'], 'f_pos_id' => $_POST['player'], 'team_id' => $team->team_id, 'name' => $_POST['name']), array('JM' => isset($_POST['as_journeyman']) && $_POST['as_journeyman'])); status(!$exitStatus, $exitStatus ? Player::$T_CREATE_ERROR_MSGS[$exitStatus] : null); break; case 'hire_journeyman': status($p->hireJourneyman()); break; case 'fire_player': status($p->sell()); break; case 'unbuy_player': status($p->unbuy()); break; case 'rename_player': status($p->rename($_POST['name'])); break; case 'renumber_player': status($p->renumber($_POST['number'])); break; case 'rename_team': status($team->rename($_POST['name'])); break; case 'buy_goods': status($team->buy($_POST['thing'])); break; case 'drop_goods': status($team->drop($_POST['thing'])); break; case 'ready_state': status($team->setReady(isset($_POST['bool']))); break; case 'retire': status(isset($_POST['bool']) && $team->setRetired(true)); break; case 'delete': status(isset($_POST['bool']) && $team->delete()); break; case 'skill': $type = null; $p->setChoosableSkills(); if (in_array($_POST['skill'], $p->choosable_skills['norm'])) { $type = 'N'; } elseif (in_array($_POST['skill'], $p->choosable_skills['doub'])) { $type = 'D'; } else { $type = 'C'; } # Assume it's a characteristic. status($p->addSkill($type, $type == 'C' ? (int) str_replace('ach_', '', $_POST['skill']) : (int) $_POST['skill'])); break; case 'teamtext': status($team->saveText($_POST['teamtext'])); break; case 'news': status($team->writeNews($_POST['txt'])); break; case 'newsdel': status($team->deleteNews($_POST['news_id'])); break; case 'newsedit': status($team->editNews($_POST['news_id'], $_POST['txt'])); break; case 'pic': if ($_POST['add_del'] == 'add') { if ($_POST['pic_obj'] == IMGTYPE_TEAMSTADIUM) { list($status, $msg) = $team->saveStadiumPic(ImageSubSys::$defaultHTMLUploadName . '_stad'); status($status, !$status ? $msg : ''); } elseif ($_POST['pic_obj'] == IMGTYPE_TEAMLOGO) { list($status, $msg) = $team->saveLogo(ImageSubSys::$defaultHTMLUploadName . '_logo'); status($status, !$status ? $msg : ''); } } else { if ($_POST['pic_obj'] == IMGTYPE_TEAMSTADIUM) { status($team->deleteStadiumPic()); } elseif ($_POST['pic_obj'] == IMGTYPE_TEAMLOGO) { status($team->deleteLogo()); } } break; } // Administrator tools used? if ($coach->isNodeCommish(T_NODE_LEAGUE, $team->f_lid)) { switch ($_POST['type']) { case 'unhire_journeyman': status($p->unhireJourneyman()); break; case 'unsell_player': status($p->unsell()); break; case 'unbuy_goods': status($team->unbuy($_POST['thing'])); break; case 'bank': status($team->dtreasury($dtreas = ($_POST['sign'] == '+' ? 1 : -1) * $_POST['amount'] * 1000)); if (Module::isRegistered('LogSubSys')) { Module::run('LogSubSys', array('createEntry', T_LOG_GOLDBANK, $coach->coach_id, "Coach '{$coach->name}' (ID={$coach->coach_id}) added a treasury delta for team '{$team->name}' (ID={$team->team_id}) of amount = {$dtreas}")); } SQLTriggers::run(T_SQLTRIG_TEAM_DPROPS, array('obj' => T_OBJ_TEAM, 'id' => $team->team_id)); break; case 'spp': status($p->dspp(($_POST['sign'] == '+' ? 1 : -1) * $_POST['amount'])); break; case 'dval': status($p->dval(($_POST['sign'] == '+' ? 1 : -1) * $_POST['amount'] * 1000)); break; case 'extra_skills': $func = $_POST['sign'] == '+' ? 'addSkill' : 'rmSkill'; status($p->{$func}('E', $_POST['skill'])); break; case 'ach_skills': $type = null; if (in_array($_POST['skill'], $p->ach_nor_skills)) { $type = 'N'; } elseif (in_array($_POST['skill'], $p->ach_dob_skills)) { $type = 'D'; } else { $type = 'C'; } # Assume it's a characteristic. status($p->rmSkill($type, $type == 'C' ? (int) str_replace('ach_', '', $_POST['skill']) : (int) $_POST['skill'])); break; } } $team->setStats(false, false, false); # Reload fields in case they changed after team actions made. }
public static function signUp($username, $password) { $mysqli = new mysqli("classroom.cs.unc.edu", "zrkaplan", "KMP4president", "zrkaplandb"); $mysqli->real_escape_string($username); $mysqli->real_escape_string($password); $result = $mysqli->query("select * from Player where username = '******'"); if ($result->num_rows === 0) { return Player::create($username, $password); } return null; }
public function create_object($data) { $agent = Agent::mapper()->create_object(array('id' => $data['agent'], 'alias' => $data['agent_alias'], 'avatar' => $data['agent_avatar'])); return Player::create(array('id' => $data['id'], 'agent' => $agent, 'target' => $data['target'], 'credits' => $data['credits'], 'pkn' => $data['pkn'], 'status' => $data['status'])); }
checkclash('igs', $igs); $player->Rank = new Rank($rank); $player->Club = new Club($club); $player->Email = $email; $player->OKemail = $okem; $player->Trivia = $trivia; $player->Phone = $phone; $player->KGS = $kgs; $player->IGS = $igs; $player->Userid = $userid; $player->Notes = $notes; $player->Latestcall = $latest == "None" ? "" : $latest; if ($joinil) { $player->ILdiv = assign_ildiv($rank); } $player->create(); // If no password specified, invent one if (strlen($passw) == 0) { $passw = generate_password(); } $player->set_passwd($passw); newaccemail($email, $userid, $passw); ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <?php $Title = "New account {$userid} created OK"; include 'php/head.php'; ?> <body> <script language="javascript" src="webfn.js"></script>
/** * Based on a Location, retrieve the local rankings * @param int $id the unique identifier of the location * @param string|RankingId $rank the kind of ranking you want to retrieve. * Based on Clans and based on players is supported at the moment. * @return The clans/player who are located at the location id */ private function _locationsByIdAndRank(int $id, $rank) { $curlClient = curl_init(self::BASE_URL . self::LOCATIONS_URL . '/' . $id . '/rankings/' . $rank); curl_setopt($curlClient, CURLOPT_HTTPHEADER, $this->_curlHeader); curl_setopt($curlClient, CURLOPT_RETURNTRANSFER, true); $results = json_decode(curl_exec($curlClient), true); $items = []; foreach ($results['items'] as $result) { if ($rank === RankingId::CLANS) { $items[] = Clan::create($result); } else { $items[] = Player::create($result); } } return $items; }
# Add team list($exitStatus, $tid) = Team::create(array_merge(array_intersect_key((array) $t, array_fill_keys(Team::$createEXPECTED, null)), array_combine(array_keys($map), array_values(array_intersect_key((array) $t, array_fill_keys(array_values($map), null)))))); status(!$exitStatus, $exitStatus ? Team::$T_CREATE_ERROR_MSGS[$exitStatus] : "Created team '{$t->name}'"); # Add players $ROLLBACK = false; if (is_numeric($tid) && !$exitStatus) { $team = new Team($tid); foreach ($t->players->player as $p) { $p = (object) (array) $p; # Get rid of SimpleXML objects. if (!$team->isPlayerPosValid($p->pos_id)) { status(false, "Invalid race position ID '{$p->pos_id}' for '{$p->name}'"); $ROLLBACK = true; break; } list($status1, $pid) = Player::create(array('nr' => $p->nr, 'f_pos_id' => $p->pos_id, 'name' => $p->name, 'team_id' => $tid), array('force' => true, 'free' => true)); if ($status1) { status(false, Player::$T_CREATE_ERROR_MSGS[$status1]); break; } $status2 = true; # The status must be set as the "inj" (not agn) field for EVERY match (import) entry. # This is because MySQL may pick a random match data entry from which to get the status from. $pstatus = $T_INJS_REV[strtoupper($p->status)]; # Injuries foreach (array('ma', 'st', 'ag', 'av', 'ni') as $inj) { $agn = $T_INJS_REV[strtoupper($inj)]; while ($p->{$inj}-- > 0) { $status2 &= Match::ImportEntry($pid, array_merge(array_fill_keys(array_merge($T_PMD_ACH, $T_PMD_IR), 0), array_combine($T_PMD_INJ, array($pstatus, $agn, $p->{$inj}-- > 0 ? $agn : NONE)))); } }
/** * Creates a clan object with the given data * @param array $data an associative array to fill up the members of the * clan class * @return Clan a clan object with the data given as it's members */ public static function create(array $data) : Clan { $clan = new Clan(); parent::fill($data, $clan); if (is_array($clan->location)) { $clan->location = Location::create($clan->location); } if (is_array($clan->memberList)) { $members = []; foreach ($clan->memberList as $member) { $members[] = Player::create($member); } $clan->memberList = $members; } return $clan; }
protected function _create_player($agent_id) { $player = Player::create(array('agent' => $agent_id, 'game' => $this->id, 'status' => 1, 'credits' => 0, 'target' => -1, 'pkn' => str_pad(mt_rand(0, 9999), 4, "0"))); $this->_storage->save($player); return $player; }
header("HTTP/1.0 400 Bad Request"); print "Bad birth date"; exit; } if (!isset($_REQUEST['playerID'])) { header("HTTP/1.0 400 Bad Request"); print "Missing playerID"; exit; } $title = trim($_REQUEST['playerID']); if (playerID == "") { header("HTTP/1.0 400 Bad Request"); print "Bad playerID"; exit; } $new_player = Player::create($firstName, $lastName, $position, $firstSeason, $lastSeason, $heightFeet, $heightInches, $weight, $college, $birthDate, $playerID); // Report if failed if ($new_player == null) { header("HTTP/1.0 500 Server Error"); print "Server couldn't create new player."; exit; } header("Content-type: application/json"); print $new_player->getJSON(); exit; } } } // If here, none of the above applied and URL could // not be interpreted with respect to RESTful conventions. header("HTTP/1.0 400 Bad Request");
public static function handlePost($cid) { global $lng, $_POST, $coach, $raceididx, $DEA, $rules, $racesNoApothecary; if (!isset($_POST['action'])) { return; } if (!self::allowEdit($cid, $coach)) { status(false, $lng->getTrn('notallowed', 'TeamCreator')); return; } $lid_did = $_POST['lid_did']; @(list($lid, $did) = explode(',', $_POST['lid_did'])); setupGlobalVars(T_SETUP_GLOBAL_VARS__LOAD_LEAGUE_SETTINGS, array('lid' => (int) $lid)); // Load correct $rules for league. if (get_magic_quotes_gpc()) { $_POST['tname'] = stripslashes($_POST['tname']); } $rid = $_POST['raceid']; $race = $DEA[$raceididx[$rid]]; /* Handle or the 'other' stuff around the team - rerolls etc */ $rerolls = $_POST['qtyo0']; $fans = $_POST['qtyo1']; $cl = $_POST['qtyo2']; $ac = $_POST['qtyo3']; $treasury = $rules['initial_treasury']; $treasury -= $rerolls * $race['other']['rr_cost']; $treasury -= $fans * 10000; $treasury -= $cl * 10000; $treasury -= $ac * 10000; $rerolls += $rules['initial_rerolls']; $fans += $rules['initial_fan_factor']; $cl += $rules['initial_ass_coaches']; $ac += $rules['initial_cheerleaders']; if (!in_array($rid, $racesNoApothecary)) { $apoth = $_POST['qtyo4']; if ($apoth) { $treasury -= 50000; } } else { $apoth = 0; } /* Create an array with all the players in. Do this first to check for sufficient funds */ $players = array(); $idx = 0; $rosterNum = 1; foreach ($race['players'] as $pos => $d) { $pid = $_POST['pid' . $idx]; if ($pid != $d['pos_id']) { // mismatched position ID status(false, $pid . ' but was ' . $d['pos_id']); return; } $qty = $_POST['qtyp' . $idx]; for ($i = 0; $i < $qty; $i++) { $treasury -= $d['cost']; $player = array(); $player['name'] = ""; $player['nr'] = $rosterNum++; $player['f_pos_id'] = $d['pos_id']; $players[] = $player; } $idx++; } /* Enforce league rules and common BB ones */ $errors = array(); if ($treasury < 0) { $errors[] = $lng->getTrn('tooExpensive', 'TeamCreator'); } if (sizeof($players) < 11) { $errors[] = $lng->getTrn('tooFewPlayers', 'TeamCreator'); } if (sizeof($players) > $rules['max_team_players']) { $errors[] = $lng->getTrn('tooManyPlayers', 'TeamCreator'); } if (self::checkLimit($rules['max_rerolls'], $rerolls)) { $errors[] = $lng->getTrn('tooManyRR', 'TeamCreator') . " " . $rerolls . " vs " . $rules['max_rerolls']; } if (self::checkLimit($rules['max_fan_factor'], $fans)) { $errors[] = $lng->getTrn('tooManyFF', 'TeamCreator') . " " . $fans . " vs " . $rules['max_fan_factor']; } if (self::checkLimit($rules['max_ass_coaches'], $ac)) { $errors[] = $lng->getTrn('tooManyAc', 'TeamCreator') . " " . $ac . " vs " . $rules['max_ass_coaches']; } if (self::checkLimit($rules['max_cheerleaders'], $cl)) { $errors[] = $lng->getTrn('tooManyCl', 'TeamCreator') . " " . $cl . " vs " . $rules['max_cheerleaders']; } /* Actually create the team in the database */ if (sizeof($errors) == 0) { list($exitStatus, $tid) = Team::create(array('name' => $_POST['tname'], 'owned_by_coach_id' => (int) $cid, 'f_race_id' => (int) $rid, 'treasury' => $treasury, 'apothecary' => $apoth, 'rerolls' => $rerolls, 'ff_bought' => $fans, 'ass_coaches' => $ac, 'cheerleaders' => $cl, 'won_0' => 0, 'lost_0' => 0, 'draw_0' => 0, 'played_0' => 0, 'wt_0' => 0, 'gf_0' => 0, 'ga_0' => 0, 'imported' => 0, 'f_lid' => (int) $lid, 'f_did' => isset($did) ? (int) $did : Team::T_NO_DIVISION_TIE)); if ($exitStatus) { $errors[] = Team::$T_CREATE_ERROR_MSGS[$exitStatus]; } } /* Actually create all the players in the database */ if (sizeof($errors) == 0) { $opts = array(); $opts['free'] = 1; // already deducted cost from treasry foreach ($players as $player) { $player['team_id'] = $tid; list($exitStatus, $pid) = Player::create($player, $opts); if ($exitStatus) { $errors = array_merge($errors, Player::$T_CREATE_ERROR_MSGS[$exitStatus]); } } } /* Report errors and reset the form, or redirect to the team page */ if (sizeof($errors) > 0) { $msg = implode(",<br />", $errors); status(false, $msg); $post = (object) $_POST; echo <<<EOQ <script type="text/javascript"> \$(document).ready(function() { document.getElementById('rid').value = {$post->rid}; changeRace({$post->rid}); document.getElementById('tname').value = '{$post->tname}'; EOQ; foreach ($_POST as $element => $value) { if (0 == strncmp($element, "qty", 3)) { $idx = substr($element, 4, 1); $type = substr($element, 3, 1); echo <<<EOQ document.getElementById('{$element}').selectedIndex = {$value}; updateQty({$idx}, '{$type}', {$value}); EOQ; } } echo <<<EOQ var lid = document.getElementById('lid_did'); for (var i = 0; i < lid.options.length; i++) { if (lid.options[i].value=={$post->lid_did}) { lid.selectedIndex = i; break; } } }); </script> EOQ; } else { // Everything worked, redirect to the team page status(true, $lng->getTrn('created', 'TeamCreator')); $teamUrl = "'" . str_replace("amp;", "", urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $tid, false, false)) . "'"; echo <<<EOQ <script type="text/javascript"> \$(document).ready(function() { window.location = {$teamUrl}; }); </script> EOQ; } }
private function checkPlayerChanges() { $number = HTMLResponse::fromPOST('number', 0); $name = HTMLResponse::fromPOST('name', ''); if ($number >= 1 && $number <= count($this->tiers)) { if ($name == '' || in_array($name, Player::getAvailable())) { $player = Player::findOne('teamid = ? and number = ? and seasonid = ?', [$this->team->teamid, $number, $this->season->seasonid]); if (!$player) { $player = Player::create(); $player->number = $number; $player->teamid = $this->team->teamid; $player->seasonid = $this->season->seasonid; } $player->name = $name; $player->save(); } } }
public static function report() { // Is $match_id valid? $match_id = (int) $_GET['mid']; if (!get_alt_col('matches', 'match_id', $match_id, 'match_id')) { fatal("Invalid match ID."); } global $lng, $stars, $rules, $settings, $coach, $racesHasNecromancer, $racesMayRaiseRotters, $DEA, $T_PMD__ENTRY_EXPECTED; global $T_MOUT_REL, $T_MOUT_ACH, $T_MOUT_IR, $T_MOUT_INJ; global $leagues, $divisions, $tours; $T_ROUNDS = Match::getRounds(); // Perform actions (delete, lock/unlock and reset). Needs the $IS_LOCAL_ADMIN = is_object($coach) && $coach->isNodeCommish(T_NODE_TOURNAMENT, get_alt_col('matches', 'match_id', $match_id, 'f_tour_id')); self::matchActions($IS_LOCAL_ADMIN); // Create objects $m = new Match($match_id); $team1 = new Team($m->team1_id); $team2 = new Team($m->team2_id); // Determine visitor privileges. $lid = $divisions[$tours[$m->f_tour_id]['f_did']]['f_lid']; $ALLOW_EDIT = !$m->locked && is_object($coach) && ($coach->ring == Coach::T_RING_GLOBAL_ADMIN || $leagues[$lid]['ring'] == Coach::T_RING_LOCAL_ADMIN || $coach->isInMatch($m->match_id)); $DIS = $ALLOW_EDIT ? '' : 'DISABLED'; // Lock page for other reasons? (Used journeys etc) $USED_JOURNEYMAN_PRESENT = false; foreach (array(1 => $team1, 2 => $team2) as $id => $t) { foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } if (!$m->is_played && $p->is_journeyman_used) { $USED_JOURNEYMAN_PRESENT = true; } } } if ($USED_JOURNEYMAN_PRESENT) { $DIS = 'DISABLED'; } // Relay to ES report page? if (isset($_GET['es_report'])) { # Don't care what value the GET field has! self::report_ES($match_id, !$ALLOW_EDIT); return; } $easyconvert = new array_to_js(); @$easyconvert->add_array($stars, 'phpStars'); // Load stars array into JavaScript array. echo $easyconvert->output_all(); echo '<script language="JavaScript" type="text/javascript"> var ID_MERCS = ' . ID_MERCS . '; var ID_STARS_BEGIN = ' . ID_STARS_BEGIN . '; </script> '; /***************** * * Submitted form? * *****************/ if (isset($_POST['button']) && $ALLOW_EDIT) { if (get_magic_quotes_gpc()) { $_POST['summary'] = stripslashes($_POST['summary']); } MTS('Report submit STARTED'); // FIRST, if any raised zombies are kept we need to create their player objects in order have the correct player- vs. match creation & played dates. foreach (array(1 => $team1, 2 => $team2) as $id => $t) { if (in_array($t->f_race_id, $racesHasNecromancer) && isset($_POST["t{$id}zombie"])) { $pos_id = $DEA[$t->f_rname]['players']['Zombie']['pos_id']; list($exitStatus, $pid) = Player::create(array('nr' => $t->getFreePlayerNr(), 'f_pos_id' => $pos_id, 'team_id' => $t->team_id, 'name' => 'RAISED ZOMBIE'), array('free' => true)); /* Knowing the new zombie's PID we relocate the zombie match data to regular player data - this allows us to use the same loop for submitting the zombie's match data. */ foreach ($T_PMD__ENTRY_EXPECTED as $f) { $postName = "{$f}_t{$id}zombie"; $_POST["{$f}_{$pid}"] = isset($_POST[$postName]) ? $_POST[$postName] : 0; unset($_POST[$postName]); } } } // SECONDLY, look for raised rotters too, do same as above with zombies... foreach (array(1 => $team1, 2 => $team2) as $id => $t) { if (in_array($t->f_race_id, $racesMayRaiseRotters) && isset($_POST["t{$id}rotterCnt"]) && ($N = (int) $_POST["t{$id}rotterCnt"]) > 0) { foreach (range(1, $N) as $n) { $pos_id = $DEA[$t->f_rname]['players']['Rotter']['pos_id']; list($exitStatus, $pid) = Player::create(array('nr' => $t->getFreePlayerNr(), 'f_pos_id' => $pos_id, 'team_id' => $t->team_id, 'name' => "RAISED ROTTER {$n}"), array('free' => true)); /* Knowing the new rotter's PID we relocate the rotter match data to regular player data - this allows us to use the same loop for submitting the rotter's match data. */ foreach ($T_PMD__ENTRY_EXPECTED as $f) { $postName = "{$f}_t{$id}rotter{$n}"; $_POST["{$f}_{$pid}"] = isset($_POST[$postName]) ? $_POST[$postName] : 0; unset($_POST[$postName]); } } } } // Update general match data status($m->update(array('submitter_id' => (int) $_SESSION['coach_id'], 'stadium' => (int) $_POST['stadium'], 'gate' => (int) $_POST['gate'] * 1000, 'fans' => (int) $_POST['fans'], 'ffactor1' => (int) $_POST['ff1'], 'ffactor2' => (int) $_POST['ff2'], 'income1' => (int) $_POST['inc1'] * 1000, 'income2' => (int) $_POST['inc2'] * 1000, 'team1_score' => (int) $_POST['result1'], 'team2_score' => (int) $_POST['result2'], 'smp1' => (int) $_POST['smp1'], 'smp2' => (int) $_POST['smp2'], 'tcas1' => (int) $_POST['tcas1'], 'tcas2' => (int) $_POST['tcas2'], 'fame1' => (int) $_POST['fame1'], 'fame2' => (int) $_POST['fame2'], 'tv1' => (int) $_POST['tv1'] * 1000, 'tv2' => (int) $_POST['tv2'] * 1000)), 'Saving match report'); if (!empty($_POST['summary'])) { $m->saveText($_POST['summary']); # Save summery. } MTS('matches entry submitted'); // Update match's player data foreach (array(1 => $team1, 2 => $team2) as $id => $t) { /* Save ordinary players */ foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } // We create zero entries for MNG player(s). This is required! $pid = $p->player_id; # Shortcut if ($p->getStatus($m->match_id) == MNG) { $_POST["mvp_{$pid}"] = 0; $_POST["cp_{$pid}"] = 0; $_POST["td_{$pid}"] = 0; $_POST["intcpt_{$pid}"] = 0; $_POST["bh_{$pid}"] = 0; $_POST["si_{$pid}"] = 0; $_POST["ki_{$pid}"] = 0; $_POST["ir1_d1_{$pid}"] = 0; $_POST["ir1_d2_{$pid}"] = 0; $_POST["ir2_d1_{$pid}"] = 0; $_POST["ir2_d2_{$pid}"] = 0; $_POST["ir3_d1_{$pid}"] = 0; $_POST["ir3_d2_{$pid}"] = 0; $_POST["inj_{$pid}"] = NONE; $_POST["agn1_{$pid}"] = NONE; $_POST["agn2_{$pid}"] = NONE; } $m->entry($p->player_id, array('mvp' => $_POST["mvp_{$pid}"], 'cp' => $_POST["cp_{$pid}"], 'td' => $_POST["td_{$pid}"], 'intcpt' => $_POST["intcpt_{$pid}"], 'bh' => $_POST["bh_{$pid}"], 'si' => $_POST["si_{$pid}"], 'ki' => $_POST["ki_{$pid}"], 'ir1_d1' => $_POST["ir1_d1_{$pid}"], 'ir1_d2' => $_POST["ir1_d2_{$pid}"], 'ir2_d1' => $_POST["ir2_d1_{$pid}"], 'ir2_d2' => $_POST["ir2_d2_{$pid}"], 'ir3_d1' => $_POST["ir3_d1_{$pid}"], 'ir3_d2' => $_POST["ir3_d2_{$pid}"], 'inj' => $_POST["inj_{$pid}"], 'agn1' => $_POST["agn1_{$pid}"], 'agn2' => $_POST["agn2_{$pid}"])); } MTS('Saved all REGULAR player entries in match_data for team ' . $id); /* Save stars entries. */ foreach ($stars as $star) { $s = new Star($star['id']); if (isset($_POST['team_' . $star['id']]) && $_POST['team_' . $star['id']] == $id) { $sid = $s->star_id; $m->entry($sid, array('f_team_id' => $t->team_id, 'mvp' => isset($_POST["mvp_{$sid}"]) && $_POST["mvp_{$sid}"] ? 1 : 0, 'cp' => $_POST["cp_{$sid}"], 'td' => $_POST["td_{$sid}"], 'intcpt' => $_POST["intcpt_{$sid}"], 'bh' => $_POST["bh_{$sid}"], 'si' => $_POST["si_{$sid}"], 'ki' => $_POST["ki_{$sid}"], 'ir1_d1' => 0, 'ir1_d2' => 0, 'ir2_d1' => 0, 'ir2_d2' => 0, 'ir3_d1' => 0, 'ir3_d2' => 0, 'inj' => NONE, 'agn1' => NONE, 'agn2' => NONE)); } else { $s->rmMatchEntry($m->match_id, $t->team_id); } } MTS('Saved all STAR player entries in match_data for team ' . $id); /* Save mercenary entries. */ Mercenary::rmMatchEntries($m->match_id, $t->team_id); // Remove all previously saved mercs in this match. for ($i = 0; $i <= 20; $i++) { # We don't expect over 20 mercs. This is just some large random number. $idm = '_' . ID_MERCS . '_' . $i; if (isset($_POST["team{$idm}"]) && $_POST["team{$idm}"] == $id) { $m->entry(ID_MERCS, array('f_team_id' => $t->team_id, 'nr' => $i, 'skills' => $_POST["skills{$idm}"], 'mvp' => isset($_POST["mvp{$idm}"]) && $_POST["mvp{$idm}"] ? 1 : 0, 'cp' => $_POST["cp{$idm}"], 'td' => $_POST["td{$idm}"], 'intcpt' => $_POST["intcpt{$idm}"], 'bh' => $_POST["bh{$idm}"], 'si' => $_POST["si{$idm}"], 'ki' => $_POST["ki{$idm}"], 'ir1_d1' => 0, 'ir1_d2' => 0, 'ir2_d1' => 0, 'ir2_d2' => 0, 'ir3_d1' => 0, 'ir3_d2' => 0, 'inj' => NONE, 'agn1' => NONE, 'agn2' => NONE)); } } MTS('Saved all MERC player entries in match_data for team ' . $id); } $m->finalizeMatchSubmit(); # Required! MTS('Report submit ENDED'); // Refresh objects used to display form. $m = new Match($match_id); $team1 = new Team($m->team1_id); $team2 = new Team($m->team2_id); } // Change round form submitted? if ($IS_LOCAL_ADMIN && isset($_POST['round'])) { status($m->chRound((int) $_POST['round'])); } /**************** * * Generate form * ****************/ $teamUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team1_id, false, false) . "\">" . $m->team1_name . "</a>"; $teamUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team2_id, false, false) . "\">" . $m->team2_name . "</a>"; $coachUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team1->owned_by_coach_id, false, false) . "\">" . $team1->f_cname . "</a>"; $coachUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team2->owned_by_coach_id, false, false) . "\">" . $team2->f_cname . "</a>"; $raceUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team1->f_race_id, false, false) . "\">" . $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team1->f_rname))) . "</a>"; $raceUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team2->f_race_id, false, false) . "\">" . $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team2->f_rname))) . "</a>"; $leagueUrl = League::getLeagueUrl(get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_LEAGUE)); $divUrl = "<a href=\"" . urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_DIVISION, get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_DIVISION)) . "\">" . get_parent_name(T_NODE_MATCH, $m->match_id, T_NODE_DIVISION) . "</a>"; $tourUrl = Tour::getTourUrl(get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_TOURNAMENT)); title($teamUrl1 . " - " . $teamUrl2); $CP = 8; // Colspan. ?> <table> <tr><td></td><td style='text-align: right;'><i><?php echo $lng->getTrn('common/home'); ?> </i></td><td>—</td><td style='text-align: left;'><i><?php echo $lng->getTrn('common/away'); ?> </i></td></tr> <tr><td><b><?php echo $lng->getTrn('common/teams'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$teamUrl1}</td><td> — </td><td style='text-align: left;'>{$teamUrl2}"; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/coaches'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$coachUrl1}</td><td> — </td><td style='text-align: left;'>{$coachUrl2}"; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/races'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$raceUrl1}</td><td> — </td><td style='text-align: left;'>{$raceUrl2}"; ?> </td></tr> <tr><td colspan="4"><hr></td></tr> <tr><td><b><?php echo $lng->getTrn('common/league'); ?> </b>:</td><td colspan="3"> <?php echo $leagueUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/division'); ?> </b>:</td><td colspan="3"> <?php echo $divUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/tournament'); ?> </b>:</td><td colspan="3"><?php echo $tourUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/round'); ?> </b>:</td><td colspan="3"> <?php echo $T_ROUNDS[$m->round]; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/dateplayed'); ?> </b>:</td><td colspan="3"><?php echo $m->is_played ? textdate($m->date_played) : '<i>' . $lng->getTrn('matches/report/notplayed') . '</i>'; ?> </td></tr> <?php if (Module::isRegistered('PDFMatchReport')) { $str = '<a href="handler.php?type=pdfmatchreport&tid1=' . $team1->team_id . '&tid2=' . $team2->team_id . '&mid=' . $m->match_id . '" TARGET="_blank">Download PDF report</a>'; echo "<tr><td><b>Match report</b>:</td><td>{$str}</td></tr>"; } if (Module::isRegistered('UPLOAD_BOTOCS')) { echo "<tr><td><b>Replay</b>:</td><td colspan='3'><a href='handler.php?type=leegmgr&replay={$m->match_id}'>View replay</a></td></tr>"; } if ($IS_LOCAL_ADMIN) { ?> <script language="JavaScript" type="text/javascript"> function match_delete() { return confirm('<?php echo $lng->getTrn('matches/tourmatches/matchdelete'); ?> '); } function match_reset() { return confirm('<?php echo $lng->getTrn('matches/tourmatches/reset_notice'); ?> '); } </script> <?php $matchURL = "index.php?section=matches&type=report&mid={$m->match_id}"; $deleteURL = "index.php?section=matches&type=tourmatches&trid={$m->f_tour_id}&mid={$m->match_id}"; echo "<tr><td><b>Admin:</b></td><td colspan='3'><b>"; echo "<a onclick=\"return match_reset();\" href='{$matchURL}&action=reset'>" . $lng->getTrn('common/reset') . "</a> \n"; echo "<a onclick=\"return match_delete();\" href='{$deleteURL}&action=delete' style='color:" . (!empty($m->date_played) ? 'Red' : 'Blue') . ";'>" . $lng->getTrn('common/delete') . "</a> \n"; echo "<a href='{$matchURL}&action=" . ($m->locked ? 'unlock' : 'lock') . "'>" . ($m->locked ? $lng->getTrn('common/unlock') : $lng->getTrn('common/lock')) . "</a> \n"; echo "<br><a href='javascript:void(0);' onClick='slideToggleFast(\"chRound\");'>" . $lng->getTrn('matches/report/chround') . "</a><div id='chRound' style='display:none;'>\n\t\t<form method='POST'>\n\t\t<select name='round'>"; foreach ($T_ROUNDS as $id => $desc) { echo "<option value='{$id}'>" . $desc . "</option>\n"; } echo "</select>\n\t\t<input type='submit' value='" . $lng->getTrn('matches/report/chround') . "'>\n\t\t</form>\n\t\t</div>"; echo "</b></td></tr>"; } ?> </table> <br> <?php echo "<b><a TARGET='_blank' href='" . DOC_URL_GUIDE . "'>" . $lng->getTrn('common/needhelp') . "</a></b><br><br>"; ?> <form method="POST" enctype="multipart/form-data"> <table class="common"> <tr class='commonhead'><td colspan="<?php echo $CP; ?> "><b><?php echo $lng->getTrn('matches/report/info'); ?> </b></td></tr> <tr><td class='seperator' colspan='<?php echo $CP; ?> '></td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('matches/report/stadium'); ?> </b> <select name="stadium" <?php echo $DIS; ?> > <?php $stad = $m->stadium ? $m->stadium : $m->team1_id; foreach (array($team1, $team2) as $_t) { echo "<option value='{$_t->team_id}'" . ($stad == $_t->team_id ? 'SELECTED' : '') . ">{$_t->name}</option>\n"; } ?> </select> </td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('common/gate'); ?> </b> <input type="text" name="gate" onChange='numError(this);' value="<?php echo $m->gate ? $m->gate / 1000 : 0; ?> " size="4" maxlength="4" <?php echo $DIS; ?> >k </td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('matches/report/fans'); ?> </b> <input type="text" name="fans" onChange='numError(this);' value="<?php echo $m->fans; ?> " size="7" maxlength="12" <?php echo $DIS; ?> > </td></tr> <?php if (!$settings['hide_ES_extensions']) { ?> <tr><td colspan='<?php echo $CP; ?> '> <b>E</b>xtra player <b>S</b>tats (ES) <a href="index.php?section=matches&type=report&mid=<?php echo $m->match_id; ?> &es_report=1">report page here</a> </td></tr> <?php } ?> <tr><td class="seperator" colspan='<?php echo $CP; ?> '></td></tr> <tr class='commonhead'> <td><b><?php echo $lng->getTrn('common/teams'); ?> </b></td> <td><b><?php echo $lng->getTrn('common/score'); ?> </b></td> <td><b>Δ <?php echo $lng->getTrn('matches/report/treas'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/ff'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/smp'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/tcas'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/fame'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/tv'); ?> </b></td> </tr> <tr><td class='seperator' colspan='<?php echo $CP; ?> '></td></tr> <?php foreach (array(1, 2) as $N) { echo "<tr>\n"; echo "<td>" . ${"teamUrl{$N}"} . "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='result{$N}' value='" . (int) $m->{"team{$N}_score"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numErrorAllowNegative(this);' name='inc{$N}' value='" . (int) $m->{"income{$N}"} / 1000 . "' size='4' maxlength='4' {$DIS}>k</td>\n"; echo "<td>"; foreach (array('1' => 'green', '0' => 'blue', '-1' => 'red') as $Nff => $color) { echo "<input {$DIS} type='radio' name='ff{$N}' value='{$Nff}' " . ($m->{"ffactor{$N}"} == (int) $Nff ? 'CHECKED' : '') . "><font color='{$color}'><b>{$Nff}</b></font>"; } echo "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='smp{$N}' value='" . $m->{"smp{$N}"} . "' size='1' maxlength='2' {$DIS}>" . $lng->getTrn('matches/report/pts') . "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='tcas{$N}' value='" . $m->{"tcas{$N}"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numError(this);' name='fame{$N}' value='" . $m->{"fame{$N}"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numError(this);' name='tv{$N}' value='" . ($m->is_played ? $m->{"tv{$N}"} / 1000 : ${"team{$N}"}->value / 1000) . "' size='4' maxlength='10' {$DIS}>k</td>\n"; echo "</tr>\n"; } ?> </table> <?php $playerFields = array_merge($T_MOUT_REL, $T_MOUT_ACH, $T_MOUT_IR, $T_MOUT_INJ); $CPP = count($playerFields); foreach (array(1 => $team1, 2 => $team2) as $id => $t) { ?> <table class='common'> <tr><td class='seperator' colspan='<?php echo $CPP; ?> '></td></tr> <tr class='commonhead'><td colspan='<?php echo $CPP; ?> '> <b><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $t->team_id, false, false); ?> "><?php echo $t->name; ?> </a> <?php echo $lng->getTrn('matches/report/report'); ?> </b> </td></tr> <tr><td class='seperator' colspan='<?php echo $CPP; ?> '></td></tr> <?php echo "<tr>\n"; foreach (array_values($playerFields) as $f) { // We need to translate table headers switch (strtolower(str_replace(' ', '', $f))) { case 'name': $header_text = $lng->getTrn('common/name'); break; case 'mvp': $header_text = $lng->getTrn('matches/report/mvp'); break; case 'cp': $header_text = $lng->getTrn('matches/report/cp'); break; case 'bh': $header_text = $lng->getTrn('matches/report/bh'); break; case 'si': $header_text = $lng->getTrn('matches/report/si'); break; case 'ki': $header_text = $lng->getTrn('matches/report/ki'); break; case 'ir1d1': $header_text = $lng->getTrn('matches/report/ir1') . " D1"; break; case 'ir1d2': $header_text = $lng->getTrn('matches/report/ir1') . " D2"; break; case 'ir2d1': $header_text = $lng->getTrn('matches/report/ir2') . " D1"; break; case 'ir2d2': $header_text = $lng->getTrn('matches/report/ir2') . " D2"; break; case 'ir3d1': $header_text = $lng->getTrn('matches/report/ir3') . " D1"; break; case 'ir3d2': $header_text = $lng->getTrn('matches/report/ir3') . " D2"; break; case 'inj': $header_text = $lng->getTrn('matches/report/inj'); break; case 'ageing1': $header_text = $lng->getTrn('matches/report/ageing1'); break; case 'ageing2': $header_text = $lng->getTrn('matches/report/ageing2'); break; default: $header_text = $f; } echo "<td><i>{$header_text}</i></td>\n"; } echo "</tr>\n"; $NORMSTAT = true; // only normal player statuses foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } // Fetch player data from match $status = $p->getStatus($m->match_id); $mdat = $m->getPlayerEntry($p->player_id); // Print player row if ($p->is_journeyman_used && !$m->is_played) { $bgcolor = COLOR_HTML_JOURNEY_USED; $NORMSTAT = false; } elseif ($p->is_journeyman) { $bgcolor = COLOR_HTML_JOURNEY; $NORMSTAT = false; } elseif ($status == MNG) { $bgcolor = COLOR_HTML_MNG; $NORMSTAT = false; } elseif ($p->mayHaveNewSkill()) { $bgcolor = COLOR_HTML_NEWSKILL; $NORMSTAT = false; } else { $bgcolor = false; } self::_print_player_row($p->player_id, '<a href="index.php?section=objhandler&type=1&obj=1&obj_id=' . $p->player_id . '">' . $p->name . '</a>', $p->nr, $lng->getTrn('position/' . strtolower($lng->FilterPosition($p->position))) . ($status == MNG ? ' [MNG]' : ''), $bgcolor, $mdat, $DIS || $status == MNG); } echo "</table>\n"; echo "<br>\n"; if (!$NORMSTAT) { ?> <table class="text"><tr><td style="width: 100%;"></td><?php if (1) { ?> <td style="background-color: <?php echo COLOR_HTML_MNG; ?> ;"><font color='black'><b> MNG </b></font></td> <td style="background-color: <?php echo COLOR_HTML_JOURNEY; ?> ;"><font color='black'><b> Journeyman </b></font></td> <td style="background-color: <?php echo COLOR_HTML_JOURNEY_USED; ?> ;"><font color='black'><b> Used journeyman </b></font></td> <td style="background-color: <?php echo COLOR_HTML_NEWSKILL; ?> ;"><font color='black'><b> New skill available </b></font></td> <?php } ?> </tr></table><?php } // Add raised zombies global $racesHasNecromancer; if (in_array($t->f_race_id, $racesHasNecromancer)) { echo "<hr style='width:200px;float:left;'><br>\n <b>Raised zombie?:</b> <input type='checkbox' name='t{$id}zombie' value='1' onclick='slideToggleFast(\"t{$id}zombie\");'><br>\n"; echo "<div id='t{$id}zombie' style='display:none;'>\n"; echo "<table class='common'>\n"; self::_print_player_row("t{$id}zombie", 'Raised zombie', '—', 'Zombie', false, array(), $DIS); echo "</table>\n"; echo "</div>\n"; } // Add raised rotters global $racesMayRaiseRotters; if (in_array($t->f_race_id, $racesMayRaiseRotters)) { $maxRotters = 6; # Note there is no real limit for raised rotters. echo "<hr style='width:200px;float:left;'><br>\n <b>Raised rotters?:</b>\n <select name='t{$id}rotterCnt' onChange='var i = this.options[this.selectedIndex].value; var j=1; for (j=1; j<={$maxRotters}; j++) {if (j<=i) {slideDownFast(\"t{$id}rotter\"+j);} else {slideUpFast(\"t{$id}rotter\"+j);}}' >"; foreach (range(0, $maxRotters) as $n) { echo "<option value='{$n}'>{$n}</option>"; } echo "</select>\n"; foreach (range(0, $maxRotters) as $n) { echo "<div id='t{$id}rotter{$n}' style='display:none;'><table class='common'>\n"; self::_print_player_row("t{$id}rotter{$n}", "Raised Rotter #{$n}", '—', 'Rotter', false, array(), $DIS); echo "</table></div>\n"; } } ?> <table style='border-spacing: 0px 10px;'> <tr><td align="left" valign="top"> <b>Star Players</b>: <input type='button' id="addStarsBtn_<?php echo $id; ?> " value="<?php echo $lng->getTrn('common/add'); ?> " onClick="stars = document.getElementById('stars_<?php echo $id; ?> '); addStarMerc(<?php echo $id; ?> , stars.options[stars.selectedIndex].value);" <?php echo $DIS; ?> > <select id="stars_<?php echo $id; ?> " <?php echo $DIS; ?> > <?php foreach ($stars as $s => $d) { echo "<option " . (in_array($t->f_race_id, $d['races']) ? 'style="background-color: ' . COLOR_HTML_READY . ';"' : '') . " value='{$d['id']}'>{$s}</option>\n"; } ?> </select> </td></tr> <tr><td align="left" valign="top"> <b>Mercenaries</b>: <input type='button' id="addMercsBtn_<?php echo $id; ?> " value="<?php echo $lng->getTrn('common/add'); ?> " onClick="addStarMerc(<?php echo "{$id}, " . ID_MERCS; ?> );" <?php echo $DIS; ?> > </td></tr> </table> <table class='common' id='<?php echo "starsmercs_{$id}"; ?> '> </table> <?php } ?> <table class='common'> <tr><td class='seperator' colspan='13'></td></tr> <tr class='commonhead'><td colspan='13'><b><?php echo $lng->getTrn('matches/report/summary'); ?> </b></td></tr> <tr><td colspan='13'><textarea name='summary' rows='10' cols='100' <?php echo $DIS . ">" . $m->getText(); ?> </textarea></td></tr> </table> <br> <center> <input type="submit" name='button' value="<?php echo $lng->getTrn('common/save'); ?> " <?php echo $DIS; ?> > <?php if ($USED_JOURNEYMAN_PRESENT) { echo "<br><br><b>" . $lng->getTrn('matches/report/usedjourney') . "</b>"; } ?> </center> </form> <br><br> <?php /* Now, we call javascript routine(s) to fill out stars and mercs rows, if such entries exist in database. */ $i = 0; // Counter. Used to pass PHP-data to Javascript. foreach (array(1 => $team1->team_id, 2 => $team2->team_id) as $id => $t) { foreach (Star::getStars(STATS_TEAM, $t, STATS_MATCH, $m->match_id) as $s) { echo "<script language='JavaScript' type='text/javascript'>\n"; echo "var mdat{$i} = [];\n"; $mdat = $s->getStats(T_NODE_MATCH, $m->match_id); foreach (array_keys($T_MOUT_ACH) as $f) { echo "mdat{$i}['{$f}'] = " . $mdat[$f] . ";\n"; } echo "existingStarMerc({$id}, {$s->star_id}, mdat{$i});\n"; echo "</script>\n"; $i++; } foreach (Mercenary::getMercsHiredByTeam($t, $m->match_id) as $merc) { echo "<script language='JavaScript' type='text/javascript'>\n"; echo "var mdat{$i} = [];\n"; foreach (array_merge(array_keys($T_MOUT_ACH), array('skills')) as $f) { echo "mdat{$i}['{$f}'] = " . $merc->{$f} . ";\n"; } echo "existingStarMerc({$id}, " . ID_MERCS . ", mdat{$i});\n"; echo "</script>\n"; $i++; } } }