diff options
| author | Patrick Seeger <pseeger@ccwn.org> | 2012-04-13 23:44:38 +0200 |
|---|---|---|
| committer | Patrick Seeger <pseeger@ccwn.org> | 2012-04-13 23:44:38 +0200 |
| commit | 69bffb7fe85347621f41c0baed839452e72930e1 (patch) | |
| tree | 8446bced1732932fd741e91ff8dba88b1e56693b /protected/models/ContactForm.php | |
| parent | a098922f681a9a1362202580a26b132501df4b1b (diff) | |
Erstes Yii Projekt
Diffstat (limited to 'protected/models/ContactForm.php')
| -rw-r--r-- | protected/models/ContactForm.php | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/protected/models/ContactForm.php b/protected/models/ContactForm.php new file mode 100644 index 0000000..86541cb --- /dev/null +++ b/protected/models/ContactForm.php @@ -0,0 +1,42 @@ +<?php + +/** + * ContactForm class. + * ContactForm is the data structure for keeping + * contact form data. It is used by the 'contact' action of 'SiteController'. + */ +class ContactForm extends CFormModel +{ + public $name; + public $email; + public $subject; + public $body; + public $verifyCode; + + /** + * Declares the validation rules. + */ + public function rules() + { + return array( + // name, email, subject and body are required + array('name, email, subject, body', 'required'), + // email has to be a valid email address + array('email', 'email'), + // verifyCode needs to be entered correctly + array('verifyCode', 'captcha', 'allowEmpty'=>!CCaptcha::checkRequirements()), + ); + } + + /** + * Declares customized attribute labels. + * If not declared here, an attribute would have a label that is + * the same as its name with the first letter in upper case. + */ + public function attributeLabels() + { + return array( + 'verifyCode'=>'Verification Code', + ); + } +}
\ No newline at end of file |
