<?php

/**
 * User filter form base class.
 *
 * @package    sf
 * @subpackage filter
 * @author     Atma
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BaseUserFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'manager_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Manager'), 'add_empty' => true)),
      'city_id'               => new sfWidgetFormFilterInput(),
      'username'              => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'fname'                 => new sfWidgetFormFilterInput(),
      'iname'                 => new sfWidgetFormFilterInput(),
      'oname'                 => new sfWidgetFormFilterInput(),
      'organization'          => new sfWidgetFormFilterInput(),
      'city'                  => new sfWidgetFormFilterInput(),
      'inner_id'              => new sfWidgetFormFilterInput(),
      'client_code'           => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'address'               => new sfWidgetFormFilterInput(),
      'phone_number'          => new sfWidgetFormFilterInput(),
      'email'                 => new sfWidgetFormFilterInput(),
      'limit_by_sum'          => new sfWidgetFormFilterInput(),
      'current_discount'      => new sfWidgetFormFilterInput(),
      'current_debt'          => new sfWidgetFormFilterInput(),
      'orders_sum_last_month' => new sfWidgetFormFilterInput(),
      'orders_sum_current'    => new sfWidgetFormFilterInput(),
      'salt'                  => new sfWidgetFormFilterInput(),
      'password'              => new sfWidgetFormFilterInput(),
      'open_password'         => new sfWidgetFormFilterInput(),
      'manifest_version'      => new sfWidgetFormFilterInput(),
      'cat_indx'              => new sfWidgetFormFilterInput(),
      'cats_with_images'      => new sfWidgetFormFilterInput(),
      'recovery_secret'       => new sfWidgetFormFilterInput(),
      'is_active'             => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'is_super_admin'        => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'last_login'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'created_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'updated_at'            => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
    ));

    $this->setValidators(array(
      'manager_id'            => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Manager'), 'column' => 'id')),
      'city_id'               => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'username'              => new sfValidatorPass(array('required' => false)),
      'fname'                 => new sfValidatorPass(array('required' => false)),
      'iname'                 => new sfValidatorPass(array('required' => false)),
      'oname'                 => new sfValidatorPass(array('required' => false)),
      'organization'          => new sfValidatorPass(array('required' => false)),
      'city'                  => new sfValidatorPass(array('required' => false)),
      'inner_id'              => new sfValidatorPass(array('required' => false)),
      'client_code'           => new sfValidatorPass(array('required' => false)),
      'address'               => new sfValidatorPass(array('required' => false)),
      'phone_number'          => new sfValidatorPass(array('required' => false)),
      'email'                 => new sfValidatorPass(array('required' => false)),
      'limit_by_sum'          => new sfValidatorPass(array('required' => false)),
      'current_discount'      => new sfValidatorPass(array('required' => false)),
      'current_debt'          => new sfValidatorPass(array('required' => false)),
      'orders_sum_last_month' => new sfValidatorPass(array('required' => false)),
      'orders_sum_current'    => new sfValidatorPass(array('required' => false)),
      'salt'                  => new sfValidatorPass(array('required' => false)),
      'password'              => new sfValidatorPass(array('required' => false)),
      'open_password'         => new sfValidatorPass(array('required' => false)),
      'manifest_version'      => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'cat_indx'              => new sfValidatorPass(array('required' => false)),
      'cats_with_images'      => new sfValidatorPass(array('required' => false)),
      'recovery_secret'       => new sfValidatorPass(array('required' => false)),
      'is_active'             => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'is_super_admin'        => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'last_login'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'created_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
      'updated_at'            => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 00:00:00')), 'to_date' => new sfValidatorDateTime(array('required' => false, 'datetime_output' => 'Y-m-d 23:59:59')))),
    ));

    $this->widgetSchema->setNameFormat('user_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'User';
  }

  public function getFields()
  {
    return array(
      'id'                    => 'Number',
      'manager_id'            => 'ForeignKey',
      'city_id'               => 'Number',
      'username'              => 'Text',
      'fname'                 => 'Text',
      'iname'                 => 'Text',
      'oname'                 => 'Text',
      'organization'          => 'Text',
      'city'                  => 'Text',
      'inner_id'              => 'Text',
      'client_code'           => 'Text',
      'address'               => 'Text',
      'phone_number'          => 'Text',
      'email'                 => 'Text',
      'limit_by_sum'          => 'Text',
      'current_discount'      => 'Text',
      'current_debt'          => 'Text',
      'orders_sum_last_month' => 'Text',
      'orders_sum_current'    => 'Text',
      'salt'                  => 'Text',
      'password'              => 'Text',
      'open_password'         => 'Text',
      'manifest_version'      => 'Number',
      'cat_indx'              => 'Text',
      'cats_with_images'      => 'Text',
      'recovery_secret'       => 'Text',
      'is_active'             => 'Boolean',
      'is_super_admin'        => 'Boolean',
      'last_login'            => 'Date',
      'created_at'            => 'Date',
      'updated_at'            => 'Date',
    );
  }
}
