r93636 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r93635‎ | r93636 | r93637 >
Date:18:18, 1 August 2011
Author:ankitgarg833
Status:deferred
Tags:
Comment:
ading getFilledHtmlTextForPS
Modified paths:
  • /trunk/extensions/SemanticForms/includes/SF_Utils.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SemanticForms/includes/SF_Utils.php
@@ -214,6 +214,38 @@
215215 $text_extensions['sf'] = $xml_text_array;
216216 return true;
217217 }
 218+ public static function getFilledHtmlTextForPS( $pageSchemaObj, &$text_extensions ){
 219+ $template_fields = array();
 220+ $html_text = "";
 221+ $template_all = $pageSchemaObj->getTemplates();
 222+ foreach ( $template_all as $template ) {
 223+ $field_all = $template->getFields();
 224+ $field_count = 0; //counts the number of fields
 225+ $html_text_array = array();
 226+ foreach( $field_all as $field ) { //for each Field, retrieve smw properties and fill $prop_name , $prop_type
 227+ $field_count++;
 228+ $sf_array = $field->getObject('FormInput');//this returns an array with property values filled
 229+ $form_input_array = $sf_array['sf'];
 230+ $html_text = '<p><legend>semanticForms:FormInput</legend> </p>
 231+ <p> Input-Type: <input size="15" name="sf_input_type_starter" value='.$form_input_array['InputType'].'></p>
 232+ <p>Parameter name and its value as a key=value pair,seperated by comma (if a value contains a comma, replace it with "\,"): For eg. Size=20,mandatory=true</p>';
 233+ $param_value_str= "";
 234+ foreach($form_input_array as $param => $value){
 235+ if($param != 'InputType'){
 236+ if( $value != null ){
 237+ $param_value_str .= $param.'='.$value.', ';
 238+ }else{
 239+ $param_value_str .= $param.'=true, ';
 240+ }
 241+ }
 242+ }
 243+ $html_text .= '<p><input name="sf_key_values_starter" size="80" value="'.$param_value_str.'" ></p>';
 244+ $html_text_array[] = $html_text;
 245+ }
 246+ }
 247+ $text_extensions['sf'] = $html_text_array;
 248+ return true;
 249+ }
218250 public static function getHtmlTextForPS( &$js_extensions ,&$text_extensions ) {
219251 $html_text = "";
220252 $html_text .= '<p><legend>semanticForms:FormInput</legend> </p>