2009-11-24 14:07:18 +00:00
|
|
|
<?php
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class FavoritesTheme extends Themelet
|
|
|
|
{
|
|
|
|
public function get_voter_html(Image $image, $is_favorited)
|
|
|
|
{
|
|
|
|
$i_image_id = int_escape($image->id);
|
|
|
|
$name = $is_favorited ? "unset" : "set";
|
|
|
|
$label = $is_favorited ? "Un-Favorite" : "Favorite";
|
|
|
|
$html = "
|
2010-09-22 11:56:19 +00:00
|
|
|
".make_form(make_link("change_favorite"))."
|
2010-05-28 13:26:46 +00:00
|
|
|
<input type='hidden' name='image_id' value='$i_image_id'>
|
|
|
|
<input type='hidden' name='favorite_action' value='$name'>
|
|
|
|
<input type='submit' value='$label'>
|
|
|
|
</form>
|
|
|
|
";
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
return $html;
|
|
|
|
}
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function display_people($username_array)
|
|
|
|
{
|
|
|
|
global $page;
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$i_favorites = count($username_array);
|
|
|
|
$html = "$i_favorites people:";
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
reset($username_array); // rewind to first element in array.
|
|
|
|
|
|
|
|
foreach ($username_array as $row) {
|
|
|
|
$username = html_escape($row);
|
|
|
|
$html .= "<br><a href='".make_link("user/$username")."'>$username</a>";
|
|
|
|
}
|
2009-11-24 14:07:18 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->add_block(new Block("Favorited By", $html, "left", 25));
|
|
|
|
}
|
2019-08-02 20:05:49 +00:00
|
|
|
|
|
|
|
public function get_help_html()
|
|
|
|
{
|
|
|
|
return '<p>Search for images that have been favorited a certain number of times, or favorited by a particular individual.</p>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>favorites=1</pre>
|
|
|
|
<p>Returns images that have been favorited once.</p>
|
|
|
|
</div>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>favorites>0</pre>
|
|
|
|
<p>Returns images that have been favorited 1 or more times</p>
|
|
|
|
</div>
|
|
|
|
<p>Can use <, <=, >, >=, or =.</p>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>favorited_by:username</pre>
|
|
|
|
<p>Returns images that have been favorited by "username". </p>
|
|
|
|
</div>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>favorited_by_userno:123</pre>
|
|
|
|
<p>Returns images that have been favorited by user 123. </p>
|
|
|
|
</div>
|
|
|
|
';
|
|
|
|
}
|
2009-11-24 14:07:18 +00:00
|
|
|
}
|