ContactForm.php 969 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. <?php
  2. /**
  3. * ContactForm class.
  4. * ContactForm is the data structure for keeping
  5. * contact form data. It is used by the 'contact' action of 'SiteController'.
  6. */
  7. class ContactForm extends CFormModel
  8. {
  9. public $name;
  10. public $email;
  11. public $subject;
  12. public $body;
  13. public $verifyCode;
  14. /**
  15. * Declares the validation rules.
  16. */
  17. public function rules()
  18. {
  19. return array(
  20. // name, email, subject and body are required
  21. array('name, email, subject, body', 'required'),
  22. // email has to be a valid email address
  23. array('email', 'email'),
  24. // verifyCode needs to be entered correctly
  25. array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()),
  26. );
  27. }
  28. /**
  29. * Declares customized attribute labels.
  30. * If not declared here, an attribute would have a label that is
  31. * the same as its name with the first letter in upper case.
  32. */
  33. public function attributeLabels()
  34. {
  35. return array(
  36. 'verifyCode'=>'Verification Code',
  37. );
  38. }
  39. }