diff --git a/apps/backend/modules/matchs/actions/actions.class.php b/apps/backend/modules/matchs/actions/actions.class.php index 2b015b0c..5c15e3e1 100644 --- a/apps/backend/modules/matchs/actions/actions.class.php +++ b/apps/backend/modules/matchs/actions/actions.class.php @@ -284,7 +284,7 @@ public function executeReset(sfWebRequest $request) $match->setStatus(0); $match->setIngameEnable(NULL); $match->setIsPaused(NULL); -// $match->setIp(null); + // $match->setIp(null); // $match->setServer(null); $match->save(); foreach ($match->getMaps() as $map) { @@ -368,7 +368,8 @@ public function executeMatchsInProgress(sfWebRequest $request) $table = MatchsTable::getInstance(); $this->pager = null; $this->pager = new sfDoctrinePager( - 'Matchs', 12 + 'Matchs', + 12 ); $this->pager->setQuery($query->andWhere("status >= ? AND status <= ?", array(Matchs::STATUS_NOT_STARTED, Matchs::STATUS_END_MATCH))->orderBy("enable DESC, status DESC")); $this->pager->setPage($request->getParameter('page', 1)); @@ -396,7 +397,8 @@ public function executeMatchsArchived(sfWebRequest $request) $table = MatchsTable::getInstance(); $this->pager = null; $this->pager = new sfDoctrinePager( - 'Matchs', 12 + 'Matchs', + 12 ); $this->pager->setQuery($query->andWhere("status = ?", Matchs::STATUS_ARCHIVE)->orderBy("id DESC")); $this->pager->setPage($request->getParameter('page', 1)); @@ -526,6 +528,7 @@ public function executeDuplicate(sfWebRequest $request) $newMatch->config_full_score = $match->config_full_score; $newMatch->config_ot = $match->config_ot; $newMatch->config_streamer = $match->config_streamer; + $newMatch->config_ready_on_halftime = $match->config_ready_on_halftime; $newMatch->config_knife_round = $match->config_knife_round; $newMatch->config_password = $match->config_password; $newMatch->map_selection_mode = $match->map_selection_mode; @@ -788,7 +791,8 @@ public function executeMatchsActions(sfWebRequest $request, $match = null) $result[] = array("label" => "End Knife", "action" => "forceknifeend", "type" => "doRequest"); } else if (in_array($match->getStatus(), array(Matchs::STATUS_WU_1_SIDE, Matchs::STATUS_WU_2_SIDE, Matchs::STATUS_WU_OT_1_SIDE, Matchs::STATUS_WU_OT_2_SIDE))) { $result[] = array("label" => "End warmup / halftime", "action" => "forcestart", "type" => "doRequest"); - } else if ($match->getStatus() == Matchs::STATUS_FIRST_SIDE || + } else if ( + $match->getStatus() == Matchs::STATUS_FIRST_SIDE || $match->getStatus() == Matchs::STATUS_SECOND_SIDE || $match->getStatus() == Matchs::STATUS_OT_FIRST_SIDE || $match->getStatus() == Matchs::STATUS_OT_SECOND_SIDE @@ -878,6 +882,7 @@ public function executeToornamentImport(sfWebRequest $request) } $match->config_full_score = false; $match->config_streamer = false; + $match->config_ready_on_halftime = false; $match->config_knife_round = true; $match->identifier_id = $identifier; @@ -901,16 +906,19 @@ public function executeToornamentImport(sfWebRequest $request) $match->save(); - return $this->renderText(json_encode(array( + return $this->renderText(json_encode( + array( "status" => true, - "matchId" => $match->getId()) + "matchId" => $match->getId() + ) )); } } } catch (\Exception $e) { return $this->renderText(json_encode(array( "status" => false, - "error" => "apiError"))); + "error" => "apiError" + ))); } } @@ -985,7 +993,8 @@ public function executeExport(sfWebRequest $request) 'result' => $round->getTeamWin() == 'a' ? 1 : 3, 'side' => $sideA, 'players' => array() - ), array( + ), + array( 'number' => 2, 'result' => $round->getTeamWin() == 'b' ? 1 : 3, 'side' => $sideB, diff --git a/config/doctrine/schema.yml b/config/doctrine/schema.yml index 6908e5c5..7a4e2562 100644 --- a/config/doctrine/schema.yml +++ b/config/doctrine/schema.yml @@ -23,6 +23,7 @@ Matchs: config_full_score: { type: boolean } config_ot: { type: boolean } config_streamer: { type: boolean } + config_ready_on_halftime: { type: boolean } config_knife_round: { type: boolean } config_switch_auto: { type: boolean } config_auto_change_password: { type: boolean } @@ -30,7 +31,7 @@ Matchs: config_heatmap: { type: boolean } config_authkey: { type: varchar(200) } enable: { type: boolean } - map_selection_mode: { type: enum, values: [ bo2, bo3_modea, bo3_modeb, normal ]} + map_selection_mode: { type: enum, values: [bo2, bo3_modea, bo3_modeb, normal] } ingame_enable: { type: boolean } current_map: { type: integer(20) } force_zoom_match: { type: boolean } @@ -54,9 +55,9 @@ Maps: map_name: { type: varchar(50) } score_1: { type: integer(5) } score_2: { type: integer(5) } - current_side: { type: enum, values: [ ct, t ] } + current_side: { type: enum, values: [ct, t] } status: { type: integer(3) } - maps_for: { type: enum, values: [ default, team1, team2 ]} + maps_for: { type: enum, values: [default, team1, team2] } nb_ot: { type: integer(20) } identifier_id: { type: integer(20) } tv_record_file: { type: varchar(255) } @@ -69,7 +70,7 @@ MapsScore: columns: id: { primary: true, type: integer(20), autoincrement: true } map_id: { type: integer(20), notnull: true } - type_score: { type: enum, values: [ normal, ot ] } + type_score: { type: enum, values: [normal, ot] } score1_side1: { type: integer(5) } score1_side2: { type: integer(5) } score2_side1: { type: integer(5) } @@ -85,11 +86,11 @@ Players: match_id: { type: integer(20), notnull: true } map_id: { type: integer(20), notnull: true } player_key: { type: varchar(255) } - team: { type: enum, values: [ a,b,other], default: other} + team: { type: enum, values: [a, b, other], default: other } ip: { type: varchar(255) } steamid: { type: varchar(255) } - first_side: { type: enum, values: [ ct, t, other ] } - current_side: { type: enum, values: [ ct, t, other ] } + first_side: { type: enum, values: [ct, t, other] } + current_side: { type: enum, values: [ct, t, other] } pseudo: { type: varchar(255) } nb_kill: { type: integer(5), default: 0 } assist: { type: integer(5), default: 0 } @@ -122,8 +123,8 @@ PlayersSnapshot: id: { primary: true, type: integer(20), autoincrement: true } player_id: { type: integer(20), notnull: true } player_key: { type: varchar(255) } - first_side: { type: enum, values: [ ct, t, other ] } - current_side: { type: enum, values: [ ct, t, other ] } + first_side: { type: enum, values: [ct, t, other] } + current_side: { type: enum, values: [ct, t, other] } nb_kill: { type: integer(5), default: 0 } assist: { type: integer(5), default: 0 } death: { type: integer(5), default: 0 } @@ -175,12 +176,14 @@ RoundSummary: bomb_planted: { type: boolean } bomb_defused: { type: boolean } bomb_exploded: { type: boolean } - win_type: { type: enum, values: [ bombdefused, bombeexploded, normal, saved], default: normal } - team_win: { type: enum, values: [ a, b ]} + win_type: { type: enum, values: [bombdefused, bombeexploded, normal, saved], default: normal } + team_win: { type: enum, values: [a, b] } ct_win: { type: boolean } t_win: { type: boolean } - score_a: { type: integer(2)} - score_b: { type: integer(2)} + score_a: { type: integer(2) } + score_b: { type: integer(2) } + side_a: { type: enum, values: [ct, t] } + side_b: { type: enum, values: [ct, t] } best_killer: { type: integer(20) } best_killer_nb: { type: integer(5) } best_killer_fk: { type: boolean } @@ -291,9 +294,9 @@ TeamsInSeasons: actAs: Timestampable: ~ columns: - id: { primary: true, type: integer(20), autoincrement: true } + id: { primary: true, type: integer(20), autoincrement: true } season_id: { type: integer(20) } team_id: { type: integer(20) } relations: Seasons: { class: Seasons, onDelete: CASCADE, local: season_id, foreign: id } - Teams: { class: Teams, onDelete: CASCADE, local: team_id, foreign: id } \ No newline at end of file + Teams: { class: Teams, onDelete: CASCADE, local: team_id, foreign: id } diff --git a/data/sql/schema.sql b/data/sql/schema.sql index 007123ca..76330ea8 100644 --- a/data/sql/schema.sql +++ b/data/sql/schema.sql @@ -1,53 +1,532 @@ -CREATE TABLE maps (id BIGINT AUTO_INCREMENT, match_id BIGINT NOT NULL, map_name VARCHAR(50), score_1 BIGINT, score_2 BIGINT, current_side VARCHAR(255), status MEDIUMINT, maps_for VARCHAR(255), nb_ot BIGINT, identifier_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX match_id_idx (match_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE maps_score (id BIGINT AUTO_INCREMENT, map_id BIGINT NOT NULL, type_score VARCHAR(255), score1_side1 BIGINT, score1_side2 BIGINT, score2_side1 BIGINT, score2_side2 BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX map_id_idx (map_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE matchs (id BIGINT AUTO_INCREMENT, ip VARCHAR(50), server_id BIGINT, season_id BIGINT, team_a BIGINT, team_a_flag VARCHAR(2), team_a_name VARCHAR(25), team_b BIGINT, team_b_flag VARCHAR(2), team_b_name VARCHAR(25), status SMALLINT, score_a BIGINT, score_b BIGINT, max_round MEDIUMINT NOT NULL, rules VARCHAR(200) NOT NULL, overtime_startmoney BIGINT, overtime_max_round MEDIUMINT, config_full_score TINYINT(1), config_ot TINYINT(1), config_streamer TINYINT(1), config_knife_round TINYINT(1), config_switch_auto TINYINT(1), config_auto_change_password TINYINT(1), config_password VARCHAR(50), config_heatmap TINYINT(1), config_authkey VARCHAR(200), enable TINYINT(1), map_selection_mode VARCHAR(255), ingame_enable TINYINT(1), current_map BIGINT, force_zoom_match TINYINT(1), tv_record_file VARCHAR(255), identifier_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX server_id_idx (server_id), INDEX team_a_idx (team_a), INDEX team_b_idx (team_b), INDEX current_map_idx (current_map), INDEX season_id_idx (season_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE player_kill (id BIGINT AUTO_INCREMENT, match_id BIGINT NOT NULL, map_id BIGINT NOT NULL, killer_name VARCHAR(100), killer_id BIGINT, killer_team VARCHAR(20), killed_name VARCHAR(100), killed_id BIGINT, killed_team VARCHAR(20), weapon VARCHAR(100), headshot TINYINT(1), round_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX match_id_idx (match_id), INDEX map_id_idx (map_id), INDEX killer_id_idx (killer_id), INDEX killed_id_idx (killed_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE players (id BIGINT AUTO_INCREMENT, match_id BIGINT NOT NULL, map_id BIGINT NOT NULL, player_key VARCHAR(255), team VARCHAR(255) DEFAULT 'other', ip VARCHAR(255), steamid VARCHAR(255), first_side VARCHAR(255), current_side VARCHAR(255), pseudo VARCHAR(255), nb_kill BIGINT DEFAULT 0, assist BIGINT DEFAULT 0, death BIGINT DEFAULT 0, point BIGINT DEFAULT 0, hs BIGINT DEFAULT 0, defuse BIGINT DEFAULT 0, bombe BIGINT DEFAULT 0, tk BIGINT DEFAULT 0, nb1 BIGINT DEFAULT 0, nb2 BIGINT DEFAULT 0, nb3 BIGINT DEFAULT 0, nb4 BIGINT DEFAULT 0, nb5 BIGINT DEFAULT 0, nb1kill BIGINT DEFAULT 0, nb2kill BIGINT DEFAULT 0, nb3kill BIGINT DEFAULT 0, nb4kill BIGINT DEFAULT 0, nb5kill BIGINT DEFAULT 0, pluskill BIGINT DEFAULT 0, firstkill BIGINT DEFAULT 0, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX match_id_idx (match_id), INDEX map_id_idx (map_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE players_heatmap (id BIGINT AUTO_INCREMENT, match_id BIGINT NOT NULL, map_id BIGINT NOT NULL, event_name VARCHAR(50), event_x DOUBLE(18, 2), event_y DOUBLE(18, 2), event_z DOUBLE(18, 2), player_name VARCHAR(255), player_id BIGINT, player_team VARCHAR(20), attacker_x DOUBLE(18, 2), attacker_y DOUBLE(18, 2), attacker_z DOUBLE(18, 2), attacker_name VARCHAR(255), attacker_id BIGINT, attacker_team VARCHAR(20), round_id BIGINT, round_time BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX match_id_idx (match_id), INDEX map_id_idx (map_id), INDEX player_id_idx (player_id), INDEX attacker_id_idx (attacker_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE players_snapshot (id BIGINT AUTO_INCREMENT, player_id BIGINT NOT NULL, player_key VARCHAR(255), first_side VARCHAR(255), current_side VARCHAR(255), nb_kill BIGINT DEFAULT 0, assist BIGINT DEFAULT 0, death BIGINT DEFAULT 0, point BIGINT DEFAULT 0, hs BIGINT DEFAULT 0, defuse BIGINT DEFAULT 0, bombe BIGINT DEFAULT 0, tk BIGINT DEFAULT 0, nb1 BIGINT DEFAULT 0, nb2 BIGINT DEFAULT 0, nb3 BIGINT DEFAULT 0, nb4 BIGINT DEFAULT 0, nb5 BIGINT DEFAULT 0, nb1kill BIGINT DEFAULT 0, nb2kill BIGINT DEFAULT 0, nb3kill BIGINT DEFAULT 0, nb4kill BIGINT DEFAULT 0, nb5kill BIGINT DEFAULT 0, pluskill BIGINT DEFAULT 0, firstkill BIGINT DEFAULT 0, round_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX player_id_idx (player_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE round (id BIGINT AUTO_INCREMENT, match_id BIGINT NOT NULL, map_id BIGINT NOT NULL, event_name VARCHAR(255), event_text text, event_time BIGINT, kill_id BIGINT, round_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX match_id_idx (match_id), INDEX map_id_idx (map_id), INDEX kill_id_idx (kill_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE round_summary (id BIGINT AUTO_INCREMENT, match_id BIGINT NOT NULL, map_id BIGINT NOT NULL, bomb_planted TINYINT(1), bomb_defused TINYINT(1), bomb_exploded TINYINT(1), win_type VARCHAR(255) DEFAULT 'normal', team_win VARCHAR(255), ct_win TINYINT(1), t_win TINYINT(1), score_a SMALLINT, score_b SMALLINT, best_killer BIGINT, best_killer_nb BIGINT, best_killer_fk TINYINT(1), best_action_type text, best_action_param text, backup_file_name VARCHAR(255), round_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX match_id_idx (match_id), INDEX map_id_idx (map_id), INDEX best_killer_idx (best_killer), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE seasons (id BIGINT AUTO_INCREMENT, name VARCHAR(50) NOT NULL, event VARCHAR(50) NOT NULL, start DATETIME NOT NULL, end DATETIME NOT NULL, link VARCHAR(100), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE servers (id BIGINT AUTO_INCREMENT, ip VARCHAR(50) NOT NULL, rcon VARCHAR(50) NOT NULL, hostname VARCHAR(100) NOT NULL, tv_ip VARCHAR(100), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE teams (id BIGINT AUTO_INCREMENT, name VARCHAR(50) NOT NULL, shorthandle VARCHAR(50) NOT NULL, flag VARCHAR(2) NOT NULL, link VARCHAR(100), season_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX season_id_idx (season_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE sf_guard_forgot_password (id BIGINT AUTO_INCREMENT, user_id BIGINT NOT NULL, unique_key VARCHAR(255), expires_at DATETIME NOT NULL, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE sf_guard_group (id BIGINT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE sf_guard_group_permission (group_id BIGINT, permission_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(group_id, permission_id)) ENGINE = INNODB; -CREATE TABLE sf_guard_permission (id BIGINT AUTO_INCREMENT, name VARCHAR(255) UNIQUE, description TEXT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE sf_guard_remember_key (id BIGINT AUTO_INCREMENT, user_id BIGINT, remember_key VARCHAR(32), ip_address VARCHAR(50), created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX user_id_idx (user_id), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE sf_guard_user (id BIGINT AUTO_INCREMENT, first_name VARCHAR(255), last_name VARCHAR(255), email_address VARCHAR(255) NOT NULL UNIQUE, username VARCHAR(128) NOT NULL UNIQUE, algorithm VARCHAR(128) DEFAULT 'sha1' NOT NULL, salt VARCHAR(128), password VARCHAR(128), is_active TINYINT(1) DEFAULT '1', is_super_admin TINYINT(1) DEFAULT '0', last_login DATETIME, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, INDEX is_active_idx_idx (is_active), PRIMARY KEY(id)) ENGINE = INNODB; -CREATE TABLE sf_guard_user_group (user_id BIGINT, group_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, group_id)) ENGINE = INNODB; -CREATE TABLE sf_guard_user_permission (user_id BIGINT, permission_id BIGINT, created_at DATETIME NOT NULL, updated_at DATETIME NOT NULL, PRIMARY KEY(user_id, permission_id)) ENGINE = INNODB; -ALTER TABLE maps ADD CONSTRAINT maps_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES matchs(id) ON DELETE CASCADE; -ALTER TABLE maps_score ADD CONSTRAINT maps_score_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps(id) ON DELETE CASCADE; -ALTER TABLE matchs ADD CONSTRAINT matchs_team_b_teams_id FOREIGN KEY (team_b) REFERENCES teams(id) ON DELETE SET NULL; -ALTER TABLE matchs ADD CONSTRAINT matchs_team_a_teams_id FOREIGN KEY (team_a) REFERENCES teams(id) ON DELETE SET NULL; -ALTER TABLE matchs ADD CONSTRAINT matchs_server_id_servers_id FOREIGN KEY (server_id) REFERENCES servers(id) ON DELETE SET NULL; -ALTER TABLE matchs ADD CONSTRAINT matchs_season_id_seasons_id FOREIGN KEY (season_id) REFERENCES seasons(id) ON DELETE SET NULL; -ALTER TABLE matchs ADD CONSTRAINT matchs_current_map_maps_id FOREIGN KEY (current_map) REFERENCES maps(id) ON DELETE SET NULL; -ALTER TABLE player_kill ADD CONSTRAINT player_kill_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES matchs(id) ON DELETE CASCADE; -ALTER TABLE player_kill ADD CONSTRAINT player_kill_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps(id) ON DELETE CASCADE; -ALTER TABLE player_kill ADD CONSTRAINT player_kill_killer_id_players_id FOREIGN KEY (killer_id) REFERENCES players(id) ON DELETE CASCADE; -ALTER TABLE player_kill ADD CONSTRAINT player_kill_killed_id_players_id FOREIGN KEY (killed_id) REFERENCES players(id) ON DELETE CASCADE; -ALTER TABLE players ADD CONSTRAINT players_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES matchs(id) ON DELETE CASCADE; -ALTER TABLE players ADD CONSTRAINT players_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps(id) ON DELETE CASCADE; -ALTER TABLE players_heatmap ADD CONSTRAINT players_heatmap_player_id_players_id FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE CASCADE; -ALTER TABLE players_heatmap ADD CONSTRAINT players_heatmap_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES matchs(id) ON DELETE CASCADE; -ALTER TABLE players_heatmap ADD CONSTRAINT players_heatmap_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps(id) ON DELETE CASCADE; -ALTER TABLE players_heatmap ADD CONSTRAINT players_heatmap_attacker_id_players_id FOREIGN KEY (attacker_id) REFERENCES players(id) ON DELETE SET NULL; -ALTER TABLE players_snapshot ADD CONSTRAINT players_snapshot_player_id_players_id FOREIGN KEY (player_id) REFERENCES players(id) ON DELETE CASCADE; -ALTER TABLE round ADD CONSTRAINT round_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES matchs(id) ON DELETE CASCADE; -ALTER TABLE round ADD CONSTRAINT round_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps(id) ON DELETE CASCADE; -ALTER TABLE round ADD CONSTRAINT round_kill_id_player_kill_id FOREIGN KEY (kill_id) REFERENCES player_kill(id) ON DELETE SET NULL; -ALTER TABLE round_summary ADD CONSTRAINT round_summary_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES matchs(id) ON DELETE CASCADE; -ALTER TABLE round_summary ADD CONSTRAINT round_summary_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps(id) ON DELETE CASCADE; -ALTER TABLE round_summary ADD CONSTRAINT round_summary_best_killer_players_id FOREIGN KEY (best_killer) REFERENCES players(id) ON DELETE SET NULL; -ALTER TABLE teams ADD CONSTRAINT teams_season_id_seasons_id FOREIGN KEY (season_id) REFERENCES seasons(id) ON DELETE SET NULL; -ALTER TABLE sf_guard_forgot_password ADD CONSTRAINT sf_guard_forgot_password_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; -ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE; -ALTER TABLE sf_guard_group_permission ADD CONSTRAINT sf_guard_group_permission_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE; -ALTER TABLE sf_guard_remember_key ADD CONSTRAINT sf_guard_remember_key_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; -ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; -ALTER TABLE sf_guard_user_group ADD CONSTRAINT sf_guard_user_group_group_id_sf_guard_group_id FOREIGN KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE; -ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_user_id_sf_guard_user_id FOREIGN KEY (user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; -ALTER TABLE sf_guard_user_permission ADD CONSTRAINT sf_guard_user_permission_permission_id_sf_guard_permission_id FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE CASCADE; +CREATE TABLE maps + ( + id BIGINT auto_increment, + match_id BIGINT NOT NULL, + map_name VARCHAR(50), + score_1 BIGINT, + score_2 BIGINT, + current_side VARCHAR(255), + status MEDIUMINT, + maps_for VARCHAR(255), + nb_ot BIGINT, + identifier_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX match_id_idx (match_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE maps_score + ( + id BIGINT auto_increment, + map_id BIGINT NOT NULL, + type_score VARCHAR(255), + score1_side1 BIGINT, + score1_side2 BIGINT, + score2_side1 BIGINT, + score2_side2 BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX map_id_idx (map_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE matchs + ( + id BIGINT auto_increment, + ip VARCHAR(50), + server_id BIGINT, + season_id BIGINT, + team_a BIGINT, + team_a_flag VARCHAR(2), + team_a_name VARCHAR(25), + team_b BIGINT, + team_b_flag VARCHAR(2), + team_b_name VARCHAR(25), + status SMALLINT, + score_a BIGINT, + score_b BIGINT, + max_round MEDIUMINT NOT NULL, + rules VARCHAR(200) NOT NULL, + overtime_startmoney BIGINT, + overtime_max_round MEDIUMINT, + config_full_score TINYINT(1), + config_ot TINYINT(1), + config_streamer TINYINT(1), + config_knife_round TINYINT(1), + config_switch_auto TINYINT(1), + config_auto_change_password TINYINT(1), + config_password VARCHAR(50), + config_heatmap TINYINT(1), + config_authkey VARCHAR(200), + enable TINYINT(1), + map_selection_mode VARCHAR(255), + ingame_enable TINYINT(1), + current_map BIGINT, + force_zoom_match TINYINT(1), + tv_record_file VARCHAR(255), + identifier_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX server_id_idx (server_id), + INDEX team_a_idx (team_a), + INDEX team_b_idx (team_b), + INDEX current_map_idx (current_map), + INDEX season_id_idx (season_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE player_kill + ( + id BIGINT auto_increment, + match_id BIGINT NOT NULL, + map_id BIGINT NOT NULL, + killer_name VARCHAR(100), + killer_id BIGINT, + killer_team VARCHAR(20), + killed_name VARCHAR(100), + killed_id BIGINT, + killed_team VARCHAR(20), + weapon VARCHAR(100), + headshot TINYINT(1), + round_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX match_id_idx (match_id), + INDEX map_id_idx (map_id), + INDEX killer_id_idx (killer_id), + INDEX killed_id_idx (killed_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE players + ( + id BIGINT auto_increment, + match_id BIGINT NOT NULL, + map_id BIGINT NOT NULL, + player_key VARCHAR(255), + team VARCHAR(255) DEFAULT 'other', + ip VARCHAR(255), + steamid VARCHAR(255), + first_side VARCHAR(255), + current_side VARCHAR(255), + pseudo VARCHAR(255), + nb_kill BIGINT DEFAULT 0, + assist BIGINT DEFAULT 0, + death BIGINT DEFAULT 0, + point BIGINT DEFAULT 0, + hs BIGINT DEFAULT 0, + defuse BIGINT DEFAULT 0, + bombe BIGINT DEFAULT 0, + tk BIGINT DEFAULT 0, + nb1 BIGINT DEFAULT 0, + nb2 BIGINT DEFAULT 0, + nb3 BIGINT DEFAULT 0, + nb4 BIGINT DEFAULT 0, + nb5 BIGINT DEFAULT 0, + nb1kill BIGINT DEFAULT 0, + nb2kill BIGINT DEFAULT 0, + nb3kill BIGINT DEFAULT 0, + nb4kill BIGINT DEFAULT 0, + nb5kill BIGINT DEFAULT 0, + pluskill BIGINT DEFAULT 0, + firstkill BIGINT DEFAULT 0, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX match_id_idx (match_id), + INDEX map_id_idx (map_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE players_heatmap + ( + id BIGINT auto_increment, + match_id BIGINT NOT NULL, + map_id BIGINT NOT NULL, + event_name VARCHAR(50), + event_x DOUBLE(18, 2), + event_y DOUBLE(18, 2), + event_z DOUBLE(18, 2), + player_name VARCHAR(255), + player_id BIGINT, + player_team VARCHAR(20), + attacker_x DOUBLE(18, 2), + attacker_y DOUBLE(18, 2), + attacker_z DOUBLE(18, 2), + attacker_name VARCHAR(255), + attacker_id BIGINT, + attacker_team VARCHAR(20), + round_id BIGINT, + round_time BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX match_id_idx (match_id), + INDEX map_id_idx (map_id), + INDEX player_id_idx (player_id), + INDEX attacker_id_idx (attacker_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE players_snapshot + ( + id BIGINT auto_increment, + player_id BIGINT NOT NULL, + player_key VARCHAR(255), + first_side VARCHAR(255), + current_side VARCHAR(255), + nb_kill BIGINT DEFAULT 0, + assist BIGINT DEFAULT 0, + death BIGINT DEFAULT 0, + point BIGINT DEFAULT 0, + hs BIGINT DEFAULT 0, + defuse BIGINT DEFAULT 0, + bombe BIGINT DEFAULT 0, + tk BIGINT DEFAULT 0, + nb1 BIGINT DEFAULT 0, + nb2 BIGINT DEFAULT 0, + nb3 BIGINT DEFAULT 0, + nb4 BIGINT DEFAULT 0, + nb5 BIGINT DEFAULT 0, + nb1kill BIGINT DEFAULT 0, + nb2kill BIGINT DEFAULT 0, + nb3kill BIGINT DEFAULT 0, + nb4kill BIGINT DEFAULT 0, + nb5kill BIGINT DEFAULT 0, + pluskill BIGINT DEFAULT 0, + firstkill BIGINT DEFAULT 0, + round_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX player_id_idx (player_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE round + ( + id BIGINT auto_increment, + match_id BIGINT NOT NULL, + map_id BIGINT NOT NULL, + event_name VARCHAR(255), + event_text TEXT, + event_time BIGINT, + kill_id BIGINT, + round_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX match_id_idx (match_id), + INDEX map_id_idx (map_id), + INDEX kill_id_idx (kill_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE round_summary + ( + id BIGINT auto_increment, + match_id BIGINT NOT NULL, + map_id BIGINT NOT NULL, + bomb_planted TINYINT(1), + bomb_defused TINYINT(1), + bomb_exploded TINYINT(1), + win_type VARCHAR(255) DEFAULT 'normal', + team_win VARCHAR(255), + ct_win TINYINT(1), + t_win TINYINT(1), + score_a SMALLINT, + score_b SMALLINT, + best_killer BIGINT, + best_killer_nb BIGINT, + best_killer_fk TINYINT(1), + best_action_type TEXT, + best_action_param TEXT, + backup_file_name VARCHAR(255), + round_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX match_id_idx (match_id), + INDEX map_id_idx (map_id), + INDEX best_killer_idx (best_killer), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE seasons + ( + id BIGINT auto_increment, + name VARCHAR(50) NOT NULL, + event VARCHAR(50) NOT NULL, + start DATETIME NOT NULL, + end DATETIME NOT NULL, + link VARCHAR(100), + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE servers + ( + id BIGINT auto_increment, + ip VARCHAR(50) NOT NULL, + rcon VARCHAR(50) NOT NULL, + hostname VARCHAR(100) NOT NULL, + tv_ip VARCHAR(100), + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE teams + ( + id BIGINT auto_increment, + name VARCHAR(50) NOT NULL, + shorthandle VARCHAR(50) NOT NULL, + flag VARCHAR(2) NOT NULL, + link VARCHAR(100), + season_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX season_id_idx (season_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE sf_guard_forgot_password + ( + id BIGINT auto_increment, + user_id BIGINT NOT NULL, + unique_key VARCHAR(255), + expires_at DATETIME NOT NULL, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX user_id_idx (user_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE sf_guard_group + ( + id BIGINT auto_increment, + name VARCHAR(255) UNIQUE, + description TEXT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE sf_guard_group_permission + ( + group_id BIGINT, + permission_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + PRIMARY KEY(group_id, permission_id) + ) +engine = innodb; + +CREATE TABLE sf_guard_permission + ( + id BIGINT auto_increment, + name VARCHAR(255) UNIQUE, + description TEXT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE sf_guard_remember_key + ( + id BIGINT auto_increment, + user_id BIGINT, + remember_key VARCHAR(32), + ip_address VARCHAR(50), + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX user_id_idx (user_id), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE sf_guard_user + ( + id BIGINT auto_increment, + first_name VARCHAR(255), + last_name VARCHAR(255), + email_address VARCHAR(255) NOT NULL UNIQUE, + username VARCHAR(128) NOT NULL UNIQUE, + algorithm VARCHAR(128) DEFAULT 'sha1' NOT NULL, + salt VARCHAR(128), + password VARCHAR(128), + is_active TINYINT(1) DEFAULT '1', + is_super_admin TINYINT(1) DEFAULT '0', + last_login DATETIME, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + INDEX is_active_idx_idx (is_active), + PRIMARY KEY(id) + ) +engine = innodb; + +CREATE TABLE sf_guard_user_group + ( + user_id BIGINT, + group_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + PRIMARY KEY(user_id, group_id) + ) +engine = innodb; + +CREATE TABLE sf_guard_user_permission + ( + user_id BIGINT, + permission_id BIGINT, + created_at DATETIME NOT NULL, + updated_at DATETIME NOT NULL, + PRIMARY KEY(user_id, permission_id) + ) +engine = innodb; + +ALTER TABLE maps + ADD CONSTRAINT maps_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES + matchs(id) ON DELETE CASCADE; + +ALTER TABLE maps_score + ADD CONSTRAINT maps_score_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps( + id) ON DELETE CASCADE; + +ALTER TABLE matchs + ADD CONSTRAINT matchs_team_b_teams_id FOREIGN KEY (team_b) REFERENCES teams(id + ) ON DELETE SET NULL; + +ALTER TABLE matchs + ADD CONSTRAINT matchs_team_a_teams_id FOREIGN KEY (team_a) REFERENCES teams(id + ) ON DELETE SET NULL; + +ALTER TABLE matchs + ADD CONSTRAINT matchs_server_id_servers_id FOREIGN KEY (server_id) REFERENCES + servers(id) ON DELETE SET NULL; + +ALTER TABLE matchs + ADD CONSTRAINT matchs_season_id_seasons_id FOREIGN KEY (season_id) REFERENCES + seasons(id) ON DELETE SET NULL; + +ALTER TABLE matchs + ADD CONSTRAINT matchs_current_map_maps_id FOREIGN KEY (current_map) REFERENCES + maps(id) ON DELETE SET NULL; + +ALTER TABLE player_kill + ADD CONSTRAINT player_kill_match_id_matchs_id FOREIGN KEY (match_id) + REFERENCES matchs(id) ON DELETE CASCADE; + +ALTER TABLE player_kill + ADD CONSTRAINT player_kill_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps + (id) ON DELETE CASCADE; + +ALTER TABLE player_kill + ADD CONSTRAINT player_kill_killer_id_players_id FOREIGN KEY (killer_id) + REFERENCES players(id) ON DELETE CASCADE; + +ALTER TABLE player_kill + ADD CONSTRAINT player_kill_killed_id_players_id FOREIGN KEY (killed_id) + REFERENCES players(id) ON DELETE CASCADE; + +ALTER TABLE players + ADD CONSTRAINT players_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES + matchs(id) ON DELETE CASCADE; + +ALTER TABLE players + ADD CONSTRAINT players_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps(id) + ON DELETE CASCADE; + +ALTER TABLE players_heatmap + ADD CONSTRAINT players_heatmap_player_id_players_id FOREIGN KEY (player_id) + REFERENCES players(id) ON DELETE CASCADE; + +ALTER TABLE players_heatmap + ADD CONSTRAINT players_heatmap_match_id_matchs_id FOREIGN KEY (match_id) + REFERENCES matchs(id) ON DELETE CASCADE; + +ALTER TABLE players_heatmap + ADD CONSTRAINT players_heatmap_map_id_maps_id FOREIGN KEY (map_id) REFERENCES + maps(id) ON DELETE CASCADE; + +ALTER TABLE players_heatmap + ADD CONSTRAINT players_heatmap_attacker_id_players_id FOREIGN KEY (attacker_id + ) REFERENCES players(id) ON DELETE SET NULL; + +ALTER TABLE players_snapshot + ADD CONSTRAINT players_snapshot_player_id_players_id FOREIGN KEY (player_id) + REFERENCES players(id) ON DELETE CASCADE; + +ALTER TABLE round + ADD CONSTRAINT round_match_id_matchs_id FOREIGN KEY (match_id) REFERENCES + matchs(id) ON DELETE CASCADE; + +ALTER TABLE round + ADD CONSTRAINT round_map_id_maps_id FOREIGN KEY (map_id) REFERENCES maps(id) + ON DELETE CASCADE; + +ALTER TABLE round + ADD CONSTRAINT round_kill_id_player_kill_id FOREIGN KEY (kill_id) REFERENCES + player_kill(id) ON DELETE SET NULL; + +ALTER TABLE round_summary + ADD CONSTRAINT round_summary_match_id_matchs_id FOREIGN KEY (match_id) + REFERENCES matchs(id) ON DELETE CASCADE; + +ALTER TABLE round_summary + ADD CONSTRAINT round_summary_map_id_maps_id FOREIGN KEY (map_id) REFERENCES + maps(id) ON DELETE CASCADE; + +ALTER TABLE round_summary + ADD CONSTRAINT round_summary_best_killer_players_id FOREIGN KEY (best_killer) + REFERENCES players(id) ON DELETE SET NULL; + +ALTER TABLE teams + ADD CONSTRAINT teams_season_id_seasons_id FOREIGN KEY (season_id) REFERENCES + seasons(id) ON DELETE SET NULL; + +ALTER TABLE sf_guard_forgot_password + ADD CONSTRAINT sf_guard_forgot_password_user_id_sf_guard_user_id FOREIGN KEY ( + user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; + +ALTER TABLE sf_guard_group_permission + ADD CONSTRAINT sf_guard_group_permission_permission_id_sf_guard_permission_id + FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE + CASCADE; + +ALTER TABLE sf_guard_group_permission + ADD CONSTRAINT sf_guard_group_permission_group_id_sf_guard_group_id FOREIGN + KEY (group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE; + +ALTER TABLE sf_guard_remember_key + ADD CONSTRAINT sf_guard_remember_key_user_id_sf_guard_user_id FOREIGN KEY ( + user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; + +ALTER TABLE sf_guard_user_group + ADD CONSTRAINT sf_guard_user_group_user_id_sf_guard_user_id FOREIGN KEY ( + user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; + +ALTER TABLE sf_guard_user_group + ADD CONSTRAINT sf_guard_user_group_group_id_sf_guard_group_id FOREIGN KEY ( + group_id) REFERENCES sf_guard_group(id) ON DELETE CASCADE; + +ALTER TABLE sf_guard_user_permission + ADD CONSTRAINT sf_guard_user_permission_user_id_sf_guard_user_id FOREIGN KEY ( + user_id) REFERENCES sf_guard_user(id) ON DELETE CASCADE; + +ALTER TABLE sf_guard_user_permission + ADD CONSTRAINT sf_guard_user_permission_permission_id_sf_guard_permission_id + FOREIGN KEY (permission_id) REFERENCES sf_guard_permission(id) ON DELETE + CASCADE; \ No newline at end of file diff --git a/lib/filter/doctrine/base/BaseMatchsFormFilter.class.php b/lib/filter/doctrine/base/BaseMatchsFormFilter.class.php index a2860fd5..df1a5594 100644 --- a/lib/filter/doctrine/base/BaseMatchsFormFilter.class.php +++ b/lib/filter/doctrine/base/BaseMatchsFormFilter.class.php @@ -13,83 +13,83 @@ abstract class BaseMatchsFormFilter extends BaseFormFilterDoctrine public function setup() { $this->setWidgets(array( - 'ip' => new sfWidgetFormFilterInput(), - 'server_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Server'), 'add_empty' => true)), - 'season_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Season'), 'add_empty' => true)), - 'team_a' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TeamA'), 'add_empty' => true)), - 'team_a_flag' => new sfWidgetFormFilterInput(), - 'team_a_name' => new sfWidgetFormFilterInput(), - 'team_b' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TeamB'), 'add_empty' => true)), - 'team_b_flag' => new sfWidgetFormFilterInput(), - 'team_b_name' => new sfWidgetFormFilterInput(), - 'status' => new sfWidgetFormFilterInput(), - 'is_paused' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'score_a' => new sfWidgetFormFilterInput(), - 'score_b' => new sfWidgetFormFilterInput(), - 'max_round' => new sfWidgetFormFilterInput(array('with_empty' => false)), - 'rules' => new sfWidgetFormFilterInput(array('with_empty' => false)), - 'overtime_startmoney' => new sfWidgetFormFilterInput(), - 'overtime_max_round' => new sfWidgetFormFilterInput(), - 'config_full_score' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'config_ot' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'config_streamer' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'config_knife_round' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'config_switch_auto' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'ip' => new sfWidgetFormFilterInput(), + 'server_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Server'), 'add_empty' => true)), + 'season_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Season'), 'add_empty' => true)), + 'team_a' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TeamA'), 'add_empty' => true)), + 'team_a_flag' => new sfWidgetFormFilterInput(), + 'team_a_name' => new sfWidgetFormFilterInput(), + 'team_b' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('TeamB'), 'add_empty' => true)), + 'team_b_flag' => new sfWidgetFormFilterInput(), + 'team_b_name' => new sfWidgetFormFilterInput(), + 'status' => new sfWidgetFormFilterInput(), + 'is_paused' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'score_a' => new sfWidgetFormFilterInput(), + 'score_b' => new sfWidgetFormFilterInput(), + 'max_round' => new sfWidgetFormFilterInput(array('with_empty' => false)), + 'rules' => new sfWidgetFormFilterInput(array('with_empty' => false)), + 'overtime_startmoney' => new sfWidgetFormFilterInput(), + 'overtime_max_round' => new sfWidgetFormFilterInput(), + 'config_full_score' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'config_ot' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'config_streamer' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'config_knife_round' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'config_switch_auto' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), 'config_auto_change_password' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'config_password' => new sfWidgetFormFilterInput(), - 'config_heatmap' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'config_authkey' => new sfWidgetFormFilterInput(), - 'enable' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'map_selection_mode' => new sfWidgetFormChoice(array('choices' => array('' => '', 'bo2' => 'bo2', 'bo3_modea' => 'bo3_modea', 'bo3_modeb' => 'bo3_modeb', 'normal' => 'normal'))), - 'ingame_enable' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'current_map' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Map'), 'add_empty' => true)), - 'force_zoom_match' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'identifier_id' => new sfWidgetFormFilterInput(), - 'startdate' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())), - 'auto_start' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), - 'auto_start_time' => new sfWidgetFormFilterInput(), - 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)), - 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)), + 'config_password' => new sfWidgetFormFilterInput(), + 'config_heatmap' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'config_authkey' => new sfWidgetFormFilterInput(), + 'enable' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'map_selection_mode' => new sfWidgetFormChoice(array('choices' => array('' => '', 'bo2' => 'bo2', 'bo3_modea' => 'bo3_modea', 'bo3_modeb' => 'bo3_modeb', 'normal' => 'normal'))), + 'ingame_enable' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'current_map' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Map'), 'add_empty' => true)), + 'force_zoom_match' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'identifier_id' => new sfWidgetFormFilterInput(), + 'startdate' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())), + 'auto_start' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))), + 'auto_start_time' => new sfWidgetFormFilterInput(), + 'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)), + 'updated_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)), )); $this->setValidators(array( - 'ip' => new sfValidatorPass(array('required' => false)), - 'server_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Server'), 'column' => 'id')), - 'season_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Season'), 'column' => 'id')), - 'team_a' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TeamA'), 'column' => 'id')), - 'team_a_flag' => new sfValidatorPass(array('required' => false)), - 'team_a_name' => new sfValidatorPass(array('required' => false)), - 'team_b' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TeamB'), 'column' => 'id')), - 'team_b_flag' => new sfValidatorPass(array('required' => false)), - 'team_b_name' => new sfValidatorPass(array('required' => false)), - 'status' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), - 'is_paused' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'score_a' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), - 'score_b' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), - 'max_round' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), - 'rules' => new sfValidatorPass(array('required' => false)), - 'overtime_startmoney' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), - 'overtime_max_round' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), - 'config_full_score' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'config_ot' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'config_streamer' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'config_knife_round' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'config_switch_auto' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'ip' => new sfValidatorPass(array('required' => false)), + 'server_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Server'), 'column' => 'id')), + 'season_id' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Season'), 'column' => 'id')), + 'team_a' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TeamA'), 'column' => 'id')), + 'team_a_flag' => new sfValidatorPass(array('required' => false)), + 'team_a_name' => new sfValidatorPass(array('required' => false)), + 'team_b' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('TeamB'), 'column' => 'id')), + 'team_b_flag' => new sfValidatorPass(array('required' => false)), + 'team_b_name' => new sfValidatorPass(array('required' => false)), + 'status' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), + 'is_paused' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'score_a' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), + 'score_b' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), + 'max_round' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), + 'rules' => new sfValidatorPass(array('required' => false)), + 'overtime_startmoney' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), + 'overtime_max_round' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), + 'config_full_score' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'config_ot' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'config_streamer' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'config_knife_round' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'config_switch_auto' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), 'config_auto_change_password' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'config_password' => new sfValidatorPass(array('required' => false)), - 'config_heatmap' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'config_authkey' => new sfValidatorPass(array('required' => false)), - 'enable' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'map_selection_mode' => new sfValidatorChoice(array('required' => false, 'choices' => array('bo2' => 'bo2', 'bo3_modea' => 'bo3_modea', 'bo3_modeb' => 'bo3_modeb', 'normal' => 'normal'))), - 'ingame_enable' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'current_map' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Map'), 'column' => 'id')), - 'force_zoom_match' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'identifier_id' => new sfValidatorPass(array('required' => false)), - 'startdate' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), - 'auto_start' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), - 'auto_start_time' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), - 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), - 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), + 'config_password' => new sfValidatorPass(array('required' => false)), + 'config_heatmap' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'config_authkey' => new sfValidatorPass(array('required' => false)), + 'enable' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'map_selection_mode' => new sfValidatorChoice(array('required' => false, 'choices' => array('bo2' => 'bo2', 'bo3_modea' => 'bo3_modea', 'bo3_modeb' => 'bo3_modeb', 'normal' => 'normal'))), + 'ingame_enable' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'current_map' => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Map'), 'column' => 'id')), + 'force_zoom_match' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'identifier_id' => new sfValidatorPass(array('required' => false)), + 'startdate' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), + 'auto_start' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))), + 'auto_start_time' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))), + 'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), + 'updated_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))), )); $this->widgetSchema->setNameFormat('matchs_filters[%s]'); @@ -109,44 +109,44 @@ public function getModelName() public function getFields() { return array( - 'id' => 'Number', - 'ip' => 'Text', - 'server_id' => 'ForeignKey', - 'season_id' => 'ForeignKey', - 'team_a' => 'ForeignKey', - 'team_a_flag' => 'Text', - 'team_a_name' => 'Text', - 'team_b' => 'ForeignKey', - 'team_b_flag' => 'Text', - 'team_b_name' => 'Text', - 'status' => 'Number', - 'is_paused' => 'Boolean', - 'score_a' => 'Number', - 'score_b' => 'Number', - 'max_round' => 'Number', - 'rules' => 'Text', - 'overtime_startmoney' => 'Number', - 'overtime_max_round' => 'Number', - 'config_full_score' => 'Boolean', - 'config_ot' => 'Boolean', - 'config_streamer' => 'Boolean', - 'config_knife_round' => 'Boolean', - 'config_switch_auto' => 'Boolean', + 'id' => 'Number', + 'ip' => 'Text', + 'server_id' => 'ForeignKey', + 'season_id' => 'ForeignKey', + 'team_a' => 'ForeignKey', + 'team_a_flag' => 'Text', + 'team_a_name' => 'Text', + 'team_b' => 'ForeignKey', + 'team_b_flag' => 'Text', + 'team_b_name' => 'Text', + 'status' => 'Number', + 'is_paused' => 'Boolean', + 'score_a' => 'Number', + 'score_b' => 'Number', + 'max_round' => 'Number', + 'rules' => 'Text', + 'overtime_startmoney' => 'Number', + 'overtime_max_round' => 'Number', + 'config_full_score' => 'Boolean', + 'config_ot' => 'Boolean', + 'config_streamer' => 'Boolean', + 'config_knife_round' => 'Boolean', + 'config_switch_auto' => 'Boolean', 'config_auto_change_password' => 'Boolean', - 'config_password' => 'Text', - 'config_heatmap' => 'Boolean', - 'config_authkey' => 'Text', - 'enable' => 'Boolean', - 'map_selection_mode' => 'Enum', - 'ingame_enable' => 'Boolean', - 'current_map' => 'ForeignKey', - 'force_zoom_match' => 'Boolean', - 'identifier_id' => 'Text', - 'startdate' => 'Date', - 'auto_start' => 'Boolean', - 'auto_start_time' => 'Number', - 'created_at' => 'Date', - 'updated_at' => 'Date', + 'config_password' => 'Text', + 'config_heatmap' => 'Boolean', + 'config_authkey' => 'Text', + 'enable' => 'Boolean', + 'map_selection_mode' => 'Enum', + 'ingame_enable' => 'Boolean', + 'current_map' => 'ForeignKey', + 'force_zoom_match' => 'Boolean', + 'identifier_id' => 'Text', + 'startdate' => 'Date', + 'auto_start' => 'Boolean', + 'auto_start_time' => 'Number', + 'created_at' => 'Date', + 'updated_at' => 'Date', ); } } diff --git a/lib/form/doctrine/MatchsForm.class.php b/lib/form/doctrine/MatchsForm.class.php index 17a327ed..c91f4637 100644 --- a/lib/form/doctrine/MatchsForm.class.php +++ b/lib/form/doctrine/MatchsForm.class.php @@ -8,19 +8,86 @@ * @author Your name here * @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $ */ -class MatchsForm extends BaseMatchsForm { +class MatchsForm extends BaseMatchsForm +{ - public function configure() { + public function configure() + { unset($this["config_authkey"], $this["ip"], $this["identifier_id"], $this["force_zoom_match"], $this["config_switch_auto"], $this["server_id"], $this["ingame_enable"], $this["config_auto_change_password"], $this["created_at"], $this["updated_at"], $this["current_map"], $this["status"], $this["score_a"], $this["score_b"], $this["config_heatmap"], $this["enable"], $this["is_paused"]); - $password = array('frosch', 'gehen', 'rennen', 'gucken', 'fliegen', 'rasen', 'snobb', 'peter', 'wackel', 'dackel', 'gut', 'schlecht', 'win', 'loss', 'tragen', - 'weg', 'berlin', 'aachen', 'mensch', 'tier', 'turtle', 'adler', 'raupe', 'rauben', 'bank', 'schalter', 'ticket', 'bahn', 'zug', 'delay', 'flugzeug', 'ratte', - 'nager', 'hase', 'feld', 'gras', 'kraut', 'gurke', 'apfel', 'salat', 'tomate', 'dressing', 'essig', 'zwiebel', 'kuchen', 'zucker', 'salz', 'kaffee', 'tee', - 'monday', 'tuesday', 'wednesday', 'friday', 'weekend', 'holiday', 'doctor', 'game', 'cup', 'death', 'player', 'monitor', 'hand', 'food', 'paper', 'windows', 'together'); - $password = $password[rand(0, count($password)-1)]; + $password = array( + 'frosch', + 'gehen', + 'rennen', + 'gucken', + 'fliegen', + 'rasen', + 'snobb', + 'peter', + 'wackel', + 'dackel', + 'gut', + 'schlecht', + 'win', + 'loss', + 'tragen', + 'weg', + 'berlin', + 'aachen', + 'mensch', + 'tier', + 'turtle', + 'adler', + 'raupe', + 'rauben', + 'bank', + 'schalter', + 'ticket', + 'bahn', + 'zug', + 'delay', + 'flugzeug', + 'ratte', + 'nager', + 'hase', + 'feld', + 'gras', + 'kraut', + 'gurke', + 'apfel', + 'salat', + 'tomate', + 'dressing', + 'essig', + 'zwiebel', + 'kuchen', + 'zucker', + 'salz', + 'kaffee', + 'tee', + 'monday', + 'tuesday', + 'wednesday', + 'friday', + 'weekend', + 'holiday', + 'doctor', + 'game', + 'cup', + 'death', + 'player', + 'monitor', + 'hand', + 'food', + 'paper', + 'windows', + 'together' + ); + $password = $password[rand(0, count($password) - 1)]; $supportedRoundFormats = array("15" => "MR15", "12" => "MR12", "9" => "MR9", "5" => "MR5", "3" => "MR3"); $defaultRoundFormat = sfConfig::get('app_default_max_round'); - if (!array_key_exists($defaultRoundFormat, $supportedRoundFormats)) $defaultRoundFormat = 12; + if (!array_key_exists($defaultRoundFormat, $supportedRoundFormats)) + $defaultRoundFormat = 12; $this->widgetSchema["max_round"] = new sfWidgetFormSelect(array("choices" => $supportedRoundFormats, "default" => $defaultRoundFormat)); $this->widgetSchema["overtime_max_round"] = new sfWidgetFormSelect(array("choices" => array("5" => "MR5", "3" => "MR3"), "default" => sfConfig::get("app_default_overtime_max_round"))); $this->widgetSchema["auto_start_time"] = new sfWidgetFormSelect(array("choices" => array("5" => "05 Minutes Before Startdate", "10" => "10 Minutes Before Startdate", "15" => "15 Minutes Before Startdate", "30" => "30 Minutes Before Startdate"))); @@ -37,6 +104,7 @@ public function configure() { $this->widgetSchema["config_ot"]->setLabel("OverTime"); $this->widgetSchema["config_ot"]->setDefault(sfConfig::get("app_default_overtime_enable", false)); $this->widgetSchema["config_streamer"]->setLabel("Streamer Ready"); + $this->widgetSchema["config_ready_on_halftime"]->setLabel("Ready on Halftime"); $this->widgetSchema["config_knife_round"]->setLabel("Knife Round"); $this->widgetSchema["config_knife_round"]->setDefault(true); $this->widgetSchema["config_full_score"]->setLabel("Play all Rounds"); @@ -50,9 +118,9 @@ public function configure() { $this->widgetSchema["overtime_max_round"]->setLabel("Overtime: Max Rounds"); $this->widgetSchema['team_a']->addOption('method', 'getNameFlag'); - $this->widgetSchema['team_a']->addOption('order_by',array('name','asc')); + $this->widgetSchema['team_a']->addOption('order_by', array('name', 'asc')); $this->widgetSchema['team_b']->addOption('method', 'getNameFlag'); - $this->widgetSchema['team_b']->addOption('order_by',array('name','asc')); + $this->widgetSchema['team_b']->addOption('order_by', array('name', 'asc')); $this->widgetSchema["auto_start"]->setLabel("Autostart Match"); $this->widgetSchema["auto_start_time"]->setLabel("Start Match");