wwwReviewForm.class.php 2.14 KB
Newer Older
Яков's avatar
first  
Яков committed
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
<?php

/**
 * Review form.
 *
 * @package    sf
 * @subpackage form
 * @author     Atma
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class wwwReviewForm extends BaseReviewForm
{
    public function configure()
    {
        $this->useFields(array('name', 'phone', 'body', 'file', 'lang'));

        sfApplicationConfiguration::getActive()->loadHelpers(array('I18N'));

        $this->widgetSchema['file'] = new sfWidgetFormInputText(array('label' => 'Фотографии'), array("size" => 64, "maxlength" => 255, 'class' => 'a_layout_work__ct__inp_file', 'data-name' => 'file', 'data-title' => 'Выбрать файл', 'data-url' => '/uploader/?key=review', 'data-multiple' => false));
        $this->widgetSchema['name'] = new sfWidgetFormInputText(array(), array("size" => 40, "maxlength" => 255, "required" => true, 'class' => 'reviews_form_inp_name', 'placeholder' => __('Как к вам обращаться'), 'autocomplete' => 'off'));
        $this->widgetSchema['body'] = new sfWidgetFormTextarea(array(), array("rows" => 6, "cols" => 70, "required" => true, 'style' => 'resize:vertical;min-height:100px;', 'class' => 'reviews_form_txa_msg', 'placeholder' => __('Текст отзыва'), 'autocomplete' => 'off'));
        $this->widgetSchema['phone'] = new sfWidgetFormInputText(array(), array("size" => 28, "maxlength" => 255, "required" => true, 'class' => 'reviews_form_inp_phone', 'placeholder' => __('Номер телефона'), 'autocomplete' => 'off'));
        $this->widgetSchema['is_agree'] = new sfWidgetFormInput(array('type' => 'checkbox'), array('required' => true, 'checked' => 'checked', 'autocomplete' => 'off', 'class' => 'reviews_form_chk_license'));

        $this->validatorSchema['is_agree'] = new sfValidatorBoolean(array('required' => true));
        $this->validatorSchema['body'] = new sfValidatorString(array('required' => true, 'max_length' => 65535));
        $this->validatorSchema['phone'] = new sfValidatorAnd(array(
            new sfValidatorNumber(array('required' => true)),
            new sfValidatorString(array('max_length' => 255, 'required' => true))
        ));
    }
}