private function getGroup() { if ($this->group != null) { return $this->group; } $group = null; $callback = function (Component &$component) use(&$group) { $group = $component; return Component::VISITOR_STOP_TRAVERSAL; }; $this->visitParents(RadioGroup::getIdentifier(), $callback); $this->group = $group; if ($group == null) { throw new \RuntimeException('A radio must be a child of RadioGroup'); } return $group; }
$formElements = ""; foreach ($keys as $key) { if ($key === "id") { $input = PartialParser::Parse('hidden', ["name" => "id[]", "value" => $result['id']]) . $result['id']; } else { if ($key === "email") { $input = PartialParser::Parse('text', ["name" => "email" . $result['id'], "value" => $result[$key], "size" => 15]); } else { if ($key === "pLevel") { $dropdown = new DropDown("userlevel" . $result['id'], $userLevels, array_search($result[$key], $userLevels)); $input = $dropdown->Html(); } else { if ($key === "activated") { $checked = $result[$key]; $values = [["Yes", "1"], ["No", "0"]]; $radio = new RadioGroup($key . $result['id'], $checked, $values); $input = $radio->Html(); } else { $input = $result[$key]; } } } } $formElements .= PartialParser::Parse('table-cell', ["content" => $input]); } $row .= PartialParser::Parse('table-row', ["content" => $formElements]); } $formElements = $row; // create the save button $input = PartialParser::Parse('button', ["value" => "Save", "type" => "submit", "id" => "save"]); // create the cancel button