Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezcontentclassclassgroup.php
Go to the documentation of this file.
1 <?php
13
17 class eZContentClassClassGroup extends eZPersistentObject
18 {
19 static function definition()
20 {
21 return array( "fields" => array( "contentclass_id" => array( 'name' => "ContentClassID",
22 'datatype' => 'integer',
23 'default' => 0,
24 'required' => true,
25 'foreign_class' => 'eZContentClass',
26 'foreign_attribute' => 'id',
27 'multiplicity' => '1..*' ),
28 "contentclass_version" => array( 'name' => "ContentClassVersion",
29 'datatype' => 'integer',
30 'default' => 0,
31 'required' => true ),
32 "group_id" => array( 'name' => "GroupID",
33 'datatype' => 'integer',
34 'default' => 0,
35 'required' => true ),
36 "group_name" => array( 'name' => "GroupName",
37 'datatype' => 'string',
38 'default' => '',
39 'required' => true ) ),
40 "keys" => array( "contentclass_id", "contentclass_version", "group_id" ),
41 // "increment_key" => "id",
42 "class_name" => "eZContentClassClassGroup",
43 "sort" => array( "contentclass_id" => "asc" ),
44 "name" => "ezcontentclass_classgroup" );
45 }
46
47 static function create( $contentclass_id, $contentclass_version, $group_id, $group_name )
48 {
49 if( $contentclass_version == null )
50 {
51 $contentclass_version = 0;
52 }
53 $row = array("contentclass_id" => $contentclass_id,
54 "contentclass_version" => $contentclass_version,
55 "group_id" => $group_id,
56 "group_name" => $group_name);
57 return new eZContentClassClassGroup( $row );
58 }
59
60 static function update( $contentclass_version, $group_id, $group_name )
61 {
62 if( $contentclass_version == null )
63 {
64 $row = array( 'group_id' => $group_id );
65 }
66 else
67 {
68 $row = array( 'contentclass_version' => $contentclass_version,
69 'group_id' => $group_id );
70 }
71
72 eZPersistentObject::updateObjectList( array( 'definition' => eZContentClassClassGroup::definition(),
73 'update_fields' => array( 'group_name' => $group_name ),
74 'conditions' => $row ) );
75 }
76
81 static function removeGroup( $contentclass_id, $contentclass_version, $group_id )
82 {
83 if ( $contentclass_version == null )
84 {
85 eZPersistentObject::removeObject( eZContentClassClassGroup::definition(),
86 array("contentclass_id" => $contentclass_id,
87 "group_id" => $group_id ) );
88 }
89 else
90 {
91 eZPersistentObject::removeObject( eZContentClassClassGroup::definition(),
92 array("contentclass_id" => $contentclass_id,
93 "contentclass_version" =>$contentclass_version,
94 "group_id" => $group_id ) );
95 }
96 }
97
102 static function removeGroupMembers( $group_id )
103 {
104 eZPersistentObject::removeObject( eZContentClassClassGroup::definition(),
105 array( "group_id" => $group_id ) );
106 }
107
112 static function removeClassMembers( $contentclass_id, $contentclass_version )
113 {
114 eZPersistentObject::removeObject( eZContentClassClassGroup::definition(),
115 array( "contentclass_id" =>$contentclass_id,
116 "contentclass_version" =>$contentclass_version ) );
117 }
118
119 static function fetch( $contentclass_id, $contentclass_version, $group_id, $asObject = true )
120 {
121 return eZPersistentObject::fetchObject( eZContentClassClassGroup::definition(),
122 null,
123 array("contentclass_id" => $contentclass_id,
124 "contentclass_version" =>$contentclass_version,
125 "group_id" => $group_id ),
126 $asObject );
127 }
128
129 static function fetchClassList( $contentclass_version, $group_id, $asObject = true, $orderByArray = array( 'name' ) )
130 {
131 $versionCond = '';
132 $orderByClause = '';
133 $group_id =(int) $group_id;
134 $classNameSqlFilter = eZContentClassName::sqlEmptyFilter();
135
136 if ( $contentclass_version !== null )
137 {
138 $contentclass_version =(int) $contentclass_version;
139 $versionCond = "AND class_group.contentclass_version='$contentclass_version'
140 AND contentclass.version='$contentclass_version'\n";
141 }
142
143 if ( $orderByArray )
144 {
145 foreach( array_keys( $orderByArray ) as $key )
146 {
147 if ( strcasecmp( $orderByArray[$key], 'name' ) === 0 )
148 {
149 $classNameSqlFilter = eZContentClassName::sqlAppendFilter( 'contentclass' );
150 $orderByArray[$key] = $classNameSqlFilter['orderBy'];
151 }
152 }
153
154 $orderByClause = 'ORDER BY ' . implode( ', ', $orderByArray );
155 }
156
157 $db = eZDB::instance();
158 $sql = "SELECT contentclass.* $classNameSqlFilter[nameField]
159 FROM ezcontentclass contentclass, ezcontentclass_classgroup class_group $classNameSqlFilter[from]
160 WHERE contentclass.id=class_group.contentclass_id
161 $versionCond
162 AND class_group.group_id='$group_id' $classNameSqlFilter[where]
163 $orderByClause";
164 $rows = $db->arrayQuery( $sql );
165 return eZPersistentObject::handleRows( $rows, "eZContentClass", $asObject );
166 }
167
168 static function fetchClassListByGroups( $contentclassVersion, $groupIDList, $asObject = true )
169 {
170 if ( is_array( $groupIDList ) )
171 {
172 $groupIDList = array( $groupIDList );
173 }
174 $classGroupList = eZPersistentObject::fetchObjectList( eZContentClassClassGroup::definition(),
175 array(),
176 array( "group_id" => $groupIDList,
177 "contentclass_version" => $contentclassVersion ),
178 null,
179 null,
180 false,
181 false,
182 array( array( 'operation' => "distinct contentclass_id" ) ) );
183 $classList = array();
184 if ( $asObject )
185 {
186 foreach ( $classGroupList as $classGroup )
187 {
188 $classList[] = eZContentClass::fetch( $classGroup['contentclass_id'] );
189 }
190 }
191 else
192 {
193 foreach ( $classGroupList as $classGroup )
194 {
195 $classList[] = $classGroup['contentclass_id'];
196 }
197 }
198 return $classList;
199 }
200
201 static function fetchGroupList( $contentclass_id, $contentclass_version, $asObject = true )
202 {
203 return eZPersistentObject::fetchObjectList( eZContentClassClassGroup::definition(),
204 null,
205 array( "contentclass_id" => $contentclass_id,
206 "contentclass_version" => $contentclass_version ),
207 null,
208 null,
209 $asObject );
210 }
211
212 static function classInGroup( $contentclassID, $contentclassVersion, $groupID )
213 {
214 $rows = eZPersistentObject::fetchObjectList( eZContentClassClassGroup::definition(),
215 null,
216 array( 'group_id' => $groupID,
217 "contentclass_id" => $contentclassID,
218 "contentclass_version" => $contentclassVersion ),
219 null,
220 null,
221 false );
222 return count( $rows ) > 0;
223 }
224
226 public $ContentClassID;
227 public $ContentClassVersion;
228 public $GroupID;
229 public $GroupName;
230 }
231
232 ?>
eZContentClassClassGroup
Definition: ezcontentclassclassgroup.php:18
eZContentClassClassGroup\$GroupID
$GroupID
Definition: ezcontentclassclassgroup.php:228
eZContentClassClassGroup\definition
static definition()
Definition: ezcontentclassclassgroup.php:19
eZContentClassClassGroup\fetchClassList
static fetchClassList( $contentclass_version, $group_id, $asObject=true, $orderByArray=array( 'name'))
Definition: ezcontentclassclassgroup.php:129
eZContentClassClassGroup\removeClassMembers
static removeClassMembers( $contentclass_id, $contentclass_version)
Definition: ezcontentclassclassgroup.php:112
eZContentClassClassGroup\$ContentClassVersion
$ContentClassVersion
Definition: ezcontentclassclassgroup.php:227
eZContentClassClassGroup\$GroupName
$GroupName
Definition: ezcontentclassclassgroup.php:229
eZContentClassClassGroup\removeGroupMembers
static removeGroupMembers( $group_id)
Definition: ezcontentclassclassgroup.php:102
eZContentClassClassGroup\removeGroup
static removeGroup( $contentclass_id, $contentclass_version, $group_id)
Definition: ezcontentclassclassgroup.php:81
eZContentClassClassGroup\$ContentClassID
$ContentClassID
Definition: ezcontentclassclassgroup.php:226
eZContentClassClassGroup\fetchGroupList
static fetchGroupList( $contentclass_id, $contentclass_version, $asObject=true)
Definition: ezcontentclassclassgroup.php:201
eZContentClassClassGroup\update
static update( $contentclass_version, $group_id, $group_name)
Definition: ezcontentclassclassgroup.php:60
eZContentClassClassGroup\fetchClassListByGroups
static fetchClassListByGroups( $contentclassVersion, $groupIDList, $asObject=true)
Definition: ezcontentclassclassgroup.php:168
eZContentClassClassGroup\classInGroup
static classInGroup( $contentclassID, $contentclassVersion, $groupID)
Definition: ezcontentclassclassgroup.php:212
eZContentClassClassGroup\create
static create( $contentclass_id, $contentclass_version, $group_id, $group_name)
Definition: ezcontentclassclassgroup.php:47
eZContentClassClassGroup\fetch
static fetch( $contentclass_id, $contentclass_version, $group_id, $asObject=true)
Definition: ezcontentclassclassgroup.php:119
eZContentClassName\sqlEmptyFilter
static sqlEmptyFilter()
Definition: ezcontentclassname.php:109
eZContentClassName\sqlAppendFilter
static sqlAppendFilter( $languageTable='ezcontentclass')
Definition: ezcontentclassname.php:92
eZContentClass\fetch
static fetch( $id, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
Definition: ezcontentclass.php:1116
eZDB\instance
static instance( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
Definition: ezdb.php:117
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\updateObjectList
static updateObjectList( $parameters)
Definition: ezpersistentobject.php:1209
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\handleRows
static handleRows( $rows, $class_name, $asObject)
Definition: ezpersistentobject.php:963
eZPersistentObject\count
static count( $def, $conds=null, $field=null)
Definition: ezpersistentobject.php:187
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
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.