Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class TicTacToeForm extends BaseTicTacToeForm
- {
- public function setup()
- {
- parent::setup();
- if(!$this->getObject()->isNew()) // new
- {
- $this->useFields('player1', 'player2');
- }
- else if($this->getObject()->won || 9 == $this->getObject()->turns) // over
- {
- $this->widgetSchema['turns'] = new csWidgetFormReadOnlyString();
- $this->widgetSchema['won'] = new csWidgetFormReadOnlyString();
- $this->useFields('turns', 'won');
- }
- else // active
- {
- $this->widgetSchema['grid'] = new csWidgetFormDoctrineTicTacToe(array('game' => $this->getObject()));
- $this->validatorSchema['grid'] = new csValidatgorTicTacToe(array('game' => $this->getObject(), 'allow_multiple_changes' => true));
- $this->useFields('grid');
- }
- }
- }
Add Comment
Please, Sign In to add comment