コード例 #1
0
/**
 * @author        Jimmy CHARLEBOIS
 * @date          04-01-2007
 * @brief         Exemple de chargement d'éléments de formulaire
 */
error_reporting(E_ALL);
require 'c.system.php';
System::import('System.Context.HttpContext');
System::import('System.FormInput.FormInputFabrication');
System::import('System.FormInput.FormInput');
System::import('System.FormInput.FormInputConfiguration');
System::import('System.FormInput.Configurations.FormInputLengthConfiguration');
System::import('System.FormInput.Configurations.FormInputSelectedConfiguration');
//System::import( 'System.StoreObject' );
$context =& new HttpContext();
FormInput::setContext($context);
$configNom =& new FormInputConfiguration();
$configNom->add(new FormInputLengthConfiguration(10));
$configCheckbox =& new FormInputConfiguration();
$configCheckbox->add(new FormInputSelectedConfiguration(false));
$inputs = array('nom' => array('type' => FormInputEnumeration::TYPE_TEXT, 'defaultValue' => 'Ab\'r"aham', 'configuration' => $configNom), 'case_a_cocher' => array('type' => FormInputEnumeration::TYPE_CHECKBOX, 'defaultValue' => 1, 'configuration' => $configCheckbox));
foreach ($inputs as $name => $struct) {
    ${$name} =& FormInputFabrication::createNew($struct['type'], $name);
    if (array_key_exists('defaultValue', $struct)) {
        ${$name}->setDefaultValue($struct['defaultValue']);
    }
    if (array_key_exists('configuration', $struct)) {
        ${$name}->setConfiguration($struct['configuration']);
    }
}
/*