diff options
author | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-18 18:03:24 +0000 |
---|---|---|
committer | ewinslow <ewinslow@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2011-02-18 18:03:24 +0000 |
commit | 562bc001f3002f43c343cc63bbbe3e9cb421de32 (patch) | |
tree | 232e0534386a6250315f20a8eaf9037197b8003d /views/default/page/layouts/widgets.php | |
parent | 412d337ee7f1463dc4ea4cf1d23415b10749f996 (diff) | |
download | elgg-562bc001f3002f43c343cc63bbbe3e9cb421de32.tar.gz elgg-562bc001f3002f43c343cc63bbbe3e9cb421de32.tar.bz2 |
Refs #2950: layout/shells => page/layouts
git-svn-id: http://code.elgg.org/elgg/trunk@8286 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/page/layouts/widgets.php')
-rw-r--r-- | views/default/page/layouts/widgets.php | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/views/default/page/layouts/widgets.php b/views/default/page/layouts/widgets.php new file mode 100644 index 000000000..8d122738e --- /dev/null +++ b/views/default/page/layouts/widgets.php @@ -0,0 +1,53 @@ +<?php +/** + * Elgg widgets layout + * + * @uses $vars['content'] Optional display box at the top of layout + * @uses $vars['num_columns'] Number of widget columns for this layout (3) + * @uses $vars['show_add_widgets'] Display the add widgets button and panel (true) + * @uses $vars['exact_match'] Widgets must match the current context (false) + * @uses $vars['show_access'] Show the access control (true) + */ + +$box = elgg_extract('box', $vars, ''); +$num_columns = elgg_extract('num_columns', $vars, 3); +$show_add_widgets = elgg_extract('show_add_widgets', $vars, true); +$exact_match = elgg_extract('exact_match', $vars, false); +$show_access = elgg_extract('show_access', $vars, true); + +$owner = elgg_get_page_owner_entity(); +$context = elgg_get_context(); +elgg_push_context('widgets'); + +$widgets = elgg_get_widgets($owner->guid, $context); + +if (elgg_can_edit_widget_layout($context)) { + if ($show_add_widgets) { + echo elgg_view('layout/shells/widgets/add_button'); + } + $params = array( + 'widgets' => $widgets, + 'context' => $context, + 'exact_match' => $exact_match, + ); + echo elgg_view('layout/shells/widgets/add_panel', $params); +} + +echo $vars['content']; + +$widget_class = "elgg-col-1of{$num_columns}"; +for ($column_index = 1; $column_index <= $num_columns; $column_index++) { + $column_widgets = $widgets[$column_index]; + + echo "<div class=\"$widget_class elgg-widgets\" id=\"elgg-widget-col-$column_index\">"; + if (is_array($column_widgets) && sizeof($column_widgets) > 0) { + foreach ($column_widgets as $widget) { + echo elgg_view_entity($widget, array('show_access' => $show_access)); + } + } + echo '</div>'; +} + +elgg_pop_context(); + +echo elgg_view('graphics/ajax_loader', array('id' => 'elgg-widget-loader')); |