2020-01-26 13:19:35 +00:00
|
|
|
<?php declare(strict_types=1);
|
2019-10-14 18:35:33 +00:00
|
|
|
|
|
|
|
class ApprovalTheme extends Themelet
|
|
|
|
{
|
2019-11-02 04:45:28 +00:00
|
|
|
public function get_image_admin_html(Image $image)
|
2019-10-14 18:35:33 +00:00
|
|
|
{
|
2019-11-02 19:57:34 +00:00
|
|
|
if ($image->approved===true) {
|
2019-11-02 04:45:28 +00:00
|
|
|
$html = "
|
|
|
|
".make_form(make_link('disapprove_image/'.$image->id), 'POST')."
|
|
|
|
<input type='hidden' name='image_id' value='$image->id'>
|
|
|
|
<input type='submit' value='Disapprove'>
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
} else {
|
|
|
|
$html = "
|
|
|
|
".make_form(make_link('approve_image/'.$image->id), 'POST')."
|
|
|
|
<input type='hidden' name='image_id' value='$image->id'>
|
2019-10-14 18:35:33 +00:00
|
|
|
<input type='submit' value='Approve'>
|
|
|
|
</form>
|
|
|
|
";
|
2019-11-02 04:45:28 +00:00
|
|
|
}
|
2019-10-14 18:35:33 +00:00
|
|
|
|
|
|
|
return $html;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public function get_help_html()
|
|
|
|
{
|
|
|
|
return '<p>Search for images that are approved/not approved.</p>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>approved:yes</pre>
|
|
|
|
<p>Returns images that have been approved.</p>
|
|
|
|
</div>
|
|
|
|
<div class="command_example">
|
|
|
|
<pre>approved:no</pre>
|
|
|
|
<p>Returns images that have not been approved.</p>
|
|
|
|
</div>
|
|
|
|
';
|
|
|
|
}
|
|
|
|
|
2019-10-14 19:40:15 +00:00
|
|
|
public function display_admin_block(SetupBuildingEvent $event)
|
|
|
|
{
|
|
|
|
$sb = new SetupBlock("Approval");
|
|
|
|
$sb->add_bool_option(ApprovalConfig::IMAGES, "Images: ");
|
|
|
|
$event->panel->add_block($sb);
|
|
|
|
}
|
|
|
|
|
2019-10-14 18:35:33 +00:00
|
|
|
public function display_admin_form()
|
|
|
|
{
|
|
|
|
global $page;
|
2019-10-14 19:40:15 +00:00
|
|
|
|
2019-10-14 18:35:33 +00:00
|
|
|
$html = make_form(make_link("admin/approval"), "POST");
|
|
|
|
$html .= "<button name='approval_action' value='approve_all'>Approve All Images</button><br/>";
|
2019-11-02 04:45:28 +00:00
|
|
|
$html .= "<button name='approval_action' value='disapprove_all'>Disapprove All Images</button>";
|
2019-10-14 18:35:33 +00:00
|
|
|
$html .= "</form>\n";
|
|
|
|
$page->add_block(new Block("Approval", $html));
|
|
|
|
}
|
|
|
|
}
|