/** * @return string The html code for the radio input. */ public function display() { $tpl_src = '<div class="form-field-radio"><input id="${escape(ID)}" type="radio" name="${escape(NAME)}" value="${escape(VALUE)}" # IF C_CHECKED # checked="checked" # ENDIF # # IF C_DISABLE # disabled="disabled" # ENDIF #><label for="${escape(ID)}"></label></div><span class="form-field-radio-span"> {LABEL}</span>'; $tpl = new StringTemplate($tpl_src); $tpl->put_all(array('ID' => $this->get_option_id(), 'NAME' => $this->get_field_id(), 'VALUE' => $this->get_raw_value(), 'C_CHECKED' => $this->is_active(), 'C_DISABLE' => $this->is_disable(), 'LABEL' => $this->get_label())); return $tpl; }
/** * @return string The html code for the select. */ public function display() { $tpl_src = '<option value="${escape(VALUE)}" # IF C_SELECTED # selected="selected" # ENDIF # # IF C_DISABLE # disabled="disabled" # ENDIF #>{LABEL}</option>'; $tpl = new StringTemplate($tpl_src); $tpl->put_all(array('VALUE' => $this->get_raw_value(), 'C_SELECTED' => $this->is_active(), 'C_DISABLE' => $this->is_disable(), 'LABEL' => $this->get_label())); return $tpl; }
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('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('<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('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; }
/** * @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; }
public function display() { $tpl_src = '<optgroup label="${escape(LABEL)}"> # START options # # INCLUDE options.OPTION # # END options # </optgroup>'; $tpl = new StringTemplate($tpl_src); $tpl->put_all(array('LABEL' => $this->get_label())); foreach ($this->options as $option) { $tpl->assign_block_vars('options', array(), array('OPTION' => $option->display())); } return $tpl; }
private function get_html_code() { $tpl_src = '<select name="${escape(NAME)}" id="${escape(HTML_ID)}" class="${escape(CSS_CLASS)}" # IF C_DISABLED # disabled="disabled" # ENDIF # >' . '# START options # # INCLUDE options.OPTION # # END options #' . '</select>'; $tpl = new StringTemplate($tpl_src); $tpl->put_all(array('NAME' => $this->get_html_id(), 'ID' => $this->get_id(), 'HTML_ID' => $this->get_html_id(), 'CSS_CLASS' => $this->get_css_class(), 'C_DISABLED' => $this->is_disabled())); foreach ($this->get_options() as $option) { $tpl->assign_block_vars('options', array(), array('OPTION' => $option->display())); } return $tpl; }
/** * @return Template */ private function generate_html_code() { $tpl_src = '# START choice # <div class="form-field-checkbox"> <input type="checkbox" name="${escape(choice.HTML_ID)}" id="${escape(choice.HTML_ID)}" # IF choice.C_CHECKED # checked="checked"# ENDIF # /> <label for="${escape(choice.HTML_ID)}"></label> </div> ${escape(choice.NAME)} <div class="spacer"></div> # END choice #'; $rows = array(); foreach ($this->available_options as $option) { $rows[] = array('NAME' => $option->get_label(), 'HTML_ID' => $this->get_option_id($option), 'C_CHECKED' => $this->is_selected($option)); } $tpl = new StringTemplate($tpl_src); $tpl->put_all(array('choice' => $rows)); return $tpl; }
/** * @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; }
/** * {@inheritdoc} */ public function display() { $template = new StringTemplate('<button type="reset" value="true">{L_RESET}</button>'); $template->put_all(array('L_RESET' => $this->value)); return $template; }