コード例 #1
0
ファイル: Match.php プロジェクト: vskants/fifastats
 public function action_new()
 {
     $match = new Model_Match();
     $values = $match->as_array();
     $errors = "";
     if (isset($_POST['submit'])) {
         $this->save($match, $this->request->post());
         Helper_App::message(__('new_result_added'), 'alert-success');
     }
     $inputs_data = array('values' => $values, 'text_inputs' => array('player_1_team', 'player_2_team'), 'player1_options' => Model_Player::get_players_ids_and_names(), 'player2_options' => Model_Player::get_players_ids_and_names(), 'score_options' => array(0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10));
     $data = array('match' => $match, 'form' => View::factory('matches/_form', $inputs_data));
     $this->template->inline_scripts[] = 'var players = ' . json_encode(Model_Player::get_players_array()) . ';';
     $this->template->content = View::factory('matches/new', $data)->bind('errors', $errors);
 }