Elgg  Version 1.9
upgrade.php
Go to the documentation of this file.
1 <?php
13  'type' => 'object',
14  'subtype' => 'moddefaultwidgets',
15  'limit' => 1,
16 ));
17 
18 if (!$object) {
20 }
21 
22 $object = $object[0];
23 
25 
27 foreach (array('profile', 'dashboard') as $context) {
28  if (isset($object->$context)) {
29  elgg_push_context($context);
30  elgg_push_context('default_widgets');
31  elgg_push_context('widgets');
32 
33  // deserialize the widget information
34  list($left, $middle, $right) = split('%%', $object->$context);
35  $left_widgets = split('::', $left);
36  $middle_widgets = split('::', $middle);
37  $right_widgets = split('::', $right);
38 
39  // 1st column is right column in default theme
40  $widgets = array(
41  1 => array_reverse($right_widgets),
42  2 => array_reverse($middle_widgets),
43  3 => array_reverse($left_widgets),
44  );
45 
46  foreach ($widgets as $column => $column_widgets) {
47  foreach ($column_widgets as $handler) {
49  if ($guid) {
51  $widget->move($column, 0);
52  }
53  }
54  }
55 
59  }
60 }
62 
63 $object->delete();
64 system_message(elgg_echo('upgrade:core'));
elgg_get_site_entity($site_guid=0)
Get an ElggSite entity (default is current site)
Definition: sites.php:18
$context
Definition: add.php:11
$object
Definition: upgrade.php:12
$column
Definition: add.php:13
$ia
Definition: upgrade.php:26
$widget
Definition: delete.php:9
$guid
Removes an admin notice.
elgg forward
Meant to mimic the php forward() function by simply redirecting the user to another page...
Definition: elgglib.js:419
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_set_ignore_access($ignore=true)
Set if Elgg&#39;s access system should be ignored.
Definition: access.php:43
const REFERER
Definition: elgglib.php:2162
elgg_pop_context()
Removes and returns the top context string from the stack.
Definition: pageowner.php:255
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:777
elgg system_message
Wrapper function for system_messages.
Definition: elgglib.js:374
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:243
$handler
Definition: add.php:10
$widgets
Definition: dashboard.php:10
$site
Definition: upgrade.php:24
elgg_create_widget($owner_guid, $handler, $context, $access_id=null)
Create a new widget instance.
Definition: widgets.php:38
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:604