Exemple #1
0
 /**
  * Create a field
  * @param \Runalyze\Configuration\Handle $Handle
  * @param string $label
  * @return \FormularField
  */
 private function createFieldFor(Handle $Handle, $label)
 {
     $Parameter = $Handle->object();
     $Class = 'FormularInput';
     if ($Parameter instanceof SelectRow) {
         $Field = new \FormularSelectDb($Handle->key(), $label, $Handle->value());
         $Field->loadOptionsFrom($Parameter->table(), $Parameter->column());
         return $Field;
     } elseif ($Parameter instanceof Select) {
         $Field = new \FormularSelectBox($Handle->key(), $label, $Handle->value());
         $Field->setOptions($Parameter->options());
         return $Field;
     } elseif ($Parameter instanceof Boolean) {
         $Field = new \FormularCheckbox($Handle->key(), $label, $Handle->value());
         $Field->addHiddenSentValue();
         return $Field;
     }
     return new $Class($Handle->key(), $label, $Handle->object()->valueAsString());
 }
 /**
  * Add boolean field
  * @param string $key
  * @param string $label
  */
 private function addBooleanField($key, $label)
 {
     $Field = new FormularSelectBox($key, $label);
     $Field->setLayout(FormularFieldset::$LAYOUT_FIELD_W33);
     $Field->setOptions(array('' => '', '1' => __('Yes'), '0' => __('No')));
     $this->Fieldset->addField($Field);
 }
 /**
  * Get input for active
  * @param bool $active
  * @return FormularSelectBox 
  */
 protected function getActiveInputCode($active)
 {
     $FieldActive = new FormularSelectBox('splits[active][]', '', (int) $active);
     $FieldActive->setOptions(array(__('Resting'), __('Active')));
     $FieldActive->setLayout(FormularFieldset::$LAYOUT_FIELD_INLINE);
     return $FieldActive->getCode();
 }
 /**
  * Display row for config form
  * @return FormularField
  */
 public function getFormField()
 {
     $Field = new FormularSelectBox($this->Key, $this->formLabel(), $this->valueAsString());
     $Field->setOptions($this->Options);
     return $Field;
 }