예제 #1
0
 public function renderEdit()
 {
     $value = $this->_input->getValue();
     $html =& new xmlElement('input');
     $html->setAttribute('type', 'checkbox');
     $html->setAttribute('name', $this->_input->getInputName());
     if (!FormInput::hasUserInput()) {
         if (is_null($value)) {
             $value = $this->_input->getDefaultValue();
         }
     }
     if (!is_null($this->_input->getConfiguration())) {
         if (!FormInput::hasUserInput()) {
             $configSelected = $this->_input->getConfiguration()->getConfig(FormInputEnumeration::CONFIG_TYPE_SELECTED);
             if (!is_null($configSelected) && $configSelected->isSelected()) {
                 $html->setAttribute('checked', 'checked');
             }
         } else {
             if (!is_null($value)) {
                 $html->setAttribute('checked', 'checked');
             }
         }
     }
     $html->setAttribute('value', htmlspecialchars($value));
     return (string) $html;
 }
예제 #2
0
 public function renderEdit()
 {
     $value = $this->_input->getValue();
     $html =& new xmlElement('input');
     $html->setAttribute('type', 'text');
     $html->setAttribute('name', $this->_input->getInputName());
     if (!FormInput::hasUserInput()) {
         if (is_null($value)) {
             $value = $this->_input->getDefaultValue();
         }
     }
     if (!is_null($this->_input->getConfiguration())) {
         if (!FormInput::hasUserInput()) {
             $configSelected = $this->_input->getConfiguration()->getConfig(FormInputEnumeration::CONFIG_TYPE_LENGTH);
             if (!is_null($configSelected)) {
                 $html->setAttribute('maxlength', $configSelected->getMaxLength());
             }
         }
     }
     $html->setAttribute('value', $value);
     return (string) $html;
 }
    if (array_key_exists('defaultValue', $struct)) {
        ${$name}->setDefaultValue($struct['defaultValue']);
    }
    if (array_key_exists('configuration', $struct)) {
        ${$name}->setConfiguration($struct['configuration']);
    }
}
/*
  System::export(
    StoreObject::restore(
      'a:2:{s:5:"class";s:9:"TextField";s:5:"props";a:5:{s:4:"name";s:8:"nom_copy";s:4:"type";s:4:"text";s:5:"value";N;s:13:"default_value";s:7:"Abraham";s:13:"configuration";s:200:"a:2:{s:5:"class";s:22:"FormInputConfiguration";s:5:"props";a:1:{s:5:"items";a:1:{s:6:"length";s:95:"a:2:{s:5:"class";s:28:"FormInputLengthConfiguration";s:5:"props";a:1:{s:10:"max_length";i:10;}}";}}}";}}'
    ),
    'restore TextField'
  );
*/
if (FormInput::hasUserInput()) {
    System::export('Des données ont été soumises');
    foreach ($inputs as $name => $struct) {
        System::export(${$name}->getValue(), $name);
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Chargeur d'éléments de formulaire</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<link rel="StyleSheet" type="text/css" href="forminput.css" />
</head>
<body>
<form id="my_form" action="<?php