aboutsummaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-19 21:05:10 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-02-19 21:05:10 +0000
commit214e892a364d94e76253a2fc9c696130f4ee685f (patch)
treeb232ee87350f442ab73e3631d56e3ef94f18dc10 /install
parentd0002284b71ffa629c26c70c9454b8e0e2dd03ac (diff)
downloadelgg-214e892a364d94e76253a2fc9c696130f4ee685f.tar.gz
elgg-214e892a364d94e76253a2fc9c696130f4ee685f.tar.bz2
Installation loads 3 default widgets for the admin dashboard.
git-svn-id: http://code.elgg.org/elgg/trunk@8347 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'install')
-rw-r--r--install/ElggInstaller.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/install/ElggInstaller.php b/install/ElggInstaller.php
index 0bf04673f..2b8fd8324 100644
--- a/install/ElggInstaller.php
+++ b/install/ElggInstaller.php
@@ -29,6 +29,17 @@ class ElggInstaller {
protected $autoLogin = FALSE;
/**
+ * @var array An array of widgets to add to the admin dashboard.
+ *
+ * @warning Columbus start on the right at 1.
+ * In the form column => array of handlers in order, top to bottom
+ */
+ protected $adminWidgets = array(
+ 1 => array('content_stats'),
+ 2 => array('online_users', 'new_users'),
+ );
+
+ /**
* Constructor bootstraps the Elgg engine
*/
public function __construct() {
@@ -168,6 +179,8 @@ class ElggInstaller {
if (!$this->createAdminAccount($params)) {
throw new InstallationException(elgg_echo('install:admin:cannot_create'));
}
+
+ $this->addAdminWidgets();
}
/**
@@ -490,6 +503,7 @@ class ElggInstaller {
* @return void
*/
protected function complete() {
+ $this->addAdminWidgets();
$params = array();
if ($this->autoLogin) {
@@ -1346,6 +1360,39 @@ class ElggInstaller {
}
/**
+ * Adds default admin widgets to the admin dashboard.
+ *
+ * @return bool
+ */
+ protected function addAdminWidgets() {
+ elgg_set_ignore_access(true);
+ // should only be one.
+ $users = elgg_get_entities(array(
+ 'type' => 'user',
+ 'limit' => 1,
+ ));
+
+ if ($users) {
+ if ($users[0]->isAdmin()) {
+ $admin = $users[0];
+ }
+ } else {
+ return false;
+ }
+
+ foreach ($this->adminWidgets as $column => $handlers) {
+ foreach ($handlers as $position => $handler) {
+ $guid = elgg_create_widget($admin->getGUID(), $handler, 'admin');
+ if ($guid) {
+ $widget = get_entity($guid);
+ $widget->move($column, $position);
+ }
+ }
+ }
+ elgg_set_ignore_access(false);
+ }
+
+ /**
* Admin account support methods
*/