2007-10-02 21:59:20 +00:00
|
|
|
<?php
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class RatingsTheme extends Themelet
|
|
|
|
{
|
|
|
|
public function get_rater_html(int $image_id, string $rating, bool $can_rate): string
|
|
|
|
{
|
|
|
|
$s_checked = $rating == 's' ? " checked" : "";
|
|
|
|
$q_checked = $rating == 'q' ? " checked" : "";
|
|
|
|
$e_checked = $rating == 'e' ? " checked" : "";
|
|
|
|
$human_rating = Ratings::rating_to_human($rating);
|
|
|
|
$html = "
|
2008-04-08 16:54:13 +00:00
|
|
|
<tr>
|
2012-03-11 15:49:37 +00:00
|
|
|
<th>Rating</th>
|
2008-04-08 16:54:13 +00:00
|
|
|
<td>
|
2016-09-13 06:10:48 +00:00
|
|
|
".($can_rate ? "
|
2016-09-12 03:26:20 +00:00
|
|
|
<span class='view'>$human_rating</span>
|
|
|
|
<span class='edit'>
|
|
|
|
<input type='radio' name='rating' value='s' id='s'$s_checked><label for='s'>Safe</label>
|
|
|
|
<input type='radio' name='rating' value='q' id='q'$q_checked><label for='q'>Questionable</label>
|
|
|
|
<input type='radio' name='rating' value='e' id='e'$e_checked><label for='e'>Explicit</label>
|
|
|
|
</span>
|
2016-09-13 06:10:48 +00:00
|
|
|
" : "
|
|
|
|
$human_rating
|
|
|
|
")."
|
2008-04-08 16:54:13 +00:00
|
|
|
</td>
|
|
|
|
</tr>
|
2007-10-02 21:59:20 +00:00
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
return $html;
|
|
|
|
}
|
2007-11-04 08:16:41 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function display_bulk_rater(string $terms)
|
|
|
|
{
|
|
|
|
global $page;
|
|
|
|
$html = "
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("admin/bulk_rate"))."
|
2012-03-19 20:16:40 +00:00
|
|
|
<input type='hidden' name='query' value='".html_escape($terms)."'>
|
|
|
|
<select name='rating'>
|
|
|
|
<option value='s'>Safe</option>
|
|
|
|
<option value='q'>Questionable</option>
|
|
|
|
<option value='e'>Explicit</option>
|
|
|
|
<option value='u'>Unrated</option>
|
|
|
|
</select>
|
|
|
|
<input type='submit' value='Go'>
|
2009-08-02 07:19:43 +00:00
|
|
|
</form>
|
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->add_block(new Block("List Controls", $html, "left"));
|
|
|
|
}
|
2019-06-05 23:03:22 +00:00
|
|
|
|
2019-06-14 12:47:50 +00:00
|
|
|
public function get_selection_rater_html(String $id = "select_rating")
|
|
|
|
{
|
2019-06-05 23:03:22 +00:00
|
|
|
return "<select name='".$id."'>
|
|
|
|
<option value='s'>Safe</option>
|
|
|
|
<option value='q'>Questionable</option>
|
|
|
|
<option value='e'>Explicit</option>
|
|
|
|
<option value='u'>Unrated</option>
|
|
|
|
</select>";
|
|
|
|
}
|
2019-08-02 20:05:49 +00:00
|
|
|
|
|
|
|
public function get_help_html(array $ratings)
|
|
|
|
{
|
|
|
|
$output = '<p>Search for images with one or more possible ratings.</p>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>rating:'.$ratings[0]->search_term.'</pre>
|
|
|
|
<p>Returns images with the '.$ratings[0]->name.' rating.</p>
|
|
|
|
</div>
|
|
|
|
<p>Ratings can be abbreviated to a single letter as well</p>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>rating:'.$ratings[0]->code.'</pre>
|
|
|
|
<p>Returns images with the '.$ratings[0]->name.' rating.</p>
|
|
|
|
</div>
|
|
|
|
<p>If abbreviations are used, multiple ratings can be searched for.</p>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>rating:'.$ratings[0]->code.$ratings[1]->code.'</pre>
|
|
|
|
<p>Returns images with the '.$ratings[0]->name.' or '.$ratings[1]->name.' rating.</p>
|
|
|
|
</div>
|
|
|
|
<p>Available ratings:</p>
|
|
|
|
<table>
|
|
|
|
<tr><th>Name</th><th>Search Term</th><th>Abbreviation</th></tr>
|
|
|
|
';
|
|
|
|
foreach ($ratings as $rating) {
|
|
|
|
$output .= "<tr><td>{$rating->name}</td><td>{$rating->search_term}</td><td>{$rating->code}</td></tr>";
|
|
|
|
}
|
|
|
|
$output .= "</table>";
|
|
|
|
return $output;
|
|
|
|
}
|
2007-10-02 21:59:20 +00:00
|
|
|
}
|