コード例 #1
0
    public function __toString()
    {
        $element = parent::__toString();
        $html = implode('', $this->_sections);
        $buttons = '';
        foreach ($this->_global as $global) {
            if ($global instanceof Form_Button) {
                $buttons .= $global;
            } else {
                $html .= $global;
            }
        }
        if (!empty($buttons)) {
            $group = new Form_Element();
            $group->addClass('col-sm-' . Form::MAX_INPUT_WIDTH, 'col-sm-offset-' . Form::LABEL_WIDTH);
            $html .= $group . $buttons . '</div>';
        }
        return <<<EOT
\t{$element}
\t\t{$html}
\t</form>
EOT;
    }
コード例 #2
0
    public function __toString()
    {
        $element = Form_Element::__toString();
        $column = new Form_Element();
        $column->addClass('checkbox', 'multi', 'col-sm-10');
        $inputs = implode('', $this->_inputs);
        $help = $this->_getHelp();
        $label = new Form_Element('label');
        $label->addClass('col-sm-' . Form::LABEL_WIDTH, 'control-label');
        $title = htmlspecialchars(gettext($this->_title));
        return <<<EOT
\t{$element}
\t\t{$label}
\t\t\t{$title}
\t\t</label>

\t\t{$column}
\t\t\t{$inputs}
\t\t</div>

\t\t{$help}
\t</div>
EOT;
    }
コード例 #3
0
ファイル: Group.class.php プロジェクト: NewEraCracker/pfsense
    public function __toString()
    {
        global $config, $user_settings;
        $element = parent::__toString();
        // Automatically determine width for inputs without explicit set
        $spaceLeft = Form::MAX_INPUT_WIDTH;
        $missingWidth = array();
        foreach ($this->_inputs as $input) {
            if (count($this->_inputs) > 1 && !$input->hasAttribute('placeholder')) {
                $input->setPlaceholder($input->getTitle());
            }
            $width = $input->getWidth();
            if (isset($width)) {
                $spaceLeft -= $width;
            } else {
                array_push($missingWidth, $input);
            }
        }
        foreach ($missingWidth as $input) {
            $input->setWidth($spaceLeft / count($missingWidth));
        }
        if (strtolower($this->_labelTarget->getType()) == 'hidden') {
            $hidden = true;
        }
        $form_controls = array('input', 'select', 'button', 'textarea', 'option', 'optgroup', 'fieldset', 'label');
        if (in_array(strtolower($this->_labelTarget->getTagName()), $form_controls) && !$hidden) {
            $target = $this->_labelTarget->getId();
        }
        $inputs = implode('', $this->_inputs);
        $help = $this->_getHelp();
        if (!$user_settings['webgui']['webguileftcolumnhyper']) {
            $target = null;
        }
        $label = new Form_Element('label', false, ['for' => $target]);
        $label->addClass('col-sm-' . Form::LABEL_WIDTH, 'control-label');
        if (!empty(trim($this->_title)) || is_numeric($this->_title)) {
            $title = htmlspecialchars(gettext($this->_title));
        }
        return <<<EOT
\t{$element}
\t\t{$label}
\t\t\t{$title}
\t\t</label>
\t\t{$inputs}
\t\t{$help}
\t</div>
EOT;
    }
コード例 #4
0
ファイル: Group.class.php プロジェクト: michaeleino/pfsense
    public function __toString()
    {
        $element = parent::__toString();
        // Automatically determine width for inputs without explicit set
        $spaceLeft = Form::MAX_INPUT_WIDTH;
        $missingWidth = array();
        foreach ($this->_inputs as $input) {
            if (count($this->_inputs) > 1 && !$input->hasAttribute('placeholder')) {
                $input->setPlaceholder($input->getTitle());
            }
            $width = $input->getWidth();
            if (isset($width)) {
                $spaceLeft -= $width;
            } else {
                array_push($missingWidth, $input);
            }
        }
        foreach ($missingWidth as $input) {
            $input->setWidth($spaceLeft / count($missingWidth));
        }
        $target = $this->_labelTarget->getId();
        $inputs = implode('', $this->_inputs);
        $help = $this->_getHelp();
        $label = new Form_Element('label', false, ['for' => $target]);
        $label->addClass('col-sm-' . Form::LABEL_WIDTH, 'control-label');
        $title = htmlspecialchars(gettext($this->_title));
        return <<<EOT
\t{$element}
\t\t{$label}
\t\t\t{$title}
\t\t</label>
\t\t{$inputs}
\t\t{$help}
\t</div>
EOT;
    }