From b5b5e56f019dce4895143a23227b5e288843adcb Mon Sep 17 00:00:00 2001 From: shish Date: Mon, 4 Jun 2007 02:43:58 +0000 Subject: [PATCH] csv export for aliases git-svn-id: file:///home/shish/svn/shimmie2/trunk@154 7f39781d-f577-437e-ae19-be835c7a54ca --- ext/alias_editor/main.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ext/alias_editor/main.php b/ext/alias_editor/main.php index 1d7d9b40..a459093e 100644 --- a/ext/alias_editor/main.php +++ b/ext/alias_editor/main.php @@ -37,6 +37,12 @@ class AliasEditor extends Extension { $page->set_heading("Alias List"); $page->add_main_block(new Block("Aliases", $this->build_aliases())); } + else if($event->get_arg(0) == "export") { + global $page; + $page->set_mode("data"); + $page->set_type("text/plain"); + $page->set_data($this->get_alias_csv()); + } } } @@ -89,9 +95,19 @@ class AliasEditor extends Extension { +

Export "; return $html; } + private function get_alias_csv() { + global $database; + $csv = ""; + $aliases = $database->db->GetAssoc("SELECT oldtag, newtag FROM aliases"); + foreach($aliases as $old => $new) { + $csv .= "$old,$new\n"; + } + return $csv; + } // }}} } add_event_listener(new AliasEditor());