Index: trunk/extensions/PageSchemas/PageSchemas.classes.php |
— | — | @@ -151,11 +151,27 @@ |
152 | 152 | $template_all = $this->getTemplates(); |
153 | 153 | //For each template, Get Fields |
154 | 154 | foreach ( $template_all as $template ) { |
| 155 | + $template_array = array(); |
| 156 | + $template_array['name'] = $template->getName(); |
| 157 | + $template_array['category_name'] = $this->categoryName; |
155 | 158 | $field_all = $template->getFields(); |
156 | | - foreach( $field_all as $field ) { //for each Field, retrieve smw properties and fill $prop_name , $prop_type |
157 | | - $prop_array = $field->getObject('Property'); //this returns an array with property values filled |
158 | | - wfRunHooks( 'PageSchemasGeneratePages', array( $prop_array['name'], $prop_array['Type'], $prop_array['allowed_value_array'] ) ); |
| 159 | + $genPageObject = array(); |
| 160 | + $field_count = 0; //counts the number of fields |
| 161 | + foreach( $field_all as $field ) { //for each Field, retrieve smw properties and fill $prop_name , $prop_type |
| 162 | + $field_count++; |
| 163 | + $field_array = array(); |
| 164 | + $field_array['name'] = $field->getName(); |
| 165 | + $field_array['label'] = $field->getLabel(); |
| 166 | + $prop_array = $field->getObject('Property'); //this returns an array with property values filled |
| 167 | + $genPageObject['Property'] = $prop_array; |
| 168 | + $field_array['Property'] = $prop_array; |
| 169 | + $template_array['Field'.$field_count] = $field_array; |
| 170 | + $form_input_array = $field->getObject('FormInput'); //this returns an array with property values filled |
| 171 | + $genPageObject['FormInput'] = $form_input_array; |
| 172 | + wfRunHooks( 'PageSchemasGeneratePages', array( $genPageObject )); |
159 | 173 | } |
| 174 | + $genPageObject['Template'] = $template_array ; |
| 175 | + wfRunHooks( 'PageSchemasGeneratePages', array( $genPageObject )); |
160 | 176 | } |
161 | 177 | } |
162 | 178 | |
— | — | @@ -175,11 +191,11 @@ |
176 | 192 | public $templateName =""; |
177 | 193 | public $templateXml = null; |
178 | 194 | function __construct( $template_xml ) { |
179 | | - $templateXml = $template_xml; |
180 | | - $templateName = $templateXml->attributes()->name; |
| 195 | + $this->templateXml = $template_xml; |
| 196 | + $this->templateName = (string) $template_xml->attributes()->name; |
181 | 197 | /*index for template objects */ |
182 | 198 | $i = 0 ; |
183 | | - foreach ($templateXml->children() as $child) { |
| 199 | + foreach ($template_xml->children() as $child) { |
184 | 200 | $fieldObj = new PSTemplateField($child); |
185 | 201 | $this->PSFields[$i++]= $fieldObj; |
186 | 202 | } |
— | — | @@ -196,14 +212,22 @@ |
197 | 213 | |
198 | 214 | public $fieldName =""; |
199 | 215 | public $fieldXml= null; |
200 | | - |
| 216 | + public $fieldLabel = ""; |
201 | 217 | function __construct( $field_xml ) { |
202 | 218 | $this->fieldXml = $field_xml; |
203 | | - $this->fieldName = $this->fieldXml->attributes()->name; |
| 219 | + $this->fieldName = (string)$this->fieldXml->attributes()->name; |
| 220 | + foreach ($this->fieldXml->children() as $tag => $child ) { |
| 221 | + if ( $tag == 'Label' ) { |
| 222 | + $this->fieldLabel = (string)$child; |
| 223 | + } |
| 224 | + } |
204 | 225 | } |
205 | 226 | function getName(){ |
206 | 227 | return $this->fieldName; |
207 | 228 | } |
| 229 | + function getLabel(){ |
| 230 | + return $this->fieldLabel; |
| 231 | + } |
208 | 232 | function getObject( $objectName ) { |
209 | 233 | $object = array(); |
210 | 234 | wfRunHooks( 'PageSchemasGetObject', array( $objectName, $this->fieldXml, &$object ) ); |