public function __construct($f = array(), $protected = true)
 {
     $this->id_ = new FormNumber('label=Sumission ID:');
     $this->regyear_ = new FormNumber();
     $this->submitted_ = new FormText('label=Submit Date:');
     $this->first_name = new FormText('maxlength=75&size=15&required=1');
     $this->last_name = new FormText('maxlength=75&size=15&required=1');
     $this->instrument = new FormSelect(array('options' => self::instruments(), 'required' => 1, 'maxlength' => 10));
     $this->address1 = new FormText('label=Address Line 1:&maxlength=75&required=1');
     $this->address2 = new FormText('label=Address Line 2:&maxlength=75');
     $this->city = new FormText('required=1&maxlength=40');
     $this->state = new FormSelect(array('options' => self::states(), 'required' => 1, 'maxlength' => 2));
     $this->zip = new FormText('maxlength=10&size=10&required=1');
     $this->high_school = new FormText('label=Name of High School:&maxlength=75&required=1');
     $this->high_school_grade = new FormSelect(array('label' => 'High School Grade:', 'options' => array(array(10, 'Sophomore'), array(11, 'Junior'), array(12, 'Senior')), 'required' => 1, 'maxlength' => 2));
     $this->high_school_enrollment = new FormNumber('label=Approximate Enrollment of High School:&size=5&maxlength=6');
     $this->band_size = new FormNumber('label=Number of Students in High School Band:&size=5&maxlength=6');
     $this->director_name = new FormText('label=Band Director\'s Name:&required=1&maxlength=75');
     $this->director_email = new FormText('required=1&maxlength=100');
     $this->director_student_rating = new FormSelect(array('label' => 'Director\'s Rating of Student:', 'options' => self::ratings(), 'required' => 1, 'maxlength' => 1));
     $this->student_past_participate = new FormSelect(array('label' => 'Has the student participated in this festival previously?', 'options' => FormSelect::yesno(), 'required' => 1, 'maxlength' => 1));
     $this->student_chair = new FormSelect(array('options' => self::chairs(4), 'required' => 1, 'maxlength' => 2));
     $this->student_section_players = new FormNumber('maxlength=3&size=3&required=1');
     $this->honorband_years = new FormNumber('label=How many years?');
     $this->honorband_recent_chair = new FormSelect(array('label' => 'Most recent chair?', 'options' => self::chairs(10), 'maxlength' => 2));
     $this->solosf_music_level = new FormSelect(array('label' => 'Most recent level of music performed:', 'options' => array(array(3, 'III'), array(4, 'IV'), array(5, 'V'), array(6, 'VI')), 'maxlength' => 1));
     $this->solosf_rating = new FormSelect(array('label' => 'Rating:', 'options' => array('A (I)', 'A-', 'B+', 'B (II)', 'B-', 'C+', 'C (III)', 'C-', 'Other'), 'maxlength' => 8));
     $this->comments = new FormTextarea('rows=10&cols=85&label=Additional Comments (optional)');
     parent::__construct($f, $protected);
     if (null == $this->regyear_->value()) {
         $this->regyear_->value($GLOBALS['ANEJF']['YEAR']);
     }
 }
