diff options
author | Bharat Mediratta <bharat@menalto.com> | 2008-12-20 00:52:20 +0000 |
---|---|---|
committer | Bharat Mediratta <bharat@menalto.com> | 2008-12-20 00:52:20 +0000 |
commit | aee3efe972317b49329703e354cc1d90afdf9488 (patch) | |
tree | cf683bfe84b85270c7c8d1193da7495a931908b9 /core/libraries | |
parent | 30d541cb26b1754afdf0f5130dcf75af40457251 (diff) |
Create a pattern for admin dashboard blocks and make the "welcome"
block.
Diffstat (limited to 'core/libraries')
-rw-r--r-- | core/libraries/Admin_View.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/core/libraries/Admin_View.php b/core/libraries/Admin_View.php index 4957fdce..548a4355 100644 --- a/core/libraries/Admin_View.php +++ b/core/libraries/Admin_View.php @@ -59,4 +59,27 @@ class Admin_View_Core extends View { print $menu; } + + /** + * Handle all theme functions that insert module content. + */ + public function __call($function, $args) { + switch ($function) { + case "dashboard_blocks": + $function = "admin_$function"; + $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"); + } + } }
\ No newline at end of file |