Index: trunk/extensions/PageSchemas/PageSchemas.classes.php |
— | — | @@ -132,8 +132,7 @@ |
133 | 133 | $pageXml = simplexml_load_string ( $pageXmlstr ); |
134 | 134 | $this->pageName = (string)$pageXml->attributes()->name; |
135 | 135 | /* index for template objects */ |
136 | | - $i = 0 ; |
137 | | - $j = 1; |
| 136 | + $i = 0 ; |
138 | 137 | foreach ( $pageXml->children() as $tag => $child ) { |
139 | 138 | if ( $tag == 'Template' ) { |
140 | 139 | $templateObj = new PSTemplate($child); |
— | — | @@ -145,8 +144,8 @@ |
146 | 145 | } |
147 | 146 | } |
148 | 147 | /* function to generate all pages based on the Xml contained in the page */ |
149 | | - function generateAllPages () { |
150 | | - wfRunHooks( 'PageSchemasGeneratePages', array( $this )); |
| 148 | + function generateAllPages ( $toGenPageList ) { |
| 149 | + wfRunHooks( 'PageSchemasGeneratePages', array( $this, $toGenPageList )); |
151 | 150 | } |
152 | 151 | /*return an array of PSTemplate Objects */ |
153 | 152 | function getTemplates () { |
— | — | @@ -169,19 +168,34 @@ |
170 | 169 | public $PSFields = array(); |
171 | 170 | public $templateName =""; |
172 | 171 | public $templateXml = null; |
| 172 | + public $multiple_allowed = false; |
| 173 | + private $label_name = null; |
173 | 174 | function __construct( $template_xml ) { |
174 | | - $this->templateXml = $template_xml; |
| 175 | + $this->templateXml = $template_xml; |
175 | 176 | $this->templateName = (string) $template_xml->attributes()->name; |
| 177 | + if( ((string) $template_xml->attributes()->multiple) == "multiple" ) { |
| 178 | + $this->multiple_allowed = true; |
| 179 | + } |
176 | 180 | /*index for template objects */ |
177 | 181 | $i = 0 ; |
178 | | - foreach ($template_xml->children() as $child) { |
179 | | - $fieldObj = new PSTemplateField($child); |
180 | | - $this->PSFields[$i++]= $fieldObj; |
181 | | - } |
| 182 | + foreach ($template_xml->children() as $child) { |
| 183 | + if( $child->getName() == "Label" ) { //@TODO Label => sf:Label |
| 184 | + $this->label_name = (string)$child; |
| 185 | + }else{ |
| 186 | + $fieldObj = new PSTemplateField($child); |
| 187 | + $this->PSFields[$i++]= $fieldObj; |
| 188 | + } |
| 189 | + } |
182 | 190 | } |
183 | 191 | function getName(){ |
184 | 192 | return $this->templateName; |
185 | | - } |
| 193 | + } |
| 194 | + function isMultiple(){ |
| 195 | + return $this->multiple_allowed; |
| 196 | + } |
| 197 | + public function getLabel(){ |
| 198 | + return $this->label_name; |
| 199 | + } |
186 | 200 | function getFields(){ |
187 | 201 | return $this->PSFields; |
188 | 202 | } |
— | — | @@ -191,10 +205,14 @@ |
192 | 206 | |
193 | 207 | public $fieldName =""; |
194 | 208 | public $fieldXml= null; |
195 | | - public $fieldLabel = ""; |
| 209 | + public $fieldLabel = ""; |
| 210 | + private $list_values = false; |
196 | 211 | function __construct( $field_xml ) { |
197 | 212 | $this->fieldXml = $field_xml; |
198 | 213 | $this->fieldName = (string)$this->fieldXml->attributes()->name; |
| 214 | + if( ((string)$this->fieldXml->attributes()->list) == "list") { |
| 215 | + $this->list_values = true; |
| 216 | + } |
199 | 217 | foreach ($this->fieldXml->children() as $tag => $child ) { |
200 | 218 | if ( $tag == 'Label' ) { |
201 | 219 | $this->fieldLabel = (string)$child; |
— | — | @@ -207,6 +225,9 @@ |
208 | 226 | function getLabel(){ |
209 | 227 | return $this->fieldLabel; |
210 | 228 | } |
| 229 | + public function isList(){ |
| 230 | + return $this->list_values; |
| 231 | + } |
211 | 232 | function getObject( $objectName ) { |
212 | 233 | $object = array(); |
213 | 234 | wfRunHooks( 'PageSchemasGetObject', array( $objectName, $this->fieldXml, &$object ) ); |