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

Revision 68, 1.3 kB (checked in by nperriault, 2 years ago)

[1.1] everything is broken \o/

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