public function setup() { parent::setup(); $status = sfConfig::get('app_rt_shop_order_status_types', array('paid', 'picking', 'dispatch', 'sent')); $this->widgetSchema['status'] = new sfWidgetFormSelect(array('choices' => $status)); $this->validatorSchema['status'] = new sfValidatorChoice(array('choices' => array_keys($status), 'required' => true), array('required' => 'Please select a value')); $this->validatorSchema['email'] = new sfValidatorEmail(array('required' => true), array('required' => 'Please provide an email address', 'invalid' => 'Please provide a valid email address (me@example.com)')); // Help text for fields $this->widgetSchema->setHelp('notes_user', 'Order notes (visible to customer)'); $this->widgetSchema->setHelp('notes_admin', 'Administrator order notes (not visible to customer)'); $this->widgetSchema->setNameFormat('rt_shop_order[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); }
public function setup() { parent::setup(); $this->enableCSRFProtection(); $this->widgetSchema->setFormFormatterName('table'); $this->useFields(array('id', 'email_address')); $this->widgetSchema->setLabel('email_address', "Email Address"); $this->widgetSchema['email_address'] = new sfWidgetFormInput(array(), array('class' => 'text')); $this->setValidator('email_address', new sfValidatorEmail(array('max_length' => 255, 'required' => true))); $this->widgetSchema->setNameFormat('rt_shop_order[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); $this->getWidgetSchema()->setFormFormatterName(sfConfig::get('app_rt_public_form_formatter_name', 'RtList')); }
public function setup() { parent::setup(); $this->useFields(array('id', 'voucher_code')); $this->_rt_shop_cart_manager = $this->getOption('rt_shop_cart_manager'); if (!$this->_rt_shop_cart_manager instanceof rtShopCartManager) { throw new sfException('rtShopCartManager must be supplied.'); } $options = array('required' => false); $options['model'] = 'rtShopVoucher'; $options['column'] = 'code'; $options['query'] = Doctrine::getTable('rtShopVoucher')->getValidityQuery($this->getRtShopCartManager()->getSubTotal()); $this->setValidator('voucher_code', new sfValidatorDoctrineChoice($options, array('invalid' => 'Couldn\'t find a valid voucher for that code.'))); $this->widgetSchema->setNameFormat('rt_shop_order_voucher[%s]'); $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema); $this->getWidgetSchema()->setFormFormatterName(sfConfig::get('app_rt_public_form_formatter_name', 'RtList')); }