示例#2
0
文件: DataForm.php 项目: h3rb/page
 public function Load($ff, $addendum, $signal)
 {
     if (!isfile($ff, 'forms/')) {
         return;
     }
     $file = file_get_contents('forms/' . $ff);
     $data = new HDataStream($file);
     $data = $data->toArray();
     $settings = array();
     $settings['insert'] = array();
     $settings['hidden'] = array();
     $settings['text'] = array();
     $settings['multiline'] = array();
     $settings['slider'] = array();
     $settings['date'] = array();
     $settings['select'] = array();
     $settings['radio'] = array();
     $settings['submit'] = array();
     $settings['list'] = array();
     $settings['name'] = 'form';
     $settings['action'] = 'ajax.post.php';
     if (!is_null($addendum) && is_array($addendum)) {
         foreach ($addendum as $add => $val) {
             $settings[$add] = $val;
         }
     }
     if (isset($settings['dbid'])) {
         $this->dbid = $settings['dbid'];
     }
     $t = count($data);
     $o = 0;
     for ($i = 0; $i < $t; $i++) {
         $setting = $data[$i + 1];
         if (matches($data[$i], "text")) {
             $settings['text'][$o++] = HDataStream::asKV($setting);
         } else {
             if (matches($data[$i], "hidden")) {
                 $settings['hidden'][$o++] = HDataStream::asKV($setting);
             } else {
                 if (matches($data[$i], "multiline") || matches($data[$i], "textarea")) {
                     $settings['multiline'][$o++] = HDataStream::asKV($setting);
                 } else {
                     if (matches($data[$i], "slider")) {
                         $settings['slider'][$o++] = HDataStream::asKV($setting);
                     } else {
                         if (matches($data[$i], "date")) {
                             $settings['date'][$o++] = HDataStream::asKV($setting);
                         } else {
                             if (matches($data[$i], "select")) {
                                 $settings['select'][$o++] = HDataStream::asKV($setting);
                             } else {
                                 if (matches($data[$i], "list")) {
                                     $settings['list'][$o++] = HDataStream::asKV($setting);
                                 } else {
                                     if (matches($data[$i], "radio")) {
                                         $settings['radio'][$o++] = HDataStream::asKV($setting);
                                     } else {
                                         if (matches($data[$i], "insert")) {
                                             $settings['insert'][$o++] = HDataStream::asKV($setting);
                                         } else {
                                             if (matches($data[$i], "submit")) {
                                                 $settings['submit'][$o++] = HDataStream::asKV($setting);
                                             } else {
                                                 $settings[$data[$i]] = $setting;
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
         $i++;
     }
     $this->form = new FormHelper($settings['name'], $settings['action'], $this->dbid, $signal);
     for ($i = 0; $i < $o; $i++) {
         if (isset($settings['radio'][$i])) {
             $e = $settings['radio'][$i];
             $e['html'] = HDataStream::asKV($e['html']);
             $e['options'] = HDataStream::asKV($e['options']);
             $element = new FormRadio($e, TRUE);
             if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                 $element->Set($this->data[$e['data']]);
             }
             $element->_Init($element->settings);
             $this->form->Add($element);
         } else {
             if (isset($settings['select'][$i])) {
                 $e = $settings['select'][$i];
                 $e['html'] = HDataStream::asKV($e['html']);
                 $e['options'] = HDataStream::asKV($e['options']);
                 $element = new FormSelect($e, TRUE);
                 if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                     $element->Set($this->data[$e['data']]);
                 }
                 $element->_Init($element->settings);
                 $this->form->Add($element);
             } else {
                 if (isset($settings['list'][$i])) {
                     $e = $settings['list'][$i];
                     $e['html'] = HDataStream::asKV($e['html']);
                     $e['options'] = HDataStream::asKV($e['options']);
                     $element = new FormList($e, TRUE);
                     if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                         $element->Set($this->data[$e['data']]);
                     }
                     $element->_Init($element->settings);
                     $this->form->Add($element);
                 } else {
                     if (isset($settings['slider'][$i])) {
                         $e = $settings['slider'][$i];
                         $e['html'] = HDataStream::asKV($e['html']);
                         $element = new FormSlider($e, TRUE);
                         if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                             $element->Set($this->data[$e['data']]);
                         }
                         $element->_Init($element->settings);
                         $this->form->Add($element);
                     } else {
                         if (isset($settings['multiline'][$i])) {
                             $e = $settings['multiline'][$i];
                             $e['html'] = HDataStream::asKV($e['html']);
                             $element = new FormMultiline($e, TRUE);
                             if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                                 $element->Set($this->data[$e['data']]);
                             }
                             $element->_Init($element->settings);
                             $this->form->Add($element);
                         } else {
                             if (isset($settings['text'][$i])) {
                                 $e = $settings['text'][$i];
                                 $e['html'] = HDataStream::asKV($e['html']);
                                 $element = new FormText($e, TRUE);
                                 if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                                     $element->Set($this->data[$e['data']]);
                                 }
                                 $element->_Init($element->settings);
                                 $this->form->Add($element);
                             } else {
                                 if (isset($settings['insert'][$i])) {
                                     $e = $settings['insert'][$i];
                                     $this->form->Add(new FormInsert($e));
                                 } else {
                                     if (isset($settings['hidden'][$i])) {
                                         $e = $settings['insert'][$i];
                                         $this->form->Add(new FormHidden($e));
                                     } else {
                                         if (isset($settings['submit'][$i])) {
                                             $e = $settings['submit'][$i];
                                             $e['html'] = HDataStream::asKV($e['html']);
                                             $element = new FormSubmit($e, TRUE);
                                             if (!is_null($this->data) && isset($e['data']) && isset($this->data[$e['data']])) {
                                                 $element->Set($this->data[$e['data']]);
                                             }
                                             $element->_Init($element->settings);
                                             $this->form->Add($element);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 public function __construct($args = array())
 {
     parent::__construct($args);
     $this->options = self::_get_states();
 }
 /**
  * Constructor
  * 
  * @return  void
  */
 function FormSelectCountry()
 {
     parent::FormSelect();
     $countries = array('AF' => 'Afghanistan', 'AL' => 'Albania', 'DZ' => 'Algeria', 'AS' => 'American Samoa', 'AD' => 'Andorra', 'AO' => 'Angola', 'AI' => 'Anguilla', 'AQ' => 'Antarctica', 'AG' => 'Antigua and Barbuda', 'AR' => 'Argentina', 'AM' => 'Armenia', 'AW' => 'Aruba', 'AU' => 'Australia', 'AT' => 'Austria', 'AZ' => 'Azerbaijan', 'BS' => 'Bahamas', 'BH' => 'Bahrain', 'BD' => 'Bangladesh', 'BB' => 'Barbados', 'BY' => 'Belarus', 'BE' => 'Belgium', 'BZ' => 'Belize', 'BJ' => 'Benin', 'BM' => 'Bermuda', 'BT' => 'Bhutan', 'BO' => 'Bolivia', 'BA' => 'Bosnia and Herzegovina', 'BW' => 'Botswana', 'BV' => 'Bouvet Island', 'BR' => 'Brazil', 'IO' => 'British Indian Ocean Territory', 'BN' => 'Brunei', 'BG' => 'Bulgaria', 'BF' => 'Burkina Faso', 'BI' => 'Burundi', 'KH' => 'Cambodia', 'CM' => 'Cameroon', 'CA' => 'Canada', 'CV' => 'Cape Verde', 'KY' => 'Cayman Islands', 'CF' => 'Central African Republic', 'TD' => 'Chad', 'CL' => 'Chile', 'CN' => 'China', 'CX' => 'Christmas Island', 'CC' => 'Cocos &#40;Keeling&#41; Islands', 'CO' => 'Colombia', 'KM' => 'Comoros', 'CG' => 'Congo', 'CK' => 'Cook Islands', 'CR' => 'Costa Rica', 'CI' => 'C&#244;te d&#39;Ivoire', 'HR' => 'Croatia &#40;Hrvatska&#41;', 'CU' => 'Cuba', 'CY' => 'Cyprus', 'CZ' => 'Czech Republic', 'CD' => 'Congo &#40;DRC&#41;', 'DK' => 'Denmark', 'DJ' => 'Djibouti', 'DM' => 'Dominica', 'DO' => 'Dominican Republic', 'TP' => 'East Timor', 'EC' => 'Ecuador', 'EG' => 'Egypt', 'SV' => 'El Salvador', 'GQ' => 'Equatorial Guinea', 'ER' => 'Eritrea', 'EE' => 'Estonia', 'ET' => 'Ethiopia', 'FK' => 'Falkland Islands &#40;Islas Malvinas&#41;', 'FO' => 'Faroe Islands', 'FJ' => 'Fiji Islands', 'FI' => 'Finland', 'FR' => 'France', 'GF' => 'French Guiana', 'PF' => 'French Polynesia', 'TF' => 'French Southern and Antarctic Lands', 'GA' => 'Gabon', 'GM' => 'Gambia', 'GE' => 'Georgia', 'DE' => 'Germany', 'GH' => 'Ghana', 'GI' => 'Gibraltar', 'GR' => 'Greece', 'GL' => 'Greenland', 'GD' => 'Grenada', 'GP' => 'Guadeloupe', 'GU' => 'Guam', 'GT' => 'Guatemala', 'GN' => 'Guinea', 'GW' => 'Guinea-Bissau', 'GY' => 'Guyana', 'HT' => 'Haiti', 'HM' => 'Heard Island and McDonald Islands', 'HN' => 'Honduras', 'HK' => 'Hong Kong SAR', 'HU' => 'Hungary', 'IS' => 'Iceland', 'IN' => 'India', 'ID' => 'Indonesia', 'IR' => 'Iran', 'IQ' => 'Iraq', 'IE' => 'Ireland', 'IL' => 'Israel', 'IT' => 'Italy', 'JM' => 'Jamaica', 'JP' => 'Japan', 'JO' => 'Jordan', 'KZ' => 'Kazakhstan', 'KE' => 'Kenya', 'KI' => 'Kiribati', 'KR' => 'Korea', 'KW' => 'Kuwait', 'KG' => 'Kyrgyzstan', 'LA' => 'Laos', 'LV' => 'Latvia', 'LB' => 'Lebanon', 'LS' => 'Lesotho', 'LR' => 'Liberia', 'LY' => 'Libya', 'LI' => 'Liechtenstein', 'LT' => 'Lithuania', 'LU' => 'Luxembourg', 'MO' => 'Macao SAR', 'MK' => 'Macedonia, Former Yugoslav Republic of', 'MG' => 'Madagascar', 'MW' => 'Malawi', 'MY' => 'Malaysia', 'MV' => 'Maldives', 'ML' => 'Mali', 'MT' => 'Malta', 'MH' => 'Marshall Islands', 'MQ' => 'Martinique', 'MR' => 'Mauritania', 'MU' => 'Mauritius', 'YT' => 'Mayotte', 'MX' => 'Mexico', 'FM' => 'Micronesia', 'MD' => 'Moldova', 'MC' => 'Monaco', 'MN' => 'Mongolia', 'MS' => 'Montserrat', 'MA' => 'Morocco', 'MZ' => 'Mozambique', 'MM' => 'Myanmar', 'NA' => 'Namibia', 'NR' => 'Nauru', 'NP' => 'Nepal', 'NL' => 'Netherlands', 'AN' => 'Netherlands Antilles', 'NC' => 'New Caledonia', 'NZ' => 'New Zealand', 'NI' => 'Nicaragua', 'NE' => 'Niger', 'NG' => 'Nigeria', 'NU' => 'Niue', 'NF' => 'Norfolk Island', 'KP' => 'North Korea', 'MP' => 'Northern Mariana Islands', 'NO' => 'Norway', 'OM' => 'Oman', 'PK' => 'Pakistan', 'PW' => 'Palau', 'PA' => 'Panama', 'PG' => 'Papua New Guinea', 'PY' => 'Paraguay', 'PE' => 'Peru', 'PH' => 'Philippines', 'PN' => 'Pitcairn Islands', 'PL' => 'Poland', 'PT' => 'Portugal', 'PR' => 'Puerto Rico', 'QA' => 'Qatar', 'RE' => 'Reunion', 'RO' => 'Romania', 'RU' => 'Russia', 'RW' => 'Rwanda', 'WS' => 'Samoa', 'SM' => 'San Marino', 'ST' => 'S&#227;o Tom&#233; and Pr&#237;ncipe', 'SA' => 'Saudi Arabia', 'SN' => 'Senegal', 'YU' => 'Serbia and Montenegro', 'SC' => 'Seychelles', 'SL' => 'Sierra Leone', 'SG' => 'Singapore', 'SK' => 'Slovakia', 'SI' => 'Slovenia', 'SB' => 'Solomon Islands', 'SO' => 'Somalia', 'ZA' => 'South Africa', 'GS' => 'South Georgia and the South Sandwich Islands', 'ES' => 'Spain', 'LK' => 'Sri Lanka', 'SH' => 'St. Helena', 'KN' => 'St. Kitts and Nevis', 'LC' => 'St. Lucia', 'PM' => 'St. Pierre and Miquelon', 'VC' => 'St. Vincent and the Grenadines', 'SD' => 'Sudan', 'SR' => 'Suriname', 'SJ' => 'Svalbard and Jan Mayen', 'SZ' => 'Swaziland', 'SE' => 'Sweden', 'CH' => 'Switzerland', 'SY' => 'Syria', 'TW' => 'Taiwan', 'TJ' => 'Tajikistan', 'TZ' => 'Tanzania', 'TH' => 'Thailand', 'TG' => 'Togo', 'TK' => 'Tokelau', 'TO' => 'Tonga', 'TT' => 'Trinidad and Tobago', 'TN' => 'Tunisia', 'TR' => 'Turkey', 'TM' => 'Turkmenistan', 'TC' => 'Turks and Caicos Islands', 'TV' => 'Tuvalu', 'UG' => 'Uganda', 'UA' => 'Ukraine', 'AE' => 'United Arab Emirates', 'UK' => 'United Kingdom', 'US' => 'United States', 'UM' => 'United States Minor Outlying Islands', 'UY' => 'Uruguay', 'UZ' => 'Uzbekistan', 'VU' => 'Vanuatu', 'VA' => 'Vatican City', 'VE' => 'Venezuela', 'VN' => 'Viet Nam', 'VG' => 'Virgin Islands &#40;British&#41;', 'VI' => 'Virgin Islands', 'WF' => 'Wallis and Futuna', 'YE' => 'Yemen', 'ZM' => 'Zambia', 'ZW' => 'Zimbabwe');
     $this->setAttribute('option', $countries);
 }