r69624 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69623‎ | r69624 | r69625 >
Date:15:22, 20 July 2010
Author:jeroendedauw
Status:deferred
Tags:
Comment:
Fixed php notice
Modified paths:
  • /trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/specials/SF_CreateTemplate.php
@@ -17,17 +17,17 @@
1818 /**
1919 * Constructor
2020 */
21 - function SFCreateTemplate() {
 21+ public function SFCreateTemplate() {
2222 SpecialPage::SpecialPage( 'CreateTemplate' );
2323 wfLoadExtensionMessages( 'SemanticForms' );
2424 }
2525
26 - function execute( $query ) {
 26+ public function execute( $query ) {
2727 $this->setHeaders();
2828 doSpecialCreateTemplate();
2929 }
3030
31 - static function getAllPropertyNames() {
 31+ public static function getAllPropertyNames() {
3232 $all_properties = array();
3333
3434 // set limit on results - a temporary fix until SMW's
@@ -35,10 +35,13 @@
3636 $options = new SMWRequestOptions();
3737 $options->limit = 10000;
3838 $used_properties = smwfGetStore()->getPropertiesSpecial( $options );
 39+
3940 foreach ( $used_properties as $property ) {
4041 $all_properties[] = $property[0]->getWikiValue();
4142 }
 43+
4244 $unused_properties = smwfGetStore()->getUnusedPropertiesSpecial( $options );
 45+
4346 foreach ( $unused_properties as $property ) {
4447 $all_properties[] = $property->getWikiValue();
4548 }
@@ -48,20 +51,24 @@
4952 return $all_properties;
5053 }
5154
52 - function printPropertiesDropdown( $all_properties, $id, $selected_property ) {
 55+ public static function printPropertiesDropdown( $all_properties, $id, $selected_property ) {
5356 $dropdown_str = "<select name=\"semantic_property_$id\">\n";
5457 $dropdown_str .= "<option value=\"\"></option>\n";
 58+
5559 foreach ( $all_properties as $prop_name ) {
5660 $selected = ( $selected_property == $prop_name ) ? "selected" : "";
5761 $dropdown_str .= "<option value=\"$prop_name\" $selected>$prop_name</option>\n";
5862 }
 63+
5964 $dropdown_str .= "</select>\n";
 65+
6066 return $dropdown_str;
6167 }
6268
63 - function printFieldEntryBox( $id, $f, $all_properties ) {
 69+ public static function printFieldEntryBox( $id, $f, $all_properties ) {
6470 wfLoadExtensionMessages( 'SemanticForms' );
6571 $dropdown_html = SFCreateTemplate::printPropertiesDropdown( $all_properties, $id, $f->semantic_property );
 72+
6673 $text = ' <div class="fieldBox">' . "\n";
6774 $text .= ' <p>' . wfMsg( 'sf_createtemplate_fieldname' ) . ' <input size="15" name="name_' . $id . '" value="' . $f->field_name . '">' . "\n";
6875 $text .= ' ' . wfMsg( 'sf_createtemplate_displaylabel' ) . ' <input size="15" name="label_' . $id . '" value="' . $f->label . '">' . "\n";
@@ -72,6 +79,7 @@
7380 if ( $id != "new" ) {
7481 $text .= ' &#160;&#160;<input name="del_' . $id . '" type="submit" value="' . wfMsg( 'sf_createtemplate_deletefield' ) . '">' . "\n";
7582 }
 83+
7684 $text .= <<<END
7785 </p>
7886 </div>
@@ -79,6 +87,7 @@
8088 END;
8189 return $text;
8290 }
 91+
8392 }
8493
8594 function doSpecialCreateTemplate() {

Status & tagging log