Фильтр: диапазон чисел

@param      $form_field
@param      $label
@param null $db_field
11825
function addFilterRangeNumeric($form_field, $label, $db_field = null) {
        if(!$db_field) {
            $db_field = $form_field;
        }
        $gr = $this->form->putTbGroup($form_field)
            ->setLabel($label);
        $gr->putTbInt('from')
            ->setLabel('С')
            ->setWrapClass('col-md-6');
        $gr->putTbInt('to')
            ->setLabel('по')
            ->setWrapClass('col-md-6');
        $from = (float) \Input::get($form_field . '.from');
        $to   = (float) \Input::get($form_field . '.to');
        if($from) {
            $this->model->where(function ($query) use ($db_field, $from) {
                $query->where($db_field, '>=', $from);
            });
        }
        if($to) {
            $this->model->where(function ($query) use ($db_field, $to) {
                $query->where($db_field, '<=', $to);
            });
        }
    }
63444
protected function checkbox($name, $label = null, $value = null, $note = null) {
		$data = is_array($value) ? $value + ['note' => $note] : (
			is_bool($value)
			? ['checked' => $value, 'note' => $note]
			: ['note' => $value]
		);
		return $this->field($name, Checkbox::class, $label, [
			'checked' => Checkbox::b($this->v($name), df_bool(dfa($data, 'checked')))
		] + $data);
	}
1075649
public static function textFormGroup( $label = null, $labelAttributes = array(), $inputAttributes = array(), $wrapper = null )
    {
        $_label = static::label( array_merge( $labelAttributes, array('class' => 'form-label') ), $label );
        $_input = static::text( array_merge( $inputAttributes, array('class' => 'form-control') ), null, $wrapper );

        return static::div( array('class' => 'form-group'), $_label . $_input );
    }
728136
public function file($field, $label) {
        $file = new File($this->_entity, $field, $label);
        array_push($this->_elements, $file);

        return $file;
    }
1016834
def formfield_for_dbfield(self, db_field, **kwargs):
        
        if isinstance(db_field, fields.OrderField):
            kwargs['widget'] = widgets.HiddenTextInput

        return super(ListView, self).formfield_for_dbfield(db_field, **kwargs)
814419
public function clickButton(string $label, int $indexOfButton = 0): void
    {
        $formButtons = $this->context->findAllElements($this->fields['button'], $this->context->findElement($this->fields['mainFormSection']));
        $filteredButtons = array_values(array_filter($formButtons, function ($element) use ($label) { return $element->getText() === $label; }));

        $filteredButtons[$indexOfButton]->click();
    }
942134
private static function buildWrapper($field, $name, $label = '', $checkbox = false, $required)
        {
            $getter = 'get' . Inflector::camelize($name);
            $error = null;
            $actual = Session::instance('ThinForm')->getActual();

            if (null !== $actual) {
                $error = $actual->getErrors()->$getter();
            }

            $class = 'control-group';

            if (!empty(static::$controlGroupError) && !empty($error)) {
                $class .= ' ' . static::$controlGroupError;
            }

            $id = ' id="control-group-' . $name . '"';
            $out = '<div class="' . $class . '"' . $id . '>';
            $out .= static::buildLabel($name, $label, $required);
            $out .= '<div class="controls">' . PHP_EOL;
            $out .= ($checkbox === true) ? '<label class="checkbox">' : '';
            $out .= $field;

            if (!empty($error)) {
                $out .= '<span class="help-inline">' . $error . '</span>';
            }

            $out .= ($checkbox === true) ? '</label>' : '';
            $out .= '</div>';
            $out .= '</div>' . PHP_EOL;

            return $out;
        }
