csv export for aliases

git-svn-id: file:///home/shish/svn/shimmie2/trunk@154 7f39781d-f577-437e-ae19-be835c7a54ca
This commit is contained in:
shish 2007-06-04 02:43:58 +00:00
parent 979b0f936a
commit b5b5e56f01

View File

@ -37,6 +37,12 @@ class AliasEditor extends Extension {
$page->set_heading("Alias List"); $page->set_heading("Alias List");
$page->add_main_block(new Block("Aliases", $this->build_aliases())); $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 {
</form> </form>
</tr> </tr>
</table> </table>
<p><a href='".make_link("alias/export")."'>Export</a>
"; ";
return $html; 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()); add_event_listener(new AliasEditor());