theme_name = module::get_var("core", "active_admin_theme"); $this->set_global('theme', $this); $this->set_global('user', user::active()); } public function url($path) { return url::file("themes/{$this->theme_name}/$path"); } public function display($page_name, $view_class="View") { return new $view_class($page_name); } public function admin_menu() { $menu = new Menu(true); core_menu::admin($menu, $this); foreach (module::installed() as $module) { if ($module->name == "core") { continue; } $class = "{$module->name}_menu"; if (method_exists($class, "admin")) { call_user_func_array(array($class, "admin"), array(&$menu, $this)); } } print $menu; } /** * Print out any messages waiting for this user. */ public function messages() { return message::get(); } /** * Handle all theme functions that insert module content. */ public function __call($function, $args) { switch ($function) { case "admin_dashboard_blocks": case "admin_footer": case "admin_page_bottom": case "admin_page_top": case "admin_sidebar_blocks": case "admin_head": $blocks = array(); foreach (module::installed() as $module) { $helper_class = "{$module->name}_block"; if (method_exists($helper_class, $function)) { $blocks[] = call_user_func_array( array($helper_class, $function), array_merge(array($this), $args)); } } return implode("\n", $blocks); default: throw new Exception("@todo UNKNOWN_THEME_FUNCTION: $function"); } } }