Guest User

Untitled

a guest
Dec 10th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.96 KB | None | 0 0
  1. <?php
  2.  
  3. class sfGuardUserAdminForm extends BasesfGuardUserAdminForm
  4. {
  5. /**
  6. * @see sfForm
  7. */
  8. public function configure()
  9. {
  10. parent::configure();
  11.  
  12. $this->useFields(array('username'));
  13. //$this->setValidator('email_address', new sfValidatorString(array(
  14. //'max_length' => 255,
  15. //'required' => false
  16. //)));
  17.  
  18. //On imbrique le formulaire pour personnaliser notre formulaire
  19. $profileForm = new UserprofilForm($this->getObject()->getUserprofil());
  20. unset($profileForm['id'], $profileForm['sf_guard_user_id'], $profileForm['points']);
  21. $this->embedForm('userprofil', $profileForm);
  22.  
  23. //On imbrique le formulaire du profile du plugin FDA
  24. $forked = new sfGuardUserProfileForm($this->getObject()->getProfile());
  25. $forked->useFields(array('email', 'firstname', 'lastname'));
  26. $this->embedForm('identifiant',$forked);
  27.  
  28. }
  29. }
  30.  
  31.  
  32. ############################
  33. Qui hérite de
  34. ############################
  35.  
  36. class BasesfGuardUserAdminForm extends BasesfGuardUserForm
  37. {
  38. /**
  39. * @see sfForm
  40. */
  41. public function setup()
  42. {
  43. parent::setup();
  44.  
  45. unset(
  46. $this['last_login'],
  47. $this['created_at'],
  48. $this['updated_at'],
  49. $this['salt'],
  50. $this['algorithm']
  51. );
  52.  
  53. $this->widgetSchema['groups_list']->setLabel('Groups');
  54. $this->widgetSchema['permissions_list']->setLabel('Permissions');
  55.  
  56. $this->widgetSchema['password'] = new sfWidgetFormInputPassword();
  57. $this->validatorSchema['password']->setOption('required', false);
  58. $this->widgetSchema['password_again'] = new sfWidgetFormInputPassword();
  59. $this->validatorSchema['password_again'] = clone $this->validatorSchema['password'];
  60.  
  61. $this->widgetSchema->moveField('password_again', 'after', 'password');
  62.  
  63. $this->mergePostValidator(new sfValidatorSchemaCompare('password', sfValidatorSchemaCompare::EQUAL, 'password_again', array(), array('invalid' => 'The two passwords must be the same.')));
  64. }
  65. }
Add Comment
Please, Sign In to add comment