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 | |
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')
-rw-r--r-- | views/default/layout/objects/media.php | 55 | ||||
-rw-r--r-- | views/default/layout/objects/module.php | 74 | ||||
-rw-r--r-- | views/default/layout/shells/administration.php | 36 | ||||
-rw-r--r-- | views/default/layout/shells/content.php | 53 | ||||
-rw-r--r-- | views/default/layout/shells/default.php | 18 | ||||
-rw-r--r-- | views/default/layout/shells/one_column.php | 16 | ||||
-rw-r--r-- | views/default/layout/shells/one_column_with_sidebar.php | 31 | ||||
-rw-r--r-- | views/default/layout/shells/one_sidebar.php | 31 | ||||
-rw-r--r-- | views/default/layout/shells/two_sidebar.php | 42 | ||||
-rw-r--r-- | views/default/layout/shells/widgets.php | 46 |
10 files changed, 402 insertions, 0 deletions
diff --git a/views/default/layout/objects/media.php b/views/default/layout/objects/media.php new file mode 100644 index 000000000..232acc8f1 --- /dev/null +++ b/views/default/layout/objects/media.php @@ -0,0 +1,55 @@ +<?php +/** + * Elgg media element + * + * --------------------------------------------------- + * | | | + * | icon | body | + * | block | block | + * | | | + * --------------------------------------------------- + * + * @uses $vars['body'] HTML content of the body block + * @uses $vars['icon'] HTML content of the icon block + * @uses $vars['class'] Optional additional class for media element + * @uses $vars['id'] Optional id for the media element + * @uses $vars['body_class'] Optional additional class for body block + * @uses $vars['icon_class'] Optional additional class for icon block + */ + +$body = elgg_get_array_value('body', $vars, ''); +$icon_block = elgg_get_array_value('icon', $vars, ''); + +$class = 'elgg-media'; +$additional_class = elgg_get_array_value('class', $vars, ''); +if ($additional_class) { + $class = "$class $additional_class"; +} + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; +} + + +$body_class = 'elgg-body'; +$additional_class = elgg_get_array_value('body_class', $vars, ''); +if ($additional_class) { + $body_class = "$body_class $additional_class"; +} +$body = "<div class=\"$body_class\">$body</div>"; + +$icon_class = 'elgg-icon'; +$additional_class = elgg_get_array_value('icon_class', $vars, ''); +if ($additional_class) { + $icon_class = "$icon_class $additional_class"; +} +if ($icon_block) { + $icon_block = "<div class=\"$icon_class\">$icon_block</div>"; +} + +echo <<<HTML +<div class="$class clearfix" $id> + $icon_block$body +</div> +HTML; diff --git a/views/default/layout/objects/module.php b/views/default/layout/objects/module.php new file mode 100644 index 000000000..ffce583ff --- /dev/null +++ b/views/default/layout/objects/module.php @@ -0,0 +1,74 @@ +<?php +/** + * Elgg module element + * + * @uses $vars['title'] Title text + * @uses $vars['header'] HTML content of the header + * @uses $vars['body'] HTML content of the body + * @uses $vars['footer'] HTML content of the footer + * @uses $vars['class'] Optional additional class for module + * @uses $vars['id'] Optional id for module + * @uses $vars['header_class'] Optional additional class for header + * @uses $vars['body_class'] Optional additional class for body + * @uses $vars['footer_class'] Optional additional class for footer + * @uses $vars['skip_inner'] Optional flag to leave out inner div + */ + +$title = elgg_get_array_value('title', $vars, ''); +$header = elgg_get_array_value('header', $vars, ''); +$body = elgg_get_array_value('body', $vars, ''); +$footer = elgg_get_array_value('footer', $vars, ''); +$skip_inner = elgg_get_array_value('skip_inner', $vars, false); + +$class = 'elgg-module'; +$additional_class = elgg_get_array_value('class', $vars, ''); +if ($additional_class) { + $class = "$class $additional_class"; +} + +$id = ''; +if (isset($vars['id'])) { + $id = "id=\"{$vars['id']}\""; +} + + +$header_class = 'elgg-header'; +$additional_class = elgg_get_array_value('header_class', $vars, ''); +if ($additional_class) { + $header_class = "$header_class $additional_class"; +} + +if (isset($vars['header'])) { + if ($vars['header']) { + $header = "<div class=\"$header_class\">$header</div>"; + } +} else { + $header = "<div class=\"$header_class\"><h3>$title</h3></div>"; +} + +$body_class = 'elgg-body'; +$additional_class = elgg_get_array_value('body_class', $vars, ''); +if ($additional_class) { + $body_class = "$body_class $additional_class"; +} +$body = "<div class=\"$body_class\">$body</div>"; + + +$footer_class = 'elgg-footer'; +$additional_class = elgg_get_array_value('footer_class', $vars, ''); +if ($additional_class) { + $body_class = "$footer_class $additional_class"; +} + +if (isset($vars['footer'])) { + if ($vars['footer']) { + $header = "<div class=\"$footer_class\">$footer</div>"; + } +} + +$contents = $header . $body . $footer; +if (!$skip_inner) { + $contents = "<div class=\"elgg-inner\">$contents</div>"; +} + +echo "<div class=\"$class\" $id>$contents</div>"; diff --git a/views/default/layout/shells/administration.php b/views/default/layout/shells/administration.php new file mode 100644 index 000000000..f7ed84935 --- /dev/null +++ b/views/default/layout/shells/administration.php @@ -0,0 +1,36 @@ +<?php +/** + * Elgg Admin Area Canvas + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + * @uses $vars['sidebar'] Optional sidebar content + */ +?> + +<div id="admin_header"> + <span class="network-title"><h2> + <a href="<?php echo elgg_get_site_url(); ?>"> + <?php echo $vars['config']->sitename; echo " ".elgg_echo('admin'); ?></a> + <a class="return_to_network" href="<?php echo elgg_get_site_url(); ?>"><< Return to network</a> + </h2></span> +</div> + +<div id="elgg-content" class="clearfix admin_area"> + + <div id="elgg-page-contents" class="clearfix"> + <?php + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> + <div id="elgg-sidebar" class="clearfix"> + <?php + echo elgg_view('page_elements/sidebar', $vars); + ?> + </div> +</div> +<div id="admin_footer"></div>
\ No newline at end of file diff --git a/views/default/layout/shells/content.php b/views/default/layout/shells/content.php new file mode 100644 index 000000000..908197a39 --- /dev/null +++ b/views/default/layout/shells/content.php @@ -0,0 +1,53 @@ +<?php +/** + * Main content area layout + * + * @uses $vars['content'] HTML of main content area + * @uses $vars['sidebar'] HTML of the sidebar + * @uses $vars['header'] HTML of the content area header (override) + * @uses $vars['nav'] HTML of the content area nav (override) + * @uses $vars['footer'] HTML of the content area footer + * @uses $vars['filter'] HTML of the content area filter (override) + * @uses $vars['title'] Title text (override) + * @uses $vars['context'] Page context (override) + * @uses $vars['buttons'] Content header buttons (override) + * @uses $vars['filter_context'] Filter context: everyone, friends, mine + */ + +// give plugins an opportunity to add to content sidebars +$sidebar_content = elgg_get_array_value('sidebar', $vars, ''); +$params = $vars; +$params['content'] = $sidebar_content; +$sidebar = elgg_view('content/sidebar', $params); + +// navigation defaults to breadcrumbs +$nav = elgg_get_array_value('nav', $vars, elgg_view('navigation/breadcrumbs')); + +// allow page handlers to override the default header +if (isset($vars['header'])) { + $vars['header_override'] = $vars['header']; +} +$header = elgg_view('content/header', $vars); + +// allow page handlers to override the default filter +if (isset($vars['filter'])) { + $vars['filter_override'] = $vars['filter']; +} +$filter = elgg_view('content/filter', $vars); + +// the all important content +$content = elgg_get_array_value('content', $vars, ''); + +// optional footer for main content area +$footer_content = elgg_get_array_value('footer', $vars, ''); +$params = $vars; +$params['content'] = $footer_content; +$footer = elgg_view('content/footer', $params); + +$body = $nav . $header . $filter . $content . $footer; + +$params = array( + 'body' => $body, + 'sidebar' => $sidebar, +); +echo elgg_view_layout('one_sidebar', $params); diff --git a/views/default/layout/shells/default.php b/views/default/layout/shells/default.php new file mode 100644 index 000000000..60dc90b0d --- /dev/null +++ b/views/default/layout/shells/default.php @@ -0,0 +1,18 @@ +<?php +/** + * Elgg default layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + */ + +// @todo deprecated so remove in Elgg 2.0 +if (isset($vars['area1'])) { + echo $vars['area1']; +} + +if (isset($vars['content'])) { + echo $vars['content']; +} diff --git a/views/default/layout/shells/one_column.php b/views/default/layout/shells/one_column.php new file mode 100644 index 000000000..84a304e14 --- /dev/null +++ b/views/default/layout/shells/one_column.php @@ -0,0 +1,16 @@ +<?php +/** + * Elgg one-column layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + */ +?> +<div class="elgg-layout-one_column elgg-center elgg-width-classic clearfix"> + <div class="elgg-body"> + <?php echo $vars['content']; ?> + <?php echo $vars['area1']; ?> + </div> +</div>
\ No newline at end of file diff --git a/views/default/layout/shells/one_column_with_sidebar.php b/views/default/layout/shells/one_column_with_sidebar.php new file mode 100644 index 000000000..e408c6c1c --- /dev/null +++ b/views/default/layout/shells/one_column_with_sidebar.php @@ -0,0 +1,31 @@ +<?php +/** + * Elgg 1 column with sidebar layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] The content string for the main column + * @uses $vars['sidebar'] Optional content that is displayed in the sidebar + */ +?> + +<div class="elgg-layout-sidebar elgg-center elgg-width-classic clearfix"> + <div class="elgg-sidebar elgg-aside"> + <?php + echo elgg_view('page_elements/sidebar', $vars); + ?> + </div> + + <div class="elgg-main elgg-body"> + <?php + // @todo deprecated so remove in Elgg 2.0 + if (isset($vars['area1'])) { + echo $vars['area1']; + } + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div> diff --git a/views/default/layout/shells/one_sidebar.php b/views/default/layout/shells/one_sidebar.php new file mode 100644 index 000000000..d0bb3879f --- /dev/null +++ b/views/default/layout/shells/one_sidebar.php @@ -0,0 +1,31 @@ +<?php +/** + * Elgg main column with one sidebar layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['body'] Content HTML for the main column + * @uses $vars['sidebar'] Optional content that is displayed in the sidebar + */ +?> + +<div class="elgg-layout-sidebar elgg-center elgg-width-classic clearfix"> + <div class="elgg-sidebar elgg-aside"> + <?php + echo elgg_view('page_elements/sidebar', $vars); + ?> + </div> + + <div class="elgg-main elgg-body"> + <?php + // @todo deprecated so remove in Elgg 2.0 + if (isset($vars['area1'])) { + echo $vars['area1']; + } + if (isset($vars['body'])) { + echo $vars['body']; + } + ?> + </div> +</div> diff --git a/views/default/layout/shells/two_sidebar.php b/views/default/layout/shells/two_sidebar.php new file mode 100644 index 000000000..26fb64920 --- /dev/null +++ b/views/default/layout/shells/two_sidebar.php @@ -0,0 +1,42 @@ +<?php +/** + * Elgg 2 sidebar layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] The content string for the main column + * @uses $vars['sidebar'] Optional content that is displayed in the sidebar + * @uses $vars['sidebar-alt'] Optional content that is displayed in the alternate sidebar + */ +?> + +<div class="elgg-layout-two-sidebar elgg-center elgg-width-classic clearfix"> + <div class="elgg-sidebar elgg-aside"> + <?php + echo elgg_view('page_elements/sidebar', $vars); + ?> + </div> + <div class="elgg-sidebar-alt elgg-aside"> + <?php + //$params = $vars; + //$params['sidebar'] = $vars['sidebar-alt']; + $params = array( + 'sidebar' => elgg_view('layout_elements/module', array('title' => 'Testing', 'body' => 'Hello, world!')) + ); + echo elgg_view('page_elements/sidebar', $params); + ?> + </div> + + <div class="elgg-main elgg-body"> + <?php + // @todo deprecated so remove in Elgg 2.0 + if (isset($vars['area1'])) { + echo $vars['area1']; + } + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div> 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 |