Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

ezcontentobjectversion.php
Go to the documentation of this file.
1 <?php
18 class eZContentObjectVersion extends eZPersistentObject
19 {
20 public $ContentObjectAttributeArray;
21 public $DataMap;
22 public $TempNode;
23 public $VersionName;
24 public $VersionNameCache;
25 public $Permissions;
26 public $ContentObject;
27 public $Version;
28 public $CreatorID;
29 const STATUS_DRAFT = 0;
30 const STATUS_PUBLISHED = 1;
31 const STATUS_PENDING = 2;
32 const STATUS_ARCHIVED = 3;
33 const STATUS_REJECTED = 4;
34 const STATUS_INTERNAL_DRAFT = 5;
35 // used when a workflow event returns FETCH_TEMPLATE_REPEAT to allow editing again
36 const STATUS_REPEAT = 6;
37 const STATUS_QUEUED = 7;
38
39 public function __construct( $row = array() )
40 {
41 $this->ContentObjectAttributeArray = false;
42 $this->DataMap = false;
43 $this->TempNode = null;
44 $this->VersionName = null;
45 $this->VersionNameCache = array();
46 parent::__construct( $row );
47 }
48
49 static function definition()
50 {
51 static $definition = array( "fields" => array( 'id' => array( 'name' => 'ID',
52 'datatype' => 'integer',
53 'default' => 0,
54 'required' => true ),
55 'contentobject_id' => array( 'name' => 'ContentObjectID',
56 'datatype' => 'integer',
57 'default' => 0,
58 'required' => true,
59 'foreign_class' => 'eZContentObject',
60 'foreign_attribute' => 'id',
61 'multiplicity' => '1..*' ),
62 'creator_id' => array( 'name' => 'CreatorID',
63 'datatype' => 'integer',
64 'default' => 0,
65 'required' => true,
66 'foreign_class' => 'eZUser',
67 'foreign_attribute' => 'id',
68 'multiplicity' => '1..*' ),
69 'version' => array( 'name' => 'Version',
70 'datatype' => 'integer',
71 'default' => 0,
72 'required' => true ),
73 'status' => array( 'name' => 'Status',
74 'datatype' => 'integer',
75 'default' => 0,
76 'required' => true ),
77 'created' => array( 'name' => 'Created',
78 'datatype' => 'integer',
79 'default' => 0,
80 'required' => true ),
81 'modified' => array( 'name' => 'Modified',
82 'datatype' => 'integer',
83 'default' => 0,
84 'required' => true ),
85 'workflow_event_pos' => array( 'name' => 'WorkflowEventPos',
86 'datatype' => 'integer',
87 'default' => 0,
88 'required' => true ),
89 'user_id' => array( 'name' => 'UserID',
90 'datatype' => 'integer',
91 'default' => 0,
92 'required' => true,
93 'foreign_class' => 'eZUser',
94 'foreign_attribute' => 'contentobject_id',
95 'multiplicity' => '1..*' ),
96 'language_mask' => array( 'name' => 'LanguageMask',
97 'datatype' => 'integer',
98 'default' => 0,
99 'required' => true ),
100 'initial_language_id' => array( 'name' => 'InitialLanguageID',
101 'datatype' => 'integer',
102 'default' => 0,
103 'required' => true,
104 'foreign_class' => 'eZContentLanguage',
105 'foreign_attribute' => 'id',
106 'multiplicity' => '1..*' ) ),
107 'keys' => array( 'id' ),
108 'function_attributes' => array( // 'data' => 'fetchData',
109 'creator' => 'creator',
110 "name" => "name",
111 "version_name" => "versionName",
112 'main_parent_node_id' => 'mainParentNodeID',
113 "contentobject_attributes" => "contentObjectAttributes",
114 "related_contentobject_array" => "relatedContentObjectArray",
115 'reverse_related_object_list' => "reverseRelatedObjectList",
116 'parent_nodes' => 'parentNodes',
117 "can_read" => "canVersionRead",
118 'can_remove' => 'canVersionRemove',
119 "data_map" => "dataMap",
120 'node_assignments' => 'nodeAssignments',
121 'contentobject' => 'contentObject',
122 'initial_language' => 'initialLanguage',
123 'language_list' => 'translations',
124 'translation' => 'translation',
125 'translation_list' => 'defaultTranslationList',
126 'complete_translation_list' => 'translationList',
127 'temp_main_node' => 'tempMainNode' ),
128 'class_name' => "eZContentObjectVersion",
129 "increment_key" => "id",
130 'sort' => array( 'version' => 'asc' ),
131 'name' => 'ezcontentobject_version' );
132 return $definition;
133 }
134
135 static function statusList( $limit = false )
136 {
137 if ( $limit == 'remove' )
138 {
139 $versions = array( array( 'name' => 'Draft', 'id' => eZContentObjectVersion::STATUS_DRAFT ),
140 array( 'name' => 'Pending', 'id' => eZContentObjectVersion::STATUS_PENDING ),
141 array( 'name' => 'Archived', 'id' => eZContentObjectVersion::STATUS_ARCHIVED ),
142 array( 'name' => 'Rejected', 'id' => eZContentObjectVersion::STATUS_REJECTED ) );
143 }
144 else
145 {
146 $versions = array( array( 'name' => 'Draft', 'id' => eZContentObjectVersion::STATUS_DRAFT ),
147 array( 'name' => 'Published', 'id' => eZContentObjectVersion::STATUS_PUBLISHED ),
148 array( 'name' => 'Pending', 'id' => eZContentObjectVersion::STATUS_PENDING ),
149 array( 'name' => 'Archived', 'id' => eZContentObjectVersion::STATUS_ARCHIVED ),
150 array( 'name' => 'Rejected', 'id' => eZContentObjectVersion::STATUS_REJECTED ) );
151 }
152 return $versions;
153 }
158 static function fetch( $id, $asObject = true )
159 {
160 return eZPersistentObject::fetchObject( eZContentObjectVersion::definition(),
161 null,
162 array( 'id' => $id ),
163 $asObject );
164 }
165
166 static function fetchVersion( $version, $contentObjectID, $asObject = true )
167 {
168 $ret = eZPersistentObject::fetchObjectList( eZContentObjectVersion::definition(),
169 null, array( "version" => $version,
170 "contentobject_id" => $contentObjectID
171 ),
172 null, null,
173 $asObject );
174 return isset( $ret[0] ) ? $ret[0] : false;
175 }
176
177 static function fetchVersionForUpdate( $version, $contentObjectID, $asObject = true )
178 {
179 global $eZContentObjectVersionCache;
180
181 $db = eZDB::instance();
182 $version = (int) $version;
183 $contentObjectID = (int) $contentObjectID;
184
185 if ( $db->DatabaseName() === 'sqlite' )
186 {
187 // Select for update, to lock the row
188 $resArray = $db->arrayQuery(
189 "SELECT * FROM
190 ezcontentobject_version
191 WHERE
192 version='$version' AND
193 contentobject_id='$contentObjectID'" );
194 }
195 else
196 {
197 // Select for update, to lock the row
198 $resArray = $db->arrayQuery(
199 "SELECT * FROM
200 ezcontentobject_version
201 WHERE
202 version='$version' AND
203 contentobject_id='$contentObjectID'
204 FOR UPDATE" );
205 }
206
207 if ( !is_array( $resArray ) || count( $resArray ) !== 1 )
208 {
209 eZDebug::writeError( "Version '$version' for content '$contentObjectID' not found", __METHOD__ );
210 return null;
211 }
212
213 if ( !isset( $resArray[0] ) )
214 {
215 return false;
216 }
217 $versionArray = $resArray[0];
218
219 if ( !$asObject )
220 {
221 return $versionArray;
222 }
223
224 $versionObject = new eZContentObjectVersion( $versionArray );
225 $eZContentObjectVersionCache[$contentObjectID][$version] = $versionObject;
226
227 return $versionObject;
228 }
229
230 static function fetchUserDraft( $objectID, $userID )
231 {
232 $versions = eZPersistentObject::fetchObjectList( eZContentObjectVersion::definition(),
233 null, array( 'creator_id' => $userID,
234 'contentobject_id' => $objectID,
235 'status' => array( array( eZContentObjectVersion::STATUS_DRAFT, eZContentObjectVersion::STATUS_INTERNAL_DRAFT ) ) ),
236 array( 'version' => 'asc' ), null,
237 true );
238 if ( $versions === null or
239 count( $versions ) == 0 )
240 return null;
241 return $versions[0];
242 }
243
254 public static function fetchLatestUserDraft( $objectID, $userID, $languageID, $modified = 0 )
255 {
256 $versions = eZPersistentObject::fetchObjectList(
257 eZContentObjectVersion::definition(),
258 null,
259 array(
260 'creator_id' => $userID,
261 'contentobject_id' => $objectID,
262 'initial_language_id' => $languageID,
263 'modified' => array( '>', $modified ),
264 'status' => array(
265 array(
266 eZContentObjectVersion::STATUS_DRAFT,
267 eZContentObjectVersion::STATUS_INTERNAL_DRAFT
268 )
269 )
270 ),
271 array( 'modified' => 'desc' ),
272 array( 'offset' => 0, 'length' => 1 ),
273 true
274 );
275
276 if ( empty( $versions ) )
277 return null;
278 return $versions[0];
279 }
280
281 static function fetchForUser( $userID, $status = eZContentObjectVersion::STATUS_DRAFT )
282 {
283 return eZPersistentObject::fetchObjectList( eZContentObjectVersion::definition(),
284 null, array( 'creator_id' => $userID,
285 'status' => $status
286 ),
287 null, null,
288 true );
289 }
290
291 static function fetchFiltered( $filters, $offset, $limit )
292 {
293 $limits = null;
294 if ( $offset or $limit )
295 $limits = array( 'offset' => $offset,
296 'length' => $limit );
297 return eZPersistentObject::fetchObjectList( eZContentObjectVersion::definition(),
298 null, $filters,
299 null, $limits,
300 true );
301 }
302
307 function tempMainNode()
308 {
309 if ( $this->TempNode !== null )
310 return $this->TempNode;
311 $object = $this->contentObject();
312 if ( $object->attribute( 'status' ) == eZContentObject::STATUS_DRAFT )
313 {
314 $nodeAssignments = $this->nodeAssignments();
315 $mainNodeAssignment = null;
316 foreach( $nodeAssignments as $nodeAssignment )
317 {
318 if ( $nodeAssignment->attribute( 'is_main' ) )
319 {
320 $mainNodeAssignment = $nodeAssignment;
321 break;
322 }
323 }
324 if ( $mainNodeAssignment === null and
325 count( $nodeAssignments ) > 0 )
326 {
327 $mainNodeAssignment = $nodeAssignments[0];
328 }
329 if ( $mainNodeAssignment )
330 {
331 $this->TempNode = $mainNodeAssignment->tempNode();
332 }
333 }
334 else if ( $object->attribute( 'status' ) == eZContentObject::STATUS_PUBLISHED )
335 {
336 $mainNode = $object->mainNode();
337 if ( is_object( $mainNode ) )
338 {
339 $this->TempNode = eZContentObjectTreeNode::create( $mainNode->attribute( 'parent_node_id' ),
340 $mainNode->attribute( 'contentobject_id' ),
341 $this->attribute( 'version' ),
342 $mainNode->attribute( 'sort_field' ),
343 $mainNode->attribute( 'sort_order' ) );
344 $this->TempNode->setName( $mainNode->Name );
345 }
346 }
347 return $this->TempNode;
348 }
349
353 function name( $lang = false )
354 {
355 if ( $this->VersionName !== null )
356 return $this->VersionName;
357 $this->VersionName = $this->attribute( 'contentobject' )->versionLanguageName( $this->attribute( 'version' ),
358 $lang );
359 if ( $lang !== false )
360 {
361 $contentObject = $this->contentObject();
362 if ( $contentObject )
363 {
364 return $contentObject->name( false, $lang );
365 }
366 }
367 if ( $this->VersionName === false )
368 {
369 $contentObject = $this->contentObject();
370 if ( $contentObject )
371 {
372 $this->VersionName = $contentObject->name( false, $lang );
373 }
374 }
375 return $this->VersionName;
376 }
377
381 function versionName( $lang = false )
382 {
383 if ( !$lang )
384 {
385 $lang = $this->initialLanguageCode();
386 }
387
388 if ( isset( $this->VersionNameCache[$lang] ) )
389 return $this->VersionNameCache[$lang];
390
391 $object = $this->attribute( 'contentobject' );
392 if ( !$object )
393 {
394 $retValue = false;
395 return $retValue;
396 }
397
398 $class = $object->attribute( 'content_class' );
399 if ( !$class )
400 {
401 $retValue = false;
402 return $retValue;
403 }
404
405 $this->VersionNameCache[$lang] = $class->contentObjectName( $object,
406 $this->attribute( 'version' ),
407 $lang );
408 return $this->VersionNameCache[$lang];
409 }
410
414 function canVersionRead( )
415 {
416 if ( !isset( $this->Permissions["can_versionread"] ) )
417 {
418 $this->Permissions["can_versionread"] = $this->checkAccess( 'versionread' );
419 }
420 return ( $this->Permissions["can_versionread"] == 1 );
421 }
422
426 function canVersionRemove( )
427 {
428 if ( !isset( $this->Permissions['can_versionremove'] ) )
429 {
430 $this->Permissions['can_versionremove'] = $this->checkAccess( 'versionremove' );
431 }
432 return ( $this->Permissions['can_versionremove'] == 1 );
433 }
434
435 function checkAccess( $functionName, $originalClassID = false, $parentClassID = false, $returnAccessList = false, $language = false )
436 {
437 $classID = $originalClassID;
438 $user = eZUser::currentUser();
439 $userID = $user->attribute( 'contentobject_id' );
440 $accessResult = $user->hasAccessTo( 'content' , $functionName );
441 $accessWord = $accessResult['accessWord'];
442 $object = $this->attribute( 'contentobject' );
443 $objectClassID = $object->attribute( 'contentclass_id' );
444 if ( ! $classID )
445 {
446 $classID = $objectClassID;
447 }
448
449 // Fetch the ID of the language if we get a string with a language code
450 // e.g. 'eng-GB'
451 $originalLanguage = $language;
452 if ( is_string( $language ) && strlen( $language ) > 0 )
453 {
454 $language = eZContentLanguage::idByLocale( $language );
455 }
456 else
457 {
458 $language = false;
459 }
460
461 // This will be filled in with the available languages of the object
462 // if a Language check is performed.
463 $languageList = false;
464
465 // 'create' is not allowed on versions
466 if ( $functionName == 'create' )
467 {
468 return false;
469 }
470
471 if ( $functionName == 'edit' )
472 {
473 // Extra checking for status and ownership
474 if ( !in_array( $this->attribute( 'status' ),
475 array( eZContentObjectVersion::STATUS_DRAFT,
476 eZContentObjectVersion::STATUS_INTERNAL_DRAFT,
477 eZContentObjectVersion::STATUS_PENDING ) ) ||
478 $this->attribute( 'creator_id' ) != $userID )
479 {
480 return false;
481 }
482 return true;
483 }
484
485 if ( $functionName == 'versionremove' and $this->attribute( 'status' ) == eZContentObjectVersion::STATUS_PUBLISHED )
486 {
487 return 0;
488 }
489
490 if ( $accessWord == 'yes' )
491 {
492 return 1;
493 }
494 elseif ( $accessWord == 'no' )
495 {
496 if ( $functionName == 'edit' )
497 {
498 // Check if we have 'create' access under the main parent
499 if ( $object && $object->attribute( 'current_version' ) == 1 && !$object->attribute( 'status' ) )
500 {
501 $mainNode = eZNodeAssignment::fetchForObject( $object->attribute( 'id' ), $object->attribute( 'current_version' ) );
502 $parentObj = $mainNode[0]->attribute( 'parent_contentobject' );
503 if ( $parentObj instanceof eZContentObject )
504 {
505 $result = $parentObj->checkAccess( 'create', $object->attribute( 'contentclass_id' ),
506 $parentObj->attribute( 'contentclass_id' ), false, $originalLanguage );
507 return $result;
508 }
509 else
510 {
511 eZDebug::writeError( "Error retrieving parent object of main node for object id: " . $object->attribute( 'id' ), __METHOD__ );
512 }
513 }
514 }
515
516 return 0;
517 }
518 else
519 {
520 $limitationList = $accessResult['policies'];
521
522 if ( count( $limitationList ) > 0 )
523 {
524 $access = 'denied';
525 foreach ( $limitationList as $limitationArray )
526 {
527 if ( $access == 'allowed' )
528 {
529 break;
530 }
531
532 if ( isset( $limitationArray['Subtree' ] ) )
533 {
534 $checkedSubtree = false;
535 }
536 else
537 {
538 $checkedSubtree = true;
539 $accessSubtree = false;
540 }
541 if ( isset( $limitationArray['Node'] ) )
542 {
543 $checkedNode = false;
544 }
545 else
546 {
547 $checkedNode = true;
548 $accessNode = false;
549 }
550 foreach ( $limitationArray as $key => $limitation )
551 {
552 $access = 'denied';
553
554 if ( $key == 'Class' )
555 {
556 if ( $functionName == 'create' and !$originalClassID )
557 $access = 'allowed';
558 else if ( $functionName == 'create' and in_array( $classID, $limitation ) )
559 $access = 'allowed';
560 elseif ( in_array( $objectClassID, $limitation ) )
561 $access = 'allowed';
562 else
563 {
564 $access = 'denied';
565 break;
566 }
567 }
568 elseif ( $key == 'Status' )
569 {
570 if ( in_array( $this->attribute( 'status' ), $limitation ) )
571 $access = 'allowed';
572 else
573 {
574 $access = 'denied';
575 break;
576 }
577 }
578 elseif ( $key == 'Section' || $key == 'User_Section' )
579 {
580 if ( in_array( $object->attribute( 'section_id' ), $limitation ) )
581 $access = 'allowed';
582 else
583 {
584 $access = 'denied';
585 break;
586 }
587 }
588 elseif ( $key == 'Language' )
589 {
590 $languageMask = 0;
591 // If we don't have a language list yet we need to fetch it
592 // and optionally filter out based on $language.
593 if ( $functionName == 'create' )
594 {
595 // If the function is 'create' we do not use the language_mask for matching.
596 if ( $language !== false )
597 {
598 $languageMask = $language;
599 }
600 else
601 {
602 // If the create is used and no language specified then
603 // we need to match against all possible languages (which
604 // is all bits set, ie. -1).
605 $languageMask = -1;
606 }
607 }
608 else
609 {
610 if ( $language !== false )
611 {
612 if ( $languageList === false )
613 {
614 $languageMask = $this->attribute( 'initial_language_id' );
615 // We are restricting language check to just one language
616 // If the specified language is not the one in the version
617 // it will become 0.
618 $languageMask &= $language;
619 }
620 }
621 else
622 {
623 $languageMask = $this->attribute( 'initial_language_id' );
624 }
625 }
626 // Fetch limit mask for limitation list
627 $limitMask = eZContentLanguage::maskByLocale( $limitationArray[$key] );
628 if ( ( $languageMask & $limitMask ) != 0 )
629 {
630 $access = 'allowed';
631 }
632 else
633 {
634 $access = 'denied';
635 }
636 }
637 elseif ( $key == 'Owner' )
638 {
639 if ( $this->attribute( 'creator_id' ) == $userID )
640 $access = 'allowed';
641 else
642 {
643 $access = 'denied';
644 break;
645 }
646 }
647 elseif ( $key == 'Node' )
648 {
649 $accessNode = false;
650 $contentObjectID = $this->attribute( 'contentobject_id' );
651 foreach ( $limitation as $nodeID )
652 {
653 $node = eZContentObjectTreeNode::fetch( $nodeID, false, false );
654 $limitationObjectID = $node['id'];
655 if ( $contentObjectID == $limitationObjectID )
656 {
657 $access = 'allowed';
658 $accessNode = true;
659 break;
660 }
661 }
662 if ( $access == 'denied' && $checkedSubtree && !$accessSubtree )
663 {
664 break;
665 }
666 else
667 {
668 $access = 'allowed';
669 }
670 $checkedNode = true;
671 }
672 elseif ( $key == 'Subtree' )
673 {
674 $accessSubtree = false;
675 $contentObject = $this->attribute( 'contentobject' );
676 foreach ( $contentObject->attribute( 'assigned_nodes' ) as $assignedNode )
677 {
678 $path = $assignedNode->attribute( 'path_string' );
679 $subtreeArray = $limitation;
680 foreach ( $subtreeArray as $subtreeString )
681 {
682 if ( strstr( $path, $subtreeString ) )
683 {
684 $access = 'allowed';
685 $accessSubtree = true;
686 break;
687 }
688 }
689 if ( $access == 'allowed' )
690 {
691 break;
692 }
693 }
694 if ( $access != 'allowed' )
695 {
696 foreach( $this->attribute( 'node_assignments' ) as $nodeAssignment )
697 {
698 $parentNode = $nodeAssignment->attribute( 'parent_node_obj' );
699 if ( !$parentNode instanceof eZContentObjectTreeNode )
700 {
701 eZDebug::writeError( "Error retrieving parent of main node for object id: " . $this->attribute( 'contentobject_id' ), __METHOD__ );
702 return 0;
703 }
704 $path = $parentNode->attribute( 'path_string' );
705 $subtreeArray = $limitation;
706 foreach ( $subtreeArray as $subtreeString )
707 {
708 if ( strstr( $path, $subtreeString ) )
709 {
710 $access = 'allowed';
711 $accessSubtree = true;
712 break;
713 }
714 }
715 if ( $access == 'allowed' )
716 {
717 break;
718 }
719 }
720 }
721 if ( $access == 'denied' && $checkedNode && !$accessNode )
722 {
723 break;
724 }
725 else
726 {
727 $access = 'allowed';
728 }
729 $checkedSubtree = true;
730 }
731 elseif ( $key == 'User_Subtree' )
732 {
733 $contentObject = $this->attribute( 'contentobject' );
734 foreach ( $contentObject->attribute( 'assigned_nodes' ) as $assignedNode )
735 {
736 $path = $assignedNode->attribute( 'path_string' );
737 $subtreeArray = $limitation;
738 foreach ( $subtreeArray as $subtreeString )
739 {
740 if ( strstr( $path, $subtreeString ) )
741 {
742 $access = 'allowed';
743 $accessSubtree = true;
744 break;
745 }
746 }
747 if ( $access == 'allowed' )
748 {
749 break;
750 }
751 }
752 if ( $access != 'allowed' )
753 {
754 foreach( $this->attribute( 'node_assignments' ) as $nodeAssignment )
755 {
756 $parentNode = $nodeAssignment->attribute( 'parent_node_obj' );
757 if ( !$parentNode instanceof eZContentObjectTreeNode )
758 {
759 eZDebug::writeError( "Error retrieving parent of main node for object id: " . $this->attribute( 'contentobject_id' ), __METHOD__ );
760 return 0;
761 }
762 $path = $parentNode->attribute( 'path_string' );
763 $subtreeArray = $limitation;
764 foreach ( $subtreeArray as $subtreeString )
765 {
766 if ( strstr( $path, $subtreeString ) )
767 {
768 $access = 'allowed';
769 break;
770 }
771 }
772 if ( $access == 'allowed' )
773 {
774 break;
775 }
776 }
777 }
778 if ( $access == 'denied' )
779 {
780 break;
781 }
782 }
783 }
784 }
785
786 if ( $access == 'denied' )
787 {
788 return 0;
789 }
790 else
791 {
792 return 1;
793 }
794 }
795 }
796 }
797
798 function contentObject()
799 {
800 if( !isset( $this->ContentObject ) )
801 {
802 $this->ContentObject = eZContentObject::fetch( $this->attribute( 'contentobject_id' ) );
803 }
804 return $this->ContentObject;
805 }
806
807 function mainParentNodeID()
808 {
809 $temp = eZNodeAssignment::fetchForObject( $this->attribute( 'contentobject_id' ), $this->attribute( 'version' ), 1 );
810 if ( $temp == null )
811 {
812 return 1;
813 }
814 else
815 {
816 return $temp[0]->attribute( 'parent_node' );
817 }
818 }
819
820 function parentNodes( )
821 {
822 $retNodes = array();
823 $nodeAssignmentList = eZNodeAssignment::fetchForObject( $this->attribute( 'contentobject_id' ), $this->attribute( 'version' ) );
824 foreach ( array_keys( $nodeAssignmentList ) as $key )
825 {
826 $nodeAssignment = $nodeAssignmentList[$key];
827 $retNodes[] = $nodeAssignment;
828 }
829 return $retNodes;
830 }
831 function nodeAssignments()
832 {
833 return eZNodeAssignment::fetchForObject( $this->attribute( 'contentobject_id' ), $this->attribute( 'version' ) );
834 }
835
847 function assignToNode( $nodeID, $main = 0, $fromNodeID = 0, $sortField = null, $sortOrder = null, $remoteID = 0, $parentRemoteId = null )
848 {
849 if ( $fromNodeID == 0 && ( $this->attribute( 'status' ) == eZContentObjectVersion::STATUS_DRAFT ||
850 $this->attribute( 'status' ) == eZContentObjectVersion::STATUS_INTERNAL_DRAFT ) )
851 $fromNodeID = -1;
852 $nodeRow = array( 'contentobject_id' => $this->attribute( 'contentobject_id' ),
853 'contentobject_version' => $this->attribute( 'version' ),
854 'parent_node' => $nodeID,
855 'is_main' => $main,
856 'remote_id' => $remoteID,
857 'parent_remote_id' => $parentRemoteId,
858 'from_node_id' => $fromNodeID );
859 if ( $sortField !== null )
860 $nodeRow['sort_field'] = $sortField;
861 if ( $sortOrder !== null )
862 $nodeRow['sort_order'] = ( $sortOrder ? eZContentObjectTreeNode::SORT_ORDER_ASC : eZContentObjectTreeNode::SORT_ORDER_DESC );
863
864 $nodeAssignment = eZNodeAssignment::create( $nodeRow );
865 $nodeAssignment->store();
866 return $nodeAssignment;
867 }
868
873 function removeAssignment( $nodeID )
874 {
875 $nodeAssignmentList = $this->attribute( 'node_assignments' );
876 $db = eZDB::instance();
877 $db->begin();
878
879 foreach ( $nodeAssignmentList as $nodeAssignment )
880 {
881 if ( $nodeAssignment->attribute( 'parent_node' ) == $nodeID )
882 {
883 $nodeAssignment->remove();
884 }
885 }
886 $db->commit();
887 }
888
892 function dataMap()
893 {
894 if ( $this->ContentObjectAttributeArray === false )
895 {
896 $data = $this->contentObjectAttributes();
897 // Store the attributes for later use
898 $this->ContentObjectAttributeArray = $data;
899 }
900 else
901 {
902 $data = $this->ContentObjectAttributeArray;
903 }
904
905 if ( $this->DataMap == false )
906 {
907 $ret = array();
908 foreach( $data as $item )
909 {
910 $ret[$item->contentClassAttributeIdentifier()] = $item;
911 }
912 $this->DataMap = $ret;
913 }
914 else
915 {
916 $ret = $this->DataMap;
917 }
918 return $ret;
919 }
920
921 function resetDataMap()
922 {
923 $this->ContentObjectAttributeArray = false;
924 $this->DataMap = false;
925 return $this->DataMap;
926 }
927
931 function relatedContentObjectArray()
932 {
933 $object = $this->attribute( 'contentobject' );
934 return $object->relatedContentObjectArray( $this->Version );
935 }
936
937 static function create( $contentobjectID, $userID = false, $version = 1, $initialLanguageCode = false )
938 {
939 if ( $userID === false )
940 {
941 $user = eZUser::currentUser();
942 $userID = $user->attribute( 'contentobject_id' );
943 }
944 $time = time();
945
946 if ( $initialLanguageCode == false )
947 {
948 $initialLanguageCode = eZContentObject::defaultLanguage();
949 }
950
951 $initialLanguageID = eZContentLanguage::idByLocale( $initialLanguageCode );
952
953 $row = array(
954 "contentobject_id" => $contentobjectID,
955 'initial_language_id' => $initialLanguageID,
956 'language_mask' => $initialLanguageID,
957 "version" => $version,
958 "created" => $time,
959 "modified" => $time,
960 'creator_id' => $userID );
961 return new eZContentObjectVersion( $row );
962 }
963
964 function reverseRelatedObjectList()
965 {
966 return $this->attribute( 'contentobject' )->reverseRelatedObjectList( $this->Version );
967 }
968
973 function removeThis()
974 {
975 $contentobjectID = $this->attribute( 'contentobject_id' );
976 $versionNum = $this->attribute( 'version' );
977
978 $db = eZDB::instance();
979 $db->begin();
980
981 if ( $db->DatabaseName() === 'sqlite' )
982 {
983 // Ensure no one else deletes this version while we are doing it.
984 $db->query( 'SELECT * FROM ezcontentobject_version
985 WHERE id=' . $this->attribute( 'id' ) );
986 }
987 else
988 {
989 // Ensure no one else deletes this version while we are doing it.
990 $db->query( 'SELECT * FROM ezcontentobject_version
991 WHERE id=' . $this->attribute( 'id' ) . ' FOR UPDATE' );
992 }
993
994 $contentObjectTranslations = $this->translations();
995
996 foreach ( $contentObjectTranslations as $contentObjectTranslation )
997 {
999 foreach ( $contentObjectTranslation->objectAttributes() as $attribute )
1000 {
1001 $attribute->removeThis( $attribute->attribute( 'id' ), $versionNum );
1002 }
1003 }
1004 $db->query( "DELETE FROM ezcontentobject_link
1005 WHERE from_contentobject_id=$contentobjectID AND from_contentobject_version=$versionNum" );
1006 $db->query( "DELETE FROM eznode_assignment
1007 WHERE contentobject_id=$contentobjectID AND contentobject_version=$versionNum" );
1008
1009 $db->query( 'DELETE FROM ezcontentobject_version
1010 WHERE id=' . $this->attribute( 'id' ) );
1011
1012 $contentobject = $this->attribute( 'contentobject' );
1013 if ( is_object( $contentobject ) )
1014 {
1015 if ( !$contentobject->hasRemainingVersions() )
1016 {
1017 $contentobject->purge();
1018 }
1019 else
1020 {
1021 $version = $contentobject->CurrentVersion;
1022 if ( $contentobject->CurrentVersion == $versionNum ) //will assign another current_version in contentObject.
1023 {
1024 //search for version that will be current after removing of this one.
1025 $candidateToBeCurrent = $db->arrayQuery( "SELECT version
1026 FROM ezcontentobject_version
1027 WHERE contentobject_id={$contentobject->ID} AND
1028 version!={$contentobject->CurrentVersion}
1029 ORDER BY modified DESC",
1030 array( 'offset' => 0, 'limit' => 1 ) );
1031
1032 if ( isset($candidateToBeCurrent[0]['version']) && is_numeric($candidateToBeCurrent[0]['version']) )
1033 {
1034 $contentobject->CurrentVersion = $candidateToBeCurrent[0]['version'];
1035 $contentobject->store();
1036 }
1037 }
1038 }
1039 }
1040 $db->query( "DELETE FROM ezcontentobject_name
1041 WHERE contentobject_id=$contentobjectID AND content_version=$versionNum" );
1042
1043 $db->commit();
1044 }
1045
1050 function removeTranslation( $languageCode )
1051 {
1052
1053 $versionNum = $this->attribute( 'version' );
1054
1055 $contentObjectAttributes = $this->contentObjectAttributes( $languageCode );
1056
1057 $db = eZDB::instance();
1058 $db->begin();
1059 foreach ( $contentObjectAttributes as $attribute )
1060 {
1061 $attribute->removeThis( $attribute->attribute( 'id' ), $versionNum );
1062 }
1063 $db->commit();
1064
1065 $this->updateLanguageMask();
1066 }
1067
1079 static function removeVersions( $versionStatus = false, $limit = false, $expiryTime = false, $fetchPortionSize = 50 )
1080 {
1081 $statuses = array( eZContentObjectVersion::STATUS_DRAFT,
1082 eZContentObjectVersion::STATUS_PENDING,
1083 eZContentObjectVersion::STATUS_REJECTED,
1084 eZContentObjectVersion::STATUS_ARCHIVED,
1085 eZContentObjectVersion::STATUS_INTERNAL_DRAFT );
1086 if ( $versionStatus === false )
1087 {
1088 $versionStatus = $statuses;
1089 }
1090 else if ( !is_array( $versionStatus ) )
1091 {
1092 $versionStatus = array( $versionStatus );
1093 }
1094
1095 $versionStatus = array_unique( $versionStatus );
1096 $checkIntersect = array_intersect( $versionStatus, $statuses );
1097 if ( count( $checkIntersect ) != count( $versionStatus ) )
1098 {
1099 eZDebug::writeError( 'Invalid version status was passed in.', __METHOD__ );
1100 return false;
1101 }
1102
1103 if ( $limit !== false and ( !is_numeric( $limit ) or $limit < 0 ) )
1104 {
1105 eZDebug::writeError( '$limit must be either false or positive numeric value.', __METHOD__ );
1106 return false;
1107 }
1108
1109 if ( !is_numeric( $fetchPortionSize ) or $fetchPortionSize < 1 )
1110 $fetchPortionSize = 50;
1111
1112 $filters = array();
1113 $filters['status'] = array( $versionStatus );
1114 if ( $expiryTime !== false )
1115 $filters['modified'] = array( '<', $expiryTime );
1116
1117 $processedCount = 0;
1118 $db = eZDB::instance();
1119 while ( $processedCount < $limit or !$limit )
1120 {
1121 // fetch by versions by preset portion at a time to avoid memory overflow
1122 $tmpLimit = ( !$limit or ( $limit - $processedCount ) > $fetchPortionSize ) ?
1123 $fetchPortionSize : $limit - $processedCount;
1124 $versions = eZContentObjectVersion::fetchFiltered( $filters, 0, $tmpLimit );
1125 if ( count( $versions ) < 1 )
1126 break;
1127
1128 foreach ( $versions as $version )
1129 {
1130 $db->begin();
1131 $version->removeThis();
1132 $db->commit();
1133 }
1134 $processedCount += count( $versions );
1135 }
1136 return $processedCount;
1137 }
1138
1143 function cloneVersion( $newVersionNumber, $userID, $contentObjectID = false, $status = eZContentObjectVersion::STATUS_DRAFT )
1144 {
1145 $time = time();
1146 $clonedVersion = clone $this;
1147 $clonedVersion->setAttribute( 'id', null );
1148 if ( $contentObjectID !== false )
1149 $clonedVersion->setAttribute( 'contentobject_id', $contentObjectID );
1150 $clonedVersion->setAttribute( 'version', $newVersionNumber );
1151 $clonedVersion->setAttribute( 'created', $time );
1152 $clonedVersion->setAttribute( 'modified', $time );
1153 $clonedVersion->setAttribute( 'creator_id', $userID );
1154 if ( $status !== false )
1155 $clonedVersion->setAttribute( 'status', $status );
1156 return $clonedVersion;
1157 }
1158
1162 function translations( $asObject = true )
1163 {
1164 return $this->translationList( false, $asObject );
1165 }
1166
1171 function translation( $asObject = true )
1172 {
1173 return false;
1174 }
1175
1182 function translationList( $language = false, $asObject = true )
1183 {
1184 $db = eZDB::instance();
1185
1186 $languageSQL = '';
1187 if ( $language !== false )
1188 {
1189 $language = $db->escapeString( $language );
1190 $languageSQL = "AND language_code!='$language'";
1191 }
1192
1193 $query = "SELECT DISTINCT language_code
1194 FROM ezcontentobject_attribute
1195 WHERE contentobject_id='$this->ContentObjectID' AND version='$this->Version'
1196 $languageSQL
1197 ORDER BY language_code";
1198
1199 $languageCodes = $db->arrayQuery( $query );
1200
1201 $translations = array();
1202 if ( $asObject )
1203 {
1204 foreach ( $languageCodes as $languageCode )
1205 {
1206 $translations[] = new eZContentObjectTranslation( $this->ContentObjectID, $this->Version, $languageCode["language_code"] );
1207 }
1208 }
1209 else
1210 {
1211 foreach ( $languageCodes as $languageCode )
1212 {
1213 $translations[] = $languageCode["language_code"];
1214 }
1215 }
1216
1217 return $translations;
1218 }
1219
1226 function defaultTranslationList()
1227 {
1228 return $this->translationList();
1229 }
1230
1235 function contentObjectAttributes( $languageCode = false, $asObject = true )
1236 {
1237 if ( $languageCode == false )
1238 {
1239 if ( $this->Status == eZContentObjectVersion::STATUS_DRAFT || $this->Status == eZContentObjectVersion::STATUS_INTERNAL_DRAFT || $this->Status == eZContentObjectVersion::STATUS_PENDING )
1240 {
1241 $languageCode = $this->initialLanguageCode();
1242 }
1243 else if ( $this->CurrentLanguage )
1244 {
1245 $languageCode = $this->CurrentLanguage;
1246 }
1247 }
1248
1249 return eZContentObjectVersion::fetchAttributes( $this->Version, $this->ContentObjectID, $languageCode, $asObject );
1250 }
1251
1260 static function fetchAttributes( $version, $contentObjectID, $language = false, $asObject = true )
1261 {
1262 $db = eZDB::instance();
1263 $language = $db->escapeString( $language );
1264 $contentObjectID = (int) $contentObjectID;
1265 $version =(int) $version;
1266 $query = "SELECT ezcontentobject_attribute.*, ezcontentclass_attribute.identifier as classattribute_identifier,
1267 ezcontentclass_attribute.can_translate, ezcontentclass_attribute.serialized_name_list as attribute_serialized_name_list
1268 FROM ezcontentobject_attribute, ezcontentclass_attribute, ezcontentobject_version
1269 WHERE
1270 ezcontentclass_attribute.version = '0' AND
1271 ezcontentclass_attribute.id = ezcontentobject_attribute.contentclassattribute_id AND
1272 ezcontentobject_attribute.version = '$version' AND
1273 ezcontentobject_attribute.contentobject_id = '$contentObjectID' AND
1274 ezcontentobject_version.contentobject_id = '$contentObjectID' AND
1275 ezcontentobject_version.version = '$version' AND ".
1276 ( ( $language )? "ezcontentobject_attribute.language_code = '$language'": eZContentLanguage::sqlFilter( 'ezcontentobject_attribute', 'ezcontentobject_version' ) ).
1277 " ORDER by
1278 ezcontentclass_attribute.placement ASC";
1279
1280 $attributeArray = $db->arrayQuery( $query );
1281
1282 $returnAttributeArray = array();
1283 foreach ( $attributeArray as $attribute )
1284 {
1285 $attr = new eZContentObjectAttribute( $attribute );
1286
1287 $attr->setContentClassAttributeIdentifier( $attribute['classattribute_identifier'] );
1288
1289 $dataType = $attr->dataType();
1290
1291 if ( is_object( $dataType ) &&
1292 $dataType->Attributes["properties"]["translation_allowed"] &&
1293 $attribute['can_translate'] )
1294 $attr->setContentClassAttributeCanTranslate( 1 );
1295 else
1296 $attr->setContentClassAttributeCanTranslate( 0 );
1297
1298 $attr->setContentClassAttributeName( eZContentClassAttribute::nameFromSerializedString( $attribute['attribute_serialized_name_list'] ) );
1299
1300 $returnAttributeArray[] = $attr;
1301 }
1302 return $returnAttributeArray;
1303 }
1304
1311 static function mapLanguage( $language, $options )
1312 {
1313 if ( isset( $options['language_map'][$language] ) )
1314 {
1315 return $options['language_map'][$language];
1316 }
1317 return $language;
1318 }
1319
1340 static function unserialize( $domNode, $contentObject, $ownerID, $sectionID, $activeVersion, $firstVersion, &$nodeList, &$options, $package, $handlerType = 'ezcontentobject', $firstVersioninitialLanguage = false )
1341 {
1342 $oldVersion = $domNode->getAttributeNS( 'http://ez.no/ezobject', 'version' );
1343 $status = $domNode->getAttributeNS( 'http://ez.no/ezobject', 'status' );
1344 $languageNodeArray = $domNode->getElementsByTagName( 'object-translation' );
1345
1346 $initialLanguage = false;
1347 $importedLanguages = $options['language_array'];
1348 $currentLanguages = array();
1349 foreach( $languageNodeArray as $languageNode )
1350 {
1351 $language = eZContentObjectVersion::mapLanguage( $languageNode->getAttribute( 'language' ), $options );
1352 if ( in_array( $language, $importedLanguages ) )
1353 {
1354 $currentLanguages[] = $language;
1355 }
1356 }
1357 if ( $firstVersion )
1358 {
1359 $initialLanguage = $firstVersioninitialLanguage;
1360 }
1361 if ( !$initialLanguage )
1362 {
1363 foreach ( eZContentLanguage::prioritizedLanguages() as $language )
1364 {
1365 if ( in_array( $language->attribute( 'locale' ), $currentLanguages ) )
1366 {
1367 $initialLanguage = $language->attribute( 'locale' );
1368 break;
1369 }
1370 }
1371 }
1372 if ( !$initialLanguage )
1373 {
1374 $initialLanguage = $currentLanguages[0];
1375 }
1376
1377 if ( $firstVersion )
1378 {
1379 $contentObjectVersion = $contentObject->version( 1 );
1380 }
1381 else
1382 {
1383 // Create new version in specific language but with empty data.
1384 $contentObjectVersion = $contentObject->createNewVersionIn( $initialLanguage );
1385 }
1386
1387 $created = eZDateUtils::textToDate( $domNode->getAttributeNS( 'http://ez.no/ezobject', 'created' ) );
1388 $modified = eZDateUtils::textToDate( $domNode->getAttributeNS( 'http://ez.no/ezobject', 'modified' ) );
1389 $contentObjectVersion->setAttribute( 'created', $created );
1390 $contentObjectVersion->setAttribute( 'modified', $modified );
1391
1392 $contentObjectVersion->setAttribute( 'status', eZContentObjectVersion::STATUS_DRAFT );
1393 $contentObjectVersion->store();
1394
1395 $db = eZDB::instance();
1396 $db->begin();
1397 foreach( $languageNodeArray as $languageNode )
1398 {
1399 $language = eZContentObjectVersion::mapLanguage( $languageNode->getAttribute( 'language' ), $options );
1400 // Only import allowed languages.
1401 if ( !in_array( $language, $importedLanguages ) )
1402 {
1403 continue;
1404 }
1405
1406 $attributeArray = $contentObjectVersion->contentObjectAttributes( $language );
1407 if ( count( $attributeArray ) == 0)
1408 {
1409 $hasTranslation = eZContentLanguage::fetchByLocale( $language );
1410
1411 if ( !$hasTranslation )
1412 {
1413 // if there is no needed translation in system then add it
1414 $locale = eZLocale::instance( $language );
1415
1416 if ( $locale->isValid() )
1417 {
1418 eZContentLanguage::addLanguage( $locale->localeCode(), $locale->internationalLanguageName() );
1419 $hasTranslation = true;
1420 }
1421 else
1422 $hasTranslation = false;
1423 }
1424
1425 if ( $hasTranslation )
1426 {
1427 // Add translated attributes for the translation
1428 $originalContentAttributes = $contentObjectVersion->contentObjectAttributes( $initialLanguage );
1429 foreach ( $originalContentAttributes as $originalContentAttribute )
1430 {
1431 $contentAttribute = $originalContentAttribute->translateTo( $language );
1432 $contentAttribute->sync();
1433 $attributeArray[] = $contentAttribute;
1434 }
1435 }
1436
1437 // unserialize object name in current version-translation
1438 $objectName = $languageNode->getAttribute( 'object_name' );
1439 if ( $objectName )
1440 $contentObject->setName( $objectName, $contentObjectVersion->attribute( 'version' ), $language );
1441 }
1442
1443 $xpath = new DOMXPath( $domNode->ownerDocument );
1444 $xpath->registerNamespace( 'ezobject', 'http://ez.no/object/' );
1445 $xpath->registerNamespace( 'ezremote', 'http://ez.no/ezobject' );
1446
1447 foreach( $attributeArray as $attribute )
1448 {
1449 $attributeIdentifier = $attribute->attribute( 'contentclass_attribute_identifier' );
1450 $xpathQuery = "ezobject:attribute[@ezremote:identifier='$attributeIdentifier']";
1451 $attributeDomNodes = $xpath->query( $xpathQuery, $languageNode );
1452 $attributeDomNode = $attributeDomNodes->item( 0 );
1453 if ( !$attributeDomNode )
1454 {
1455 continue;
1456 }
1457 $attribute->unserialize( $package, $attributeDomNode );
1458 $attribute->store();
1459 }
1460 }
1461
1462 $objectRelationList = $domNode->getElementsByTagName( 'object-relation-list' )->item( 0 );
1463 if ( $objectRelationList )
1464 {
1465 $objectRelationArray = $objectRelationList->getElementsByTagName( 'related-object-remote-id' );
1466 foreach( $objectRelationArray as $objectRelation )
1467 {
1468 $relatedObjectRemoteID = $objectRelation->textContent;
1469 if ( $relatedObjectRemoteID )
1470 {
1471 $object = eZContentObject::fetchByRemoteID( $relatedObjectRemoteID );
1472 $relatedObjectID = ( $object !== null ) ? $object->attribute( 'id' ) : null;
1473
1474 if ( $relatedObjectID )
1475 {
1476 $contentObject->addContentObjectRelation( $relatedObjectID, $contentObjectVersion->attribute( 'version' ) );
1477 }
1478 else
1479 {
1480 if ( !isset( $options['suspended-relations'] ) )
1481 {
1482 $options['suspended-relations'] = array();
1483 }
1484
1485 $options['suspended-relations'][] = array( 'related-object-remote-id' => $relatedObjectRemoteID,
1486 'contentobject-id' => $contentObject->attribute( 'id' ),
1487 'contentobject-version' => $contentObjectVersion->attribute( 'version' ) );
1488 }
1489 }
1490 }
1491 }
1492
1493 $nodeAssignmentNodeList = $domNode->getElementsByTagName( 'node-assignment-list' )->item( 0 );
1494 $nodeAssignmentNodeArray = $nodeAssignmentNodeList->getElementsByTagName( 'node-assignment' );
1495 foreach( $nodeAssignmentNodeArray as $nodeAssignmentNode )
1496 {
1497 $result = eZContentObjectTreeNode::unserialize( $nodeAssignmentNode,
1498 $contentObject,
1499 $contentObjectVersion->attribute( 'version' ),
1500 ( $oldVersion == $activeVersion ? 1 : 0 ),
1501 $nodeList,
1502 $options,
1503 $handlerType );
1504 if ( $result === false )
1505 {
1506 $db->commit();
1507 $retValue = false;
1508 return $retValue;
1509 }
1510 }
1511
1512 $contentObjectVersion->store();
1513 $db->commit();
1514
1515 return $contentObjectVersion;
1516 }
1517
1518 function postUnserialize( $package )
1519 {
1520 foreach( $this->translations( false ) as $language )
1521 {
1522 foreach( $this->contentObjectAttributes( $language ) as $attribute )
1523 {
1524 $attribute->postUnserialize( $package );
1525 }
1526 }
1527 }
1528
1539 function serialize( $package, $options = false, $contentNodeIDArray = false, $topNodeIDArray = false )
1540 {
1541 $dom = new DOMDocument( '1.0', 'utf-8' );
1542
1543 $versionNode = $dom->createElementNS( 'http://ez.no/object/', 'ezobject:version' );
1544 $dom->appendChild( $versionNode );
1545
1546 $versionNode->setAttributeNS( 'http://ez.no/ezobject', 'ezremote:version', $this->Version );
1547 $versionNode->setAttributeNS( 'http://ez.no/ezobject', 'ezremote:status', $this->Status );
1548 $versionNode->setAttributeNS( 'http://ez.no/ezobject', 'ezremote:created', eZDateUtils::rfc1123Date( $this->attribute( 'created' ) ) );
1549 $versionNode->setAttributeNS( 'http://ez.no/ezobject', 'ezremote:modified', eZDateUtils::rfc1123Date( $this->attribute( 'modified' ) ) );
1550
1551 $translationList = $this->translationList( false, false );
1552 $contentObject = $this->attribute( 'contentobject' );
1553
1554 $db = eZDB::instance();
1555 $db->begin();
1556 $allowedLanguages = $options['language_array'];
1557 if ( $options['only_initial_language'] )
1558 {
1559 $initialLanguageCode = $this->initialLanguageCode();
1560 if ( !in_array( $initialLanguageCode, $allowedLanguages ) )
1561 {
1562 // We can only export initial language but is not in the allowed
1563 // language list so we return false, ie. no export of this version.
1564 return false;
1565 }
1566 // Make sure only the initial language is exported
1567 $allowedLanguages = array( $initialLanguageCode );
1568 }
1569 $exportedLanguages = array();
1570 foreach ( $translationList as $translationItem )
1571 {
1572 $language = $translationItem;
1573 if ( !in_array( $language, $allowedLanguages ) )
1574 {
1575 continue;
1576 }
1577
1578 $translationNode = $dom->createElementNS( 'http://ez.no/object/', 'ezobject:object-translation' );
1579 $translationNode->setAttribute( 'language', $language );
1580
1581 // serialize object name in current version-translation
1582 $objectName = $contentObject->name( $this->Version, $language );
1583 if ( $objectName )
1584 {
1585 $translationNode->setAttribute( 'object_name', $objectName );
1586 }
1587 else
1588 {
1589 eZDebug::writeWarning( sprintf( "Name for object %s of version %s in translation %s not found",
1590 $contentObject->attribute( 'id' ),
1591 $this->Version,
1592 $language ) );
1593 }
1594
1595 $attributes = $this->contentObjectAttributes( $language );
1596 foreach ( $attributes as $attribute )
1597 {
1598 $serializedAttributeNode = $attribute->serialize( $package );
1599 $importedSerializedAttributeNode = $dom->importNode( $serializedAttributeNode, true );
1600 $translationNode->appendChild( $importedSerializedAttributeNode );
1601 }
1602
1603 $versionNode->appendChild( $translationNode );
1604 $exportedLanguages[] = $language;
1605 }
1606
1607 $nodeAssignmentListNode = $dom->createElementNS( 'http://ez.no/object/', 'ezobject:node-assignment-list' );
1608 $versionNode->appendChild( $nodeAssignmentListNode );
1609
1610 $contentNodeArray = eZContentObjectTreeNode::fetchByContentObjectID( $this->ContentObjectID, true, $this->Version );
1611 foreach( $contentNodeArray as $contentNode )
1612 {
1613 $contentNodeDOMNode = $contentNode->serialize( $options, $contentNodeIDArray, $topNodeIDArray );
1614 if ( $contentNodeDOMNode !== false )
1615 {
1616 $importedContentDOMNode = $dom->importNode( $contentNodeDOMNode, true );
1617 $nodeAssignmentListNode->appendChild( $importedContentDOMNode );
1618 }
1619 }
1620 $initialLanguage = $this->attribute( 'initial_language' );
1621 $initialLanguageCode = $initialLanguage->attribute( 'locale' );
1622 if ( in_array( $initialLanguageCode, $exportedLanguages ) )
1623 {
1624 $versionNode->setAttribute( 'initial_language', $initialLanguageCode );
1625 }
1626
1627 if ( $options['related_objects'] === 'selected' )
1628 {
1629 $relatedObjectArray = $contentObject->relatedContentObjectList( $this->Version, $contentObject->ID, 0, false,
1630 array( 'AllRelations' => eZContentObject::RELATION_COMMON ) );
1631 if ( count( $relatedObjectArray ) )
1632 {
1633 $relationListNode = $dom->createElementNS( 'http://ez.no/object/', 'ezobject:object-relation-list' );
1634
1635 foreach( $relatedObjectArray as $relatedObject )
1636 {
1637 $relatedObjectRemoteID = $relatedObject->attribute( 'remote_id' );
1638
1639 $relationNode = $dom->createElement( 'related-object-remote-id' );
1640 $relationNode->appendChild( $dom->createTextNode( $relatedObjectRemoteID ) );
1641
1642 $relationListNode->appendChild( $relationNode );
1643 }
1644 $versionNode->appendChild( $relationListNode );
1645 }
1646 }
1647
1648 $db->commit();
1649 return $versionNode;
1650 }
1651
1655 function creator()
1656 {
1657 if ( isset( $this->CreatorID ) and $this->CreatorID )
1658 {
1659 return eZContentObject::fetch( $this->CreatorID );
1660 }
1661 return null;
1662 }
1663
1668 function unpublish()
1669 {
1670 if ( $this->attribute( 'status' ) == eZContentObjectVersion::STATUS_PUBLISHED )
1671 {
1672 $this->setAttribute( 'status', eZContentObjectVersion::STATUS_ARCHIVED );
1673 $parentNodeList = $this->attribute( 'parent_nodes' );
1674 $parentNodeIDList = array();
1675 foreach( $parentNodeList as $parentNode )
1676 {
1677 $parentNodeIDList[] = $parentNode->attribute( 'parent_node' );
1678 }
1679 if ( count( $parentNodeIDList ) == 0 )
1680 {
1681 eZDebug::writeWarning( $this, "unable to get parent nodes for version" );
1682 return;
1683 }
1684 $parentNodeIDString = implode( ',' , $parentNodeIDList );
1685 $contentObjectID = $this->attribute( 'contentobject_id' );
1686 $version = $this->attribute( 'version' );
1687 $db = eZDB::instance();
1688 $query = "update ezcontentobject_tree
1689 set contentobject_is_published = '0'
1690 where parent_node_id in ( $parentNodeIDString ) and
1691 contentobject_id = $contentObjectID and
1692 contentobject_version = $version" ;
1693 $db->query( $query );
1694 }
1695 else
1696 {
1697 eZDebug::writeWarning( $this, "trying to unpublish non published version" );
1698 }
1699
1700 }
1701
1706 function nonTranslationList()
1707 {
1708 $translationList = eZContentObject::translationList();
1709 if ( $translationList === null )
1710 {
1711 $retValue = null;
1712 return $retValue;
1713 }
1714
1715 $translations = $this->translations( false );
1716 $nonTranslationList = array();
1717 foreach ( $translationList as $translationItem )
1718 {
1719 $locale = $translationItem->attribute( 'locale_code' );
1720 if ( !in_array( $locale, $translations ) )
1721 $nonTranslationList[] = $translationItem;
1722 }
1723 return $nonTranslationList;
1724 }
1725
1726 function languageMask()
1727 {
1728 return (int)$this->attribute( 'language_mask' );
1729 }
1730
1731 function updateLanguageMask( $mask = false, $forceStore = true )
1732 {
1733 if ( $mask == false )
1734 {
1735 $mask = eZContentLanguage::maskByLocale( $this->translationList( false, false ), true );
1736 }
1737
1738 $this->setAttribute( 'language_mask', $mask );
1739
1740 if ( $forceStore )
1741 {
1742 $this->store();
1743 }
1744 }
1745
1746 function initialLanguage()
1747 {
1748 return eZContentLanguage::fetch( $this->InitialLanguageID );
1749 }
1750
1751 function initialLanguageCode()
1752 {
1753 $initialLanguage = $this->initialLanguage();
1754
1755 $initialLanguageCode = $initialLanguage !== false ? $initialLanguage->attribute( 'locale' ) : false;
1756
1757 return $initialLanguageCode;
1758 }
1759
1760 function nonTranslatableAttributesToUpdate( )
1761 {
1762 $object = $this->contentObject();
1763 $version = $this->attribute( 'version' );
1764 $objectID = $object->attribute( 'id' );
1765 $initialLanguageID = $object->attribute( 'initial_language_id' );
1766 $db = eZDB::instance();
1767
1768 $attributeRows = $db->arrayQuery( "SELECT ezcontentobject_attribute.id, ezcontentobject_attribute.version
1769 FROM ezcontentobject_version,
1770 ezcontentobject_attribute,
1771 ezcontentclass_attribute
1772 WHERE
1773 ezcontentobject_version.contentobject_id='$objectID'
1774 AND ( ezcontentobject_version.status in ( " .
1775 eZContentObjectVersion::STATUS_DRAFT . ", " . eZContentObjectVersion::STATUS_PENDING . ", " . eZContentObjectVersion::STATUS_INTERNAL_DRAFT .
1776 " ) OR ( ezcontentobject_version.status = '" . self::STATUS_PUBLISHED . "' AND ezcontentobject_version.version = '$version' ) )
1777 AND ezcontentobject_attribute.contentobject_id=ezcontentobject_version.contentobject_id
1778 AND ezcontentobject_attribute.version=ezcontentobject_version.version
1779 AND ezcontentobject_attribute.language_id!='$initialLanguageID'
1780 AND ezcontentobject_attribute.contentclassattribute_id=ezcontentclass_attribute.id
1781 AND ezcontentclass_attribute.can_translate=0" );
1782
1783 $attributes = array();
1784 foreach( $attributeRows as $row )
1785 {
1786 $attributes[] = eZContentObjectAttribute::fetch( $row['id'], $row['version'] );
1787 }
1788 return $attributes;
1789 }
1790
1791 function setAlwaysAvailableLanguageID( $languageID )
1792 {
1793 $db = eZDB::instance();
1794 $db->begin();
1795
1796 $objectID = $this->attribute( 'contentobject_id' );
1797 $version = $this->attribute( 'version' );
1798
1799 // reset 'always available' flag
1800 $sql = "UPDATE ezcontentobject_attribute SET language_id=";
1801 if ( $db->databaseName() == 'oracle' )
1802 {
1803 $sql .= "bitand( language_id, -2 )";
1804 }
1805 else
1806 {
1807 $sql .= "language_id & ~1";
1808 }
1809 $sql .= " WHERE contentobject_id = '$objectID' AND version = '$version'";
1810 $db->query( $sql );
1811
1812 if ( $languageID != false )
1813 {
1814 $newLanguageID = $languageID | 1;
1815
1816 $sql = "UPDATE ezcontentobject_attribute
1817 SET language_id='$newLanguageID'
1818 WHERE language_id='$languageID' AND contentobject_id = '$objectID' AND version = '$version'";
1819 $db->query( $sql );
1820 }
1821
1822 $db->commit();
1823 }
1824
1825 function clearAlwaysAvailableLanguageID()
1826 {
1827 $this->setAlwaysAvailableLanguageID( false );
1828 }
1829
1830 // Checks if there is another version (published or archived status) which has higher modification time than the
1831 // current version creation time.
1832 // Typically this function can be used before object's publishing to prevent conflicts.
1833 //
1834 // \return array of version objects that caused conflict or false.
1835 function hasConflicts( $editLanguage = false )
1836 {
1837 $object = $this->contentObject();
1838 if ( !$editLanguage )
1839 $editLanguage = $this->initialLanguageCode();
1840
1841 // Get versions (with published or archived status)
1842 $versions = $object->versions( true, array( 'conditions' => array( 'status' => array( array( eZContentObjectVersion::STATUS_PUBLISHED, eZContentObjectVersion::STATUS_ARCHIVED ) ),
1843 'language_code' => $editLanguage ) ) );
1844
1845 $conflictVersions = array();
1846 foreach ( array_keys( $versions ) as $key )
1847 {
1848 $version =& $versions[$key];
1849 if ( $version->attribute( 'modified' ) > $this->attribute( 'created' ) )
1850 {
1851 $conflictVersions[] = $version;
1852 }
1853 }
1854 if ( !count( $conflictVersions ) )
1855 {
1856 return false;
1857 }
1858
1859 return $conflictVersions;
1860 }
1861
1862 public function store( $fieldFilters = null )
1863 {
1864 eZContentObject::clearCache( $this->attribute( 'contentobject_id' ) );
1865 parent::store( $fieldFilters );
1866 }
1867
1868 public $CurrentLanguage = false;
1869 }
1870
1871 ?>
eZContentClassAttribute\nameFromSerializedString
static nameFromSerializedString( $serializedNameList, $languageLocale=false)
Definition: ezcontentclassattribute.php:699
eZContentLanguage\sqlFilter
static sqlFilter( $languageTable, $languageListTable=null, $languageAttributeName='language_id', $languageListAttributeName='language_mask', $lang=false)
Definition: ezcontentlanguage.php:692
eZContentLanguage\fetch
static fetch( $id)
Definition: ezcontentlanguage.php:251
eZContentLanguage\prioritizedLanguages
static prioritizedLanguages( $languageList=false)
Definition: ezcontentlanguage.php:294
eZContentLanguage\addLanguage
static addLanguage( $locale, $name=null)
Definition: ezcontentlanguage.php:52
eZContentLanguage\idByLocale
static idByLocale( $locale)
Definition: ezcontentlanguage.php:637
eZContentLanguage\maskByLocale
static maskByLocale( $locales, $setZerothBit=false)
Definition: ezcontentlanguage.php:546
eZContentLanguage\fetchByLocale
static fetchByLocale( $locale, $createIfNotExist=false)
Definition: ezcontentlanguage.php:264
eZContentObjectAttribute
Encapsulates the data for an object attribute.
Definition: ezcontentobjectattribute.php:20
eZContentObjectAttribute\fetch
static fetch( $id, $version, $asObject=true, $field_filters=null)
Definition: ezcontentobjectattribute.php:136
eZContentObjectTranslation
eZContentObjectTranslation handles translation a translation of content objects
Definition: ezcontentobjecttranslation.php:20
eZContentObjectTreeNode
Definition: ezcontentobjecttreenode.php:17
eZContentObjectTreeNode\SORT_ORDER_DESC
const SORT_ORDER_DESC
Definition: ezcontentobjecttreenode.php:32
eZContentObjectTreeNode\create
static create( $parentNodeID=null, $contentObjectID=null, $contentObjectVersion=0, $sortField=0, $sortOrder=true)
Definition: ezcontentobjecttreenode.php:182
eZContentObjectTreeNode\fetch
static fetch( $nodeID=false, $lang=false, $asObject=true, $conditions=false)
Definition: ezcontentobjecttreenode.php:3058
eZContentObjectTreeNode\fetchByContentObjectID
static fetchByContentObjectID( $contentObjectID, $asObject=true, $contentObjectVersion=false)
Definition: ezcontentobjecttreenode.php:2918
eZContentObjectTreeNode\unserialize
static unserialize( $contentNodeDOMNode, $contentObject, $version, $isMain, &$nodeList, &$options, $handlerType='ezcontentobject')
Definition: ezcontentobjecttreenode.php:5550
eZContentObjectTreeNode\SORT_ORDER_ASC
const SORT_ORDER_ASC
Definition: ezcontentobjecttreenode.php:33
eZContentObjectVersion
The class eZContentObjectVersion handles different versions of an content object.
Definition: ezcontentobjectversion.php:19
eZContentObjectVersion\initialLanguageCode
initialLanguageCode()
Definition: ezcontentobjectversion.php:1751
eZContentObjectVersion\translationList
translationList( $language=false, $asObject=true)
Definition: ezcontentobjectversion.php:1182
eZContentObjectVersion\contentObjectAttributes
contentObjectAttributes( $languageCode=false, $asObject=true)
Definition: ezcontentobjectversion.php:1235
eZContentObjectVersion\unpublish
unpublish()
Definition: ezcontentobjectversion.php:1668
eZContentObjectVersion\parentNodes
parentNodes()
Definition: ezcontentobjectversion.php:820
eZContentObjectVersion\canVersionRead
canVersionRead()
Definition: ezcontentobjectversion.php:414
eZContentObjectVersion\fetchAttributes
static fetchAttributes( $version, $contentObjectID, $language=false, $asObject=true)
Definition: ezcontentobjectversion.php:1260
eZContentObjectVersion\fetchUserDraft
static fetchUserDraft( $objectID, $userID)
Definition: ezcontentobjectversion.php:230
eZContentObjectVersion\removeTranslation
removeTranslation( $languageCode)
Definition: ezcontentobjectversion.php:1050
eZContentObjectVersion\postUnserialize
postUnserialize( $package)
Definition: ezcontentobjectversion.php:1518
eZContentObjectVersion\STATUS_PENDING
const STATUS_PENDING
Definition: ezcontentobjectversion.php:31
eZContentObjectVersion\assignToNode
assignToNode( $nodeID, $main=0, $fromNodeID=0, $sortField=null, $sortOrder=null, $remoteID=0, $parentRemoteId=null)
Definition: ezcontentobjectversion.php:847
eZContentObjectVersion\STATUS_DRAFT
const STATUS_DRAFT
Definition: ezcontentobjectversion.php:29
eZContentObjectVersion\$DataMap
$DataMap
Definition: ezcontentobjectversion.php:21
eZContentObjectVersion\$CurrentLanguage
$CurrentLanguage
Definition: ezcontentobjectversion.php:1868
eZContentObjectVersion\$ContentObject
$ContentObject
Definition: ezcontentobjectversion.php:26
eZContentObjectVersion\dataMap
dataMap()
Definition: ezcontentobjectversion.php:892
eZContentObjectVersion\reverseRelatedObjectList
reverseRelatedObjectList()
Definition: ezcontentobjectversion.php:964
eZContentObjectVersion\statusList
static statusList( $limit=false)
Definition: ezcontentobjectversion.php:135
eZContentObjectVersion\translation
translation( $asObject=true)
Definition: ezcontentobjectversion.php:1171
eZContentObjectVersion\relatedContentObjectArray
relatedContentObjectArray()
Definition: ezcontentobjectversion.php:931
eZContentObjectVersion\mainParentNodeID
mainParentNodeID()
Definition: ezcontentobjectversion.php:807
eZContentObjectVersion\removeVersions
static removeVersions( $versionStatus=false, $limit=false, $expiryTime=false, $fetchPortionSize=50)
Definition: ezcontentobjectversion.php:1079
eZContentObjectVersion\fetch
static fetch( $id, $asObject=true)
Definition: ezcontentobjectversion.php:158
eZContentObjectVersion\clearAlwaysAvailableLanguageID
clearAlwaysAvailableLanguageID()
Definition: ezcontentobjectversion.php:1825
eZContentObjectVersion\$CreatorID
$CreatorID
Definition: ezcontentobjectversion.php:28
eZContentObjectVersion\$VersionName
$VersionName
Definition: ezcontentobjectversion.php:23
eZContentObjectVersion\definition
static definition()
Definition: ezcontentobjectversion.php:49
eZContentObjectVersion\fetchVersionForUpdate
static fetchVersionForUpdate( $version, $contentObjectID, $asObject=true)
Definition: ezcontentobjectversion.php:177
eZContentObjectVersion\defaultTranslationList
defaultTranslationList()
Definition: ezcontentobjectversion.php:1226
eZContentObjectVersion\removeAssignment
removeAssignment( $nodeID)
Definition: ezcontentobjectversion.php:873
eZContentObjectVersion\contentObject
contentObject()
Definition: ezcontentobjectversion.php:798
eZContentObjectVersion\languageMask
languageMask()
Definition: ezcontentobjectversion.php:1726
eZContentObjectVersion\STATUS_PUBLISHED
const STATUS_PUBLISHED
Definition: ezcontentobjectversion.php:30
eZContentObjectVersion\nodeAssignments
nodeAssignments()
Definition: ezcontentobjectversion.php:831
eZContentObjectVersion\canVersionRemove
canVersionRemove()
Definition: ezcontentobjectversion.php:426
eZContentObjectVersion\STATUS_REPEAT
const STATUS_REPEAT
Definition: ezcontentobjectversion.php:36
eZContentObjectVersion\STATUS_ARCHIVED
const STATUS_ARCHIVED
Definition: ezcontentobjectversion.php:32
eZContentObjectVersion\tempMainNode
tempMainNode()
Definition: ezcontentobjectversion.php:307
eZContentObjectVersion\STATUS_QUEUED
const STATUS_QUEUED
Definition: ezcontentobjectversion.php:37
eZContentObjectVersion\fetchFiltered
static fetchFiltered( $filters, $offset, $limit)
Definition: ezcontentobjectversion.php:291
eZContentObjectVersion\cloneVersion
cloneVersion( $newVersionNumber, $userID, $contentObjectID=false, $status=eZContentObjectVersion::STATUS_DRAFT)
Definition: ezcontentobjectversion.php:1143
eZContentObjectVersion\STATUS_REJECTED
const STATUS_REJECTED
Definition: ezcontentobjectversion.php:33
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
eZContentObjectVersion\creator
creator()
Definition: ezcontentobjectversion.php:1655
eZContentObjectVersion\hasConflicts
hasConflicts( $editLanguage=false)
Definition: ezcontentobjectversion.php:1835
eZContentObjectVersion\fetchForUser
static fetchForUser( $userID, $status=eZContentObjectVersion::STATUS_DRAFT)
Definition: ezcontentobjectversion.php:281
eZContentObjectVersion\name
name( $lang=false)
Definition: ezcontentobjectversion.php:353
eZContentObjectVersion\setAlwaysAvailableLanguageID
setAlwaysAvailableLanguageID( $languageID)
Definition: ezcontentobjectversion.php:1791
eZContentObjectVersion\versionName
versionName( $lang=false)
Definition: ezcontentobjectversion.php:381
eZContentObjectVersion\store
store( $fieldFilters=null)
Definition: ezcontentobjectversion.php:1862
eZContentObjectVersion\$Version
$Version
Definition: ezcontentobjectversion.php:27
eZContentObjectVersion\fetchVersion
static fetchVersion( $version, $contentObjectID, $asObject=true)
Definition: ezcontentobjectversion.php:166
eZContentObjectVersion\$ContentObjectAttributeArray
$ContentObjectAttributeArray
Definition: ezcontentobjectversion.php:20
eZContentObjectVersion\nonTranslationList
nonTranslationList()
Definition: ezcontentobjectversion.php:1706
eZContentObjectVersion\updateLanguageMask
updateLanguageMask( $mask=false, $forceStore=true)
Definition: ezcontentobjectversion.php:1731
eZContentObjectVersion\$Permissions
$Permissions
Definition: ezcontentobjectversion.php:25
eZContentObjectVersion\nonTranslatableAttributesToUpdate
nonTranslatableAttributesToUpdate()
Definition: ezcontentobjectversion.php:1760
eZContentObjectVersion\fetchLatestUserDraft
static fetchLatestUserDraft( $objectID, $userID, $languageID, $modified=0)
Definition: ezcontentobjectversion.php:254
eZContentObjectVersion\resetDataMap
resetDataMap()
Definition: ezcontentobjectversion.php:921
eZContentObjectVersion\__construct
__construct( $row=array())
Definition: ezcontentobjectversion.php:39
eZContentObjectVersion\unserialize
static unserialize( $domNode, $contentObject, $ownerID, $sectionID, $activeVersion, $firstVersion, &$nodeList, &$options, $package, $handlerType='ezcontentobject', $firstVersioninitialLanguage=false)
Definition: ezcontentobjectversion.php:1340
eZContentObjectVersion\mapLanguage
static mapLanguage( $language, $options)
Definition: ezcontentobjectversion.php:1311
eZContentObjectVersion\initialLanguage
initialLanguage()
Definition: ezcontentobjectversion.php:1746
eZContentObjectVersion\translations
translations( $asObject=true)
Definition: ezcontentobjectversion.php:1162
eZContentObjectVersion\$TempNode
$TempNode
Definition: ezcontentobjectversion.php:22
eZContentObjectVersion\$VersionNameCache
$VersionNameCache
Definition: ezcontentobjectversion.php:24
eZContentObjectVersion\serialize
serialize( $package, $options=false, $contentNodeIDArray=false, $topNodeIDArray=false)
Definition: ezcontentobjectversion.php:1539
eZContentObjectVersion\checkAccess
checkAccess( $functionName, $originalClassID=false, $parentClassID=false, $returnAccessList=false, $language=false)
Definition: ezcontentobjectversion.php:435
eZContentObject
Definition: ezcontentobject.php:17
eZContentObject\STATUS_PUBLISHED
const STATUS_PUBLISHED
Definition: ezcontentobject.php:20
eZContentObject\clearCache
static clearCache( $idArray=array())
Definition: ezcontentobject.php:284
eZContentObject\defaultLanguage
static defaultLanguage()
Definition: ezcontentobject.php:5330
eZContentObject\fetch
static fetch( $id, $asObject=true)
Definition: ezcontentobject.php:885
eZContentObject\RELATION_COMMON
const RELATION_COMMON
Definition: ezcontentobject.php:37
eZContentObject\fetchByRemoteID
static fetchByRemoteID( $remoteID, $asObject=true)
Definition: ezcontentobject.php:865
eZContentObject\STATUS_DRAFT
const STATUS_DRAFT
Definition: ezcontentobject.php:19
eZContentObject\translationList
static translationList()
Definition: ezcontentobject.php:5404
eZDB\instance
static instance( $databaseImplementation=false, $databaseParameters=false, $forceNewInstance=false)
Definition: ezdb.php:117
eZDateUtils\textToDate
static textToDate( $dateText)
Definition: ezdateutils.php:88
eZDateUtils\rfc1123Date
static rfc1123Date( $timestamp=false)
Definition: ezdateutils.php:34
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZDebug\writeWarning
static writeWarning( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:502
eZLocale\instance
static instance( $localeString=false)
Definition: ezlocale.php:1536
eZNodeAssignment\fetchForObject
static fetchForObject( $contentObjectID, $version=1, $main=0, $asObject=true)
Definition: eznodeassignment.php:392
eZNodeAssignment\create
static create( $parameters=array())
Definition: eznodeassignment.php:193
eZPersistentObject
Definition: ezpersistentobject.php:33
eZPersistentObject\fetchObject
static fetchObject( $def, $field_filters, $conds, $asObject=true, $grouping=null, $custom_fields=null)
Definition: ezpersistentobject.php:213
eZPersistentObject\setAttribute
setAttribute( $attr, $val)
Definition: ezpersistentobject.php:1374
eZPersistentObject\count
static count( $def, $conds=null, $field=null)
Definition: ezpersistentobject.php:187
eZPersistentObject\attribute
attribute( $attr, $noFunction=false)
Definition: ezpersistentobject.php:1329
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
eZUser\currentUser
static currentUser()
Definition: ezuser.php:1716
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.