From c5f77510a77f42bf0a66d5d79353dbf040d41515 Mon Sep 17 00:00:00 2001 From: Bharat Mediratta Date: Mon, 12 Jan 2009 08:51:54 +0000 Subject: Refactor dashboard block handling out into a dashboard helper so that module installers don't have to know the grotty details of how it works. --- core/helpers/dashboard.php | 63 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 core/helpers/dashboard.php (limited to 'core/helpers/dashboard.php') diff --git a/core/helpers/dashboard.php b/core/helpers/dashboard.php new file mode 100644 index 00000000..61ff01ce --- /dev/null +++ b/core/helpers/dashboard.php @@ -0,0 +1,63 @@ +name}_dashboard", "get_list")) { + foreach (call_user_func(array("{$module->name}_dashboard", "get_list")) as $id => $title) { + $blocks["{$module->name}:$id"] = $title; + } + } + } + return $blocks; + } + + public static function get_blocks($blocks) { + $result = ""; + foreach ($blocks as $id => $desc) { + if (method_exists("$desc[0]_dashboard", "get_block")) { + $block = call_user_func(array("$desc[0]_dashboard", "get_block"), $desc[1]); + $block->id = $id; + $result .= $block; + } + } + return $result; + } +} + -- cgit v1.2.3