Elgg  Version 1.11
widgets.php
Go to the documentation of this file.
1 <?php
12 $num_columns = elgg_extract('num_columns', $vars, 3);
13 $show_add_widgets = elgg_extract('show_add_widgets', $vars, true);
14 $exact_match = elgg_extract('exact_match', $vars, false);
15 $show_access = elgg_extract('show_access', $vars, true);
16 
18 
20 
22 elgg_push_context('widgets');
23 
25 
26 echo '<div class="elgg-layout-widgets">';
27 
29  if ($show_add_widgets) {
30  echo elgg_view('page/layouts/widgets/add_button');
31  }
32  $params = array(
33  'widgets' => $widgets,
34  'context' => $context,
35  'exact_match' => $exact_match,
36  'show_access' => $show_access,
37  );
38  echo elgg_view('page/layouts/widgets/add_panel', $params);
39 }
40 
41 if (isset($vars['content'])) {
42  echo $vars['content'];
43 }
44 
45 $widget_class = "elgg-col-1of{$num_columns}";
46 for ($column_index = 1; $column_index <= $num_columns; $column_index++) {
47  if (isset($widgets[$column_index])) {
48  $column_widgets = $widgets[$column_index];
49  } else {
50  $column_widgets = array();
51  }
52 
53  echo "<div class=\"$widget_class elgg-widgets\" id=\"elgg-widget-col-$column_index\">";
54  if (sizeof($column_widgets) > 0) {
55  foreach ($column_widgets as $widget) {
56  if (array_key_exists($widget->handler, $widget_types)) {
57  echo elgg_view_entity($widget, array('show_access' => $show_access));
58  }
59  }
60  }
61  echo '</div>';
62 }
63 
65 
66 echo elgg_view('graphics/ajax_loader', array('id' => 'elgg-widget-loader'));
67 
68 echo '</div>';
$owner
Definition: widgets.php:17
$exact_match
Definition: widgets.php:14
$widget_types
Definition: widgets.php:19
$num_columns
Elgg widgets layout.
Definition: widgets.php:12
$widget
Definition: delete.php:9
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1246
$params
Definition: login.php:72
elgg_get_widgets($owner_guid, $context)
Get widgets for a particular context.
Definition: widgets.php:23
elgg_can_edit_widget_layout($context, $user_guid=0)
Can the user edit the widget layout.
Definition: widgets.php:53
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_context()
Get the current context.
Definition: pageowner.php:213
elgg_get_page_owner_entity()
Gets the owner entity for the current page.
Definition: pageowner.php:53
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
$widgets
Definition: widgets.php:24
elgg_push_context($context)
Push a context onto the top of the stack.
Definition: pageowner.php:224
elgg_get_widget_types($context="", $exact=false)
Get the widget types for a context.
Definition: widgets.php:119
$context
Definition: widgets.php:21
elgg_view_entity(\ElggEntity $entity, $vars=array(), $bypass=false, $debug=false)
Returns a string of a rendered entity.
Definition: views.php:793
$show_access
Definition: widgets.php:15
$show_add_widgets
Definition: widgets.php:13
if(elgg_can_edit_widget_layout($context)) if(isset($vars['content'])) $widget_class
Definition: widgets.php:45
if(file_exists($welcome)) $vars
Definition: upgrade.php:93