<?php
class Krugozor_Module_User_Model_User extends Krugozor_Model
{
/**
* Время жизни cookie гостя - 10 лет.
*
* @var int
*/
protected static $unique_user_cookie_id_lifetime = 315360000;
/**
* Имя cookie гостя
*
* @var string
*/
public static $unique_user_cookie_id_name = 'unique_user_cookie_id';
protected static $db_field_prefix = 'user';
protected static $model_attributes = array
(
'id' => array('db_element' => false,
'default_value' => 0,
'validators' => array(
'Common/Decimal' => array('signed' => true),
)
),
'unique_cookie_id' => array('db_element' => true,
'db_field_name' => 'user_unique_cookie_id',
'validators' => array(
'Common/StringLength' => array(
'start' => 0,
'stop' => Krugozor_Module_Common_Validator_StringLength::MD5_MAX_LENGTH),
'Common/CharPassword' => array(),
)
),
'active' => array('db_element' => true,
'db_field_name' => 'user_active',
'default_value' => 1,
'validators' => array(
'Common/EmptyNull' => array(),
'Common/Decimal' => array('signed' => false),
'Common/IntRange' => array('min' => 0, 'max' => 1),
)
),
'group' => array('db_element' => true,
'db_field_name' => 'user_group',
'default_value'=> 2, // 2 - ID группы Пользователи
'validators' => array(
'Common/Empty' => array(),
'Common/Decimal' => array('signed' => false),
)
),
'login' => array('db_element' => true,
'db_field_name' => 'user_login',
'validators' => array(
'Common/EmptyNull' => array(),
'Common/StringLength' => array(
'start' => 0,
'stop' => Krugozor_Module_Common_Validator_StringLength::VARCHAR_MAX_LENGTH),
'Common/CharPassword' => array(),
)
),
'email' => array('type' => 'Krugozor_Module_Common_Type_Email',
'db_element' => true,
'default_value' => null,
'db_field_name' => 'user_email',
'validators' => array(
'Common/StringLength' => array(
'start' => 0,
'stop' => Krugozor_Module_Common_Validator_StringLength::VARCHAR_MAX_LENGTH),
'Common/Email' => array(),
)
),
'password' => array('db_element' => true,
'db_field_name' => 'user_password',
'validators' => array(
'Common/CharPassword' => array(),
)
),
'regdate' => array('type' => 'Krugozor_Module_Common_Type_Datetime',
'db_element' => true,
'db_field_name' => 'user_regdate',
'default_value' => 'now',
'validators' => array(
)
),
'visitdate' => array('type' => 'Krugozor_Module_Common_Type_Datetime',
'db_element' => true,
'db_field_name' => 'user_visitdate',
'default_value' => null,
'validators' => array(
)
),
'ip' => array('db_element' => true,
'db_field_name' => 'user_ip',
'default_value' => null,
'validators' => array(
//'Common/FixedStringLength' => array(15),
)
),
'first_name' => array('db_element' => true,
'db_field_name' => 'user_first_name',
'default_value' => null,
'validators' => array(
'Common/StringLength' => array('start' => 0, 'stop' => 30),
)
),
'last_name' => array('db_element' => true,
'db_field_name' => 'user_last_name',
'default_value' => null,
'validators' => array(
'Common/StringLength' => array('start' => 0, 'stop' => 30),
)
),
'age' => array('type' => 'Krugozor_Module_Common_Type_Datetime',
'db_element' => true,
'db_field_name' => 'user_age',
'default_value' => null,
'validators' => array(
)
),
'sex' => array('type' => 'Krugozor_Module_User_Type_Sex',
'db_element' => true,
'db_field_name' => 'user_sex',
'default_value' => null,
'validators' => array(
'Common/StringLength' => array('start' => 1, 'stop' => 1),
'Common/VarEnum' => array('enum' => array('M', 'F')),
)
),
'city' => array('db_element' => true,
'db_field_name' => 'user_city',
'default_value' => 0,
'validators' => array(
'Common/Decimal' => array('signed' => false),
)
),
'region' => array('db_element' => true,
'db_field_name' => 'user_region',
'default_value' => 0,
'validators' => array(
'Common/Decimal' => array('signed' => false),
)
),
'country' => array('db_element' => true,
'db_field_name' => 'user_country',
'default_value' => 0,
'validators' => array(
'Common/Decimal' => array('signed' => false),
)
),
'phone' => array('db_element' => true,
'db_field_name' => 'user_phone',
'default_value' => null,
'validators' => array(
'Common/StringLength' => array(
'start'=> 0,
'stop' => Krugozor_Module_Common_Validator_StringLength::VARCHAR_MAX_LENGTH),
)
),
'icq' => array('db_element' => true,
'db_field_name' => 'user_icq',
'default_value' => null,
'validators' => array(
'Common/Decimal' => array('signed' => true),
'Common/IntRange' => array(
'min' => 10000,
'max' => Krugozor_Module_Common_Validator_IntRange::PHP_MAX_INT_32)
)
),
'url' => array('db_element' => true,
'db_field_name' => 'user_url',
'default_value' => null,
'validators' => array(
'Common/StringLength' => array(
'start' => 0,
'stop' => Krugozor_Module_Common_Validator_StringLength::VARCHAR_MAX_LENGTH),
'Common/Url' => array()
)
),
);