|
Revision 75, 2.0 kB
(checked in by nperriault, 5 months ago)
|
[1.1]:
- Companies and people modules migrated, with according form classes and templates, and functional test suite
- Enhanced SymfoniansTestBrowser?
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 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 |
class BaseConnectionForm extends sfForm |
|---|
| 31 |
{ |
|---|
| 32 |
|
|---|
| 33 |
* Form configuration |
|---|
| 34 |
* |
|---|
| 35 |
*/ |
|---|
| 36 |
public function setup() |
|---|
| 37 |
{ |
|---|
| 38 |
$years = range(date('Y') - 5, date('Y')); |
|---|
| 39 |
$years = array_combine($years, $years); |
|---|
| 40 |
$dateConfig = array('culture' => sfContext::getInstance()->getUser()->getCulture(), |
|---|
| 41 |
'years' => $years); |
|---|
| 42 |
|
|---|
| 43 |
|
|---|
| 44 |
$this->setWidgets(array( |
|---|
| 45 |
'role' => new sfWidgetFormInput(), |
|---|
| 46 |
'description' => new sfWidgetFormTextarea(), |
|---|
| 47 |
'started_at' => new sfWidgetFormI18nDate($dateConfig), |
|---|
| 48 |
'ended_at' => new sfWidgetFormI18nDate($dateConfig), |
|---|
| 49 |
)); |
|---|
| 50 |
|
|---|
| 51 |
|
|---|
| 52 |
$this->setValidators(array( |
|---|
| 53 |
'role' => new sfValidatorString(array('max_length' => 255, 'required' => true)), |
|---|
| 54 |
'description' => new sfValidatorString(array('max_length' => 65535, 'required' => false)), |
|---|
| 55 |
'started_at' => new sfValidatorDate(array('required' => false)), |
|---|
| 56 |
'ended_at' => new sfValidatorDate(array('required' => false)), |
|---|
| 57 |
)); |
|---|
| 58 |
|
|---|
| 59 |
$this->validatorSchema->setPostValidator(new sfValidatorSchemaTimeInterval('started_at', 'ended_at')); |
|---|
| 60 |
|
|---|
| 61 |
$this->widgetSchema->setNameFormat('connection[%s]'); |
|---|
| 62 |
} |
|---|
| 63 |
} |
|---|