root/trunk/lib/form/ResendActivationForm.class.php

Revision 75, 1.3 kB (checked in by nperriault, 3 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  * Resend activation mail form
4  *
5  */
6 class ResendActivationForm extends sfFormReCaptcha
7 {
8   /**
9    * Form configuration
10    *
11    */
12   public function configure()
13   {
14     // Widgets
15     $this->widgetSchema['email'] = new sfWidgetFormInput();
16     if (true === sfConfig::get('app_recaptcha_enabled'))
17     {
18       $this->widgetSchema['captcha'] = new sfWidgetFormReCaptcha(array('public_key' => sfConfig::get('app_recaptcha_public_key')));
19     }
20
21     // Validators
22     $this->validatorSchema['email'] = new sfValidatorAnd(array(
23       new sfValidatorEmail(),
24       new sfValidatorPropelChoice(array('model' => 'sfGuardUser', 'column' => 'email', 'criteria' => self::getActiveCriteria()),
25                                   array('invalid' => 'This email has never been registered here, or is already activated.')),
26     ));
27
28     if (true === sfConfig::get('app_recaptcha_enabled'))
29     {
30       $this->validatorSchema['captcha'] = new sfValidatorReCaptcha(array('private_key' => sfConfig::get('app_recaptcha_private_key')));
31     }
32
33     $this->widgetSchema->setNameFormat('user[%s]');
34   }
35
36   /**
37    * Generates a Criteria filtering active users only
38    *
39    * @return Criteria
40    */
41   static protected function getActiveCriteria()
42   {
43     $c = new Criteria();
44     $c->add(sfGuardUserPeer::IS_ACTIVE, true);
45     return $c;
46   }
47 }
48
Note: See TracBrowser for help on using the browser.