| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 9 |
class ApplicationForm extends BaseApplicationForm |
|---|
| 10 |
{ |
|---|
| 11 |
public function configure() |
|---|
| 12 |
{ |
|---|
| 13 |
$context = sfContext::getInstance(); |
|---|
| 14 |
$culture = $context->getUser()->getCulture(); |
|---|
| 15 |
sfLoader::loadHelpers('I18n'); |
|---|
| 16 |
|
|---|
| 17 |
|
|---|
| 18 |
unset($this['created_at'], |
|---|
| 19 |
$this['updated_at'], |
|---|
| 20 |
$this['slug'], |
|---|
| 21 |
$this['is_featured']); |
|---|
| 22 |
|
|---|
| 23 |
|
|---|
| 24 |
$this->widgetSchema['tags'] = new sfWidgetFormInput(); |
|---|
| 25 |
$this->widgetSchema['screenshot_path'] = new sfWidgetFormInputFile(); |
|---|
| 26 |
$this->widgetSchema['country'] = new sfWidgetFormI18nSelectCountry(array('culture' => $culture)); |
|---|
| 27 |
$this->widgetSchema['started_at'] = new sfWidgetFormI18nDate(array('culture' => $culture)); |
|---|
| 28 |
$this->widgetSchema['released_at'] = new sfWidgetFormI18nDate(array('culture' => $culture)); |
|---|
| 29 |
|
|---|
| 30 |
|
|---|
| 31 |
$this->validatorSchema['tags'] = new sfValidatorRegex(array('pattern' => '/[0-9\w-_ ]/i', 'required' => false)); |
|---|
| 32 |
$this->validatorSchema['screenshot_path'] = new sfValidatorFile(array('max_size' => 512000, 'required' => false)); |
|---|
| 33 |
$this->validatorSchema['country'] = new sfValidatorI18nChoiceCountry(array('culture' => $culture, 'required' => false)); |
|---|
| 34 |
$this->validatorSchema['started_at'] = new sfValidatorDate(array('required' => false)); |
|---|
| 35 |
$this->validatorSchema['ended_at'] = new sfValidatorDate(array('required' => false)); |
|---|
| 36 |
|
|---|
| 37 |
|
|---|
| 38 |
$this->validatorSchema['homepage'] = new sfValidatorUrl(); |
|---|
| 39 |
$this->validatorSchema['feed_url'] = new sfValidatorOr(array( |
|---|
| 40 |
new sfValidatorUrl(), |
|---|
| 41 |
new sfValidatorChoice(array('choices' => array('http://', ''))), |
|---|
| 42 |
), array('required' => false)); |
|---|
| 43 |
|
|---|
| 44 |
|
|---|
| 45 |
$this->setDefaults(array('homepage' => 'http://', |
|---|
| 46 |
'feed_url' => 'http://', |
|---|
| 47 |
'released_at' => 'today', |
|---|
| 48 |
'is_featured' => null)); |
|---|
| 49 |
} |
|---|
| 50 |
} |
|---|
| 51 |
|
|---|