2007-10-18 01:21:55 +00:00
|
|
|
<?php
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
class NumericScoreTheme extends Themelet
|
|
|
|
{
|
|
|
|
public function get_voter(Image $image)
|
|
|
|
{
|
|
|
|
global $user, $page;
|
|
|
|
$i_image_id = int_escape($image->id);
|
|
|
|
$i_score = int_escape($image->numeric_score);
|
|
|
|
|
|
|
|
$html = "
|
2008-07-21 15:16:48 +00:00
|
|
|
Current Score: $i_score
|
|
|
|
|
|
|
|
<p><form action='".make_link("numeric_score_vote")."' method='POST'>
|
2010-05-28 13:26:46 +00:00
|
|
|
".$user->get_auth_html()."
|
2008-07-21 15:16:48 +00:00
|
|
|
<input type='hidden' name='image_id' value='$i_image_id'>
|
|
|
|
<input type='hidden' name='vote' value='up'>
|
|
|
|
<input type='submit' value='Vote Up'>
|
|
|
|
</form>
|
|
|
|
|
2010-05-28 10:58:26 +00:00
|
|
|
<form action='".make_link("numeric_score_vote")."' method='POST'>
|
2010-05-28 13:26:46 +00:00
|
|
|
".$user->get_auth_html()."
|
2010-05-28 10:58:26 +00:00
|
|
|
<input type='hidden' name='image_id' value='$i_image_id'>
|
|
|
|
<input type='hidden' name='vote' value='null'>
|
|
|
|
<input type='submit' value='Remove Vote'>
|
|
|
|
</form>
|
|
|
|
|
|
|
|
<form action='".make_link("numeric_score_vote")."' method='POST'>
|
2010-05-28 13:26:46 +00:00
|
|
|
".$user->get_auth_html()."
|
2008-07-21 15:16:48 +00:00
|
|
|
<input type='hidden' name='image_id' value='$i_image_id'>
|
|
|
|
<input type='hidden' name='vote' value='down'>
|
|
|
|
<input type='submit' value='Vote Down'>
|
|
|
|
</form>
|
2007-10-18 02:29:39 +00:00
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
if ($user->can("edit_other_vote")) {
|
|
|
|
$html .= "
|
2011-03-23 11:04:22 +00:00
|
|
|
<form action='".make_link("numeric_score/remove_votes_on")."' method='POST'>
|
|
|
|
".$user->get_auth_html()."
|
|
|
|
<input type='hidden' name='image_id' value='$i_image_id'>
|
|
|
|
<input type='submit' value='Remove All Votes'>
|
|
|
|
</form>
|
2011-11-08 11:23:38 +00:00
|
|
|
|
2013-07-06 09:42:06 +00:00
|
|
|
<br><div id='votes-content'>
|
|
|
|
<a
|
|
|
|
href='".make_link("numeric_score_votes/$i_image_id")."'
|
|
|
|
onclick='$(\"#votes-content\").load(\"".make_link("numeric_score_votes/$i_image_id")."\"); return false;'
|
|
|
|
>See All Votes</a>
|
|
|
|
</div>
|
2011-03-23 11:04:22 +00:00
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
}
|
|
|
|
$page->add_block(new Block("Image Score", $html, "left", 20));
|
|
|
|
}
|
|
|
|
|
|
|
|
public function get_nuller(User $duser)
|
|
|
|
{
|
|
|
|
global $user, $page;
|
|
|
|
$html = "
|
2011-03-28 21:31:45 +00:00
|
|
|
<form action='".make_link("numeric_score/remove_votes_by")."' method='POST'>
|
|
|
|
".$user->get_auth_html()."
|
|
|
|
<input type='hidden' name='user_id' value='{$duser->id}'>
|
|
|
|
<input type='submit' value='Delete all votes by this user'>
|
|
|
|
</form>
|
|
|
|
";
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->add_block(new Block("Votes", $html, "main", 80));
|
|
|
|
}
|
2012-01-24 20:11:16 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
public function view_popular($images, $dte)
|
|
|
|
{
|
|
|
|
global $page, $config;
|
2012-01-24 20:11:16 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$pop_images = "";
|
|
|
|
foreach ($images as $image) {
|
|
|
|
$pop_images .= $this->build_thumb_html($image)."\n";
|
|
|
|
}
|
2012-01-24 20:11:16 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$b_dte = make_link("popular_by_".$dte[3]."?".date($dte[2], (strtotime('-1 '.$dte[3], strtotime($dte[0])))));
|
|
|
|
$f_dte = make_link("popular_by_".$dte[3]."?".date($dte[2], (strtotime('+1 '.$dte[3], strtotime($dte[0])))));
|
2012-01-26 05:39:04 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$html = "\n".
|
|
|
|
"<center>\n".
|
|
|
|
" <h3>\n".
|
|
|
|
" <a href='{$b_dte}'>«</a> {$dte[1]} <a href='{$f_dte}'>»</a>\n".
|
|
|
|
" </h3>\n".
|
|
|
|
"</center>\n".
|
|
|
|
"<br/>\n".$pop_images;
|
2012-01-26 05:39:04 +00:00
|
|
|
|
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$nav_html = "<a href=".make_link().">Index</a>";
|
2012-01-24 20:11:16 +00:00
|
|
|
|
2019-05-28 16:59:38 +00:00
|
|
|
$page->set_heading($config->get_string('title'));
|
|
|
|
$page->add_block(new Block("Navigation", $nav_html, "left", 10));
|
|
|
|
$page->add_block(new Block(null, $html, "main", 30));
|
|
|
|
}
|
2007-10-18 01:21:55 +00:00
|
|
|
}
|