示例#1
0
 public function configure()
 {
     parent::configure();
     if ($this->getOption('allowUserTypeSelection')) {
         $this->setWidget('type', new sfWidgetFormChoice(array('choices' => gmExporterTypes::getChoices(true, $this->getContext()))));
         $this->setValidator('type', new sfValidatorChoice(array('choices' => gmExporterTypes::getTypes(), 'required' => true)));
     } else {
         $this->setWidget('type', new sfWidgetFormInputHidden());
         $this->setValidator('type', new sfValidatorString(array('required' => true)));
     }
     $this->setWidget('title', new sfWidgetFormInput());
     $this->setValidator('title', new sfValidatorString(array('required' => true)));
     foreach ($this->getFields() as $fieldDecorator) {
         $this->setWidget($fieldDecorator->getId(), new sfWidgetFormInputCheckbox());
         $this->setValidator($fieldDecorator->getId(), new sfValidatorBoolean());
         $this->getWidgetSchema()->setLabel($fieldDecorator->getId(), $fieldDecorator->getLabel());
         $this->setDefault($fieldDecorator->getId(), true);
     }
     $this->getWidgetSchema()->setNameFormat('exportation[%s]');
     $this->setDefault('title', $this->translate($this->getOption('title')));
     $this->setDefault('type', $this->getOption('type'));
 }
 /**
  * Returns the exporter subclass name
  *
  * @return string exporter subclass name
  */
 protected function getExporterSubclassName()
 {
     return gmExporterTypes::getClassForType($this->type, $this->getExporterSubclassPrefix());
 }