| [ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZSectionFunctionCollection class 4 // 5 // Created on: <23-May-2003 16:46:17 amos> 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 ezsectionfunctioncollection.php 30 */ 31 32 /*! 33 \class eZSectionFunctionCollection ezsectionfunctioncollection.php 34 \brief The class eZSectionFunctionCollection does 35 36 */ 37 38 include_once ( 'kernel/error/errors.php' ); 39 40 class eZSectionFunctionCollection 41 { 42 /*! 43 Constructor 44 */ 45 function eZSectionFunctionCollection() 46 { 47 } 48 49 function fetchSectionObject( $sectionID ) 50 { 51 include_once ( 'kernel/classes/ezsection.php' ); 52 $sectionObject = eZSection::fetch( $sectionID ); 53 if ( $sectionObject === null ) 54 return array( 'error' => array( 'error_type' => 'kernel', 55 'error_code' => EZ_ERROR_KERNEL_NOT_FOUND ) ); 56 return array( 'result' => $sectionObject ); 57 } 58 59 function fetchSectionList() 60 { 61 include_once ( 'kernel/classes/ezsection.php' ); 62 $sectionObjects = eZSection::fetchList( ); 63 return array( 'result' => $sectionObjects ); 64 } 65 66 function fetchObjectList( $sectionID, $offset = false, $limit = false, $sortOrder = false ) 67 { 68 include_once ( "kernel/classes/ezcontentobject.php" ); 69 70 if ( $sortOrder === false ) 71 { 72 $sortOrder = array( 'id' => 'desc' ); 73 } 74 $objects = eZPersistentObject::fetchObjectList( eZContentObject::definition(), 75 null, 76 array( 'section_id' => $sectionID ), 77 $sortOrder, 78 array( 'offset' => $offset, 'limit' => $limit ) ); 79 return array( 'result' => $objects ); 80 } 81 82 function fetchObjectListCount( $sectionID ) 83 { 84 include_once ( "kernel/classes/ezcontentobject.php" ); 85 86 $custom = array( array( 'operation' => 'count( id )', 87 'name' => 'count' ) ); 88 $rows = eZPersistentObject::fetchObjectList( eZContentObject::definition(), 89 array(), 90 array( 'section_id' => $sectionID ), 91 false, null, false, false, $custom ); 92 return array( 'result' => $rows[0]['count'] ); 93 } 94 95 function fetchRoles( $sectionID ) 96 { 97 include_once ( 'kernel/classes/ezpolicylimitation.php' ); 98 include_once ( 'kernel/classes/ezrole.php' ); 99 100 $policies = $roleIDs = $usedRoleIDs = $roles = $roleLimitations = array(); 101 102 $limitations = eZPolicyLimitation::findByType( 'Section', $sectionID, true, false ); 103 foreach ( array_keys( $limitations ) as $key ) 104 { 105 $policy =& $limitations[$key]->policy(); 106 $policies[] = $policy; 107 108 $roleID= $policy->attribute( 'role_id' ); 109 $roleIDs[] = $roleID; 110 if ( !isset( $roleLimitations[$roleID] ) ) 111 { 112 $roleLimitations[$roleID] = array(); 113 } 114 $roleLimitations[$roleID][] =& $policy; 115 } 116 117 foreach ( array_keys( $policies ) as $key ) 118 { 119 $roleID = $policies[$key]->attribute( 'role_id' ); 120 if ( in_array( $roleID, $roleIDs ) && !in_array( $roleID, $usedRoleIDs ) ) 121 { 122 $roles[] = $policies[$key]->attribute( 'role' ); 123 $usedRoleIDs[] = $roleID; 124 } 125 } 126 127 return array( 'result' => array( 'roles' => $roles, 'limited_policies' => $roleLimitations ) ); 128 } 129 130 function fetchUserRoles( $sectionID ) 131 { 132 include_once ( 'kernel/classes/ezrole.php' ); 133 134 $userRoles = eZRole::fetchRolesByLimitation( 'section', $sectionID ); 135 return array( 'result' => $userRoles ); 136 } 137 } 138 139 ?>
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 |