diff options
author | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-17 22:08:39 +0000 |
---|---|---|
committer | cash <cash@36083f99-b078-4883-b0ff-0f9b5a30f544> | 2010-11-17 22:08:39 +0000 |
commit | b128ec82c4bd149beb6f4436b030e288ae75fb1d (patch) | |
tree | 7d63a7b8e473073c95bff122f006f28983e1ee21 /views/default/layouts | |
parent | fc7f4e880ddfed812438fabc791c5f5056f541e6 (diff) | |
download | elgg-b128ec82c4bd149beb6f4436b030e288ae75fb1d.tar.gz elgg-b128ec82c4bd149beb6f4436b030e288ae75fb1d.tar.bz2 |
Refs #1793 - added a basic add new widgets view - it is not wired up yet
git-svn-id: http://code.elgg.org/elgg/trunk@7333 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'views/default/layouts')
-rw-r--r-- | views/default/layouts/widgets.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/views/default/layouts/widgets.php b/views/default/layouts/widgets.php index 21d942080..5d6e42a43 100644 --- a/views/default/layouts/widgets.php +++ b/views/default/layouts/widgets.php @@ -4,21 +4,25 @@ * * @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 */ +$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'); -if (isset($vars['box'])) { - echo $vars['box']; -} +elgg_get_widgets($owner->guid, $context); -$num_columns = 3; -if (isset($vars['num_columns'])) { - $num_columns = $vars['num_columns']; +if (elgg_can_edit_widgets()) { + echo elgg_view('widgets/add', array('widgets' => $widgets)); } +echo $vars['box']; + $widget_class = "widget_col_$num_columns"; for ($column_index = 1; $column_index <= $num_columns; $column_index++) { $widgets = get_widgets($owner->guid, $context, $column_index); @@ -33,6 +37,12 @@ for ($column_index = 1; $column_index <= $num_columns; $column_index++) { $first = ($column_index == 1) ? 'widget_first_col' : ''; echo "<div class=\"widget_column $widget_class $first\">"; + // button for adding new widgets + if ($column_index == 1) { + if ($show_add_widgets && elgg_can_edit_widgets()) { + echo elgg_view('widgets/add_button'); + } + } if (is_array($widgets) && sizeof($widgets) > 0) { foreach ($widgets as $widget) { echo elgg_view_entity($widget); |