1059395
public function addMultiField($label = null, $meta = array())
    {
        $objField = new MultiField($label, $meta);

        $objField->setRequiredStyle($this->__requiredstyle);

        // *** Page already defined?
        $objPage = $this->__elements->getLast("ValidFormBuilder\\Page");
        if ($this->__elements->count() == 0 || ! is_object($objPage)) {
            $objPage = $this->addPage();
        }

        // *** Fieldset already defined?
        $objFieldset = $objPage->getElements()->getLast("ValidFormBuilder\\Fieldset");
        if ($this->__elements->count() == 0 || ! is_object($objFieldset)) {
            $objFieldset = $this->addFieldset();
        }

        $objField->setMeta("parent", $objFieldset, true);

        // *** Add field to the fieldset.
        $objFieldset->addField($objField);

        return $objField;
    }
1095248
private function formatLabel($label, $id = NULL, $attrs = array())
    {
        if($id)
            $attrs['for'] = $id;
        $ret = self::tag('label', $label, NULL, NULL, $attrs);
        return $ret;
    }
964024
public function radio($field, $label) {
        $radio = new Radio($field, $label);
        array_push($this->_elements, $radio);

        return $radio;
    }
891527
public static function get_form_field_from_label($label, RawMinkContext $context) {

        // There are moodle form elements that are not directly related with
        // a basic HTML form field, we should also take care of them.
        // The DOM node.
        $fieldnode = $context->find_field($label);

        // The behat field manager.
        return self::get_form_field($fieldnode, $context->getSession());
    }
455905
function forms_html($form, $field)
	{
		$value = isset($form->values[$field['name']]) ?
			$form->values[$field['name']] :
			(isset($field['value'])?$field['value']:'');
		$preset = isset($field['preset']) ? $field['preset'] : 'default';
		$result = "\t\t" . '<tr><td colspan="2">' . $field['label'] .
			'<br /><textarea name="wyswyg_' . $field['name'] . '" class="tinymce_' . $preset .
			'" cols="80" rows="25" style="width: 100%; height: ' .
			$field['height'].';">'.str_replace('$(httpRoot)', Eresus_CMS::getLegacyKernel()->root,
			EncodeHTML($value)).'</textarea></td></tr>'."\n";

		if (!self::$scriptsInstalled)
		{
			Eresus_Kernel::app()->getPage()->linkScripts($this->root.'tiny_mce.js');
			Eresus_Kernel::app()->getPage()->linkScripts($this->root.'presets/'.$preset.'.js');
			self::$scriptsInstalled = true;
		}

		return $result;
	}
1346265
protected function wrapField(&$fieldStub, Field $field, $standardLabel = true, $required = '')
    {
        $stub = $this->getStubContent('form-input-wrapper.blade', $this->template);

        $this->replaceFieldName($stub, $field->name)
            ->replaceCssClass($stub, $field->cssClass)
            ->replaceFieldLabel($stub, $this->getLabelFromField($standardLabel ? $field : null))
            ->replaceFieldValidationHelper($stub, $this->getNewHelper($field))
            ->replaceFieldInput($stub, $fieldStub)
            ->replaceRequiredClass($stub, $required);

        $fieldStub = $stub;

        return $this;
    }
861278
protected function handleTableColumn($method, $label)
    {
        if (empty($this->dbColumns)) {
            $this->setDbColumns();
        }

        if ($this->dbColumns->has($method)) {
            return $this->addColumn($method, $label);
        }

        return false;
    }
1354386
protected function addAddress($address, $label, $field)
    {
        $label = is_string($label) ? trim($label) : $label;
        $address = is_string($address) ? trim($address) : $label;

        $label = $label ?: $address;

        if (!empty($address)) {
            $this->{$field}[$address] = $label;
        }
    }
209227
public function editField($field_id = null)
    {
        $this->setField($field_id);
        $this->setTitleEditField();
        $this->setBreadcrumbEditField();

        $this->setData('field', $this->data_field);
        $this->setData('types', $this->field->getTypes());
        $this->setData('can_delete', $this->canDeleteField());
        $this->setData('widget_types', $this->field->getWidgetTypes());
        $this->setData('languages', $this->language->getList(array('enabled' => true)));

        $this->submitEditField();
        $this->outputEditField();
    }
128608
public function label($name, $label, array $attr = null)
    {
        return $this->input($name, [ 'type' => 'label', 'label' => $label, 'attr' => $attr ]);
    }