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/news.ext.php
shish 7161656063 Initial import, 2.0rc1
git-svn-id: file:///home/shish/svn/shimmie2/trunk@1 7f39781d-f577-437e-ae19-be835c7a54ca
2007-04-16 11:58:25 +00:00

23 lines
640 B
PHP

<?php
class News extends Extension {
public function receive_event($event) {
global $page;
if(is_a($event, 'PageRequestEvent') && ($event->page == "index")) {
global $config;
if(strlen($config->get_string("news_text")) > 0) {
$page->add_side_block(new Block("Note", $config->get_string("news_text")), 5);
}
}
if(is_a($event, 'SetupBuildingEvent')) {
$sb = new SetupBlock("News");
$sb->add_longtext_option("news_text");
$event->panel->add_main_block($sb);
}
if(is_a($event, 'ConfigSaveEvent')) {
$event->config->set_string("news_text", $_POST['news_text']);
}
}
}
add_event_listener(new News());
?>