make_link($target), "method" => 'POST' ]; if ($form_id) { $attrs["id"] = $form_id; } if ($multipart) { $attrs["enctype"] = 'multipart/form-data'; } if ($onsubmit) { $attrs["onsubmit"] = $onsubmit; } if ($name) { $attrs["name"] = $name; } return FORM( $attrs, INPUT(["type" => "hidden", "name" => "auth_token", "value" => $user->get_auth_token()]) ); } /** * @param array $children */ function SHM_SIMPLE_FORM(string $target, ...$children): HTMLElement { $form = SHM_FORM($target); $form->appendChild(emptyHTML(...$children)); return $form; } /** * @param array $args */ function SHM_SUBMIT(string $text, array $args = []): HTMLElement { $args["type"] = "submit"; $args["value"] = $text; return INPUT($args); } /** * @param array $args */ function SHM_A(string $href, string|HTMLElement $text, string $id = "", string $class = "", array $args = []): HTMLElement { $args["href"] = make_link($href); if ($id) { $args["id"] = $id; } if ($class) { $args["class"] = $class; } return A($args, $text); } function SHM_COMMAND_EXAMPLE(string $ex, string $desc): HTMLElement { return DIV( ["class" => "command_example"], CODE($ex), P($desc) ); } function SHM_USER_FORM(User $duser, string $target, string $title, HTMLElement $body, HTMLElement|string $foot): HTMLElement { if (is_string($foot)) { $foot = TFOOT(TR(TD(["colspan" => "2"], INPUT(["type" => "submit", "value" => $foot])))); } return SHM_SIMPLE_FORM( $target, P( INPUT(["type" => 'hidden', "name" => 'id', "value" => $duser->id]), TABLE( ["class" => "form"], THEAD(TR(TH(["colspan" => "2"], $title))), $body, $foot ) ) ); } /** * Generates a . * @param array $options An array of pairs of parameters for