-
-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathMatchsForm.class.php
More file actions
93 lines (73 loc) · 5.89 KB
/
MatchsForm.class.php
File metadata and controls
93 lines (73 loc) · 5.89 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
* Matchs form.
*
* @package PhpProject1
* @subpackage form
* @author Your name here
* @version SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
*/
class MatchsForm extends BaseMatchsForm {
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"]);
$passwordArray = 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');
$defaultPassword = sfConfig::get('app_default_password', '');
if (empty($defaultPassword)) {
$password = $passwordArray[rand(0, count($passwordArray) - 1)];
} else {
$password = $defaultPassword;
}
$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;
$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")));
$this->widgetSchema["startdate"] = new sfWidgetFormInputText(array("default" => date("d.m.Y H:i")), array("id" => "match_startdate", "style" => "width:180px;"));
$query = Doctrine_Core::getTable('Seasons')->createQuery()->where('active = ?', '1');
$this->widgetSchema['season_id']->setOption('query', $query);
$this->widgetSchema["team_a"]->setLabel("Team A");
$this->widgetSchema["team_b"]->setLabel("Team B");
$this->widgetSchema["max_round"]->setLabel("Max Rounds (MR)");
$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_knife_round"]->setLabel("Knife Round");
$this->widgetSchema["config_knife_round"]->setDefault(true);
$this->widgetSchema["config_full_score"]->setLabel("Play all Rounds");
$this->widgetSchema["config_password"]->setLabel("Password");
$this->widgetSchema["config_password"]->setDefault($password);
$this->widgetSchema["map_selection_mode"]->setDefault("normal");
$this->widgetSchema["rules"]->setDefault(sfConfig::get("app_default_rules"));
$this->widgetSchema["overtime_startmoney"]->setLabel("Overtime: Startmoney");
$this->widgetSchema["overtime_startmoney"]->setDefault(sfConfig::get("app_default_overtime_startmoney"));
$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_b']->addOption('method', 'getNameFlag');
$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");
$flags = sfConfig::get("app_flag_team_en");
$aFlags = array();
$aFlags[""] = "";
foreach ($flags as $k => $flag) {
$aFlags[$k] = $flag;
}
$this->widgetSchema["team_a_flag"] = new sfWidgetFormSelect(array("choices" => $aFlags));
$this->widgetSchema["team_b_flag"] = new sfWidgetFormSelect(array("choices" => $aFlags));
$this->widgetSchema["map_selection_mode"]->addOption('choices', array('normal' => 'BO1', 'bo3_modeb' => 'BO3'));
// MOVING FIELDS
$this->getWidgetSchema()->moveField('config_password', sfWidgetFormSchema::AFTER, 'rules');
$this->getWidgetSchema()->moveField('max_round', sfWidgetFormSchema::AFTER, 'config_password');
$this->getWidgetSchema()->moveField('config_ot', sfWidgetFormSchema::AFTER, 'config_knife_round');
$this->getWidgetSchema()->moveField('auto_start', sfWidgetFormSchema::AFTER, 'config_ot');
$this->getWidgetSchema()->moveField('overtime_startmoney', sfWidgetFormSchema::AFTER, 'config_ot');
$this->getWidgetSchema()->moveField('overtime_max_round', sfWidgetFormSchema::AFTER, 'overtime_startmoney');
$this->getWidgetSchema()->moveField('startdate', sfWidgetFormSchema::AFTER, 'auto_start');
$this->getWidgetSchema()->moveField('auto_start_time', sfWidgetFormSchema::AFTER, 'startdate');
}
}