2020-01-26 13:19:35 +00:00
|
|
|
<?php declare(strict_types=1);
|
2007-06-30 01:19:11 +00:00
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
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
|
2019-05-28 17:59:38 +01:00
|
|
|
{
|
|
|
|
global $page, $user;
|
2012-02-07 15:15:18 +00:00
|
|
|
|
2019-07-09 09:10:21 -05:00
|
|
|
$can_manage = $user->can(Permissions::MANAGE_ALIAS_LIST);
|
2019-05-28 17:59:38 +01:00
|
|
|
$html = "
|
2019-12-01 01:02:18 +00:00
|
|
|
$table
|
|
|
|
$paginator
|
2015-03-20 22:16:20 +00:00
|
|
|
<p><a href='".make_link("alias/export/aliases.csv")."' download='aliases.csv'>Download as CSV</a></p>
|
2009-08-03 10:24:32 +01:00
|
|
|
";
|
|
|
|
|
2019-05-28 17:59:38 +01:00
|
|
|
$bulk_html = "
|
2013-07-06 00:12:25 +02:00
|
|
|
".make_form(make_link("alias/import"), 'post', true)."
|
2008-02-16 03:58:05 +00:00
|
|
|
<input type='file' name='alias_file'>
|
|
|
|
<input type='submit' value='Upload List'>
|
|
|
|
</form>
|
2007-06-30 01:19:11 +00:00
|
|
|
";
|
2009-01-04 11:18:37 -08:00
|
|
|
|
2019-05-28 17:59:38 +01: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));
|
|
|
|
}
|
|
|
|
}
|
2007-06-30 01:19:11 +00:00
|
|
|
}
|