Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezusersetting.php
Go to the documentation of this file.
1 <?php
17 class eZUserSetting extends eZPersistentObject
18 {
19 static function definition()
20 {
21 static $definition = array( 'fields' => array( 'user_id' => array( 'name' => 'UserID',
22 'datatype' => 'integer',
23 'default' => 0,
24 'required' => true,
25 'foreign_class' => 'eZUser',
26 'foreign_attribute' => 'contentobject_id',
27 'multiplicity' => '0..1' ),
28 'is_enabled' => array( 'name' => 'IsEnabled',
29 'datatype' => 'integer',
30 'default' => 0,
31 'required' => true ),
32 'max_login' => array( 'name' => 'MaxLogin',
33 'datatype' => 'integer',
34 'default' => 0,
35 'required' => true ) ),
36 'keys' => array( 'user_id' ),
37 'relations' => array( 'user_id' => array( 'class' => 'ezuser',
38 'field' => 'contentobject_id' ) ),
39 'class_name' => 'eZUserSetting',
40 'name' => 'ezuser_setting' );
41 return $definition;
42 }
43
44 static function create( $userID, $isEnabled )
45 {
46 $row = array( 'user_id' => $userID,
47 'is_enabled' => $isEnabled,
48 'max_login' => null );
49 return new eZUserSetting( $row );
50 }
51
52
53 function setAttribute( $attr, $val )
54 {
55 switch( $attr )
56 {
57 case 'is_enabled':
58 {
59 if ( !$val )
60 {
61 $user = eZUser::fetch( $this->UserID );
62 if ( $user )
63 {
64 eZUser::removeSessionData( $this->UserID );
65 }
66 }
67 eZUser::purgeUserCacheByUserId( $this->UserID );
68 } break;
69 }
70
71 parent::setAttribute( $attr, $val );
72 }
73
77 static function fetch( $userID, $asObject = true )
78 {
79 return eZPersistentObject::fetchObject( eZUserSetting::definition(),
80 null,
81 array('user_id' => $userID ),
82 $asObject );
83 }
84
88 static function fetchAll( $asObject = true )
89 {
90 return eZPersistentObject::fetchObjectList( eZUserSetting::definition(),
91 null,
92 null,
93 null,
94 null,
95 $asObject );
96 }
97
98 static function removeByUserID( $userID )
99 {
100 eZPersistentObject::removeObject( eZUserSetting::definition(),
101 array( 'user_id' => $userID ) );
102 }
103
105 public $UserID;
106 public $IsEnabled;
107 public $MaxLogin;
108 }
109
110 ?>
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\fetchObject
static fetchObject( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
Definition: ezpersistentobject.php:213
eZPersistentObject\removeObject
static removeObject( $def, $conditions=null, $extraConditions=null)
Definition: ezpersistentobject.php:271
eZPersistentObject\fetchObjectList
static fetchObjectList( $def, $field_filters=null, $conds=null, $sorts=null, $limit=null, $asObject=true, $grouping=false, $custom_fields=null, $custom_tables=null, $custom_conds=null)
Definition: ezpersistentobject.php:806
eZUserSetting
Definition: ezusersetting.php:18
eZUserSetting\$MaxLogin
$MaxLogin
Definition: ezusersetting.php:107
eZUserSetting\fetch
static fetch( $userID, $asObject=true)
Definition: ezusersetting.php:77
eZUserSetting\$IsEnabled
$IsEnabled
Definition: ezusersetting.php:106
eZUserSetting\fetchAll
static fetchAll( $asObject=true)
Definition: ezusersetting.php:88
eZUserSetting\create
static create( $userID, $isEnabled)
Definition: ezusersetting.php:44
eZUserSetting\setAttribute
setAttribute( $attr, $val)
Definition: ezusersetting.php:53
eZUserSetting\removeByUserID
static removeByUserID( $userID)
Definition: ezusersetting.php:98
eZUserSetting\$UserID
$UserID
Definition: ezusersetting.php:105
eZUserSetting\definition
static definition()
Definition: ezusersetting.php:19
eZUser\purgeUserCacheByUserId
static purgeUserCacheByUserId( $userId)
Definition: ezuser.php:1345
eZUser\fetch
static fetch( $id, $asObject=true)
Definition: ezuser.php:351
eZUser\removeSessionData
static removeSessionData( $userID)
Definition: ezuser.php:619
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.