Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

private/api/content/content.php
Go to the documentation of this file.
1 <?php
56 class ezpContent
57 {
64 public static function create( $contentType )
65 {
66 }
67
73 public static function fromNode( eZContentObjectTreeNode $node, $checkAccess = true )
74 {
75 $object = $node->object();
76 if ( $checkAccess && !$object->attribute( 'can_read' ) )
77 {
78 throw new ezpContentAccessDeniedException( $object->attribute( 'id' ) );
79 }
80
81 $content = new ezpContent();
82 $content->fields = ezpContentFieldSet::fromContentObject( $object );
83 $content->object = $object;
84 $content->locations = ezpContentLocation::fromNode( $node );
85
86 return $content;
87 }
88
94 public static function fromNodeId( $nodeId, $checkAccess = true )
95 {
96 $node = eZContentObjectTreeNode::fetch( $nodeId );
97 if ( $node instanceof eZContentObjectTreeNode )
98 return self::fromNode( $node, $checkAccess );
99 else
100 throw new ezpContentNotFoundException( "Unable to find node with ID $nodeId" );
101 }
102
108 public static function fromObjectId( $objectId, $checkAccess = true )
109 {
110 $object = eZContentObject::fetch( $objectId );
111 if ( $object instanceof eZContentObject )
112 return self::fromObject( $object, $checkAccess );
113 else
114 throw new ezpContentNotFoundException( "Unable to find an eZContentObject with ID $objectId" );
115 }
116
122 public static function fromObject( eZContentObject $object, $checkAccess = true )
123 {
124 if ( $checkAccess && !$object->attribute( 'can_read' ) )
125 {
126 throw new ezpContentAccessDeniedException( $object->attribute( 'id' ) );
127 }
128
129 $content = new ezpContent();
130 $content->fields = ezpContentFieldSet::fromContentObject( $object );
131
132 $content->object = $object;
133
134 return $content;
135 }
136
142 public function setActiveLanguage( $language )
143 {
144 $this->fields->setActiveLanguage( $language );
145 $this->activeLanguage = $language;
146 }
147
148 public function __get( $property )
149 {
150 switch( $property )
151 {
152 case 'classIdentifier':
153 return $this->object->attribute( 'class_identifier' );
154 break;
155 case 'owner':
156 return $this->object->attribute( 'owner' );
157 break;
158 case 'name':
159 if ( $this->activeLanguage !== null )
160 return $this->object->name( false, $this->activeLanguage );
161 else
162 return $this->object->name();
163 break;
164 case 'datePublished':
165 return $this->object->attribute( 'published' );
166 break;
167 case 'dateModified':
168 return $this->object->attribute( 'modified' );
169 break;
170 default:
171 if( $this->object->hasAttribute( $property ) )
172 return $this->object->attribute( $property );
173 else
174 throw new ezcBasePropertyNotFoundException( $property );
175 }
176 }
177
182 public $fields;
183
188 public $locations;
189
194 protected $object;
195
200 public $activeLanguage;
201 }
202 ?>
ezpContentAccessDeniedException
Definition: access_denied.php:13
ezpContentFieldSet\fromContentObject
static fromContentObject(eZContentObject $contentObject)
Definition: field_set.php:34
ezpContentLocation\fromNode
static fromNode(eZContentObjectTreeNode $node)
Definition: content/location.php:48
ezpContentNotFoundException
Definition: content_not_found.php:13
ezpContent
Definition: private/api/content/content.php:57
ezpContent\create
static create( $contentType)
Definition: private/api/content/content.php:64
ezpContent\$fields
$fields
Definition: private/api/content/content.php:182
ezpContent\fromNode
static fromNode(eZContentObjectTreeNode $node, $checkAccess=true)
Definition: private/api/content/content.php:73
ezpContent\$activeLanguage
$activeLanguage
Definition: private/api/content/content.php:200
ezpContent\setActiveLanguage
setActiveLanguage( $language)
Definition: private/api/content/content.php:142
ezpContent\$object
$object
Definition: private/api/content/content.php:194
ezpContent\fromObject
static fromObject(eZContentObject $object, $checkAccess=true)
Definition: private/api/content/content.php:122
ezpContent\$locations
$locations
Definition: private/api/content/content.php:188
ezpContent\fromObjectId
static fromObjectId( $objectId, $checkAccess=true)
Definition: private/api/content/content.php:108
ezpContent\fromNodeId
static fromNodeId( $nodeId, $checkAccess=true)
Definition: private/api/content/content.php:94
ezpContent\__get
__get( $property)
Definition: private/api/content/content.php:148
$content
$content
Definition: ezimagecatalogue/admin/filedownload.php:53
$language
$language
Definition: messageform.php:32
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.