private function showTheEditField(FBField $field)
 {
     static $t;
     if (!$t) {
         $t = new FBTemplatizer('field_edit.phtml');
     }
     $t->clear();
     $t->set('FIELD_ID', $field->getId());
     $t->set('FIELD_NAME', htmlentities($field->getName(), ENT_QUOTES, get_option('blog_charset')));
     $t->set('FIELD_VALUE', htmlentities($field->getValue(), ENT_QUOTES, get_option('blog_charset')));
     $t->set('FIELD_LABEL', htmlentities($field->getLabel(), ENT_QUOTES, get_option('blog_charset')));
     $t->set('FIELD_ERROR', htmlentities($field->getError(), ENT_QUOTES, get_option('blog_charset')));
     $t->set('FIELD_HELP', htmlentities($field->getHelp(), ENT_QUOTES, get_option('blog_charset')));
     $all_field_types = formbuilder_get_field_types();
     $html = '';
     $help = '';
     foreach ($all_field_types as $key => $value) {
         if ($key == $field->getType()) {
             $selected = "selected = 'selected'";
         } else {
             $selected = "";
         }
         $html .= "<option value='{$key}' {$selected}>{$key}</option>";
         $help .= "{$key}: {$value}\\n";
     }
     $t->set('FIELD_TYPE_SELECT', $html);
     $t->set('FIELD_TYPE_HELP', htmlentities($help, ENT_QUOTES, get_option('blog_charset')));
     $all_required_types = formbuilder_get_required_types();
     $html = '';
     $help = '';
     foreach ($all_required_types as $key => $value) {
         if ($key == $field->getRequired()) {
             $selected = "selected = 'selected'";
         } else {
             $selected = "";
         }
         $html .= "<option value='{$key}' {$selected}>{$key}</option>";
         $help .= "{$key}: {$value}\\n";
     }
     $t->set('FIELD_REQUIRED_SELECT', $html);
     $t->set('FIELD_REQUIRED_HELP', htmlentities($help, ENT_QUOTES, get_option('blog_charset')));
     return $t->parse();
 }
예제 #2
0
 /**
  * Retrieve the HTML code used to display this field.
  * @param array $extraParams to be set in the template overwriting existing params.
  */
 function getHtml()
 {
     if (!$this->field_type) {
         throw new Exception("No field type defined.");
     }
     // Load the appropriate field template.
     $fieldTemplate = "field_" . str_replace(" ", "_", $this->field_type) . ".phtml";
     $t = new FBTemplatizer($fieldTemplate);
     if (!$t->exists()) {
         unset($t);
         $fieldTemplate = "field_single_line_text_box.phtml";
         $t = new FBTemplatizer($fieldTemplate);
     }
     $t->set('ERROR', $this->getError());
     $t->set('NAME', $this->getName());
     $t->set('LABEL', $this->getLabel());
     $t->set('TYPE', str_replace(" ", "", $this->getType()));
     $t->set('HELPTEXT', $this->getHelp());
     $t->set('VALUE', $this->getValue());
     $html = $t->parse();
     return $html;
 }