function XMLSchema::typeToForm in Salesforce Suite 5.2
Same name in this branch
- 5.2 includes/nusoap.php \XMLSchema::typeToForm()
- 5.2 includes/nusoap.orig.php \XMLSchema::typeToForm()
Same name and namespace in other branches
- 5 includes/nusoap.php \XMLSchema::typeToForm()
- 5 includes/nusoap.orig.php \XMLSchema::typeToForm()
returns HTML form elements that allow a user to enter values for creating an instance of the given type.
@access public
Parameters
string $name, name for type instance:
string $type, name of type:
Return value
string
File
- includes/
nusoap.php, line 1757
Class
- XMLSchema
- parses an XML Schema, allows access to it's data, other utility methods no validation... yet. very experimental and limited. As is discussed on XML-DEV, I'm one of the people that just doesn't have time to read the spec(s) thoroughly,…
Code
function typeToForm($name, $type) {
// get typedef
if ($typeDef = $this
->getTypeDef($type)) {
// if struct
if ($typeDef['phpType'] == 'struct') {
$buffer .= '<table>';
foreach ($typeDef['elements'] as $child => $childDef) {
$buffer .= "\n\t\t\t\t\t<tr><td align='right'>{$childDef['name']} (type: " . $this
->getLocalPart($childDef['type']) . "):</td>\n\t\t\t\t\t<td><input type='text' name='parameters[" . $name . "][{$childDef['name']}]'></td></tr>";
}
$buffer .= '</table>';
// if array
}
elseif ($typeDef['phpType'] == 'array') {
$buffer .= '<table>';
for ($i = 0; $i < 3; $i++) {
$buffer .= "\n\t\t\t\t\t<tr><td align='right'>array item (type: {$typeDef['arrayType']}):</td>\n\t\t\t\t\t<td><input type='text' name='parameters[" . $name . "][]'></td></tr>";
}
$buffer .= '</table>';
// if scalar
}
else {
$buffer .= "<input type='text' name='parameters[{$name}]'>";
}
}
else {
$buffer .= "<input type='text' name='parameters[{$name}]'>";
}
return $buffer;
}