Elgg  Version 1.11
default_widgets.php
Go to the documentation of this file.
1 <?php
10  'type' => 'object',
11  'subtype' => 'moddefaultwidgets',
12  'distinct' => false,
13  'limit' => 1,
14 ));
15 
16 if ($object) {
17  echo elgg_view('output/url', array(
18  'text' => elgg_echo('upgrade'),
19  'href' => 'action/widgets/upgrade',
20  'is_action' => true,
21  'is_trusted' => true,
22  'class' => 'elgg_button elgg-button-submit',
23  'title' => 'Upgrade your default widgets to work on Elgg 1.8',
24  ));
25 }
26 
27 elgg_push_context('default_widgets');
28 $widget_context = get_input('widget_context');
29 $list = elgg_trigger_plugin_hook('get_list', 'default_widgets', null, array());
30 
31 // default to something if we can
32 if (!$widget_context && $list) {
33  $widget_context = $list[0]['widget_context'];
34 }
35 
37 $tabs = array();
38 foreach ($list as $info) {
39  $url = "admin/appearance/default_widgets?widget_context={$info['widget_context']}";
40  $selected = false;
41  if ($widget_context == $info['widget_context']) {
42  $selected = true;
43  $current_info = $info;
44  }
45 
46  $tabs[] = array(
47  'title' => $info['name'],
48  'url' => $url,
49  'selected' => $selected
50  );
51 }
52 
53 $tabs_vars = array(
54  'tabs' => $tabs
55 );
56 
57 echo elgg_view('navigation/tabs', $tabs_vars);
58 
59 echo elgg_view('output/longtext', array('value' => elgg_echo('admin:default_widgets:instructions')));
60 
61 if (!$current_info) {
62  $content = elgg_echo('admin:default_widgets:unknown_type');
63 } else {
64  // default widgets are owned and saved to the site.
66  elgg_push_context($current_info['widget_context']);
67 
68  $default_widgets_input = elgg_view('input/hidden', array(
69  'name' => 'default_widgets',
70  'value' => 1
71  ));
72 
73  $params = array(
74  'content' => $default_widgets_input,
75  'num_columns' => $current_info['widget_columns'],
76  );
77 
80 }
82 
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:234
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:490
elgg_trigger_plugin_hook($hook, $type, $params=null, $returnvalue=null)
Definition: elgglib.php:775
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:622
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:224
$default_widgets_input
$widget_context