sys info to simpleext

This commit is contained in:
Shish 2012-01-27 16:52:12 +00:00
parent ee40a9aad3
commit eedfc5e6b4
2 changed files with 13 additions and 16 deletions

View File

@ -12,23 +12,20 @@
* versions of PHP I should test with, etc. * versions of PHP I should test with, etc.
*/ */
class ET implements Extension { class ET extends SimpleExtension {
var $theme; public function onPageRequest($event) {
global $user;
public function receive_event(Event $event) { if($event->page_matches("system_info")) {
global $config, $database, $page, $user;
if(is_null($this->theme)) $this->theme = get_theme_object($this);
if(($event instanceof PageRequestEvent) && $event->page_matches("system_info")) {
if($user->is_admin()) { if($user->is_admin()) {
$this->theme->display_info_page($page, $this->get_info()); $this->theme->display_info_page($this->get_info());
} }
} }
}
if($event instanceof UserBlockBuildingEvent) { public function onUserBlockBuilding($event) {
if($user->is_admin()) { global $user;
$event->add_link("System Info", make_link("system_info")); if($user->is_admin()) {
} $event->add_link("System Info", make_link("system_info"));
} }
} }
@ -72,7 +69,5 @@ class ET implements Extension {
return $info; return $info;
} }
// }}}
} }
add_event_listener(new ET());
?> ?>

View File

@ -6,7 +6,9 @@ class ETTheme extends Themelet {
* *
* $info = an array of ($name => $value) * $info = an array of ($name => $value)
*/ */
public function display_info_page(Page $page, $info) { public function display_info_page($info) {
global $page;
$page->set_title("System Info"); $page->set_title("System Info");
$page->set_heading("System Info"); $page->set_heading("System Info");
$page->add_block(new NavBlock()); $page->add_block(new NavBlock());