Blame view

protected/models/ContactForm.php 1.37 KB
a1684257   Administrator   first commit
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
  <?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 $contact;
      public $name;
      public $email;
      public $phone;
      public $body;
      public $verifyCode;
      public $link;
  
      /**
       * Declares the validation rules.
       */
      public function rules()
      {
          return array(
              // name, email, subject and body are required
              array('name, email, phone, body', 'required'),
              // email has to be a valid email address
              array('email', 'email'),
              array('contact, link','safe'),
              // 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(
              'name'=>Yii::t('site','ФИО'),
              'phone'=>Yii::t('site','Телефон'),
              'email'=>Yii::t('site','E-mail'),
              'body'=>Yii::t('site','Сообщение'),
  //            'verifyCode' => 'Verification Code',
          );
      }
  }