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/image/theme.php

34 lines
956 B
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
2020-01-26 13:19:35 +00:00
use function MicroHTML\INPUT;
class ImageIOTheme extends Themelet
{
/**
* Display a link to delete an image
* (Added inline Javascript to confirm the deletion)
*/
public function get_deleter_html(int $image_id): string
{
return (string)"<span id='image_delete_form'>".SHM_SIMPLE_FORM(
2020-01-30 10:31:11 +00:00
"image/delete",
2023-11-11 21:49:12 +00:00
INPUT(["type" => 'hidden', "name" => 'image_id', "value" => $image_id]),
INPUT(["type" => 'submit', "value" => 'Delete', "onclick" => 'return confirm("Delete the image?");', "id" => "image_delete_button"]),
)."</span>";
}
2014-04-25 02:29:29 +00:00
/**
* Display link to replace the image
*/
public function get_replace_html(int $image_id): string
{
$form = SHM_FORM("replace/$image_id", "GET");
$form->appendChild(INPUT(["type" => 'submit', "value" => 'Replace']));
return (string)$form;
}
}