public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; return \Kodazzi\Helper\FormHtml::hidden($format, $this->value, $this->max_length, array('id' => $id, 'class' => $this->getClassCss()), $this->other_attributes); }
public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; return \Kodazzi\Helper\FormHtml::input($format, $this->value, $this->max_length, array('id' => $id, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly(), 'placeholder' => $this->getPlaceholder())); }
public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; return \Kodazzi\Helper\FormHtml::textarea($format, $this->value, 40, 10, array('id' => $id, 'class' => 'editor ' . $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); }
public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; $value = $this->value ? number_format(str_replace(',', '.', $this->value), $this->scale, '.', '') : ''; return \Kodazzi\Helper\FormHtml::input($format, $value, $this->max_length, array('id' => $id, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly(), 'placeholder' => $this->getPlaceholder()), $this->other_attributes); }
public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; $options = $this->options; if (count($options) == 0) { $options = Service::get('database.manager')->model($this->name_model_relation)->getForOptions(); } return \Kodazzi\Helper\FormHtml::select($format, $options, $this->value, null, array('id' => $id, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); }
public function renderField() { if (!$this->is_display) { return ''; } $format = $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; $string = ''; $_data = array(); $options = $this->options; $Model = null; if (count($options) == 0) { $Model = Service::get('database.manager')->model($this->name_model_relation, 't'); } if (!$this->form->isNew()) { $definition = $this->definition; $model = $this->form->getModel(); $name_primary = $model::primary; $_id = $model->{$name_primary}; // Si se esta editando el registro // Si el modelo fue iniciado // Si la relacion es 'many-to-many-self-referencing' // Entontes, excluye del query el ID del registro actual. if ($Model && $this->type_relation == 'many-to-many-self-referencing') { $Model->where("t.{$name_primary}", '<>', $_id); } /** * @var $db DatabaseManager */ $db = Service::get('database.manager'); $ConnectionOptions = $db->getConnectionManager()->getConnectionOptions(); // Busca los registros que han sido seleccionados $_opt = $db->getQueryBuilder()->select('*')->from("{$ConnectionOptions['prefix']}{$definition['tableManyToMany']}", 't')->where("t.{$definition['localField']}=:{$definition['localField']}")->setParameter(":{$definition['localField']}", $_id)->execute()->fetchAll(); foreach ($_opt as $op) { $_data[] = $op[$definition['foreignField']]; } } if ($Model) { $options = $Model->getForOptions(); } foreach ($options as $_value => $_option) { $string .= '<label class="checkbox-inline">'; $is_active = in_array($_value, $_data) ? true : false; $string .= \Kodazzi\Helper\FormHtml::checkbox($format . '[' . $_value . ']', $_value, $is_active, array('id' => $id . '_' . $_value, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); $string .= $_option . ' </label>'; } return $string; }
public function renderRow(\Kodazzi\Form\Field $widget) { if ($widget->isDisplay()) { // Si el formulario tiene una plantilla para todos los campos la agrega. if ($this->template_row) { $widget->setTemplate($this->template_row); } if ($widget->isHidden()) { $format = $widget->getFormat() ? $widget->getFormat() : $this->name_form . '[' . $widget->getName() . ']'; return \Kodazzi\Helper\FormHtml::hidden($format, $widget->getValue(), $widget->getMaxlength(), array('id' => $widget->getId() ? $widget->getId() : $this->name_form . '_' . $widget->getName(), 'class' => $widget->getClassCss())); } else { $template = $widget->getTemplate(); return Service::get('view')->render($template, array('widget' => $widget)); } } return ''; }
public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; if ($this->type_field_tag === 'check') { $label = $this->getValueLabel(); $string = ''; $string .= '<label>'; $string .= \Kodazzi\Helper\FormHtml::checkbox($format, 1, (int) $this->value === 1 || $this->value === true ? true : false, array('id' => $id, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); $string .= "{$label}"; $string .= '</label>'; return $string; } }
public function renderField() { if (!$this->is_display) { return ''; } $format = $this->format ? $this->format : $this->name_form . '[' . $this->name . ']'; $id = $this->id ? $this->id : $this->name_form . '_' . $this->name; if ($this->type_field_tag === 'radio') { $string = ''; foreach ($this->options as $value => $name) { $string .= '<span class="radio">'; $string .= '<label for="' . $id . '_' . $value . '">' . $name . '</label>'; $string .= \Kodazzi\Helper\FormHtml::radio($format, $value, $this->value == null ? $this->default && $this->default == $value ? true : false : ($value == $this->value ? true : false), array('id' => $id . '_' . $value, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); $string .= '</span>'; } return $string; } return \Kodazzi\Helper\FormHtml::select($format, $this->options, $this->value == null ? $this->default : $this->value, null, array('id' => $id, 'class' => $this->getClassCss(), 'disabled' => $this->isDisabled(), 'readonly' => $this->isReadonly())); }
/** * @return \Kodazzi\Form\Field */ public function renderLabel($value = null, $attributes = '') { $for = $this->id ? $this->id : $this->name_form . '_' . $this->name; if (!$value) { $value = $this->getValueLabel(); } return \Kodazzi\Helper\FormHtml::label($for, $value, $attributes); }