mirror of
https://github.com/pfsense/pfsense.git
synced 2025-10-26 11:38:35 +00:00
system - removed trailing unused form-html Form - set proper width for submit-button column Element - support returning raw-list for Inputs Group,Input - renamed getColumnWidth to getWidth Input - make setWidth consistent with Form->setWidth, directly add proper class to column
53 lines
930 B
PHP
53 lines
930 B
PHP
<?php
|
|
|
|
class Form_Section extends Form_Element
|
|
{
|
|
protected $_title;
|
|
protected $_groups = array();
|
|
|
|
public function __construct($title)
|
|
{
|
|
$this->_title = $title;
|
|
}
|
|
|
|
public function add(Form_Group $group)
|
|
{
|
|
array_push($this->_groups, $group);
|
|
$group->_setParent($this);
|
|
|
|
return $group;
|
|
}
|
|
|
|
// Shortcut, adds a group for the specified input
|
|
public function addInput(Form_Input $input)
|
|
{
|
|
$group = new Form_Group($input->getTitle());
|
|
$group->add($input);
|
|
|
|
$this->add($group);
|
|
|
|
return $input;
|
|
}
|
|
|
|
// Potentially allow overloading
|
|
public function getLabelWidth()
|
|
{
|
|
return $this->_parent->getLabelWidth();
|
|
}
|
|
|
|
public function __toString()
|
|
{
|
|
$title = gettext($this->_title);
|
|
$body = implode('', $this->_groups);
|
|
|
|
return <<<EOT
|
|
<div class="panel panel-default">
|
|
<div class="panel-heading">
|
|
<h2 class="panel-title">{$title}</h2>
|
|
</div>
|
|
|
|
<div class="panel-body">{$body}</div>
|
|
</div>
|
|
EOT;
|
|
}
|
|
} |