Index: trunk/extensions/SemanticDrilldown/includes/SD_Filter.php |
— | — | @@ -19,21 +19,27 @@ |
20 | 20 | var $allowed_values; |
21 | 21 | var $possible_applied_filters = array(); |
22 | 22 | |
23 | | - static function loadAllFromPageSchema( $psSchemaObj ){ |
| 23 | + static function loadAllFromPageSchema( $psSchemaObj ){ |
24 | 24 | $filters_ps = array(); |
25 | 25 | $template_all = $psSchemaObj->getTemplates(); |
26 | 26 | foreach ( $template_all as $template ) { |
27 | 27 | $field_all = $template->getFields(); |
28 | 28 | foreach( $field_all as $fieldObj ) { //for each Field, retrieve smw properties and fill $prop_name , $prop_type |
29 | 29 | $f = new SDFilter(); |
30 | | - $object_values = $fieldObj->getObject('semanticdrilldown_Filter');//this returns an array with property values filled |
31 | | - $sd_array = $object_values['sd']; |
32 | | - $smw_array = $fieldObj->getObject('semanticmediawiki_Property'); //this returns an array with property values filled |
| 30 | + $object_values = $fieldObj->getObject('semanticdrilldown_Filter'); |
| 31 | + if ( !array_key_exists( 'sd', $object_values ) ) { |
| 32 | + continue; |
| 33 | + } |
| 34 | + $sd_array = $object_values['sd']; |
| 35 | + $smw_array = $fieldObj->getObject('semanticmediawiki_Property'); |
| 36 | + if ( !array_key_exists( 'smw', $smw_array ) ) { |
| 37 | + continue; |
| 38 | + } |
33 | 39 | $prop_array = $smw_array['smw']; |
34 | 40 | if ( array_key_exists( 'Name', $sd_array ) ) { |
35 | 41 | $f->name = $sd_array['Name']; |
36 | 42 | } else { |
37 | | - $f->name = $prop_array['name']; |
| 43 | + $f->name = $fieldObj->getName(); |
38 | 44 | } |
39 | 45 | $f->property = $prop_array['name']; |
40 | 46 | $f->escaped_property = str_replace( array( ' ', "'" ), array( '_', "\'" ), $f->property ); |
— | — | @@ -41,7 +47,9 @@ |
42 | 48 | if ( array_key_exists( 'Type', $prop_array ) && $prop_array['Type'] != 'Page' ) { |
43 | 49 | $f->is_relation = false; |
44 | 50 | } |
45 | | - $f->input_type = $sd_array['InputType']; |
| 51 | + if ( array_key_exists( 'InputType', $sd_array ) ) { |
| 52 | + $f->input_type = $sd_array['InputType']; |
| 53 | + } |
46 | 54 | if ( array_key_exists( 'ValuesFromCategory', $sd_array ) ) { |
47 | 55 | $f->category = $sd_array['ValuesFromCategory']; |
48 | 56 | $f->allowed_values = SDUtils::getCategoryChildren( $f->category, false, 5 ); |