Elgg  Version 1.9
default_widgets.php
Go to the documentation of this file.
1 <?php
10  'type' => 'object',
11  'subtype' => 'moddefaultwidgets',
12  'limit' => 1,
13 ));
14 
15 if ($object) {
16  echo elgg_view('output/url', array(
17  'text' => elgg_echo('upgrade'),
18  'href' => 'action/widgets/upgrade',
19  'is_action' => true,
20  'is_trusted' => true,
21  'class' => 'elgg_button elgg-button-submit',
22  'title' => 'Upgrade your default widgets to work on Elgg 1.8',
23  ));
24 }
25 
26 elgg_push_context('default_widgets');
27 $widget_context = get_input('widget_context');
28 $list = elgg_trigger_plugin_hook('get_list', 'default_widgets', null, array());
29 
30 // default to something if we can
31 if (!$widget_context && $list) {
32  $widget_context = $list[0]['widget_context'];
33 }
34 
36 $tabs = array();
37 foreach ($list as $info) {
38  $url = "admin/appearance/default_widgets?widget_context={$info['widget_context']}";
39  $selected = false;
40  if ($widget_context == $info['widget_context']) {
41  $selected = true;
42  $current_info = $info;
43  }
44 
45  $tabs[] = array(
46  'title' => $info['name'],
47  'url' => $url,
48  'selected' => $selected
49  );
50 }
51 
52 $tabs_vars = array(
53  'tabs' => $tabs
54 );
55 
56 echo elgg_view('navigation/tabs', $tabs_vars);
57 
58 echo elgg_view('output/longtext', array('value' => elgg_echo('admin:default_widgets:instructions')));
59 
60 if (!$current_info) {
61  $content = elgg_echo('admin:default_widgets:unknown_type');
62 } else {
63  // default widgets are owned and saved to the site.
65  elgg_push_context($current_info['widget_context']);
66 
67  $default_widgets_input = elgg_view('input/hidden', array(
68  'name' => 'default_widgets',
69  'value' => 1
70  ));
71 
72  $params = array(
73  'content' => $default_widgets_input,
74  'num_columns' => $current_info['widget_columns'],
75  );
76 
79 }
81 
elgg_get_config($name, $site_guid=0)
Get an Elgg configuration value.
get_input($variable, $default=null, $filter_result=true)
Get some input from variables passed submitted through GET or POST.
Definition: input.php:27
foreach($list as $info) $tabs_vars
$content
$url
Definition: exceptions.php:24
elgg_set_page_owner_guid($guid)
Set the guid of the entity that owns this page.
Definition: pageowner.php:73
$object
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_pop_context()
Removes and returns the top context string from the stack.
Definition: pageowner.php:255
elgg echo
Translates a string.
Definition: languages.js:43
elgg_get_entities(array $options=array())
Returns an array of entities with optional filtering.
Definition: entities.php:777
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Trigger a Plugin Hook and run all handler callbacks registered to that hook:type. ...
Definition: elgglib.php:925
if(!$widget_context &&$list) $current_info
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
elgg_view_layout($layout_name, $vars=array())
Displays a layout with optional parameters.
Definition: views.php:617
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:243
$default_widgets_input
$widget_context