This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/ext/rating/theme.php

50 lines
1.4 KiB
PHP
Raw Normal View History

<?php
class RatingsTheme extends Themelet {
2012-02-10 04:04:37 +00:00
public function get_rater_html(/*int*/ $image_id, /*string*/ $rating) {
$i_image_id = int_escape($image_id);
$s_checked = $rating == 's' ? " checked" : "";
$q_checked = $rating == 'q' ? " checked" : "";
$e_checked = $rating == 'e' ? " checked" : "";
$html = "
<tr>
2012-03-11 15:49:37 +00:00
<th>Rating</th>
<td>
<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>
</td>
</tr>
";
return $html;
}
public function display_bulk_rater($terms) {
2009-08-02 07:19:43 +00:00
global $page;
$html = "
".make_form(make_link("admin/bulk_rate"))."
<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>
";
$page->add_block(new Block("List Controls", $html, "left"));
2009-08-02 07:19:43 +00:00
}
2012-02-10 04:04:37 +00:00
public function rating_to_name(/*string*/ $rating) {
switch($rating) {
case 's': return "Safe";
case 'q': return "Questionable";
case 'e': return "Explicit";
default: return "Unknown";
}
}
}
?>