* @package tao */ use oat\tao\helpers\form\elements\xhtml\XhtmlRenderingTrait; /** * Treebox widget */ class tao_helpers_form_elements_xhtml_Treebox extends tao_helpers_form_elements_Treebox { use XhtmlRenderingTrait; /** * * @var core_kernel_classes_Class */ protected $range; /** * * @return void */ public function feed() { $expression = "/^" . preg_quote($this->name, "/") . "(.)*[0-9]+$/"; $this->setValues([]); foreach ($_POST as $key => $value) { if (preg_match($expression, $key)) { $this->addValue(tao_helpers_Uri::decode($value)); } } } /** * * @param string $format * * @return array */ public function getOptions($format = 'flat') { switch ($format) { case 'structured': $returnValue = parent::getOptions(); break; case 'flat': default: $returnValue = tao_helpers_form_GenerisFormFactory::extractTreeData(parent::getOptions()); break; } return $returnValue; } /** * * @param string $value * * @return void */ public function setValue($value) { $this->addValue($value); } /** * * @return string */ public function render() { $widgetTreeName = $this->name . '-TreeBox'; $widgetValueName = $this->name . '-TreeValues'; $returnValue = $this->renderLabel(); $returnValue .= "