Example #1
0
 public function render(html_form $form, $name, $input, $label, model_editor $editor, model_editor_field $field)
 {
     if ($this->isReadOnly) {
         return $this->renderStatic($form, $name, $input, $label, $editor, $field);
     }
     $available = array_merge(array('0' => \de\toxa\txf\_L('-')), $this->getSelectableOptions());
     $values = array_pad($input, $this->selectorCount, null);
     if (\de\toxa\txf\input::vget($name . '_cmdActionAddSelector')) {
         $values[] = null;
     }
     if (count($values) > $this->maxCount) {
         array_splice($values, $this->maxCount);
     }
     $selectors = array_map(function ($value) use($name, $available) {
         return markup::selector($name . '[]', $available, $value);
     }, $values);
     $classes = implode(' ', array_filter(array($this->class, 'related')));
     $form->setRow($name, $label, implode("\n", $selectors), $this->isMandatory, $this->hint, null, $classes);
     if (count($selectors) < $this->maxCount) {
         $form->setRowCode($name, markup::button($name . '_cmdActionAddSelector', '1', \de\toxa\txf\_L('Add Entry'), \de\toxa\txf\_L('Click this button to add another selector for choosing related information.'), 'actionAddSelector'));
     }
     return $this;
 }
Example #2
0
 public function render(html_form $form, $name, $input, $label, model_editor $editor, model_editor_field $field)
 {
     if ($this->isReadOnly) {
         return $this->renderStatic($form, $name, $input, $label, $editor, $field);
     }
     $parts = explode(' ', $input);
     $code = markup::textedit("{$name}_amount", $parts[0]);
     $code .= markup::selector("{$name}_currency", static::$currencies, $parts[1]);
     $classes = implode(' ', array_filter(array($this->class, 'currency')));
     $form->setRow($name, $label, $code, $this->isMandatory, $this->hint, null, $classes);
     return $this;
 }