Index: trunk/extensions/PageSchemas/PageSchemas.classes.php |
— | — | @@ -111,7 +111,7 @@ |
112 | 112 | function __construct ( $category_name ) { |
113 | 113 | $this->categoryName = $category_name; |
114 | 114 | $title = Title::newFromText( $category_name, NS_CATEGORY ); |
115 | | - $pageId = $title->getArticleID(); |
| 115 | + $this->pageId = $title->getArticleID(); |
116 | 116 | $dbr = wfGetDB( DB_SLAVE ); |
117 | 117 | //get the result set, query : slect page_props |
118 | 118 | $res = $dbr->select( 'page_props', |
— | — | @@ -121,17 +121,14 @@ |
122 | 122 | 'pp_value' |
123 | 123 | ), |
124 | 124 | array( |
125 | | - 'pp_page' => $pageId, |
| 125 | + 'pp_page' => $this->pageId, |
126 | 126 | 'pp_propname' => 'PageSchema' |
127 | 127 | ) |
128 | 128 | ); |
129 | | - |
130 | 129 | //first row of the result set |
131 | 130 | $row = $dbr->fetchRow( $res ); |
132 | | - |
133 | 131 | //retrievimg the third attribute which is pp_value |
134 | 132 | $pageXmlstr = $row[2]; |
135 | | - |
136 | 133 | $pageXml = simplexml_load_string ( $pageXmlstr ); |
137 | 134 | $this->pageName = (string)$pageXml->attributes()->name; |
138 | 135 | /* index for template objects */ |
— | — | @@ -145,46 +142,15 @@ |
146 | 143 | $this->formName = (string)$child; |
147 | 144 | } |
148 | 145 | } |
149 | | - |
150 | 146 | } |
151 | | - |
152 | 147 | /* function to generate all pages based on the Xml contained in the page */ |
153 | | - function generateAllPages () { |
154 | | - //Get templates |
155 | | - $template_all = $this->getTemplates(); |
156 | | - /*obj. to create form Page */ |
157 | | - $form_templates = array(); |
158 | | - $genFormObj = array(); |
159 | | - foreach ( $template_all as $template ) { |
160 | | - $template_array = array(); |
161 | | - $template_array['name'] = $template->getName(); |
162 | | - $template_array['category_name'] = $this->categoryName; |
163 | | - $field_all = $template->getFields(); |
164 | | - $genPageObject = array(); |
165 | | - $field_count = 0; //counts the number of fields |
166 | | - foreach( $field_all as $field ) { //for each Field, retrieve smw properties and fill $prop_name , $prop_type |
167 | | - $field_count++; |
168 | | - $prop_array = $field->getObject('Property'); //this returns an array with property values filled |
169 | | - $genPageObject['Property'] = $prop_array; |
170 | | - $template_array['Field'.$field_count] = $field; |
171 | | - $form_input_array = $field->getObject('FormInput'); //this returns an array with property values filled |
172 | | - $genPageObject['FormInput'] = $form_input_array; |
173 | | - wfRunHooks( 'PageSchemasGeneratePages', array( $genPageObject )); |
174 | | - } |
175 | | - $genPageObject['Template'] = $template_array ; |
176 | | - wfRunHooks( 'PageSchemasGeneratePages', array( $genPageObject )); |
177 | | - $form_templates[] = $template_array; |
178 | | - } |
179 | | - $genFormObj['Form'] = $form_templates; |
180 | | - $genFormObj['FormName'] = $this->getFormName(); |
181 | | - wfRunHooks( 'PageSchemasGeneratePages', array( $genFormObj )); |
| 148 | + function generateAllPages () { |
| 149 | + wfRunHooks( 'PageSchemasGeneratePages', array( $this )); |
182 | 150 | } |
183 | | - |
184 | 151 | /*return an array of PSTemplate Objects */ |
185 | 152 | function getTemplates () { |
186 | 153 | return $this->PSTemplates; |
187 | | - } |
188 | | - |
| 154 | + } |
189 | 155 | /*returns the name of the PageSchema object */ |
190 | 156 | function getName(){ |
191 | 157 | return $this->pageName; |
— | — | @@ -192,6 +158,10 @@ |
193 | 159 | function getFormName(){ |
194 | 160 | return $this->formName; |
195 | 161 | } |
| 162 | + function getCategoryName(){ |
| 163 | + return $this->categoryName; |
| 164 | + } |
| 165 | + |
196 | 166 | } |
197 | 167 | class PSTemplate { |
198 | 168 | /* Stores the field objects */ |