private function genereInputField($field, $container, FormDefinition $definition, $type) { $html = '<tr><td nowrap="nowrap">' . (string) $field['legend'] . ' :</td>'; $html .= '<td width="100%">'; $containerName = (string) $field['container']; $fieldName = (string) $field['name']; $attribute = array(); $attribute['type'] = $type; if ($definition->fieldHaveError($containerName, $fieldName)) { $attribute['class'] = 'error'; } $attribute['name'] = $definition->name . '[' . $containerName . '][' . $fieldName . ']'; $attribute['value'] = $container->{$fieldName}; $size = (string) $field['size']; if ($size != '') { $attribute['size'] = $size; } $html .= '<input' . $this->genereAttribute($attribute) . '/>'; if ((string) $field['mandatory'] == 'true') { $html .= ' *'; } if ($definition->fieldHaveError($containerName, $fieldName)) { $base = dirname($_SERVER["SCRIPT_NAME"]); if ($base == '/') { $base = ''; } $html .= ' <img src="' . $base . '/images/warning.png" title="' . implode(". ", $definition->listFieldError($containerName, $fieldName)) . '"/>'; } $html .= '</td></tr>'; return $html; }
public function __construct() { $this->registrationForm = FormDefinition::get(); }