From ca88b28b1ea682074a7b4567e972465bb85703ff Mon Sep 17 00:00:00 2001 From: Luana Date: Sun, 25 Jun 2023 21:31:11 -0300 Subject: [PATCH] use MicroHTML --- core/basethemelet.php | 24 +++++++++++++++++------- ext/pools/theme.php | 2 +- ext/rating/theme.php | 6 +++--- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/core/basethemelet.php b/core/basethemelet.php index b1995660..69284878 100644 --- a/core/basethemelet.php +++ b/core/basethemelet.php @@ -6,7 +6,7 @@ namespace Shimmie2; use MicroHTML\HTMLElement; -use function MicroHTML\{A,B,BR,IMG,emptyHTML}; +use function MicroHTML\{A,B,BR,IMG,OPTION,SELECT,emptyHTML}; /** * Class BaseThemelet @@ -201,22 +201,32 @@ class BaseThemelet * @param bool $empty_option Whether the first option should be an empty one. * @param array $selected_options The values of options that should be pre-selected. */ - protected function build_selector(string $name, array $options, string $attributes="", bool $empty_option=false, array $selected_options=[]): string + protected function build_selector(string $name, array $options, bool $required=false, bool $multiple=false, bool $empty_option=false, array $selected_options=[]): string { - $output = ""; + return (string)$s; } } diff --git a/ext/pools/theme.php b/ext/pools/theme.php index ea85d724..9dd7962f 100644 --- a/ext/pools/theme.php +++ b/ext/pools/theme.php @@ -388,7 +388,7 @@ class PoolsTheme extends Themelet public function get_bulk_pool_selector(array $options): string { - return $this->build_selector("bulk_pool_select", $options, "required", true); + return $this->build_selector("bulk_pool_select", $options, required: true, empty_option: true); } public function get_bulk_pool_input(array $search_terms): string diff --git a/ext/rating/theme.php b/ext/rating/theme.php index f9463b6f..895a3633 100644 --- a/ext/rating/theme.php +++ b/ext/rating/theme.php @@ -33,8 +33,8 @@ class RatingsTheme extends Themelet $html = make_form(make_link("admin/update_ratings")).""; - $html .= ""; - $html .= ""; + $html .= ""; + $html .= ""; $html .= "
Change".$this->build_selector("rating_old", $current_ratings, "required", true)."
To".$this->build_selector("rating_new", Ratings::get_ratings_dict(), "required", true)."
Change".$this->build_selector("rating_old", $current_ratings, required: true)."
To".$this->build_selector("rating_new", Ratings::get_ratings_dict(), required: true)."
\n"; @@ -44,7 +44,7 @@ class RatingsTheme extends Themelet public function get_selection_rater_html(array $selected_options, bool $multiple = false): string { - return $this->build_selector($multiple ? "rating[]" : "rating", Ratings::get_ratings_dict(), ($multiple ? "multiple" : ""), false, $selected_options); + return $this->build_selector("rating", Ratings::get_ratings_dict(), multiple: $multiple, empty_option: false, selected_options: $selected_options); } public function get_help_html(array $ratings): string