<?php
/**
* ContactForm class.
* ContactForm is the data structure for keeping
* contact form data. It is used by the 'contact' action of 'SiteController'.
* ContactForm类。
* ContactForm是保持数据结构等为
* 表单数据联系。这是所使用的“接触”的动作'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',
);
}
}