/**
  * @return string The html code for the input.
  */
 public function display()
 {
     $template = $this->get_template_to_use();
     $field = new StringTemplate(self::$tpl_src);
     $field->put_all(array('C_MIN' => $this->min !== null, 'MIN' => $this->min, 'C_MAX' => $this->max != 0, 'MAX' => $this->max, 'C_STEP' => $this->step > 0, 'STEP' => $this->step, 'NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'TYPE' => $this->type, 'VALUE' => $this->get_value(), 'CLASS' => $this->get_css_class(), 'C_DISABLED' => $this->is_disabled(), 'C_READONLY' => $this->is_readonly(), 'C_DISABLED' => $this->is_disabled(), 'C_PATTERN' => $this->has_pattern(), 'PATTERN' => $this->pattern, 'C_VERTICAL' => $this->is_vertical()));
     $this->assign_common_template_variables($template);
     $template->assign_block_vars('fieldelements', array('ELEMENT' => $field->render()));
     return $template;
 }
 public function display()
 {
     $tpl = new StringTemplate('<img src="{URL}" # START attributs # {attributs.TYPE}="{attributs.VALUE}"# END attributs ## IF C_HAS_CSS_CLASSES #class="{CSS_CLASSES}"# ENDIF #>');
     $tpl->put_all(array('C_HAS_CSS_CLASSES' => $this->has_css_class(), 'CSS_CLASSES' => $this->get_css_class(), 'URL' => $this->url));
     foreach ($this->attributs as $type => $value) {
         $tpl->assign_block_vars('attributs', array('TYPE' => $type, 'VALUE' => $value));
     }
     return $tpl->render();
 }
 /**
  * @return string The html code for the input.
  */
 public function display()
 {
     $template = $this->get_template_to_use();
     $field = new StringTemplate(self::$tpl_src);
     $field->put_all(array('SIZE' => $this->size, 'MAX_LENGTH' => $this->maxlength, 'NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'TYPE' => $this->type, 'VALUE' => $this->get_value(), 'CLASS' => $this->get_css_class(), 'C_DISABLED' => $this->is_disabled(), 'C_READONLY' => $this->is_readonly(), 'C_MULTIPLE' => $this->is_multiple()));
     $this->assign_common_template_variables($template);
     $template->assign_block_vars('fieldelements', array('ELEMENT' => $field->render()));
     return $template;
 }
 public function display()
 {
     $tpl = new StringTemplate('<span # IF C_HAS_CSS_CLASSES #class="{CSS_CLASSES}"# ENDIF ## START attributs # {attributs.TYPE}="{attributs.VALUE}"# END attributs #>{CONTENT}</span>');
     $tpl->put_all(array('C_HAS_CSS_CLASSES' => $this->has_css_class(), 'CSS_CLASSES' => $this->get_css_class(), 'CONTENT' => $this->content));
     foreach ($this->attributs as $type => $value) {
         $tpl->assign_block_vars('attributs', array('TYPE' => $type, 'VALUE' => $value));
     }
     return $tpl->render();
 }
 /**
  * @return string The html code for the input.
  */
 public function display()
 {
     $template = $this->get_template_to_use();
     $field = new StringTemplate(self::$tpl_src);
     $field->put_all(array('ROWS' => $this->rows, 'COLS' => $this->cols, 'WIDTH' => $this->width > 0 ? 'width: ' . $this->width . '%;' : '', 'NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'VALUE' => $this->get_value(), 'CLASS' => $this->get_css_class(), 'C_DISABLED' => $this->is_disabled(), 'C_READONLY' => $this->is_readonly()));
     $this->assign_common_template_variables($template);
     $template->assign_block_vars('fieldelements', array('ELEMENT' => $field->render()));
     return $template;
 }
 /**
  * @return Template The html code for the file input.
  */
 function display()
 {
     $template = $this->get_template_to_use();
     $file_field_tpl = new StringTemplate(self::$tpl_src);
     $file_field_tpl->put_all(array('MAX_FILE_SIZE' => $this->get_max_file_size(), 'NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'C_DISABLED' => $this->is_disabled()));
     $this->assign_common_template_variables($template);
     $template->assign_block_vars('fieldelements', array('ELEMENT' => $file_field_tpl->render()));
     return $template;
 }
Esempio n. 7
0
 public function render(array $variables = array())
 {
     $variables = $variables ?: $this->array;
     $callback = function ($item) use($variables) {
         if ($item instanceof Renderizable) {
             return $item->render($variables);
         } elseif (is_string($item)) {
             $string = new StringTemplate($item);
             return $string->render($variables);
         }
         return $item;
     };
     return array_map($callback, $this->array);
 }
    private function warning_if_not_equals(FormField $field, $message)
    {
        $tpl = new StringTemplate('var field = $FF(${escapejs(ID)});
var value = ${escapejs(VALUE)};
if (field.getValue()!=value && !confirm(${escapejs(MESSAGE)})){field.setValue(value);}');
        $tpl->put('ID', $field->get_id());
        $tpl->put('VALUE', $field->get_value());
        $tpl->put('MESSAGE', $message);
        return $tpl->render();
    }
 /**
  * @return string The html code for the input.
  */
 public function display()
 {
     $template = $this->get_template_to_use();
     $field = new StringTemplate(self::$tpl_src);
     if (empty($this->file)) {
         throw new Exception('Add file options containing file url');
     }
     $field->put_all(array('SIZE' => $this->size, 'MAX_LENGTH' => $this->maxlength, 'NAME' => $this->get_html_id(), 'FILE' => $this->file, 'METHOD' => $this->method, 'NAME_PARAMETER' => $this->name_parameter, 'PRESERVE_INPUT' => $this->preserve_input, 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'VALUE' => $this->get_value(), 'CLASS' => $this->get_css_class(), 'C_DISABLED' => $this->is_disabled()));
     $this->assign_common_template_variables($template);
     $template->assign_block_vars('fieldelements', array('ELEMENT' => $field->render()));
     return $template;
 }