diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-07 02:47:31 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-12-07 02:47:31 +0000 |
commit | 9cd7ebd1ece016577c435b85f56d6c30545ff363 (patch) | |
tree | 47ef92f31014403699387797bc8498c64bdcffe2 /views/default/layout/shells/widgets.php | |
parent | a1d3c90fb72cd14f61b1209f9c0a0d3a106c71a8 (diff) | |
download | elgg-9cd7ebd1ece016577c435b85f56d6c30545ff363.tar.gz elgg-9cd7ebd1ece016577c435b85f56d6c30545ff363.tar.bz2 |
reorganized the layout views
git-svn-id: http://code.elgg.org/elgg/trunk@7553 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/layout/shells/widgets.php')
-rw-r--r-- | views/default/layout/shells/widgets.php | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/views/default/layout/shells/widgets.php b/views/default/layout/shells/widgets.php new file mode 100644 index 000000000..130b2eaad --- /dev/null +++ b/views/default/layout/shells/widgets.php @@ -0,0 +1,46 @@ +<?php +/** + * Elgg widgets layout + * + * @uses $vars['box'] Optional display box at the top of layout + * @uses $vars['num_columns'] Number of widget columns for this layout + * @uses $vars['show_add_widgets'] Display the add widgets button and panel + */ + +$box = elgg_get_array_value('box', $vars, ''); +$num_columns = elgg_get_array_value('num_columns', $vars, 3); +$show_add_widgets = elgg_get_array_value('show_add_widgets', $vars, true); + +$owner = elgg_get_page_owner(); +$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('widgets/add-button'); + } + $params = array( + 'widgets' => $widgets, + 'context' => $context, + ); + echo elgg_view('widgets/add_panel', $params); +} + +echo $vars['box']; + +$widget_class = "widget-{$num_columns}-columns"; +for ($column_index = 1; $column_index <= $num_columns; $column_index++) { + $column_widgets = $widgets[$column_index]; + + echo "<div class=\"widget-column $widget_class\" id=\"widget-col-$column_index\">"; + if (is_array($column_widgets) && sizeof($column_widgets) > 0) { + foreach ($column_widgets as $widget) { + echo elgg_view_entity($widget); + } + } + echo '</div>'; +} + +elgg_pop_context();
\ No newline at end of file |