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

37 lines
1 KiB
PHP
Raw Normal View History

2020-01-26 13:19:35 +00:00
<?php declare(strict_types=1);
class AliasEditorTheme extends Themelet
{
/**
* Show a page of aliases.
*
* Note: $can_manage = whether things like "add new alias" should be shown
*/
2019-12-01 01:02:18 +00:00
public function display_aliases($table, $paginator): void
{
global $page, $user;
2012-02-07 15:15:18 +00:00
2019-07-09 14:10:21 +00:00
$can_manage = $user->can(Permissions::MANAGE_ALIAS_LIST);
$html = "
2019-12-01 01:02:18 +00:00
$table
$paginator
<p><a href='".make_link("alias/export/aliases.csv")."' download='aliases.csv'>Download as CSV</a></p>
2009-08-03 09:24:32 +00:00
";
$bulk_html = "
".make_form(make_link("alias/import"), 'post', true)."
<input type='file' name='alias_file'>
<input type='submit' value='Upload List'>
</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));
if ($can_manage) {
$page->add_block(new Block("Bulk Upload", $bulk_html, "main", 51));
}
}
}