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

43 lines
1.4 KiB
PHP
Raw Normal View History

2021-12-14 18:32:47 +00:00
<?php
declare(strict_types=1);
namespace Shimmie2;
2023-07-10 18:03:54 +00:00
use MicroHTML\HTMLElement;
use function MicroHTML\emptyHTML;
use function MicroHTML\rawHTML;
use function MicroHTML\{BR,CODE,INPUT};
2023-07-10 18:03:54 +00:00
class AliasEditorTheme extends Themelet
{
/**
* Show a page of aliases.
*/
2023-07-10 18:03:54 +00:00
public function display_aliases(HTMLElement $table, HTMLElement $paginator): void
{
global $page, $user;
2012-02-07 15:15:18 +00:00
$info_html = rawHTML("A tag alias replaces a tag with another tag or tags.".BR()."A tag implication (where the old tag stays and adds a new tag) is made by including the old tag in the list of new tags (".CODE("fox")."&nbsp;→&nbsp;".CODE("fox canine").")".BR());
$html = emptyHTML($info_html, BR(), $table, BR(), $paginator, BR(), SHM_A("alias/export/aliases.csv", "Download as CSV", args: ["download" => "aliases.csv"]));
2009-08-03 09:24:32 +00:00
2023-07-10 18:03:54 +00:00
$bulk_form = SHM_FORM("alias/import", multipart: true);
$bulk_form->appendChild(
2023-11-11 21:49:12 +00:00
INPUT(["type" => "file", "name" => "alias_file"]),
2023-07-10 18:03:54 +00:00
SHM_SUBMIT("Upload List")
);
$bulk_html = emptyHTML($bulk_form);
2009-01-04 19:18:37 +00:00
$page->set_title("Alias List");
$page->set_heading("Alias List");
$page->add_block(new NavBlock());
$page->add_block(new Block("Aliases", $html));
2023-07-10 18:03:54 +00:00
if ($user->can(Permissions::MANAGE_ALIAS_LIST)) {
$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
}
}
}