Esempio n. 1
0
 $key = '';
 $value = '';
 if (isset($data['type'])) {
     $key = $data['type'];
 } else {
     $key = '?';
 }
 // Create different controls based on the key
 switch ($key) {
     case 'checkbox':
         if (HasAnyAdditionalStepValueBeenPostedYet()) {
             $checked = GetAdditionalControlValue($data['keyword'], $data['value_off']) == $data['value_on'] ? array('checked') : array();
         } else {
             $checked = isset($data['checked']) && $data['checked'] === true ? array('checked') : array();
         }
         $page->FormCheckbox($data['value_on'], $data['keyword'], $mask->ReplaceKeywords($data['text']), $checked);
         break;
     case 'radiobox':
         if (HasAnyAdditionalStepValueBeenPostedYet()) {
             $checked = GetAdditionalControlValue($data['keyword'], '') == $data['value'] ? array('checked') : array();
         } else {
             $checked = isset($data['checked']) && $data['checked'] === true ? array('checked') : array();
         }
         $page->FormRadiobox($data['value'], $data['keyword'], $mask->ReplaceKeywords($data['text']), $checked);
         break;
     case 'textbox':
         $value = GetAdditionalControlValue($data['keyword'], $data['value']);
         $value = $value === false ? $data['value'] : $value;
         $hasErrors = HasTextInputErrors($data, $value) || $hasErrors ? true : false;
         $page->FormInput($value, $data['keyword']);
         break;