Пример #1
0
 /**
  * @see sfForm
  */
 public function configure()
 {
     parent::configure();
     $profileForm = new ProfileForm($this->object->Profile);
     unset($profileForm['id'], $profileForm['sf_guard_user_id']);
     $this->embedForm('Profile', $profileForm);
 }
 public function configure()
 {
     parent::configure();
     /* embed the user profile form fields */
     $profileForm = new UserProfileAdminForm($this->object->UserProfile);
     unset($profileForm['id'], $profileForm['sf_guard_user_id']);
     $this->embedForm('UserProfile', $profileForm);
 }
 public function updateDefaultsFromObject()
 {
     parent::updateDefaultsFromObject();
     if ($this->isNew()) {
         $profile = new sfGuardUserProfileForm();
     } else {
         $profile = new sfGuardUserProfileForm($this->getObject()->getProfile());
     }
     unset($profile['user_id'], $profile['id']);
     $this->embedMergeForm('profile', $profile);
 }
Пример #4
0
 public function processValues($values)
 {
     $values = parent::processValues($values);
     $values['username'] = $values['email_address'];
     if ($this->isNew()) {
         $values['account_type'] = 'Pro';
         $values['is_active'] = true;
     }
     $this->object->link('Permissions', array(sfGuardPermission::DECISION_MANAGEMENT));
     return $values;
 }
Пример #5
0
 public function processValues($values)
 {
     $values = parent::processValues($values);
     if ($values['password'] === '' && $values['password_again'] === '') {
         $values['password'] = false;
     }
     $this->object->link('Permissions', array(sfGuardPermission::DECISION_MANAGEMENT));
     if (isset($values['is_admin']) && $values['is_admin']) {
         $this->object->link('Permissions', array(sfGuardPermission::ADMINISTRATION, sfGuardPermission::DECISION_MANAGEMENT));
     } else {
         $this->object->unlink('Permissions', array(sfGuardPermission::ADMINISTRATION));
     }
     return $values;
 }
Пример #6
0
 public function setup()
 {
     parent::setup();
     $this->widgetSchema->setFormFormatterName('bootstrap');
     $this->widgetSchema->setNameFormat('user_form[%s]');
     $this->setWidget('country', new sfWidgetFormI18nChoiceCountry());
     $this->setValidator('country', new sfValidatorI18nChoiceCountry());
     $this->setValidator('email_address', new ValidatorEmail(array('max_length' => 80)));
     foreach (array('email_address', 'first_name', 'last_name', 'organisation', 'website', 'street', 'post_code', 'city', 'country', 'mobile', 'phone', 'language_id') as $field) {
         $this->getValidator($field)->setOption('required', true);
     }
     $this->useFields(array('email_address', 'first_name', 'last_name', 'organisation', 'website', 'street', 'post_code', 'city', 'country', 'mobile', 'phone', 'language_id', 'groups_list'), true);
     $this->getWidget('groups_list')->setOption('expanded', true);
     $this->getWidgetSchema()->setHelp('street', 'In accordance with our terms of service and legal obligations, you must provide your, or your organisations\' legal address.');
     $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorDoctrineUnique(array('model' => 'sfGuardUser', 'column' => array('email_address')), array('invalid' => 'An user account with this email exists already.')), new sfValidatorDoctrineUnique(array('model' => 'sfGuardUser', 'column' => array('username'))))));
 }
 /**
  * @see sfForm
  */
 public function configure()
 {
     parent::configure();
     //   $profile = new MobilyrentProfile();
     //   $profile->setSfGuardUserId($this->getObject()->id);
     //   $profileForm = new MobilyrentProfileForm($profile);
     //   unset($profileForm['sf_guard_user_id'], $profileForm['sf_guard_user_id']);
     //   unset($profileForm['created_at'], $profileForm['created_at']);
     //   unset($profileForm['updated_at'], $profileForm['updated_at']);
     //   unset($profileForm['is_activated'],$profileForm['is_activated']);
     //   $this->embedForm('Profile', $profileForm);
     $profileForm = new MobilyrentProfileForm($this->object->Profile);
     unset($profileForm['id'], $profileForm['sf_guard_user_id']);
     unset($profileForm['created_at'], $profileForm['created_at']);
     unset($profileForm['updated_at'], $profileForm['updated_at']);
     unset($profileForm['is_activated'], $profileForm['is_activated']);
     $this->embedForm('Profile', $profileForm);
 }
Пример #8
0
 public function setup()
 {
     parent::setup();
     $this->widgetSchema->setFormFormatterName('bootstrap');
     $this->widgetSchema->setNameFormat('user_form[%s]');
     $this->setWidget('country', new sfWidgetFormI18nChoiceCountry());
     $this->setValidator('country', new sfValidatorI18nChoiceCountry());
     $this->setValidator('email_address', new ValidatorEmail(array('max_length' => 80)));
     foreach (array('email_address', 'password', 'password_again', 'first_name', 'last_name', 'organisation', 'website', 'street', 'post_code', 'city', 'country', 'mobile', 'phone', 'language_id') as $field) {
         $this->getValidator($field)->setOption('required', true);
     }
     $this->useFields(array('email_address', 'password', 'password_again', 'first_name', 'last_name', 'organisation', 'website', 'street', 'post_code', 'city', 'country', 'mobile', 'phone', 'language_id', 'is_active', 'groups_list'), true);
     $this->setValidator('password', new ValidatorPassword(array('required' => false, 'min_length' => 10, 'max_length' => 100)));
     $this->getValidator('password_again')->setOption('required', false);
     $this->getWidget('groups_list')->setOption('expanded', true);
     $this->getWidgetSchema()->setHelp('password', 'Your password must be at least 10 characters long, and include at least one number and one capital letter.');
     $this->getWidgetSchema()->setHelp('street', 'In accordance with our terms of service and legal obligations, you must provide your, or your organisations\' legal address.');
     $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(new sfValidatorDoctrineUnique(array('model' => 'sfGuardUser', 'column' => array('email_address')), array('invalid' => 'An user account with this email exists already.')), new sfValidatorDoctrineUnique(array('model' => 'sfGuardUser', 'column' => array('username'))), new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')))));
 }
 public function configure()
 {
     parent::configure();
     unset($this['rated_plugins_list'], $this['is_super_admin'], $this['is_active'], $this['permissions_list'], $this['groups_list']);
 }
Пример #10
0
 /**
  * @see sfForm
  */
 public function configure()
 {
     parent::setup();
     unset($this['last_login'], $this['created_at'], $this['updated_at'], $this['salt'], $this['algorithm'], $this['is_super_admin'], $this['is_active'], $this['permissions_list'], $this['procedures_list'], $this['groups_list'], $this['username']);
 }