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 | |
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')
-rw-r--r-- | views/default/page/layouts/admin.php | 84 | ||||
-rw-r--r-- | views/default/page/layouts/content.php | 57 | ||||
-rw-r--r-- | views/default/page/layouts/default.php | 18 | ||||
-rw-r--r-- | views/default/page/layouts/one_column.php | 25 | ||||
-rw-r--r-- | views/default/page/layouts/one_sidebar.php | 42 | ||||
-rw-r--r-- | views/default/page/layouts/two_column_left_sidebar.php | 26 | ||||
-rw-r--r-- | views/default/page/layouts/two_sidebar.php | 48 | ||||
-rw-r--r-- | views/default/page/layouts/widgets.php | 53 |
8 files changed, 353 insertions, 0 deletions
diff --git a/views/default/page/layouts/admin.php b/views/default/page/layouts/admin.php new file mode 100644 index 000000000..7ba4abbd1 --- /dev/null +++ b/views/default/page/layouts/admin.php @@ -0,0 +1,84 @@ +<?php +/** + * Elgg Admin Area Canvas + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + * @uses $vars['sidebar'] Optional sidebar content + * @uses $vars['title'] Title string + */ + +$admin_title = elgg_get_site_entity()->name . ' ' . elgg_echo('admin'); + +$view_site = elgg_view('output/url', array( + 'href' => elgg_get_site_url(), + 'text' => elgg_echo('admin:view_site'), +)); +$logout = elgg_view('output/url', array( + 'href' => 'action/logout', + 'text' => elgg_echo('logout'), +)); +?> + +<div class="elgg-page-header"> + <div class="elgg-inner clearfix"> + <h1 class="elgg-heading-site"> + <a href="<?php echo elgg_get_site_url(); ?>pg/admin/"> + <?php echo $admin_title; ?> + </a> + </h1> + <ul class="elgg-menu-user"> + <li><?php echo elgg_echo('admin:loggedin', array(elgg_get_logged_in_user_entity()->name)); ?></li> + <li><?php echo $view_site; ?></li> + <li><?php echo $logout; ?></li> + </ul> + </div> +</div> + +<?php +// @todo clean up system messages code +$messages = null; +if (count_messages()) { + // get messages - try for errors first + $messages = system_messages(NULL, "error"); + if (count($messages["error"]) == 0) { + // no errors so grab rest of messages + $messages = system_messages(null, ""); + } else { + // we have errors - clear out remaining messages + system_messages(null, ""); + } +} +echo elgg_view('page/elements/messages', array('object' => $messages)); +?> + +<div class="elgg-page-body"> + <div class="elgg-sidebar clearfix"> + <?php + echo elgg_view('admin/sidebar/top', $vars); + echo elgg_view('layout/shells/admin/menu', $vars); + echo elgg_view('admin/sidebar/bottom', $vars); + ?> + </div> + <div class="elgg-main elgg-body"> + <div class="elgg-head"> + <?php + if (isset($vars['title'])) { + echo elgg_view_title($vars['title']); + } + ?> + </div> + <?php + if (isset($vars['content'])) { + echo $vars['content']; + } + ?> + </div> +</div> +<div class="elgg-page-footer"> +</div> +<?php + +echo elgg_view('footer/analytics'); diff --git a/views/default/page/layouts/content.php b/views/default/page/layouts/content.php new file mode 100644 index 000000000..69772985a --- /dev/null +++ b/views/default/page/layouts/content.php @@ -0,0 +1,57 @@ +<?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 + * @uses $vars['class'] Additional class to apply to layout + */ + +// give plugins an opportunity to add to content sidebars +$sidebar_content = elgg_extract('sidebar', $vars, ''); +$params = $vars; +$params['content'] = $sidebar_content; +$sidebar = elgg_view('layout/shells/content/sidebar', $params); + +// navigation defaults to breadcrumbs +$nav = elgg_extract('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('layout/shells/content/header', $vars); + +// allow page handlers to override the default filter +if (isset($vars['filter'])) { + $vars['filter_override'] = $vars['filter']; +} +$filter = elgg_view('layout/shells/content/filter', $vars); + +// the all important content +$content = elgg_extract('content', $vars, ''); + +// optional footer for main content area +$footer_content = elgg_extract('footer', $vars, ''); +$params = $vars; +$params['content'] = $footer_content; +$footer = elgg_view('layout/shells/content/footer', $params); + +$body = $nav . $header . $filter . $content . $footer; + +$params = array( + 'content' => $body, + 'sidebar' => $sidebar, +); +if (isset($vars['class'])) { + $params['class'] = $vars['class']; +} +echo elgg_view_layout('one_sidebar', $params); diff --git a/views/default/page/layouts/default.php b/views/default/page/layouts/default.php new file mode 100644 index 000000000..60dc90b0d --- /dev/null +++ b/views/default/page/layouts/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/page/layouts/one_column.php b/views/default/page/layouts/one_column.php new file mode 100644 index 000000000..ab6a24878 --- /dev/null +++ b/views/default/page/layouts/one_column.php @@ -0,0 +1,25 @@ +<?php +/** + * Elgg one-column layout + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content string + * @uses $vars['class'] Additional class to apply to layout + */ + +$class = 'elgg-inner clearfix'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} +?> +<div class="<?php echo $class; ?>" id="elgg-layout-one-column"> + <div class="elgg-body"> + <?php echo $vars['content']; ?> + <?php + // @deprecated 1.8 + echo $vars['area1']; + ?> + </div> +</div>
\ No newline at end of file diff --git a/views/default/page/layouts/one_sidebar.php b/views/default/page/layouts/one_sidebar.php new file mode 100644 index 000000000..53f065b3e --- /dev/null +++ b/views/default/page/layouts/one_sidebar.php @@ -0,0 +1,42 @@ +<?php +/** + * Layout for main column with one sidebar + * + * @package Elgg + * @subpackage Core + * + * @uses $vars['content'] Content HTML for the main column + * @uses $vars['sidebar'] Optional content that is displayed in the sidebar + * @uses $vars['title'] Optional title for main content area + * @uses $vars['class'] Additional class to apply to layout + */ + +$class = 'elgg-inner clearfix'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} + +?> + +<div class="<?php echo $class; ?>" id="elgg-layout-sidebar"> + <div class="elgg-sidebar elgg-aside"> + <?php + echo elgg_view('page/elements/sidebar', $vars); + ?> + </div> + + <div class="elgg-main elgg-body"> + <?php + if (isset($vars['title'])) { + echo elgg_view_title($vars['title']); + } + // @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/page/layouts/two_column_left_sidebar.php b/views/default/page/layouts/two_column_left_sidebar.php new file mode 100644 index 000000000..97f4d2719 --- /dev/null +++ b/views/default/page/layouts/two_column_left_sidebar.php @@ -0,0 +1,26 @@ +<?php +/** + * Deprecated layout from 1.0-1.7 + * + * Use one_sidebar instead + */ + +if (!isset($vars['content'])) { + $vars['content'] = $vars['area2']; +} +if (!isset($vars['content'])) { + $vars['sidebar'] = $vars['area1'] . $vars['area3']; +} + +unset($vars['area1']); +unset($vars['area2']); +unset($vars['area3']); + +// backward compatability support for plugins that are not using the new approach +// of routing through pg/admin +if (elgg_get_context() == 'admin') { + echo elgg_view('page/layouts/admin', $vars); + return true; +} + +echo elgg_view('page/layouts/one_sidebar', $vars); diff --git a/views/default/page/layouts/two_sidebar.php b/views/default/page/layouts/two_sidebar.php new file mode 100644 index 000000000..1e6c2aae7 --- /dev/null +++ b/views/default/page/layouts/two_sidebar.php @@ -0,0 +1,48 @@ +<?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 + * @uses $vars['class'] Additional class to apply to layout + */ + +$class = 'elgg-inner clearfix'; +if (isset($vars['class'])) { + $class = "$class {$vars['class']}"; +} +?> + +<div class="<?php echo $class; ?>" id="elgg-layout-two-sidebar"> + <div class="elgg-sidebar elgg-aside"> + <?php + echo elgg_view('page/elements/sidebar', $vars); + ?> + </div> + <div class="elgg-sidebar elgg-alt elgg-aside"> + <?php + //$params = $vars; + //$params['sidebar'] = $vars['sidebar_alt']; + $params = array( + 'sidebar' => elgg_view_module('test', 'Testing', '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/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')); |