diff options
-rw-r--r-- | core/helpers/core_block.php | 8 | ||||
-rw-r--r-- | core/hooks/load_modules.php | 1 | ||||
-rw-r--r-- | core/libraries/Admin_View.php | 23 | ||||
-rw-r--r-- | core/views/admin_dashboard.html.php | 16 | ||||
-rw-r--r-- | core/views/admin_dashboard_welcome.html.php | 11 |
5 files changed, 44 insertions, 15 deletions
diff --git a/core/helpers/core_block.php b/core/helpers/core_block.php index 7f756b92..3c1e0727 100644 --- a/core/helpers/core_block.php +++ b/core/helpers/core_block.php @@ -29,4 +29,12 @@ class core_block_Core { return new View("in_place_edit.html"); } } + + public static function admin_dashboard_blocks($theme) { + $block = new Block(); + $block->id = "gWelcome"; + $block->title = _("Welcome to Gallery3"); + $block->content = new View("admin_dashboard_welcome.html"); + return $block; + } }
\ No newline at end of file diff --git a/core/hooks/load_modules.php b/core/hooks/load_modules.php index 57d0fffb..887582f7 100644 --- a/core/hooks/load_modules.php +++ b/core/hooks/load_modules.php @@ -19,3 +19,4 @@ */ Event::add("system.ready", array("module", "load_modules")); +Event::add("system.post_routing", array("module", "load_themes")); 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 diff --git a/core/views/admin_dashboard.html.php b/core/views/admin_dashboard.html.php index 1cfd8e23..4603a8bf 100644 --- a/core/views/admin_dashboard.html.php +++ b/core/views/admin_dashboard.html.php @@ -1,19 +1,5 @@ <? defined("SYSPATH") or die("No direct script access."); ?> -<div class="gBlock"> - <h2>Welcome to Gallery 3!</h2> - <div class="gBlockContent"> - <p>This is your administration dashboard and it provides a quick overview of status messages, - recent updates, and frequently used options. Add or remove blocks and rearrange them - to tailor to your needs. The admin menu provides quick access to all of Gallery 3's options - and settings. Here are a few of the most used options to get you started.</p> - <ul> - <li><a href="#">General Settings</a> - General configuation options for your Gallery.</li> - <li><a href="#">Modules</a> - Manage available and installed modules.</li> - <li><a href="#">Presentation</a> - Choose a theme, set image sizes.</li> - </ul> - </div> -</div> - +<?= $theme->dashboard_blocks(); ?> <div class="gBlock"> <h2>Status Messages</h2> <ul class="gBlockContent gMessages"> diff --git a/core/views/admin_dashboard_welcome.html.php b/core/views/admin_dashboard_welcome.html.php new file mode 100644 index 00000000..996adc9f --- /dev/null +++ b/core/views/admin_dashboard_welcome.html.php @@ -0,0 +1,11 @@ +<p> + This is your administration dashboard and it provides a quick overview of status messages, + recent updates, and frequently used options. Add or remove blocks and rearrange them + to tailor to your needs. The admin menu provides quick access to all of Gallery 3's options + and settings. Here are a few of the most used options to get you started. +</p> +<ul> + <li><a href="#">General Settings</a> - General configuation options for your Gallery.</li> + <li><a href="#">Modules</a> - Manage available and installed modules.</li> + <li><a href="#">Presentation</a> - Choose a theme, set image sizes.</li> +</ul> |