Exponential 6.0.13 Exponential Enterprise Open Source CMS - PHP Class Reference

eztemplatesectioniterator.php
Go to the documentation of this file.
1 <?php
27 class eZTemplateSectionIterator
28 {
29 public $InternalAttributes;
33 public function __construct()
34 {
35 $this->InternalAttributes = array( 'item' => false,
36 'key' => false,
37 'index' => false,
38 'number' => false,
39 'sequence' => false,
40 'last' => false );
41 }
42
46 function templateValue()
47 {
48 $value = $this->InternalAttributes['item'];
49 return $value;
50 }
51
55 function attributes()
56 {
57 $attributes = array();
58 $item = $this->InternalAttributes['item'];
59 if ( is_array( $item ) )
60 {
61 $attributes = array_keys( $item );
62 }
63 else if ( is_object( $item ) and
64 method_exists( $item, 'attributes' ) )
65 {
66 $attributes = $item->attributes();
67 }
68 $attributes = array_merge( $this->InternalAttributes, $attributes );
69 $attributes = array_unique( $attributes );
70 return $attributes;
71 }
72
77 function hasAttribute( $name )
78 {
79 switch ( $name )
80 {
81 case "item":
82 case "key":
83 case "index":
84 case "number":
85 case "sequence":
86 case "last":
87 return true;
88 }
89 $item = $this->InternalAttributes['item'];
90 if ( is_array( $item ) )
91 {
92 return array_key_exists( $name, $item );
93 }
94 if ( is_object( $item ) && method_exists( $item, 'hasAttribute' ) )
95 {
96 return $item->hasAttribute( $name );
97 }
98 return false;
99 }
100
105 function attribute( $name )
106 {
107 switch ( $name )
108 {
109 case "item":
110 case "key":
111 case "index":
112 case "number":
113 case "sequence":
114 case "last":
115 return $this->InternalAttributes[$name];
116 }
117 $item = $this->InternalAttributes['item'];
118 if ( is_array( $item ) )
119 {
120 return $item[$name];
121 }
122 if ( is_object( $item ) && method_exists( $item, 'attribute' ) )
123 {
124 return $item->attribute( $name );
125 }
126 eZDebug::writeError( "Attribute '$name' does not exist", __METHOD__ );
127 return null;
128 }
129
133 function setIteratorValues( $item, $key, $index, $number, $sequence, &$last )
134 {
135 $this->InternalAttributes['item'] = $item;
136 $this->InternalAttributes['key'] = $key;
137 $this->InternalAttributes['index'] = $index;
138 $this->InternalAttributes['number'] = $number;
139 $this->InternalAttributes['sequence'] = $sequence;
140 $this->InternalAttributes['last'] = $last;
141 }
142
146 function setSequence( $sequence )
147 {
148 $this->InternalAttributes['sequence'] = $sequence;
149 }
150 }
151
152 ?>
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:545
eZTemplateSectionIterator
The iterator item in a section loop which works as a proxy.
Definition: eztemplatesectioniterator.php:28
eZTemplateSectionIterator\hasAttribute
hasAttribute( $name)
Definition: eztemplatesectioniterator.php:77
eZTemplateSectionIterator\$InternalAttributes
$InternalAttributes
Definition: eztemplatesectioniterator.php:29
eZTemplateSectionIterator\templateValue
templateValue()
Definition: eztemplatesectioniterator.php:46
eZTemplateSectionIterator\setSequence
setSequence( $sequence)
Definition: eztemplatesectioniterator.php:146
eZTemplateSectionIterator\setIteratorValues
setIteratorValues( $item, $key, $index, $number, $sequence, &$last)
Definition: eztemplatesectioniterator.php:133
eZTemplateSectionIterator\__construct
__construct()
Definition: eztemplatesectioniterator.php:33
eZTemplateSectionIterator\attribute
attribute( $name)
Definition: eztemplatesectioniterator.php:105
eZTemplateSectionIterator\attributes
attributes()
Definition: eztemplatesectioniterator.php:55
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.