Index: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php |
— | — | @@ -17,17 +17,17 @@ |
18 | 18 | /** |
19 | 19 | * Constructor |
20 | 20 | */ |
21 | | - function SFCreateTemplate() { |
| 21 | + public function SFCreateTemplate() { |
22 | 22 | SpecialPage::SpecialPage( 'CreateTemplate' ); |
23 | 23 | wfLoadExtensionMessages( 'SemanticForms' ); |
24 | 24 | } |
25 | 25 | |
26 | | - function execute( $query ) { |
| 26 | + public function execute( $query ) { |
27 | 27 | $this->setHeaders(); |
28 | 28 | doSpecialCreateTemplate(); |
29 | 29 | } |
30 | 30 | |
31 | | - static function getAllPropertyNames() { |
| 31 | + public static function getAllPropertyNames() { |
32 | 32 | $all_properties = array(); |
33 | 33 | |
34 | 34 | // set limit on results - a temporary fix until SMW's |
— | — | @@ -35,10 +35,13 @@ |
36 | 36 | $options = new SMWRequestOptions(); |
37 | 37 | $options->limit = 10000; |
38 | 38 | $used_properties = smwfGetStore()->getPropertiesSpecial( $options ); |
| 39 | + |
39 | 40 | foreach ( $used_properties as $property ) { |
40 | 41 | $all_properties[] = $property[0]->getWikiValue(); |
41 | 42 | } |
| 43 | + |
42 | 44 | $unused_properties = smwfGetStore()->getUnusedPropertiesSpecial( $options ); |
| 45 | + |
43 | 46 | foreach ( $unused_properties as $property ) { |
44 | 47 | $all_properties[] = $property->getWikiValue(); |
45 | 48 | } |
— | — | @@ -48,20 +51,24 @@ |
49 | 52 | return $all_properties; |
50 | 53 | } |
51 | 54 | |
52 | | - function printPropertiesDropdown( $all_properties, $id, $selected_property ) { |
| 55 | + public static function printPropertiesDropdown( $all_properties, $id, $selected_property ) { |
53 | 56 | $dropdown_str = "<select name=\"semantic_property_$id\">\n"; |
54 | 57 | $dropdown_str .= "<option value=\"\"></option>\n"; |
| 58 | + |
55 | 59 | foreach ( $all_properties as $prop_name ) { |
56 | 60 | $selected = ( $selected_property == $prop_name ) ? "selected" : ""; |
57 | 61 | $dropdown_str .= "<option value=\"$prop_name\" $selected>$prop_name</option>\n"; |
58 | 62 | } |
| 63 | + |
59 | 64 | $dropdown_str .= "</select>\n"; |
| 65 | + |
60 | 66 | return $dropdown_str; |
61 | 67 | } |
62 | 68 | |
63 | | - function printFieldEntryBox( $id, $f, $all_properties ) { |
| 69 | + public static function printFieldEntryBox( $id, $f, $all_properties ) { |
64 | 70 | wfLoadExtensionMessages( 'SemanticForms' ); |
65 | 71 | $dropdown_html = SFCreateTemplate::printPropertiesDropdown( $all_properties, $id, $f->semantic_property ); |
| 72 | + |
66 | 73 | $text = ' <div class="fieldBox">' . "\n"; |
67 | 74 | $text .= ' <p>' . wfMsg( 'sf_createtemplate_fieldname' ) . ' <input size="15" name="name_' . $id . '" value="' . $f->field_name . '">' . "\n"; |
68 | 75 | $text .= ' ' . wfMsg( 'sf_createtemplate_displaylabel' ) . ' <input size="15" name="label_' . $id . '" value="' . $f->label . '">' . "\n"; |
— | — | @@ -72,6 +79,7 @@ |
73 | 80 | if ( $id != "new" ) { |
74 | 81 | $text .= '   <input name="del_' . $id . '" type="submit" value="' . wfMsg( 'sf_createtemplate_deletefield' ) . '">' . "\n"; |
75 | 82 | } |
| 83 | + |
76 | 84 | $text .= <<<END |
77 | 85 | </p> |
78 | 86 | </div> |
— | — | @@ -79,6 +87,7 @@ |
80 | 88 | END; |
81 | 89 | return $text; |
82 | 90 | } |
| 91 | + |
83 | 92 | } |
84 | 93 | |
85 | 94 | function doSpecialCreateTemplate() { |