示例#1
0
 /**
  *	Constructor
  *
  *	@return
  */
 public function __construct()
 {
     parent::__construct(qw2('userClass>RM_Client_Object'));
     $this->_guidTypeClient = G('client');
     $this->_guidTypeGroup = G('client-group');
     $this->_guidTypeCompany = G('client-company');
     $this->_fields = array('client' => qw2('id email first_name middle_name last_name company_id active city_id ssl_number lang'), 'group' => qw2('id name weight ssl_only alias'), 'company' => qw2('id name group_id manager_group_id'));
     // Field validator
     $this->_validator = array('group' => qw2('name>not_empty'), 'company' => array('name' => qw2('and not_empty company_name_unique')), 'client' => array_merge(qw2('first_name>not_empty last_name>not_empty company_id>not_empty'), array('ssl_number' => qw2('and not_empty client_ssl_unique'), 'email' => qw2('and not_empty email'))));
     $storages = array('client' => M('Store')->storage(array('table' => $this->_tables['client'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id ssl_number'), 'props' => $this->_getProps('client'), 'class' => 'RM_Client_Object', 'guid' => $this->_guidTypeClient, 'validator' => M('Validator')->create($this->_validator['client']))), 'group' => M('Store')->storage(array('table' => $this->_tables['group'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id name alias'), 'props' => $this->_getProps('group'), 'class' => 'RM_Account_Simple_Group', 'guid' => $this->_guidTypeGroup, 'validator' => M('Validator')->create($this->_validator['group']))), 'company' => M('Store')->storage(array('table' => $this->_tables['company'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id name'), 'props' => $this->_getProps('company'), 'class' => 'RM_Client_Company', 'guid' => $this->_guidTypeCompany, 'validator' => M('Validator')->create($this->_validator['company']))));
     foreach ($storages as $k => $v) {
         $this->_storage[$k] = $v;
     }
     if (C('client.cache-active')) {
         $this->_grpCacheNs = C('client.group-cache-ns');
     }
 }
示例#2
0
 /**
  *	Constructor
  *
  *	@return
  */
 public function __construct()
 {
     parent::__construct(qw2('userClass>RM_User_Object'));
     $this->_day_results = array('-2' => 'В отпуске', '-1' => 'Не покупал', '0' => 'Не работал', '>0' => 'Сканировал');
     $this->_guidTypeUser = G('user');
     $this->_guidTypeGroup = G('user-group');
     $this->_guidTypePerson = G('user-person');
     $this->_fields = array('user' => qw2('id>user_id user_hash_id login password active first_name middle_name last_name phone _created_datetime _edited_datetime _created_user_id _edited_user_id home_longitude home_latitude home_address home_index work_longitude work_latitude work_address city_id status_id ssp_collab_type collab_initials collab_phone collab_time collab_day collab_workaday_time_1 collab_workaday_time_2 collab_workaday_time_3 collab_workaday_time_4 collab_rest_time_1 collab_rest_time_2 collab_rest_time_3 collab_rest_time_4 collab_comments collab_maybe_comment collab_reject_comment scanner_num setup_date notebook_serial mobile_serial passport_number passport_department register_address who_set_scanner is_tester diary_access_disabled user_reg_from date_reject extended_info equipment equipment_removed modem_num home_street home_bld work_street work_bld panelist_deny admin_group deny_status repair_status ssl_number animal_data init_status inn_id pensionary_id area_id metro_id payment_method payment_info compensation_method compensation_info email_confirmed document_copy stream internet_connection_type'), 'group' => qw2('id parent_id name weight ssl_only alias'), 'person' => qw2('id user_id first_name middle_name last_name sex birthday is_animal animal_type is_panelist phone_exists phone is_deleted animal_breed_id animal_weight_id animal_castrated animal_certificate animal_descr'), 'leave' => qw2('id user_id date_from date_to cdate mdate'), 'day' => qw2('id event_date user_id result_id last_visited last_logged user_agent remote_addr x_forwarded_for diary_version cdate mdate'));
     $storages = array('user' => M('Store')->storage(array('table' => $this->_tables['user'], 'table-history' => $this->_tables['user_history'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id login'), 'props' => $this->_getProps('user'), 'class' => 'RM_User_Object', 'guid' => $this->_guidTypeUser, 'validator' => M('Validator')->create(array('first_name' => 'not_empty', 'middle_name' => 'not_empty', 'login' => array('and', 'not_empty', 'email'), 'phone' => 'not_empty', 'password' => 'not_empty')))), 'group' => M('Store')->storage(array('table' => $this->_tables['group'], 'ctorArgs' => array('mapper' => $this), 'auto-id-prop' => 'id', 'keys' => qw2('id alias name'), 'props' => $this->_getProps('group'), 'class' => 'RM_User_Group', 'guid' => $this->_guidTypeGroup)), 'person' => M('Store')->storage(array('table' => $this->_tables['person'], 'table-history' => $this->_tables['person_history'], 'ctorArgs' => array('mapper' => $this), 'keys' => qw2('id'), 'props' => $this->_getProps('person'), 'class' => 'RM_User_Family_Object', 'guid' => $this->_guidTypePerson)), 'leave' => M('Store')->storage(array('table' => $this->_tables['leave'], 'ctorArgs' => array('mapper' => $this), 'auto-id-prop' => 'id', 'keys' => qw2('id'), 'props' => $this->_getProps('leave'), 'class' => 'RM_User_Leave', 'validator' => M('Validator')->create(array('date_from' => 'not_empty', 'date_to' => 'not_empty')))));
     foreach ($storages as $k => $v) {
         $this->_storage[$k] = $v;
     }
     if (C('user.cache-active')) {
         $this->_grpCacheNs = C('user.group-cache-ns');
         $this->_lstCacheNs = C('user.list-cache-ns');
         $this->_authCacheNs = C('user.auth-cache-ns');
         //$this->_grpCachePrefix	= C('user.group-cache-prefix');
     }
     $this->tree = M('Tree')->createDbTree($this->_tables['group_tree'], array($this, '_getRootNodes'));
 }