Rating
".($can_rate ? "
$human_rating
".$this->get_selection_rater_html([$rating])."
" : "
$human_rating
")."
";
return $html;
}
public function display_form(array $current_ratings, array $available_ratings)
{
global $page;
$html = make_form(make_link("admin/update_ratings"))."
\n";
$page->add_block(new Block("Update Ratings", $html));
}
// public function display_bulk_rater(string $terms)
// {
// global $page;
// $html = "
// ".make_form(make_link("admin/bulk_rate"))."
//
//
// Safe
// Questionable
// Explicit
// Unrated
//
//
//
// ";
// $page->add_block(new Block("List Controls", $html, "left"));
// }
public function get_selection_rater_html(array $selected_options, bool $multiple = false, array $available_options = null)
{
$output = "";
$options = Ratings::get_sorted_ratings();
foreach ($options as $option) {
if ($available_options!=null && !in_array($option->code, $available_options)) {
continue;
}
$output .= "code, $selected_options) ? "selected='selected'": "")
.">".$option->name." ";
}
return $output." ";
}
public function get_help_html(array $ratings)
{
$output = 'Search for images with one or more possible ratings.
rating:'.$ratings[0]->search_term.'
Returns images with the '.$ratings[0]->name.' rating.
Ratings can be abbreviated to a single letter as well
rating:'.$ratings[0]->code.'
Returns images with the '.$ratings[0]->name.' rating.
If abbreviations are used, multiple ratings can be searched for.
rating:'.$ratings[0]->code.$ratings[1]->code.'
Returns images with the '.$ratings[0]->name.' or '.$ratings[1]->name.' rating.
Available ratings:
Name Search Term Abbreviation
';
foreach ($ratings as $rating) {
$output .= "{$rating->name} {$rating->search_term} {$rating->code} ";
}
$output .= "
";
return $output;
}
public function get_user_options(User $user, array $selected_ratings, array $available_ratings): string
{
$html = "
".make_form(make_link("user_admin/default_ratings"))."
";
return $html;
}
}