[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZUserSetting class 4 // 5 // 6 // SOFTWARE NAME: eZ publish 7 // SOFTWARE RELEASE: 3.9.0 8 // BUILD VERSION: 17785 9 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 10 // SOFTWARE LICENSE: GNU General Public License v2.0 11 // NOTICE: > 12 // This program is free software; you can redistribute it and/or 13 // modify it under the terms of version 2.0 of the GNU General 14 // Public License as published by the Free Software Foundation. 15 // 16 // This program is distributed in the hope that it will be useful, 17 // but WITHOUT ANY WARRANTY; without even the implied warranty of 18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 // GNU General Public License for more details. 20 // 21 // You should have received a copy of version 2.0 of the GNU General 22 // Public License along with this program; if not, write to the Free 23 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 24 // MA 02110-1301, USA. 25 // 26 // 27 28 /*! 29 \class eZUserSetting ezusersetting.php 30 \ingroup eZDatatype 31 32 */ 33 34 include_once ( 'kernel/classes/ezpersistentobject.php' ); 35 36 class eZUserSetting extends eZPersistentObject 37 { 38 function eZUserSetting( $row ) 39 { 40 $this->eZPersistentObject( $row ); 41 } 42 43 function definition() 44 { 45 return array( 'fields' => array( 'user_id' => array( 'name' => 'UserID', 46 'datatype' => 'integer', 47 'default' => 0, 48 'required' => true, 49 'foreign_class' => 'eZUser', 50 'foreign_attribute' => 'contentobject_id', 51 'multiplicity' => '0..1' ), 52 'is_enabled' => array( 'name' => 'IsEnabled', 53 'datatype' => 'integer', 54 'default' => 0, 55 'required' => true ), 56 'max_login' => array( 'name' => 'MaxLogin', 57 'datatype' => 'integer', 58 'default' => 0, 59 'required' => true ) ), 60 'keys' => array( 'user_id' ), 61 'relations' => array( 'user_id' => array( 'class' => 'ezuser', 62 'field' => 'contentobject_id' ) ), 63 'class_name' => 'eZUserSetting', 64 'name' => 'ezuser_setting' ); 65 } 66 67 function create( $userID, $isEnabled ) 68 { 69 $row = array( 'user_id' => $userID, 70 'is_enabled' => $isEnabled, 71 'max_login' => null ); 72 return new eZUserSetting( $row ); 73 } 74 75 76 /*! 77 \reimp 78 */ 79 function setAttribute( $attr, $val ) 80 { 81 switch( $attr ) 82 { 83 case 'is_enabled': 84 { 85 if ( !$val ) 86 { 87 $user = eZUser::fetch( $this->UserID ); 88 if ( $user ) 89 { 90 eZUser::removeSessionData( $this->UserID ); 91 } 92 } 93 } break; 94 } 95 96 eZPersistentObject::setAttribute( $attr, $val ); 97 } 98 99 /*! 100 Remove user settings with \a $userID 101 */ 102 function remove( $userID ) 103 { 104 eZPersistentObject::removeObject( eZUserSetting::definition(), 105 array( 'user_id' => $userID ) ); 106 } 107 108 /*! 109 Fetch message object with \a $userID 110 */ 111 function fetch( $userID, $asObject = true ) 112 { 113 return eZPersistentObject::fetchObject( eZUserSetting::definition(), 114 null, 115 array('user_id' => $userID ), 116 $asObject ); 117 } 118 119 /*! 120 Fetch all settings from database 121 */ 122 function fetchAll( $asObject = true ) 123 { 124 return eZPersistentObject::fetchObjectList( eZUserSetting::definition(), 125 null, 126 null, 127 null, 128 null, 129 $asObject ); 130 } 131 132 /// \privatesection 133 var $UserID; 134 var $IsEnabled; 135 var $MaxLogin; 136 } 137 138 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |