| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZPolicyLimitationValue class 4 // 5 // Created on: <19-Aug-2002 11:28:06 sp> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 eZ systems AS 11 // SOFTWARE LICENSE: GNU General Public License v2.0 12 // NOTICE: > 13 // This program is free software; you can redistribute it and/or 14 // modify it under the terms of version 2.0 of the GNU General 15 // Public License as published by the Free Software Foundation. 16 // 17 // This program is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 // GNU General Public License for more details. 21 // 22 // You should have received a copy of version 2.0 of the GNU General 23 // Public License along with this program; if not, write to the Free 24 // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, 25 // MA 02110-1301, USA. 26 // 27 // 28 29 /*! \file ezpolicylimitationvalue.php 30 */ 31 32 /*! 33 \class eZPolicyLimitationValue ezpolicylimitationvalue.php 34 \ingroup eZRole 35 \brief Defines a limitation value for a policy in the permission system 36 37 */ 38 include_once ( "kernel/classes/ezpersistentobject.php" ); 39 40 class eZPolicyLimitationValue extends eZPersistentObject 41 { 42 /*! 43 Constructor 44 */ 45 function eZPolicyLimitationValue( $row ) 46 { 47 $this->eZPersistentObject( $row ); 48 } 49 50 51 function definition() 52 { 53 return array( "fields" => array( "id" => array( 'name' => 'ID', 54 'datatype' => 'integer', 55 'default' => 0, 56 'required' => true ), 57 'limitation_id' => array( 'name' => 'LimitationID', 58 'datatype' => 'integer', 59 'default' => 0, 60 'required' => true, 61 'foreign_class' => 'eZPolicyLimitation', 62 'foreign_attribute' => 'id', 63 'multiplicity' => '1..*' ), 64 'value' => array( 'name' => 'Value', 65 'datatype' => 'integer', 66 'default' => 0, 67 'required' => true ) ), 68 "keys" => array( "id" ), 69 "increment_key" => "id", 70 "sort" => array( "value" => "asc" ), 71 "class_name" => "eZPolicyLimitationValue", 72 "name" => "ezpolicy_limitation_value" ); 73 } 74 75 76 /*! 77 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 78 the calls within a db transaction; thus within db->begin and db->commit. 79 */ 80 function createNew( $limitationID, $value ) 81 { 82 $limitationValue = new eZPolicyLimitationValue( array() ); 83 $limitationValue->setAttribute( 'limitation_id', $limitationID ); 84 $limitationValue->setAttribute( 'value', $value ); 85 $limitationValue->store(); 86 87 return $limitationValue; 88 } 89 90 /*! 91 \static 92 Creates a new limitation value for the limitation \a $limitationID and returns it. 93 \note The value is not stored. 94 */ 95 function create( $limitationID, $value ) 96 { 97 $row = array( 'id' => null, 98 'limitation_id' => $limitationID, 99 'value' => $value ); 100 return new eZPolicyLimitationValue( $row ); 101 } 102 103 /*! 104 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 105 the calls within a db transaction; thus within db->begin and db->commit. 106 */ 107 function copy( $limitationID ) 108 { 109 $newValue = eZPolicyLimitationValue::createNew( $limitationID, $this->attribute( 'value' ) ); 110 } 111 112 function fetchList( $limitationID, $asObject = true ) 113 { 114 return eZPersistentObject::fetchObjectList( eZPolicyLimitationValue::definition(), 115 null, 116 array( 'limitation_id' => $limitationID ), 117 null, 118 null, 119 $asObject ); 120 } 121 122 /*! 123 \note Transaction unsafe. If you call several transaction unsafe methods you must enclose 124 the calls within a db transaction; thus within db->begin and db->commit. 125 */ 126 function removeByValue( $value, $policyID = false ) 127 { 128 if ( $policyID ) 129 { 130 $limitationIDList = array(); 131 $limitations = eZPolicyLimitation::fetchByPolicyID( $policyID, false ); 132 foreach ( $limitations as $limitationArray ) 133 { 134 $limitationIDList[] = $limitationArray['id']; 135 } 136 if ( count( $limitationIDList ) > 0 ) 137 { 138 eZPersistentObject::removeObject( eZPolicyLimitationValue::definition(), 139 array( 'limitation_id' => array( $limitationIDList ), 140 "value" => $value ) ); 141 return; 142 } 143 } 144 eZPersistentObject::removeObject( eZPolicyLimitationValue::definition(), 145 array( "value" => $value ) ); 146 } 147 148 } 149 150 ?>
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 |