summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/controllers/admin.php19
-rw-r--r--core/controllers/admin_dashboard.php4
-rw-r--r--core/views/admin_dashboard.html.php3
3 files changed, 14 insertions, 12 deletions
diff --git a/core/controllers/admin.php b/core/controllers/admin.php
index d6d65c69..2a6bae7e 100644
--- a/core/controllers/admin.php
+++ b/core/controllers/admin.php
@@ -18,20 +18,25 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
class Admin_Controller extends Controller {
- public function __construct() {
+ private $theme;
+
+ public function __construct($theme=null) {
if (!(user::active()->admin)) {
throw new Exception("@todo UNAUTHORIZED", 401);
}
+ $this->theme = $theme;
parent::__construct();
}
+ public function theme() {
+ return $this->theme;
+ }
+
public function __call($controller_name, $args) {
if ($controller_name == "index") {
$controller_name = "dashboard";
}
-
- $controller = "Admin_{$controller_name}_Controller";
- $controller = new $controller;
+ $controller_name = "Admin_{$controller_name}_Controller";
if ($args) {
$method = array_shift($args);
@@ -40,9 +45,9 @@ class Admin_Controller extends Controller {
}
$theme_name = module::get_var("core", "active_admin_theme", "admin_default");
- $template = new Admin_View("admin.html", $theme_name);
- $template->content =
- call_user_func_array(array(new $controller, $method), $args);
+ $this->template = $template = new Admin_View("admin.html", $theme_name);
+ $template->content = call_user_func_array(
+ array(new $controller_name($template), $method), $args);
print $template;
}
}
diff --git a/core/controllers/admin_dashboard.php b/core/controllers/admin_dashboard.php
index 7d752495..a29c2167 100644
--- a/core/controllers/admin_dashboard.php
+++ b/core/controllers/admin_dashboard.php
@@ -17,9 +17,9 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
-class Admin_Dashboard_Controller extends Controller {
+class Admin_Dashboard_Controller extends Admin_Controller {
public function index() {
- return new View("admin_dashboard.html");
+ return $this->theme()->dashboard_blocks();
}
}
diff --git a/core/views/admin_dashboard.html.php b/core/views/admin_dashboard.html.php
deleted file mode 100644
index 2713cc0b..00000000
--- a/core/views/admin_dashboard.html.php
+++ /dev/null
@@ -1,3 +0,0 @@
-<? defined("SYSPATH") or die("No direct script access."); ?>
-<?= $theme->dashboard_blocks(); ?>
-