Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezcontentclass.php
Go to the documentation of this file.
1 <?php
19 class eZContentClass extends eZPersistentObject
20 {
21 public $InGroupIDs;
22 const VERSION_STATUS_DEFINED = 0;
23 const VERSION_STATUS_TEMPORARY = 1;
24 const VERSION_STATUS_MODIFIED = 2;
25
30 const CONTENT_OBJECT_NAME_MAX_LENGTH = 255;
31
32 public function __construct( $row )
33 {
34 if ( is_array( $row ) )
35 {
36 parent::__construct( $row );
37 $this->VersionCount = false;
38 $this->InGroups = null;
39 $this->AllGroups = null;
40 if ( isset( $row["version_count"] ) )
41 $this->VersionCount = $row["version_count"];
42
43 $this->NameList = new eZContentClassNameList();
44 if ( isset( $row['serialized_name_list'] ) )
45 $this->NameList->initFromSerializedList( $row['serialized_name_list'] );
46 else
47 $this->NameList->initDefault();
48
49 $this->DescriptionList = new eZSerializedObjectNameList();
50 if ( isset( $row['serialized_description_list'] ) )
51 $this->DescriptionList->initFromSerializedList( $row['serialized_description_list'] );
52 else
53 $this->DescriptionList->initDefault();
54 }
55 $this->DataMap = false;
56 }
57
58 static function definition()
59 {
60 static $definition = array( "fields" => array( "id" => array( 'name' => 'ID',
61 'datatype' => 'integer',
62 'default' => 0,
63 'required' => true ),
64 "version" => array( 'name' => 'Version',
65 'datatype' => 'integer',
66 'default' => 0,
67 'required' => true ),
68 "serialized_name_list" => array( 'name' => 'SerializedNameList',
69 'datatype' => 'string',
70 'default' => '',
71 'required' => true ),
72 'serialized_description_list' => array( 'name' => 'SerializedDescriptionList',
73 'datatype' => 'string',
74 'default' => '',
75 'required' => true ),
76 "identifier" => array( 'name' => "Identifier",
77 'datatype' => 'string',
78 'default' => '',
79 'required' => true,
80 'max_length' => 50 ),
81 "contentobject_name" => array( 'name' => "ContentObjectName",
82 'datatype' => 'string',
83 'default' => '',
84 'required' => true ),
85 "url_alias_name" => array( 'name' => "URLAliasName",
86 'datatype' => 'string',
87 'default' => '',
88 'required' => false ),
89 "creator_id" => array( 'name' => "CreatorID",
90 'datatype' => 'integer',
91 'default' => 0,
92 'required' => true,
93 'foreign_class' => 'eZUser',
94 'foreign_attribute' => 'contentobject_id',
95 'multiplicity' => '1..*' ),
96 "modifier_id" => array( 'name' => "ModifierID",
97 'datatype' => 'integer',
98 'default' => 0,
99 'required' => true,
100 'foreign_class' => 'eZUser',
101 'foreign_attribute' => 'contentobject_id',
102 'multiplicity' => '1..*' ),
103 "created" => array( 'name' => "Created",
104 'datatype' => 'integer',
105 'default' => 0,
106 'required' => true ),
107 "remote_id" => array( 'name' => "RemoteID",
108 'datatype' => 'string',
109 'default' => '',
110 'required' => true ),
111 "modified" => array( 'name' => "Modified",
112 'datatype' => 'integer',
113 'default' => 0,
114 'required' => true ),
115 "is_container" => array( 'name' => "IsContainer",
116 'datatype' => 'integer',
117 'default' => 0,
118 'required' => true ),
119 'always_available' => array( 'name' => "AlwaysAvailable",
120 'datatype' => 'integer',
121 'default' => 0,
122 'required' => true ),
123 'language_mask' => array( 'name' => "LanguageMask",
124 'datatype' => 'integer',
125 'default' => 0,
126 'required' => true ),
127 'initial_language_id' => array( 'name' => "InitialLanguageID",
128 'datatype' => 'integer',
129 'default' => 0,
130 'required' => true,
131 'foreign_class' => 'eZContentLanguage',
132 'foreign_attribute' => 'id',
133 'multiplicity' => '1..*' ),
134 'sort_field' => array( 'name' => 'SortField',
135 'datatype' => 'integer',
136 'default' => 1,
137 'required' => true ),
138 'sort_order' => array( 'name' => 'SortOrder',
139 'datatype' => 'integer',
140 'default' => 1,
141 'required' => true ) ),
142 "keys" => array( "id", "version" ),
143 "function_attributes" => array( "data_map" => "dataMap",
144 'object_count' => 'objectCount',
145 'object_list' => 'objectList',
146 'version_count' => 'versionCount',
147 'version_status' => 'versionStatus',
148 'remote_id' => 'remoteID', // Note: This overrides remote_id field
149 'ingroup_list' => 'fetchGroupList',
150 'ingroup_id_list' => 'fetchGroupIDList',
151 'match_ingroup_id_list' => 'fetchMatchGroupIDList',
152 'group_list' => 'fetchAllGroups',
153 'creator' => 'creator',
154 'modifier' => 'modifier',
155 'can_instantiate_languages' => 'canInstantiateLanguages',
156 'name' => 'name',
157 'nameList' => 'nameList',
158 'description' => 'description',
159 'descriptionList' => 'descriptionList',
160 'languages' => 'languages',
161 'prioritized_languages' => 'prioritizedLanguages',
162 'prioritized_languages_js_array' => 'prioritizedLanguagesJsArray',
163 'can_create_languages' => 'canCreateLanguages',
164 'top_priority_language_locale' => 'topPriorityLanguageLocale',
165 'always_available_language' => 'alwaysAvailableLanguage' ),
166 'set_functions' => array( 'name' => 'setName' ),
167 "increment_key" => "id",
168 "class_name" => "eZContentClass",
169 "sort" => array( "id" => "asc" ),
170 "name" => "ezcontentclass" );
171 return $definition;
172 }
173
174 function __clone()
175 {
176 unset( $this->Version );
177 unset( $this->InGroups );
178 unset( $this->AllGroups );
179 unset( $this->CanInstantiateLanguages );
180 unset( $this->VersionCount );
181 $this->ID = null;
182 $this->RemoteID = eZRemoteIdUtility::generate( 'class' );
183 }
184
207 static function create( $userID = false, $optionalValues = array(), $languageLocale = false )
208 {
209 $dateTime = time();
210 if ( !$userID )
211 $userID = eZUser::currentUserID();
212
213 $nameList = new eZContentClassNameList();
214 if ( isset( $optionalValues['serialized_name_list'] ) )
215 $nameList->initFromSerializedList( $optionalValues['serialized_name_list'] );
216 else if ( isset( $optionalValues['name'] ) )
217 $nameList->initFromString( $optionalValues['name'], $languageLocale );
218 else
219 $nameList->initFromString( '', $languageLocale );
220
221 $descriptionList = new eZSerializedObjectNameList();
222 if ( isset( $optionalValues['serialized_description_list'] ) )
223 $descriptionList->initFromSerializedList( $optionalValues['serialized_description_list'] );
224 else if ( isset( $optionalValues['description'] ) )
225 $descriptionList->initFromString( $optionalValues['description'], $languageLocale );
226 else
227 $descriptionList->initFromString( '', $languageLocale );
228
229 $languageMask = $nameList->languageMask();
230 $initialLanguageID = $nameList->alwaysAvailableLanguageID();
231
232 $contentClassDefinition = eZContentClass::definition();
233 $row = array(
234 "id" => null,
235 "version" => 1,
236 "serialized_name_list" => $nameList->serializeNames(),
237 'serialized_description_list' => $descriptionList->serializeNames(),
238 "identifier" => "",
239 "contentobject_name" => "",
240 "creator_id" => $userID,
241 "modifier_id" => $userID,
242 "created" => $dateTime,
243 'remote_id' => eZRemoteIdUtility::generate( 'class' ),
244 "modified" => $dateTime,
245 "is_container" => $contentClassDefinition[ 'fields' ][ 'is_container' ][ 'default' ],
246 "always_available" => $contentClassDefinition[ 'fields' ][ 'always_available' ][ 'default' ],
247 'language_mask' => $languageMask,
248 'initial_language_id' => $initialLanguageID,
249 "sort_field" => $contentClassDefinition[ 'fields' ][ 'sort_field' ][ 'default' ],
250 "sort_order" => $contentClassDefinition[ 'fields' ][ 'sort_order' ][ 'default' ] );
251
252 $row = array_merge( $row, $optionalValues );
253
254 $contentClass = new eZContentClass( $row );
255
256 // setting 'dirtyData' to make sure the 'NameList' will be stored into db.
257 $contentClass->NameList->setHasDirtyData( true );
258
259 return $contentClass;
260 }
261
262 function instantiateIn( $lang, $userID = false, $sectionID = 0, $versionNumber = false, $versionStatus = eZContentObjectVersion::STATUS_INTERNAL_DRAFT )
263 {
264 return eZContentClass::instantiate( $userID, $sectionID, $versionNumber, $lang, $versionStatus );
265 }
266
276 function instantiate( $userID = false, $sectionID = 0, $versionNumber = false, $languageCode = false, $versionStatus = eZContentObjectVersion::STATUS_INTERNAL_DRAFT )
277 {
278 $attributes = $this->fetchAttributes();
279
280 if ( $userID === false )
281 {
282 $user = eZUser::currentUser();
283 $userID = $user->attribute( 'contentobject_id' );
284 }
285
286 if ( $languageCode == false )
287 {
288 $languageCode = eZContentObject::defaultLanguage();
289 }
290
291 $object = eZContentObject::create( ezpI18n::tr( "kernel/contentclass", "New %1", null, array( $this->name( $languageCode ) ) ),
292 $this->attribute( "id" ),
293 $userID,
294 $sectionID,
295 1,
296 $languageCode );
297
298 if ( $this->attribute( 'always_available' ) )
299 {
300 $object->setAttribute( 'language_mask', (int)$object->attribute( 'language_mask') | 1 );
301 }
302
303 $db = eZDB::instance();
304 $db->begin();
305
306 $object->store();
307 $object->assignDefaultStates();
308 $object->setName( ezpI18n::tr( "kernel/contentclass", "New %1", null, array( $this->name( $languageCode ) ) ), false, $languageCode );
309
310 if ( !$versionNumber )
311 {
312 $version = $object->createInitialVersion( $userID, $languageCode );
313 }
314 else
315 {
316 $version = eZContentObjectVersion::create( $object->attribute( "id" ), $userID, $versionNumber, $languageCode );
317 }
318 if ( $versionStatus !== false )
319 {
320 $version->setAttribute( 'status', $versionStatus );
321 }
322
323 $version->store();
324
325 foreach ( $attributes as $attribute )
326 {
327 $attribute->instantiate( $object->attribute( 'id' ), $languageCode );
328 }
329
330 if ( isset( $user ) && $user instanceof eZUser && $user->isAnonymous() )
331 {
332 $createdObjectIDList = eZPreferences::value( 'ObjectCreationIDList' );
333 if ( !$createdObjectIDList )
334 {
335 $createdObjectIDList = array( $object->attribute( 'id' ) );
336 }
337 else
338 {
339 $createdObjectIDList = unserialize( $createdObjectIDList );
340 $createdObjectIDList[] = $object->attribute( 'id' );
341 }
342 eZPreferences::setValue( 'ObjectCreationIDList', serialize( $createdObjectIDList ) );
343 }
344
345 $db->commit();
346 return $object;
347 }
348
349 function canInstantiateClasses()
350 {
351 $accessResult = eZUser::currentUser()->hasAccessTo( 'content' , 'create' );
352 $canInstantiateClasses = 1;
353 if ( $accessResult['accessWord'] == 'no' )
354 {
355 $canInstantiateClasses = 0;
356 }
357 return $canInstantiateClasses;
358 }
359
360 // code-template::create-block: can-instantiate-class-list, group-filter, role-caching, class-policy-list, name-instantiate, object-creation, class-sql-creation, static-method
361 // code-template::auto-generated:START can-instantiate-class-list
362 // This code is automatically generated from templates/classcreatelist.ctpl
363 // DO NOT EDIT THIS CODE DIRECTLY, CHANGE THE TEMPLATE FILE INSTEAD
364
379 static function canInstantiateClassList( $asObject = false, $includeFilter = true, $groupList = false, $fetchID = false )
380 {
381 $ini = eZINI::instance();
382 $groupArray = array();
383
384 $enableCaching = ( $ini->variable( 'RoleSettings', 'EnableCaching' ) == 'true' );
385 if ( is_array( $groupList ) )
386 {
387 if ( $fetchID == false )
388 $enableCaching = false;
389 }
390
391 if ( $enableCaching )
392 {
393 $http = eZHTTPTool::instance();
394 $handler = eZExpiryHandler::instance();
395 $expiredTimeStamp = 0;
396 if ( $handler->hasTimestamp( 'user-class-cache' ) )
397 $expiredTimeStamp = $handler->timestamp( 'user-class-cache' );
398
399 $classesCachedForUser = $http->sessionVariable( 'ClassesCachedForUser' );
400 $classesCachedTimestamp = $http->sessionVariable( 'ClassesCachedTimestamp' );
401
402 $cacheVar = 'CanInstantiateClassList';
403 if ( is_array( $groupList ) and $fetchID !== false )
404 {
405 $cacheVar = 'CanInstantiateClassListGroup';
406 }
407
408 $user = eZUser::currentUser();
409 $userID = $user->id();
410 if ( ( $classesCachedTimestamp >= $expiredTimeStamp ) && $classesCachedForUser == $userID )
411 {
412 if ( $http->hasSessionVariable( $cacheVar ) )
413 {
414 if ( $fetchID !== false )
415 {
416 // Check if the group contains our ID, if not we need to fetch from DB
417 $groupArray = $http->sessionVariable( $cacheVar );
418 if ( isset( $groupArray[$fetchID] ) )
419 {
420 return $groupArray[$fetchID];
421 }
422 }
423 else
424 {
425 return $http->sessionVariable( $cacheVar );
426 }
427 }
428 }
429 else
430 {
431 $http->setSessionVariable( 'ClassesCachedForUser' , $userID );
432 $http->setSessionVariable( 'ClassesCachedTimestamp', time() );
433 }
434 }
435
436 $languageCodeList = eZContentLanguage::fetchLocaleList();
437 $allowedLanguages = array( '*' => array() );
438
439 $user = eZUser::currentUser();
440 $accessResult = $user->hasAccessTo( 'content' , 'create' );
441 $accessWord = $accessResult['accessWord'];
442
443 $classIDArray = array();
444 $classList = array();
445 $fetchAll = false;
446 if ( $accessWord == 'yes' )
447 {
448 $fetchAll = true;
449 $allowedLanguages['*'] = $languageCodeList;
450 }
451 else if ( $accessWord == 'no' )
452 {
453 // Cannot create any objects, return empty list.
454 return $classList;
455 }
456 else
457 {
458 $policies = $accessResult['policies'];
459 foreach ( $policies as $policyKey => $policy )
460 {
461 $classIDArrayPart = '*';
462 if ( isset( $policy['Class'] ) )
463 {
464 $classIDArrayPart = $policy['Class'];
465 }
466 $languageCodeArrayPart = $languageCodeList;
467 if ( isset( $policy['Language'] ) )
468 {
469 $languageCodeArrayPart = array_intersect( $policy['Language'], $languageCodeList );
470 }
471
472 // No class limitation for this policy AND no previous limitation(s)
473 if ( $classIDArrayPart == '*' && empty( $classIDArray ) )
474 {
475 $fetchAll = true;
476 $allowedLanguages['*'] = array_unique( array_merge( $allowedLanguages['*'], $languageCodeArrayPart ) );
477 }
478 else if ( is_array( $classIDArrayPart ) )
479 {
480 $fetchAll = false;
481 foreach( $classIDArrayPart as $class )
482 {
483 if ( isset( $allowedLanguages[$class] ) )
484 {
485 $allowedLanguages[$class] = array_unique( array_merge( $allowedLanguages[$class], $languageCodeArrayPart ) );
486 }
487 else
488 {
489 $allowedLanguages[$class] = $languageCodeArrayPart;
490 }
491 }
492 $classIDArray = array_merge( $classIDArray, array_diff( $classIDArrayPart, $classIDArray ) );
493 }
494 }
495 }
496
497 $db = eZDB::instance();
498
499 $filterTableSQL = '';
500 $filterSQL = '';
501 // Create extra SQL statements for the class group filters.
502 if ( is_array( $groupList ) )
503 {
504 if ( count( $groupList ) == 0 )
505 {
506 return $classList;
507 }
508
509 $filterTableSQL = ', ezcontentclass_classgroup ccg';
510 $filterSQL = ( " AND" .
511 " cc.id = ccg.contentclass_id AND" .
512 " " );
513 $filterSQL .= $db->generateSQLINStatement( $groupList, 'ccg.group_id', !$includeFilter, true, 'int' );
514 }
515
516 $classNameFilter = eZContentClassName::sqlFilter( 'cc' );
517 $filterSQL .= " AND cc.id=" . $classNameFilter['from'] . ".contentclass_id";
518
519 if ( $fetchAll )
520 {
521 // If $asObject is true we fetch all fields in class
522 $fields = $asObject ? "cc.*, $classNameFilter[nameField]" : "cc.id, $classNameFilter[nameField]";
523 $rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
524 "FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
525 "WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " $filterSQL " .
526 "ORDER BY $classNameFilter[nameField] ASC" );
527 $classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
528 }
529 else
530 {
531 // If the constrained class list is empty we are not allowed to create any class
532 if ( count( $classIDArray ) == 0 )
533 {
534 return $classList;
535 }
536
537 $classIDCondition = $db->generateSQLINStatement( $classIDArray, 'cc.id' );
538 // If $asObject is true we fetch all fields in class
539 $fields = $asObject ? "cc.*, $classNameFilter[nameField]" : "cc.id, $classNameFilter[nameField]";
540 $rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
541 "FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
542 "WHERE $classIDCondition AND" .
543 " cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . " $filterSQL " .
544 "ORDER BY $classNameFilter[nameField] ASC" );
545 $classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
546 }
547
548 if ( $asObject )
549 {
550 foreach ( $classList as $key => $class )
551 {
552 $id = $class->attribute( 'id' );
553 if ( isset( $allowedLanguages[$id] ) )
554 {
555 $languageCodes = array_unique( array_merge( $allowedLanguages['*'], $allowedLanguages[$id] ) );
556 }
557 else
558 {
559 $languageCodes = $allowedLanguages['*'];
560 }
561 $classList[$key]->setCanInstantiateLanguages( $languageCodes );
562 }
563 }
564
565 eZDebugSetting::writeDebug( 'kernel-content-class', $classList, "class list fetched from db" );
566 if ( $enableCaching )
567 {
568 if ( $fetchID !== false )
569 {
570 $groupArray[$fetchID] = $classList;
571 $http->setSessionVariable( $cacheVar, $groupArray );
572 }
573 else
574 {
575 $http->setSessionVariable( $cacheVar, $classList );
576 }
577 }
578
579 return $classList;
580 }
581
582 // This code is automatically generated from templates/classcreatelist.ctpl
583 // code-template::auto-generated:END can-instantiate-class-list
584
588 function creator()
589 {
590 if ( isset( $this->CreatorID ) and $this->CreatorID )
591 {
592 return eZUser::fetch( $this->CreatorID );
593 }
594 return null;
595 }
596
600 function modifier()
601 {
602 if ( isset( $this->ModifierID ) and $this->ModifierID )
603 {
604 return eZUser::fetch( $this->ModifierID );
605 }
606 return null;
607 }
608
614 function fetchGroupList()
615 {
616 $this->InGroups = eZContentClassClassGroup::fetchGroupList( $this->attribute( "id" ),
617 $this->attribute( "version" ),
618 true );
619 return $this->InGroups;
620 }
621
627 function fetchGroupIDList()
628 {
629 $list = eZContentClassClassGroup::fetchGroupList( $this->attribute( "id" ),
630 $this->attribute( "version" ),
631 false );
632 $this->InGroupIDs = array();
633 foreach ( $list as $item )
634 {
635 $this->InGroupIDs[] = $item['group_id'];
636 }
637 return $this->InGroupIDs;
638 }
639
647 function fetchMatchGroupIDList()
648 {
649 $contentINI = eZINI::instance( 'content.ini' );
650 if( $contentINI->variable( 'ContentOverrideSettings', 'EnableClassGroupOverride' ) == 'true' )
651 {
652 return $this->attribute( 'ingroup_id_list' );
653 }
654
655 return false;
656 }
657
662 static function fetchAllClasses( $asObject = true, $includeFilter = true, $groupList = false )
663 {
664 $filterTableSQL = '';
665 $filterSQL = '';
666 if ( is_array( $groupList ) )
667 {
668 $filterTableSQL = ', ezcontentclass_classgroup ccg';
669 $filterSQL = ( " AND" .
670 " cc.id = ccg.contentclass_id AND" .
671 " ccg.group_id " );
672 $groupText = implode( ', ', $groupList );
673 if ( $includeFilter )
674 $filterSQL .= "IN ( $groupText )";
675 else
676 $filterSQL .= "NOT IN ( $groupText )";
677 }
678
679 $classNameFilter = eZContentClassName::sqlFilter( 'cc' );
680
681 $classList = array();
682 $db = eZDB::instance();
683 // If $asObject is true we fetch all fields in class
684 $fields = $asObject ? "cc.*" : "cc.id, $classNameFilter[nameField]";
685 $rows = $db->arrayQuery( "SELECT DISTINCT $fields " .
686 "FROM ezcontentclass cc$filterTableSQL, $classNameFilter[from] " .
687 "WHERE cc.version = " . eZContentClass::VERSION_STATUS_DEFINED . "$filterSQL AND $classNameFilter[where]" .
688 "ORDER BY $classNameFilter[nameField] ASC" );
689
690 $classList = eZPersistentObject::handleRows( $rows, 'eZContentClass', $asObject );
691 return $classList;
692 }
693
699 function fetchAllGroups()
700 {
701 $this->AllGroups = eZContentClassGroup::fetchList();
702 return $this->AllGroups;
703 }
704
708 function inGroup( $groupID )
709 {
710 return eZContentClassClassGroup::classInGroup( $this->attribute( 'id' ),
711 $this->attribute( 'version' ),
712 $groupID );
713 }
714
719 static function removeTemporary()
720 {
721 $version = eZContentClass::VERSION_STATUS_TEMPORARY;
722 $temporaryClasses = eZContentClass::fetchList( $version, true );
723 $db = eZDB::instance();
724 $db->begin();
725 foreach ( $temporaryClasses as $class )
726 {
727 $class->remove( true, $version );
728 }
729 eZPersistentObject::removeObject( eZContentClassAttribute::definition(),
730 array( 'version' => $version ) );
731
732 $db->commit();
733 }
734
738 function remoteID()
739 {
740 $remoteID = $this->attribute( 'remote_id', true );
741 if ( !$remoteID &&
742 $this->Version == eZContentClass::VERSION_STATUS_DEFINED )
743 {
744 $this->setAttribute( 'remote_id', eZRemoteIdUtility::generate( 'class' ) );
745 $this->sync( array( 'remote_id' ) );
746 $remoteID = $this->attribute( 'remote_id', true );
747 }
748
749 return $remoteID;
750 }
751
756 function remove( $removeAttributes = false, $version = eZContentClass::VERSION_STATUS_DEFINED )
757 {
758 // If we are not allowed to remove just return false
759 if ( $this->Version == eZContentClass::VERSION_STATUS_DEFINED && !$this->isRemovable() )
760 return false;
761
762 if ( is_array( $removeAttributes ) or $removeAttributes )
763 $this->removeAttributes( $removeAttributes );
764
765 $this->NameList->remove( $this );
766 parent::remove();
767 }
768
773 function isRemovable()
774 {
775 $info = $this->removableInformation( false );
776 return count( $info['list'] ) == 0;
777 }
778
791 function removableInformation( $includeAll = true )
792 {
793 $result = array( 'text' => ezpI18n::tr( 'kernel/contentclass', "Cannot remove class '%class_name':",
794 null, array( '%class_name' => $this->attribute( 'name' ) ) ),
795 'list' => array() );
796 $db = eZDB::instance();
797
798 // Check top-level nodes
799 $rows = $db->arrayQuery( "SELECT ezcot.node_id
800 FROM ezcontentobject_tree ezcot, ezcontentobject ezco
801 WHERE ezcot.depth = 1 AND
802 ezco.contentclass_id = $this->ID AND
803 ezco.id=ezcot.contentobject_id" );
804 if ( count( $rows ) > 0 )
805 {
806 $result['list'][] = array( 'text' => ezpI18n::tr( 'kernel/contentclass', 'The class is used by a top-level node and cannot be removed.
807 You will need to change the class of the node by using the swap functionality.' ) );
808 if ( !$includeAll )
809 return $result;
810 }
811
812 // Check class attributes
813 foreach ( $this->fetchAttributes() as $attribute )
814 {
815 $dataType = $attribute->dataType();
816
817 if ( $dataType === null )
818 {
819 eZDebug::writeError(
820 "Skipping removal of class attribute for non-existent datatype " . $attribute->DataTypeString,
821 __METHOD__
822 );
823 continue;
824 }
825
826 if ( !$dataType->isClassAttributeRemovable( $attribute ) )
827 {
828 $info = $dataType->classAttributeRemovableInformation( $attribute, $includeAll );
829 $result['list'][] = $info;
830 if ( !$includeAll )
831 return $result;
832 }
833 }
834
835 return $result;
836 }
837
844 function removeAttributes( $removeAttributes = false, $version = false )
845 {
846 if ( is_array( $removeAttributes ) )
847 {
848 $db = eZDB::instance();
849 $db->begin();
850 foreach( $removeAttributes as $attribute )
851 {
852 $attribute->removeThis();
853 }
854 $db->commit();
855 }
856 else
857 {
858 $contentClassID = $this->ID;
859
860 if ( $version === false )
861 {
862 $version = $this->Version;
863 }
864 $classAttributes = $this->fetchAttributes( );
865
866 $db = eZDB::instance();
867 $db->begin();
868 foreach ( $classAttributes as $classAttribute )
869 {
870 $dataType = $classAttribute->dataType();
871 if ( $dataType === null )
872 {
873 eZDebug::writeError(
874 "Skipping removal of class attribute for non-existent datatype " . $classAttribute->DataTypeString,
875 __METHOD__
876 );
877 continue;
878 }
879 $dataType->deleteStoredClassAttribute( $classAttribute, $version );
880 }
881 eZPersistentObject::removeObject( eZContentClassAttribute::definition(),
882 array( 'contentclass_id' => $contentClassID,
883 'version' => $version ) );
884 $db->commit();
885 }
886 }
887
888 function compareAttributes( $attr1, $attr2 )
889 {
890 return ( $attr1->attribute( "placement" ) > $attr2->attribute( "placement" ) ) ? 1 : -1;
891 }
892
893 function adjustAttributePlacements( $attributes )
894 {
895 if ( !is_array( $attributes ) )
896 return;
897 usort( $attributes, array( $this, "compareAttributes" ) );
898 $i = 0;
899 foreach( $attributes as $attribute )
900 {
901 $attribute->setAttribute( "placement", ++$i );
902 }
903 }
904
905 function store( $store_childs = false, $fieldFilters = null )
906 {
907
908 self::expireCache();
909
910 $db = eZDB::instance();
911 $db->begin();
912
913 if ( is_array( $store_childs ) ||
914 $store_childs )
915 {
916 if ( is_array( $store_childs ) )
917 {
918 $attributes = $store_childs;
919 }
920 else
921 {
922 $attributes = $this->fetchAttributes();
923 }
924
925 foreach( $attributes as $attribute )
926 {
927 if ( is_object ( $attribute ) )
928 $attribute->store();
929 }
930 }
931
932 $handler = eZExpiryHandler::instance();
933 $handler->setTimestamp( 'user-class-cache', time() );
934 $handler->store();
935
936 $this->setAttribute( 'serialized_name_list', $this->NameList->serializeNames() );
937 $this->setAttribute( 'serialized_description_list', $this->DescriptionList->serializeNames() );
938
939 parent::store( $fieldFilters );
940
941 $this->NameList->store( $this );
942
943 $db->commit();
944 }
945
946 function sync( $fieldFilters = null )
947 {
948 if ( $this->hasDirtyData() )
949 $this->store( false, $fieldFilters );
950 }
951
958 function initializeCopy( &$originalClass )
959 {
960 $name = ezpI18n::tr( 'kernel/class', 'Copy of %class_name', null,
961 array( '%class_name' => $originalClass->attribute( 'name' ) ) );
962 $identifier = 'copy_of_' . $originalClass->attribute( 'identifier' );
963 $db = eZDB::instance();
964 $sql = "SELECT count( ezcontentclass_name.name ) AS count FROM ezcontentclass, ezcontentclass_name WHERE ezcontentclass.id = ezcontentclass_name.contentclass_id AND ezcontentclass_name.name like '" . $db->escapeString( $name ) . "%'";
965 $rows = $db->arrayQuery( $sql );
966 $count = $rows[0]['count'];
967 if ( $count > 0 )
968 {
969 ++$count;
970 $name .= $count;
971 $identifier .= $count;
972 if ( strlen( $identifier ) > 50 )
973 {
974 $identifier = "copy_{$count}_of_" . $originalClass->attribute( 'identifier' );
975 }
976 }
977 $this->setName( $name );
978 $this->setAttribute( 'identifier', $identifier );
979 $this->setAttribute( 'created', time() );
980 $user = eZUser::currentUser();
981 $userID = $user->attribute( "contentobject_id" );
982 $this->setAttribute( 'creator_id', $userID );
983 }
984
993 public function storeDefined( $attributes )
994 {
995 $this->storeVersioned( $attributes, self::VERSION_STATUS_DEFINED );
996 }
997
1008 public function storeVersioned( $attributes, $version )
1009 {
1010 $previousVersion = $this->attribute( 'version' );
1011
1012 $db = eZDB::instance();
1013 $db->begin();
1014
1015 // Before removing anything from the attributes, load attribute information
1016 // which might otherwise not accessible when recreating them below.
1017 // See issue #18164
1018 foreach ( $attributes as $attribute )
1019 {
1020 $attribute->content();
1021 }
1022
1023 $this->removeAttributes( false, $version );
1024 $this->removeAttributes( false, $previousVersion );
1025 $this->remove( false );
1026 $this->setVersion( $version, $attributes );
1027 $this->setAttribute( "modifier_id", eZUser::currentUser()->attribute( "contentobject_id" ) );
1028 $this->setAttribute( "modified", time() );
1029 $this->adjustAttributePlacements( $attributes );
1030 foreach( $attributes as $attribute )
1031 {
1032 $attribute->storeVersioned( $version );
1033 }
1034
1035 // Set contentobject_name to something sensible if it is missing
1036 if ( count( $attributes ) > 0 && trim( $this->attribute( 'contentobject_name' ) ) == '' )
1037 {
1038 $this->setAttribute( 'contentobject_name', '<' . $attributes[0]->attribute( 'identifier' ) . '>' );
1039 }
1040
1041 // Recreate class member entries
1042 eZContentClassClassGroup::removeClassMembers( $this->ID, $version );
1043
1044 foreach( eZContentClassClassGroup::fetchGroupList( $this->ID, $previousVersion ) as $classgroup )
1045 {
1046 $classgroup->setAttribute( 'contentclass_version', $version );
1047 $classgroup->store();
1048 }
1049 eZContentClassClassGroup::removeClassMembers( $this->ID, $previousVersion );
1050
1051 $handler = eZExpiryHandler::instance();
1052 $time = time();
1053 $handler->setTimestamp( 'user-class-cache', $time );
1054 $handler->setTimestamp( 'class-identifier-cache', $time );
1055 $handler->setTimestamp( 'sort-key-cache', $time );
1056 $handler->store();
1057
1058 $this->setAttribute( 'serialized_name_list', $this->NameList->serializeNames() );
1059 $this->setAttribute( 'serialized_description_list', $this->DescriptionList->serializeNames() );
1060 parent::store();
1061 $this->NameList->store( $this );
1062
1063 $db->commit();
1064
1065 eZContentCacheManager::clearAllContentCache();
1066 }
1067
1068 function setVersion( $version, $set_childs = false )
1069 {
1070 if ( is_array( $set_childs ) or $set_childs )
1071 {
1072 if ( is_array( $set_childs ) )
1073 {
1074 $attributes = $set_childs;
1075 }
1076 else
1077 {
1078 $attributes = $this->fetchAttributes();
1079 }
1080 foreach( $attributes as $attribute )
1081 {
1082 $attribute->setAttribute( "version", $version );
1083 }
1084 }
1085
1086 if ( $this->Version != $version )
1087 $this->NameList->setHasDirtyData();
1088
1089 $this->setAttribute( "version", $version );
1090 }
1091
1092 static function exists( $id, $version = eZContentClass::VERSION_STATUS_DEFINED, $userID = false, $useIdentifier = false )
1093 {
1094 $conds = array( "version" => $version );
1095 if ( $useIdentifier )
1096 $conds["identifier"] = $id;
1097 else
1098 $conds["id"] = $id;
1099 if ( $userID !== false and is_numeric( $userID ) )
1100 $conds["creator_id"] = $userID;
1101 $version_sort = "desc";
1102 if ( $version == eZContentClass::VERSION_STATUS_DEFINED )
1103 $conds['version'] = $version;
1104 $rows = eZPersistentObject::fetchObjectList( eZContentClass::definition(),
1105 null,
1106 $conds,
1107 null,
1108 array( "offset" => 0,
1109 "length" => 1 ),
1110 false );
1111 if ( count( $rows ) > 0 )
1112 return $rows[0]['id'];
1113 return false;
1114 }
1115
1116 static function fetch( $id, $asObject = true, $version = eZContentClass::VERSION_STATUS_DEFINED, $user_id = false ,$parent_id = null )
1117 {
1118 global $eZContentClassObjectCache;
1119
1120 // If the object given by its id is not cached or should be returned as array
1121 // then we fetch it from the DB (objects are always cached as arrays).
1122 if ( !isset( $eZContentClassObjectCache[$id] ) or $asObject === false or $version != eZContentClass::VERSION_STATUS_DEFINED )
1123 {
1124 $conds = array( "id" => $id,
1125 "version" => $version );
1126
1127 if ( $user_id !== false and is_numeric( $user_id ) )
1128 $conds["creator_id"] = $user_id;
1129
1130 $version_sort = "desc";
1131 if ( $version == eZContentClass::VERSION_STATUS_DEFINED )
1132 $version_sort = "asc";
1133 $rows = eZPersistentObject::fetchObjectList( eZContentClass::definition(),
1134 null,
1135 $conds,
1136 array( "version" => $version_sort ),
1137 array( "offset" => 0,
1138 "length" => 2 ),
1139 false );
1140
1141 if ( count( $rows ) == 0 )
1142 {
1143 $contentClass = null;
1144 return $contentClass;
1145 }
1146
1147 $row = $rows[0];
1148 $row["version_count"] = count( $rows );
1149
1150 if ( $asObject )
1151 {
1152 $contentClass = new eZContentClass( $row );
1153 if ( $version == eZContentClass::VERSION_STATUS_DEFINED )
1154 {
1155 $eZContentClassObjectCache[$id] = $contentClass;
1156 }
1157 return $contentClass;
1158 }
1159 else
1160 $contentClass = $row;
1161 }
1162 else
1163 {
1164 $contentClass = $eZContentClassObjectCache[$id];
1165 }
1166
1167 return $contentClass;
1168 }
1169
1170 static function fetchByRemoteID( $remoteID, $asObject = true, $version = eZContentClass::VERSION_STATUS_DEFINED, $user_id = false ,$parent_id = null )
1171 {
1172 $conds = array( "remote_id" => $remoteID,
1173 "version" => $version );
1174 if ( $user_id !== false and is_numeric( $user_id ) )
1175 $conds["creator_id"] = $user_id;
1176 $version_sort = "desc";
1177 if ( $version == eZContentClass::VERSION_STATUS_DEFINED )
1178 $version_sort = "asc";
1179 $rows = eZPersistentObject::fetchObjectList( eZContentClass::definition(),
1180 null,
1181 $conds,
1182 array( "version" => $version_sort ),
1183 array( "offset" => 0,
1184 "length" => 2 ),
1185 false );
1186 if ( count( $rows ) == 0 )
1187 {
1188 $contentClass = null;
1189 return $contentClass;
1190 }
1191
1192 $row = $rows[0];
1193 $row["version_count"] = count( $rows );
1194
1195 if ( $asObject )
1196 {
1197 return new eZContentClass( $row );
1198 }
1199
1200 return $row;
1201 }
1202
1203 static function fetchByIdentifier( $identifier, $asObject = true, $version = eZContentClass::VERSION_STATUS_DEFINED, $user_id = false ,$parent_id = null )
1204 {
1205 $conds = array( "identifier" => $identifier,
1206 "version" => $version );
1207 if ( $user_id !== false and is_numeric( $user_id ) )
1208 $conds["creator_id"] = $user_id;
1209 $version_sort = "desc";
1210 if ( $version == eZContentClass::VERSION_STATUS_DEFINED )
1211 $version_sort = "asc";
1212 $rows = eZPersistentObject::fetchObjectList( eZContentClass::definition(),
1213 null,
1214 $conds,
1215 array( "version" => $version_sort ),
1216 array( "offset" => 0,
1217 "length" => 2 ),
1218 false );
1219 if ( count( $rows ) == 0 )
1220 {
1221 $contentClass = null;
1222 return $contentClass;
1223 }
1224
1225 $row = $rows[0];
1226 $row["version_count"] = count( $rows );
1227
1228 if ( $asObject )
1229 {
1230 return new eZContentClass( $row );
1231 }
1232 return $row;
1233 }
1234
1238 static function fetchList( $version = eZContentClass::VERSION_STATUS_DEFINED, $asObject = true, $user_id = false,
1239 $sorts = null, $fields = null, $classFilter = false, $limit = null )
1240 {
1241 $conds = array();
1242 $custom_fields = null;
1243 $custom_tables = null;
1244 $custom_conds = null;
1245
1246 if ( is_numeric( $version ) )
1247 $conds["version"] = $version;
1248 if ( $user_id !== false and is_numeric( $user_id ) )
1249 $conds["creator_id"] = $user_id;
1250 if ( $classFilter )
1251 {
1252 $classIDCount = 0;
1253 $classIdentifierCount = 0;
1254
1255 $classIDFilter = array();
1256 $classIdentifierFilter = array();
1257 foreach ( $classFilter as $classType )
1258 {
1259 if ( is_numeric( $classType ) )
1260 {
1261 $classIDFilter[] = $classType;
1262 $classIDCount++;
1263 }
1264 else
1265 {
1266 $classIdentifierFilter[] = $classType;
1267 $classIdentifierCount++;
1268 }
1269 }
1270
1271 if ( $classIDCount > 1 )
1272 $conds['id'] = array( $classIDFilter );
1273 else if ( $classIDCount == 1 )
1274 $conds['id'] = $classIDFilter[0];
1275 if ( $classIdentifierCount > 1 )
1276 $conds['identifier'] = array( $classIdentifierFilter );
1277 else if ( $classIdentifierCount == 1 )
1278 $conds['identifier'] = $classIdentifierFilter[0];
1279 }
1280
1281 if ( $sorts && isset( $sorts['name'] ) )
1282 {
1283 $nameFiler = eZContentClassName::sqlFilter( 'ezcontentclass' );
1284 $custom_tables = array( $nameFiler['from'] );
1285 $custom_conds = "AND " . $nameFiler['where'];
1286 $custom_fields = array( $nameFiler['nameField'] );
1287
1288 $sorts[$nameFiler['orderBy']] = $sorts['name'];
1289 unset( $sorts['name'] );
1290 }
1291
1292 return eZPersistentObject::fetchObjectList( eZContentClass::definition(),
1293 $fields,
1294 $conds,
1295 $sorts,
1296 $limit,
1297 $asObject,
1298 false,
1299 $custom_fields,
1300 $custom_tables,
1301 $custom_conds );
1302 }
1303
1307 function dataMap()
1308 {
1309 if ( !isset( $this->DataMap[$this->Version] ) )
1310 {
1311 $attributes = $this->fetchAttributes( false, true, $this->Version );
1312 foreach ( $attributes as $attribute )
1313 {
1314 $this->DataMap[$this->Version][$attribute->attribute( 'identifier' )] = $attribute;
1315 }
1316 }
1317 return $this->DataMap[$this->Version];
1318 }
1319
1320 function fetchAttributes( $id = false, $asObject = true, $version = eZContentClass::VERSION_STATUS_DEFINED )
1321 {
1322 if ( $id === false )
1323 {
1324 $id = $this->ID;
1325 $version = $this->Version;
1326 }
1327
1328 return eZContentClassAttribute::fetchFilteredList( array( "contentclass_id" => $id,
1329 "version" => $version ),
1330 $asObject );
1331 }
1332
1340 function fetchAttributeByIdentifier( $identifier, $asObject = true )
1341 {
1342 $attributeArray = eZContentClassAttribute::fetchFilteredList( array( 'contentclass_id' => $this->ID,
1343 'version' => $this->Version,
1344 'identifier' => $identifier ), $asObject );
1345 if ( count( $attributeArray ) > 0 )
1346 {
1347 return $attributeArray[0];
1348 }
1349 return null;
1350 }
1351
1352 function fetchSearchableAttributes( $id = false, $asObject = true, $version = eZContentClass::VERSION_STATUS_DEFINED )
1353 {
1354 if ( $id === false )
1355 {
1356 $id = $this->ID;
1357 $version = $this->Version;
1358 }
1359
1360 return eZContentClassAttribute::fetchFilteredList( array( "contentclass_id" => $id,
1361 "is_searchable" => 1,
1362 "version" => $version ), $asObject );
1363 }
1364
1365 function versionStatus()
1366 {
1367
1368 if ( $this->VersionCount == 1 )
1369 {
1370 if ( $this->Version == eZContentClass::VERSION_STATUS_TEMPORARY )
1371 {
1372 return eZContentClass::VERSION_STATUS_TEMPORARY;
1373 }
1374 return eZContentClass::VERSION_STATUS_DEFINED;
1375 }
1376 return eZContentClass::VERSION_STATUS_MODIFIED;
1377 }
1378
1383 function versionCount()
1384 {
1385 return $this->VersionCount;
1386 }
1387
1397 function contentObjectName( eZContentObject $contentObject, $version = false, $translation = false )
1398 {
1399 $contentObjectNamePattern = $this->ContentObjectName;
1400
1401 $ini = eZINI::instance();
1402 $length = (int) $ini->variable('ContentSettings', 'ContentObjectNameLimit');
1403 $sequence = $ini->variable('ContentSettings', 'ContentObjectNameLimitSequence');
1404 if ( $length < 1 || $length > self::CONTENT_OBJECT_NAME_MAX_LENGTH )
1405 {
1406 $length = self::CONTENT_OBJECT_NAME_MAX_LENGTH;
1407 }
1408 $nameResolver = new eZNamePatternResolver( $contentObjectNamePattern, $contentObject, $version, $translation );
1409 $contentObjectName = $nameResolver->resolveNamePattern( $length, $sequence );
1410
1411 return $contentObjectName;
1412 }
1413
1423 function urlAliasName( eZContentObject $contentObject, $version = false, $translation = false )
1424 {
1425 if ( $this->URLAliasName )
1426 {
1427 $urlAliasNamePattern = $this->URLAliasName;
1428 }
1429 else
1430 {
1431 $urlAliasNamePattern = $this->ContentObjectName;
1432 }
1433
1434 $length = (int) eZINI::instance()->variable('URLTranslator', 'UrlAliasNameLimit');
1435 $nameResolver = new eZNamePatternResolver( $urlAliasNamePattern, $contentObject, $version, $translation );
1436 $urlAliasName = $nameResolver->resolveNamePattern( $length );
1437
1438 return $urlAliasName;
1439 }
1440
1445 function buildContentObjectName( $contentObjectName, $dataMap, $tmpTags = false )
1446 {
1447 preg_match_all( "|<[^>]+>|U",
1448 $contentObjectName,
1449 $tagMatchArray );
1450
1451 foreach ( $tagMatchArray[0] as $tag )
1452 {
1453 $tagName = str_replace( "<", "", $tag );
1454 $tagName = str_replace( ">", "", $tagName );
1455
1456 $tagParts = explode( '|', $tagName );
1457
1458 $namePart = "";
1459 foreach ( $tagParts as $name )
1460 {
1461 // get the value of the attribute to use in name
1462 if ( isset( $dataMap[$name] ) )
1463 {
1464 $namePart = $dataMap[$name]->title();
1465 if ( $namePart != "" )
1466 break;
1467 }
1468 elseif ( $tmpTags && isset( $tmpTags[$name] ) && $tmpTags[$name] != '' )
1469 {
1470 $namePart = $tmpTags[$name];
1471 break;
1472 }
1473
1474 }
1475
1476 // replace tag with object name part
1477 $contentObjectName = str_replace( $tag, $namePart, $contentObjectName );
1478 }
1479 return $contentObjectName;
1480 }
1481
1485 function objectCount()
1486 {
1487 $db = eZDB::instance();
1488
1489 $countRow = $db->arrayQuery( 'SELECT count(*) AS count FROM ezcontentobject '.
1490 'WHERE contentclass_id='.$this->ID ." and status = " . eZContentObject::STATUS_PUBLISHED );
1491
1492 return $countRow[0]['count'];
1493 }
1494
1498 function objectList()
1499 {
1500 return eZContentObject::fetchSameClassList( $this->ID );
1501 }
1502
1507 function setCanInstantiateLanguages( $languageCodes )
1508 {
1509 $this->CanInstantiateLanguages = $languageCodes;
1510 }
1511
1512 function canInstantiateLanguages()
1513 {
1514 if ( is_array( $this->CanInstantiateLanguages ) )
1515 {
1516 return array_intersect( eZContentLanguage::prioritizedLanguageCodes(), $this->CanInstantiateLanguages );
1517 }
1518 return array();
1519 }
1520
1529 static function nameFromSerializedString( $serializedNameList )
1530 {
1531 return eZContentClassNameList::nameFromSerializedString( $serializedNameList );
1532 }
1533
1542 static function descriptionFromSerializedString( $serializedNameList )
1543 {
1544 return eZSerializedObjectNameList::nameFromSerializedString( $serializedNameList );
1545 }
1546
1547 function hasNameInLanguage( $languageLocale )
1548 {
1549 $hasName = $this->NameList->hasNameInLocale( $languageLocale );
1550 return $hasName;
1551 }
1552
1559 function name( $languageLocale = false )
1560 {
1561 return $this->NameList->name( $languageLocale );
1562 }
1563
1564 function setName( $name, $languageLocale = false )
1565 {
1566 if ( !$languageLocale )
1567 $languageLocale = $this->topPriorityLanguageLocale();
1568 $this->NameList->setNameByLanguageLocale( $name, $languageLocale );
1569
1570 $languageID = eZContentLanguage::idByLocale( $languageLocale );
1571 $languageMask = $this->attribute( 'language_mask' );
1572 $this->setAttribute( 'language_mask', $languageMask | $languageID );
1573 }
1574
1575 function nameList()
1576 {
1577 return $this->NameList->nameList();
1578 }
1579
1586 function description( $languageLocale = false )
1587 {
1588 return $this->DescriptionList->name( $languageLocale );
1589 }
1590
1591 function setDescription( $description, $languageLocale = false )
1592 {
1593 $this->DescriptionList->setName( $description, $languageLocale );
1594 }
1595
1596 function descriptionList()
1597 {
1598 return $this->DescriptionList->nameList();
1599 }
1600
1601 function setAlwaysAvailableLanguageID( $languageID, $updateChilds = true )
1602 {
1603 $db = eZDB::instance();
1604 $db->begin();
1605
1606 $languageLocale = false;
1607 if ( $languageID )
1608 {
1609 $language = eZContentLanguage::fetch( $languageID );
1610 $languageLocale = $language->attribute( 'locale' );
1611 }
1612
1613 if ( $languageID )
1614 {
1615 $this->setAttribute( 'language_mask', (int)$this->attribute( 'language_mask' ) | 1 );
1616 $this->NameList->setAlwaysAvailableLanguage( $languageLocale );
1617 $this->DescriptionList->setAlwaysAvailableLanguage( $languageLocale );
1618 }
1619 else
1620 {
1621 $this->setAttribute( 'language_mask', (int)$this->attribute( 'language_mask' ) & ~1 );
1622 $this->NameList->setAlwaysAvailableLanguage( false );
1623 $this->DescriptionList->setAlwaysAvailableLanguage( false );
1624 }
1625 $this->store();
1626
1627 $classID = $this->attribute( 'id' );
1628 $version = $this->attribute( 'version' );
1629
1630 $attributes = $this->fetchAttributes();
1631 foreach( $attributes as $attribute )
1632 {
1633 $attribute->setAlwaysAvailableLanguage( $languageLocale );
1634 $attribute->store();
1635 }
1636
1637 // reset 'always available' flag
1638 $sql = "UPDATE ezcontentclass_name SET language_id=";
1639 if ( $db->databaseName() == 'oracle' )
1640 {
1641 $sql .= "bitand( language_id, -2 )";
1642 }
1643 else
1644 {
1645 $sql .= "language_id & ~1";
1646 }
1647 $sql .= " WHERE contentclass_id = '$classID' AND contentclass_version = '$version'";
1648 $db->query( $sql );
1649
1650 if ( $languageID != false )
1651 {
1652 $newLanguageID = $languageID | 1;
1653
1654 $sql = "UPDATE ezcontentclass_name
1655 SET language_id='$newLanguageID'
1656 WHERE language_id='$languageID' AND contentclass_id = '$classID' AND contentclass_version = '$version'";
1657 $db->query( $sql );
1658 }
1659
1660 $db->commit();
1661 }
1662
1663 function clearAlwaysAvailableLanguageID()
1664 {
1665 $this->setAlwaysAvailableLanguageID( false );
1666 }
1667
1671 function languages()
1672 {
1673 return $this->NameList->languages();
1674 }
1675
1679 function prioritizedLanguages()
1680 {
1681 return $this->NameList->prioritizedLanguages();
1682 }
1683
1684 function prioritizedLanguagesJsArray()
1685 {
1686 return $this->NameList->prioritizedLanguagesJsArray();
1687 }
1688
1692 function canCreateLanguages()
1693 {
1694 return $this->NameList->untranslatedLanguages();
1695 }
1696
1700 function topPriorityLanguageLocale()
1701 {
1702 return $this->NameList->topPriorityLanguageLocale();
1703 }
1704
1710 function alwaysAvailableLanguage()
1711 {
1712 return $this->NameList->alwaysAvailableLanguage();
1713 }
1714
1720 function alwaysAvailableLanguageLocale()
1721 {
1722 $language = $this->NameList->alwaysAvailableLanguageLocale();
1723 return $language;
1724 }
1725
1729 function removeTranslation( $languageID )
1730 {
1731 $language = eZContentLanguage::fetch( $languageID );
1732
1733 if ( !$language )
1734 {
1735 return false;
1736 }
1737
1738 // check if it is not the initial language
1739 $classInitialLanguageID = $this->attribute( 'initial_language_id' );
1740 if ( $classInitialLanguageID == $languageID )
1741 {
1742 return false;
1743 }
1744
1745 $db = eZDB::instance();
1746 $db->begin();
1747
1748 $classID = $this->attribute( 'id' );
1749 $languageID = $language->attribute( 'id' );
1750
1751 // change language_mask of the object
1752 $languageMask = (int) $this->attribute( 'language_mask' );
1753 $languageMask = (int) $languageMask & ~ (int) $languageID;
1754 $this->setAttribute( 'language_mask', $languageMask );
1755
1756 // Remove all names in the language
1757 $db->query( "DELETE FROM ezcontentclass_name
1758 WHERE contentclass_id='$classID'
1759 AND language_id='$languageID'" );
1760
1761 $languageLocale = $language->attribute( 'locale' );
1762 $this->NameList->removeName( $languageLocale );
1763 $this->DescriptionList->removeName( $languageLocale );
1764
1765 $this->store();
1766
1767 // Remove names for attributes in the language
1768 $attributes = $this->fetchAttributes();
1769 foreach ( $attributes as $attribute )
1770 {
1771 $attribute->removeTranslation( $languageLocale );
1772 $attribute->store();
1773 }
1774
1775 $db->commit();
1776
1777 return true;
1778 }
1779
1790 public static function classIDByIdentifier( $identifier )
1791 {
1792 $identifierHash = self::classIdentifiersHash();
1793
1794 if ( is_array( $identifier ) )
1795 {
1796 $idList = array();
1797 foreach( $identifier as $identifierItem )
1798 {
1799 if ( isset( $identifierHash[$identifierItem] ) )
1800 $idList[] = $identifierHash[$identifierItem];
1801 else if ( is_numeric( $identifierItem ) ) // to be able to pass mixed arrays
1802 $idList[] = $identifierItem;
1803 }
1804 return $idList;
1805 }
1806 else if ( isset( $identifierHash[$identifier] ) )
1807 return $identifierHash[$identifier];
1808 else
1809 return false;
1810 }
1811
1819 public static function classIdentifierByID( $id )
1820 {
1821 $identifierHash = array_flip( self::classIdentifiersHash() );
1822
1823 if ( isset( $identifierHash[$id] ) )
1824 return $identifierHash[$id];
1825 else
1826 return false;
1827 }
1828
1838 protected static function classIdentifiersHash()
1839 {
1840 if ( self::$identifierHash === null )
1841 {
1842 $db = eZDB::instance();
1843 $dbName = md5( $db->DB );
1844
1845 $cacheDir = eZSys::cacheDirectory();
1846 $phpCache = new eZPHPCreator( $cacheDir,
1847 'classidentifiers_' . $dbName . '.php',
1848 '',
1849 array( 'clustering' => 'classidentifiers' ) );
1850
1851 $handler = eZExpiryHandler::instance();
1852 $expiryTime = 0;
1853 if ( $handler->hasTimestamp( 'class-identifier-cache' ) )
1854 {
1855 $expiryTime = $handler->timestamp( 'class-identifier-cache' );
1856 }
1857
1858 if ( $phpCache->canRestore( $expiryTime ) )
1859 {
1860 $var = $phpCache->restore( array( 'identifierHash' => 'identifier_hash' ) );
1861 self::$identifierHash = $var['identifierHash'];
1862 }
1863 else
1864 {
1865 // Fetch identifier/id pair from db
1866 $query = "SELECT id, identifier FROM ezcontentclass where version=0";
1867 $identifierArray = $db->arrayQuery( $query );
1868
1869 self::$identifierHash = array();
1870 foreach ( $identifierArray as $identifierRow )
1871 {
1872 self::$identifierHash[$identifierRow['identifier']] = $identifierRow['id'];
1873 }
1874
1875 // Store identifier list to cache file
1876 $phpCache->addVariable( 'identifier_hash', self::$identifierHash );
1877 $phpCache->store();
1878 }
1879 }
1880 return self::$identifierHash;
1881 }
1882
1888 static function fetchIDListContainingDatatype( $dataTypeString )
1889 {
1890 $db = eZDB::instance();
1891
1892 $version = self::VERSION_STATUS_DEFINED;
1893 $escapedDataTypeString = $db->escapeString( $dataTypeString );
1894
1895 $sql = "SELECT DISTINCT contentclass_id
1896 FROM ezcontentclass_attribute
1897 WHERE version=$version
1898 AND data_type_string='$escapedDataTypeString'";
1899
1900 $classIDArray = $db->arrayQuery( $sql, array( 'column' => 'contentclass_id' ) );
1901 return $classIDArray;
1902 }
1903
1912 public static function expireCache()
1913 {
1914 unset( $GLOBALS['eZContentClassObjectCache'] );
1915 self::$identifierHash = null;
1916 eZContentClassAttribute::expireCache();
1917 }
1918
1927 public static function versionHistoryLimit( $class )
1928 {
1929 // default version limit
1930 $contentINI = eZINI::instance( 'content.ini' );
1931 $versionLimit = $contentINI->variable( 'VersionManagement', 'DefaultVersionHistoryLimit' );
1932
1933 // version limit can't be < 2
1934 if ( $versionLimit < 2 )
1935 {
1936 eZDebug::writeWarning( "Global version history limit must be equal to or higher than 2", __METHOD__ );
1937 $versionLimit = 2;
1938 }
1939
1940 // we need to take $class down to a class ID
1941 if ( is_numeric( $class ) )
1942 {
1943 if (!eZContentClass::classIdentifierByID( $class ) )
1944 {
1945 eZDebug::writeWarning( "class integer parameter doesn't match any content class ID", __METHOD__ );
1946 return $versionLimit;
1947 }
1948 $classID = (int)$class;
1949 }
1950 // literal identifier
1951 elseif ( is_string( $class ) )
1952 {
1953 $classID = eZContentClass::classIDByIdentifier( $class );
1954 if ( !$classID )
1955 {
1956 eZDebug::writeWarning( "class string parameter doesn't match any content class identifier", __METHOD__ );
1957 return $versionLimit;
1958 }
1959 }
1960 // eZContentClass object
1961 elseif ( is_object( $class ) )
1962 {
1963 if ( !$class instanceof eZContentClass )
1964 {
1965 eZDebug::writeWarning( "class object parameter is not an eZContentClass", __METHOD__ );
1966 return $versionLimit;
1967 }
1968 else
1969 {
1970 $classID = $class->attribute( 'id' );
1971 }
1972 }
1973
1974 $classLimitSetting = $contentINI->variable( 'VersionManagement', 'VersionHistoryClass' );
1975 $classArray = array_keys( $classLimitSetting );
1976 $limitsArray = array_values( $classLimitSetting );
1977
1978 $classArray = eZContentClass::classIDByIdentifier( $classArray );
1979
1980 foreach ( $classArray as $index => $id )
1981 {
1982 if ( $id == $classID )
1983 {
1984 $limit = $limitsArray[$index];
1985 // version limit can't be < 2
1986 if ( $limit < 2 )
1987 {
1988 $classIdentifier = eZContentClass::classIdentifierByID( $classID );
1989 eZDebug::writeWarning( "Version history limit for class {$classIdentifier} must be equal to or higher than 2", __METHOD__ );
1990 $limit = 2;
1991 }
1992 $versionLimit = $limit;
1993 }
1994 }
1995
1996 return $versionLimit;
1997 }
1998
2000 public $ID;
2001 // serialized array of translated class names
2002 public $SerializedNameList;
2003 // unserialized class names
2004 public $NameList;
2005 // unserialized class description
2006 public $DescriptionList;
2007 public $Identifier;
2008 public $ContentObjectName;
2009 public $Version;
2010 public $VersionCount;
2011 public $CreatorID;
2012 public $ModifierID;
2013 public $Created;
2014 public $Modified;
2015 public $InGroups;
2016 public $AllGroups;
2017 public $IsContainer;
2018 public $CanInstantiateLanguages;
2019 public $LanguageMask;
2020 public $DataMap;
2021
2025 private static $identifierHash = null;
2026 }
2027
2028 ?>
eZContentCacheManager\clearAllContentCache
static clearAllContentCache( $ignoreINISettings=false)
Definition: ezcontentcachemanager.php:1116
eZContentClassAttribute\expireCache
static expireCache( $contentClassAttributeID=false, $contentClassID=false)
Definition: ezcontentclassattribute.php:1099
eZContentClassAttribute\definition
static definition()
Definition: ezcontentclassattribute.php:62
eZContentClassAttribute\fetchFilteredList
static fetchFilteredList( $cond, $asObject=true)
Definition: ezcontentclassattribute.php:481
eZContentClassClassGroup\removeClassMembers
static removeClassMembers( $contentclass_id, $contentclass_version)
Definition: ezcontentclassclassgroup.php:112
eZContentClassClassGroup\fetchGroupList
static fetchGroupList( $contentclass_id, $contentclass_version, $asObject=true)
Definition: ezcontentclassclassgroup.php:201
eZContentClassClassGroup\classInGroup
static classInGroup( $contentclassID, $contentclassVersion, $groupID)
Definition: ezcontentclassclassgroup.php:212
eZContentClassGroup\fetchList
static fetchList( $user_id=false, $asObject=true)
Definition: ezcontentclassgroup.php:129
eZContentClassNameList
Definition: ezcontentclassnamelist.php:12
eZContentClassName\sqlFilter
static sqlFilter( $languageTable='ezcontentclass')
Definition: ezcontentclassname.php:75
eZContentClass
Handles eZ Publish content classes.
Definition: ezcontentclass.php:20
eZContentClass\topPriorityLanguageLocale
topPriorityLanguageLocale()
Definition: ezcontentclass.php:1700
eZContentClass\fetchAttributes
fetchAttributes( $id=false, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED)
Definition: ezcontentclass.php:1320
eZContentClass\canCreateLanguages
canCreateLanguages()
Definition: ezcontentclass.php:1692
eZContentClass\fetchList
static fetchList( $version=eZContentClass::VERSION_STATUS_DEFINED, $asObject=true, $user_id=false, $sorts=null, $fields=null, $classFilter=false, $limit=null)
Definition: ezcontentclass.php:1238
eZContentClass\fetchByRemoteID
static fetchByRemoteID( $remoteID, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
Definition: ezcontentclass.php:1170
eZContentClass\$Modified
$Modified
Definition: ezcontentclass.php:2014
eZContentClass\objectList
objectList()
Definition: ezcontentclass.php:1498
eZContentClass\name
name( $languageLocale=false)
Definition: ezcontentclass.php:1559
eZContentClass\removableInformation
removableInformation( $includeAll=true)
Definition: ezcontentclass.php:791
eZContentClass\fetchByIdentifier
static fetchByIdentifier( $identifier, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
Definition: ezcontentclass.php:1203
eZContentClass\modifier
modifier()
Definition: ezcontentclass.php:600
eZContentClass\classIdentifierByID
static classIdentifierByID( $id)
Definition: ezcontentclass.php:1819
eZContentClass\canInstantiateClasses
canInstantiateClasses()
Definition: ezcontentclass.php:349
eZContentClass\isRemovable
isRemovable()
Definition: ezcontentclass.php:773
eZContentClass\VERSION_STATUS_MODIFIED
const VERSION_STATUS_MODIFIED
Definition: ezcontentclass.php:24
eZContentClass\canInstantiateLanguages
canInstantiateLanguages()
Definition: ezcontentclass.php:1512
eZContentClass\descriptionList
descriptionList()
Definition: ezcontentclass.php:1596
eZContentClass\compareAttributes
compareAttributes( $attr1, $attr2)
Definition: ezcontentclass.php:888
eZContentClass\fetchIDListContainingDatatype
static fetchIDListContainingDatatype( $dataTypeString)
Definition: ezcontentclass.php:1888
eZContentClass\removeTemporary
static removeTemporary()
Definition: ezcontentclass.php:719
eZContentClass\$ContentObjectName
$ContentObjectName
Definition: ezcontentclass.php:2008
eZContentClass\$ID
$ID
Definition: ezcontentclass.php:2000
eZContentClass\urlAliasName
urlAliasName(eZContentObject $contentObject, $version=false, $translation=false)
Definition: ezcontentclass.php:1423
eZContentClass\adjustAttributePlacements
adjustAttributePlacements( $attributes)
Definition: ezcontentclass.php:893
eZContentClass\fetchAttributeByIdentifier
fetchAttributeByIdentifier( $identifier, $asObject=true)
Definition: ezcontentclass.php:1340
eZContentClass\clearAlwaysAvailableLanguageID
clearAlwaysAvailableLanguageID()
Definition: ezcontentclass.php:1663
eZContentClass\fetchAllGroups
fetchAllGroups()
Definition: ezcontentclass.php:699
eZContentClass\removeAttributes
removeAttributes( $removeAttributes=false, $version=false)
Definition: ezcontentclass.php:844
eZContentClass\fetch
static fetch( $id, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED, $user_id=false, $parent_id=null)
Definition: ezcontentclass.php:1116
eZContentClass\$Version
$Version
Definition: ezcontentclass.php:2009
eZContentClass\objectCount
objectCount()
Definition: ezcontentclass.php:1485
eZContentClass\CONTENT_OBJECT_NAME_MAX_LENGTH
const CONTENT_OBJECT_NAME_MAX_LENGTH
Definition: ezcontentclass.php:30
eZContentClass\fetchMatchGroupIDList
fetchMatchGroupIDList()
Definition: ezcontentclass.php:647
eZContentClass\classIdentifiersHash
static classIdentifiersHash()
Definition: ezcontentclass.php:1838
eZContentClass\$Created
$Created
Definition: ezcontentclass.php:2013
eZContentClass\instantiate
instantiate( $userID=false, $sectionID=0, $versionNumber=false, $languageCode=false, $versionStatus=eZContentObjectVersion::STATUS_INTERNAL_DRAFT)
Definition: ezcontentclass.php:276
eZContentClass\sync
sync( $fieldFilters=null)
Definition: ezcontentclass.php:946
eZContentClass\__construct
__construct( $row)
Definition: ezcontentclass.php:32
eZContentClass\$VersionCount
$VersionCount
Definition: ezcontentclass.php:2010
eZContentClass\alwaysAvailableLanguageLocale
alwaysAvailableLanguageLocale()
Definition: ezcontentclass.php:1720
eZContentClass\descriptionFromSerializedString
static descriptionFromSerializedString( $serializedNameList)
Definition: ezcontentclass.php:1542
eZContentClass\versionHistoryLimit
static versionHistoryLimit( $class)
Definition: ezcontentclass.php:1927
eZContentClass\remoteID
remoteID()
Definition: ezcontentclass.php:738
eZContentClass\$DataMap
$DataMap
Definition: ezcontentclass.php:2020
eZContentClass\fetchAllClasses
static fetchAllClasses( $asObject=true, $includeFilter=true, $groupList=false)
Definition: ezcontentclass.php:662
eZContentClass\$IsContainer
$IsContainer
Definition: ezcontentclass.php:2017
eZContentClass\setDescription
setDescription( $description, $languageLocale=false)
Definition: ezcontentclass.php:1591
eZContentClass\fetchGroupIDList
fetchGroupIDList()
Definition: ezcontentclass.php:627
eZContentClass\$NameList
$NameList
Definition: ezcontentclass.php:2004
eZContentClass\setAlwaysAvailableLanguageID
setAlwaysAvailableLanguageID( $languageID, $updateChilds=true)
Definition: ezcontentclass.php:1601
eZContentClass\creator
creator()
Definition: ezcontentclass.php:588
eZContentClass\inGroup
inGroup( $groupID)
Definition: ezcontentclass.php:708
eZContentClass\buildContentObjectName
buildContentObjectName( $contentObjectName, $dataMap, $tmpTags=false)
Definition: ezcontentclass.php:1445
eZContentClass\definition
static definition()
Definition: ezcontentclass.php:58
eZContentClass\nameList
nameList()
Definition: ezcontentclass.php:1575
eZContentClass\storeVersioned
storeVersioned( $attributes, $version)
Definition: ezcontentclass.php:1008
eZContentClass\VERSION_STATUS_DEFINED
const VERSION_STATUS_DEFINED
Definition: ezcontentclass.php:22
eZContentClass\$ModifierID
$ModifierID
Definition: ezcontentclass.php:2012
eZContentClass\dataMap
dataMap()
Definition: ezcontentclass.php:1307
eZContentClass\nameFromSerializedString
static nameFromSerializedString( $serializedNameList)
Definition: ezcontentclass.php:1529
eZContentClass\fetchSearchableAttributes
fetchSearchableAttributes( $id=false, $asObject=true, $version=eZContentClass::VERSION_STATUS_DEFINED)
Definition: ezcontentclass.php:1352
eZContentClass\storeDefined
storeDefined( $attributes)
Definition: ezcontentclass.php:993
eZContentClass\store
store( $store_childs=false, $fieldFilters=null)
Definition: ezcontentclass.php:905
eZContentClass\setCanInstantiateLanguages
setCanInstantiateLanguages( $languageCodes)
Definition: ezcontentclass.php:1507
eZContentClass\$InGroups
$InGroups
Definition: ezcontentclass.php:2015
eZContentClass\instantiateIn
instantiateIn( $lang, $userID=false, $sectionID=0, $versionNumber=false, $versionStatus=eZContentObjectVersion::STATUS_INTERNAL_DRAFT)
Definition: ezcontentclass.php:262
eZContentClass\exists
static exists( $id, $version=eZContentClass::VERSION_STATUS_DEFINED, $userID=false, $useIdentifier=false)
Definition: ezcontentclass.php:1092
eZContentClass\languages
languages()
Definition: ezcontentclass.php:1671
eZContentClass\$identifierHash
static $identifierHash
Definition: ezcontentclass.php:2025
eZContentClass\alwaysAvailableLanguage
alwaysAvailableLanguage()
Definition: ezcontentclass.php:1710
eZContentClass\hasNameInLanguage
hasNameInLanguage( $languageLocale)
Definition: ezcontentclass.php:1547
eZContentClass\$CreatorID
$CreatorID
Definition: ezcontentclass.php:2011
eZContentClass\$Identifier
$Identifier
Definition: ezcontentclass.php:2007
eZContentClass\$SerializedNameList
$SerializedNameList
Definition: ezcontentclass.php:2002
eZContentClass\versionStatus
versionStatus()
Definition: ezcontentclass.php:1365
eZContentClass\canInstantiateClassList
static canInstantiateClassList( $asObject=false, $includeFilter=true, $groupList=false, $fetchID=false)
Definition: ezcontentclass.php:379
eZContentClass\fetchGroupList
fetchGroupList()
Definition: ezcontentclass.php:614
eZContentClass\VERSION_STATUS_TEMPORARY
const VERSION_STATUS_TEMPORARY
Definition: ezcontentclass.php:23
eZContentClass\$CanInstantiateLanguages
$CanInstantiateLanguages
Definition: ezcontentclass.php:2018
eZContentClass\contentObjectName
contentObjectName(eZContentObject $contentObject, $version=false, $translation=false)
Definition: ezcontentclass.php:1397
eZContentClass\$LanguageMask
$LanguageMask
Definition: ezcontentclass.php:2019
eZContentClass\prioritizedLanguagesJsArray
prioritizedLanguagesJsArray()
Definition: ezcontentclass.php:1684
eZContentClass\initializeCopy
initializeCopy(&$originalClass)
Definition: ezcontentclass.php:958
eZContentClass\expireCache
static expireCache()
Definition: ezcontentclass.php:1912
eZContentClass\setName
setName( $name, $languageLocale=false)
Definition: ezcontentclass.php:1564
eZContentClass\create
static create( $userID=false, $optionalValues=array(), $languageLocale=false)
Definition: ezcontentclass.php:207
eZContentClass\__clone
__clone()
Definition: ezcontentclass.php:174
eZContentClass\removeTranslation
removeTranslation( $languageID)
Definition: ezcontentclass.php:1729
eZContentClass\classIDByIdentifier
static classIDByIdentifier( $identifier)
Definition: ezcontentclass.php:1790
eZContentClass\$InGroupIDs
$InGroupIDs
Definition: ezcontentclass.php:21
eZContentClass\$DescriptionList
$DescriptionList
Definition: ezcontentclass.php:2006
eZContentClass\$AllGroups
$AllGroups
Definition: ezcontentclass.php:2016
eZContentClass\description
description( $languageLocale=false)
Definition: ezcontentclass.php:1586
eZContentClass\versionCount
versionCount()
Definition: ezcontentclass.php:1383
eZContentClass\setVersion
setVersion( $version, $set_childs=false)
Definition: ezcontentclass.php:1068
eZContentClass\prioritizedLanguages
prioritizedLanguages()
Definition: ezcontentclass.php:1679
eZContentLanguage\fetchLocaleList
static fetchLocaleList()
Definition: ezcontentlanguage.php:231
eZContentLanguage\fetch
static fetch( $id)
Definition: ezcontentlanguage.php:251
eZContentLanguage\idByLocale
static idByLocale( $locale)
Definition: ezcontentlanguage.php:637
eZContentLanguage\prioritizedLanguageCodes
static prioritizedLanguageCodes()
Definition: ezcontentlanguage.php:361
eZContentObjectVersion\STATUS_INTERNAL_DRAFT
const STATUS_INTERNAL_DRAFT
Definition: ezcontentobjectversion.php:34
eZContentObjectVersion\create
static create( $contentobjectID, $userID=false, $version=1, $initialLanguageCode=false)
Definition: ezcontentobjectversion.php:937
eZContentObject
Definition: ezcontentobject.php:17
eZContentObject\STATUS_PUBLISHED
const STATUS_PUBLISHED
Definition: ezcontentobject.php:20
eZContentObject\defaultLanguage
static defaultLanguage()
Definition: ezcontentobject.php:5330
eZContentObject\create
static create( $name, $contentclassID, $userID, $sectionID=1, $version=1, $languageCode=false)
Definition: ezcontentobject.php:1669
eZContentObject\fetchSameClassList
static fetchSameClassList( $contentClassID, $asObject=true, $offset=false, $limit=false)
Definition: ezcontentobject.php:1247
eZDB\instance
static instance( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
Definition: ezdb.php:117
eZDebugSetting\writeDebug
static writeDebug( $conditionName, $string, $label="")
Definition: ezdebugsetting.php:127
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZDebug\writeWarning
static writeWarning( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:502
eZHTTPTool\instance
static instance()
Definition: ezhttptool.php:189
eZNamePatternResolver
Definition: eznamepatternresolver.php:39
eZPHPCreator
eZPHPCreator provides a simple interface for creating and executing PHP code.
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\removeObject
static removeObject( $def, $conditions=null, $extraConditions=null)
Definition: ezpersistentobject.php:271
eZPersistentObject\setAttribute
setAttribute( $attr, $val)
Definition: ezpersistentobject.php:1374
eZPersistentObject\handleRows
static handleRows( $rows, $class_name, $asObject)
Definition: ezpersistentobject.php:963
eZPersistentObject\hasDirtyData
hasDirtyData()
Definition: ezpersistentobject.php:1414
eZPersistentObject\count
static count( $def, $conds=null, $field=null)
Definition: ezpersistentobject.php:187
eZPersistentObject\attribute
attribute( $attr, $noFunction=false)
Definition: ezpersistentobject.php:1329
eZPersistentObject\$URLAliasName
$URLAliasName
Definition: ezpersistentobject.php:1480
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
eZPreferences\value
static value( $name, $user=false)
Definition: ezpreferences.php:106
eZPreferences\setValue
static setValue( $name, $value, $storeUserID=false)
Definition: ezpreferences.php:38
eZRemoteIdUtility\generate
static generate( $type='')
Definition: ezremoteidutility.php:21
eZSerializedObjectNameList
Definition: ezserializedobjectnamelist.php:12
eZSerializedObjectNameList\nameFromSerializedString
static nameFromSerializedString( $serializedNames, $languageLocale=false)
Definition: ezserializedobjectnamelist.php:267
eZSys\cacheDirectory
static cacheDirectory()
Definition: ezsys.php:527
eZUser
eZUser handles eZ Publish user accounts
Definition: ezuser.php:19
eZUser\fetch
static fetch( $id, $asObject=true)
Definition: ezuser.php:351
eZUser\currentUserID
static currentUserID()
Definition: ezuser.php:1731
eZUser\currentUser
static currentUser()
Definition: ezuser.php:1716
eZUser\isAnonymous
isAnonymous()
Definition: ezuser.php:1703
ezpI18n\tr
static tr( $context, $source, $comment=null, $arguments=null)
Definition: ezpi18n.php:86
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.