forked from concretecms/concrete5-legacy
/
controller.php
49 lines (40 loc) · 1.19 KB
/
controller.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?
defined('C5_EXECUTE') or die("Access Denied.");
class DashboardController extends Controller {
public function view() {
$this->set('latest_version', Config::get('APP_VERSION_LATEST'));
Loader::model('dashboard/homepage');
$dh = new DashboardHomepageView();
$modules = $dh->getModules();
$this->set('dh', $dh);
$this->set('modules', $modules);
$html = Loader::helper('html');
$this->addHeaderItem($html->javascript('swfobject.js'));
}
public function module($module = null, $task = null) {
Loader::model('dashboard/homepage');
$dh = new DashboardHomepageView();
$mod = $dh->getByHandle($module);
if ($mod->pkgID > 0) {
$pkg = Package::getByID($mod->pkgID);
$class = Loader::dashboardModuleController($mod->dbhModule, $pkg);
} else {
$class = Loader::dashboardModuleController($mod->dbhModule);
}
$args = func_get_args();
array_shift($args);
array_shift($args); // no that's not a misprint
if (method_exists($class, $task)) {
try {
$resp = call_user_func_array(array($class, $task), $args);
if ($resp) {
$this->set('message', $resp);
}
} catch(Exception $e) {
$this->set('error', $e);
}
}
print $this->view();
}
}
?>