示例#1
0
 /**
  * Return a single input form field.
  *
  * @param string $fieldName Name of the field
  * @param array $fieldConfig Configuration of this field
  * @param string $fieldValue Current value of this field
  * @param string $step Name of the step
  *
  * @return string Single input field
  */
 protected function getInputField($fieldName, array $fieldConfig, $fieldValue, $step)
 {
     $this->debug($step, '$step', __FILE__ . ' ' . __LINE__);
     $this->debug($fieldConfig, '$fieldConfig', __FILE__ . ' ' . __LINE__);
     $this->debug($fieldValue, '$fieldValue', __FILE__ . ' ' . __LINE__);
     switch (strtolower($fieldConfig['type'])) {
         case 'select':
             $result = $this->getSelectInputField($fieldName, $fieldConfig, $fieldValue, $step);
             break;
         case 'static_info_tables':
             $selected = $fieldValue != '' ? $fieldValue : $fieldConfig['default'];
             $result = $this->staticInfo->buildStaticInfoSelector($fieldConfig['field'], $this->prefixId . '[' . $step . '][' . $fieldName . ']', $fieldConfig['cssClass'], $selected, '', '', $step . '-' . $fieldName, '', $fieldConfig['select'], $this->getFrontendController()->tmpl->setup['config.']['language']);
             break;
         case 'static_info_country':
             $nameArray = $this->staticInfo->initCountries($fieldConfig['country_association'], $this->getFrontendController()->tmpl->setup['config.']['language'], 1, $fieldConfig['select']);
             asort($nameArray, SORT_LOCALE_STRING);
             $countries = array();
             foreach ($nameArray as $itemKey => $itemName) {
                 $countries[] = array('name' => $itemName, 'value' => $itemKey);
             }
             $selected = $fieldValue != '' ? $fieldValue : $fieldConfig['default'];
             $result = '<select id="' . $step . '-' . $fieldName . '" name="' . $this->prefixId . '[' . $step . '][' . $fieldName . ']" class="' . $fieldConfig['cssClass'] . '">' . LF;
             $options = array();
             $result .= \SJBR\StaticInfoTables\Utility\HtmlElementUtility::optionsConstructor($countries, array($selected), $options);
             $result .= implode(LF, $options) . '</select>' . LF;
             break;
         case 'check':
             $result = $this->getCheckboxInputField($fieldName, $fieldConfig, $fieldValue, $step);
             break;
         case 'hidden':
             // fall through
         // fall through
         case 'single':
             // fall through
         // fall through
         default:
             $result = $this->getSingleInputField($fieldName, $fieldConfig, $step);
     }
     return $result;
 }