diff options
Diffstat (limited to 'mod/pages/pages/pages/view.php')
-rw-r--r-- | mod/pages/pages/pages/view.php | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/mod/pages/pages/pages/view.php b/mod/pages/pages/pages/view.php new file mode 100644 index 000000000..e1c3fdbfd --- /dev/null +++ b/mod/pages/pages/pages/view.php @@ -0,0 +1,55 @@ +<?php +/** + * View a single page + * + * @package ElggPages + */ + +$page_guid = get_input('guid'); +$page = get_entity($page_guid); +if (!$page) { + register_error(elgg_echo('noaccess')); + $_SESSION['last_forward_from'] = current_page_url(); + forward(''); +} + +elgg_set_page_owner_guid($page->getContainerGUID()); + +group_gatekeeper(); + +$container = elgg_get_page_owner_entity(); +if (!$container) { +} + +$title = $page->title; + +if (elgg_instanceof($container, 'group')) { + elgg_push_breadcrumb($container->name, "pages/group/$container->guid/all"); +} else { + elgg_push_breadcrumb($container->name, "pages/owner/$container->username"); +} +pages_prepare_parent_breadcrumbs($page); +elgg_push_breadcrumb($title); + +$content = elgg_view_entity($page, array('full_view' => true)); +$content .= elgg_view_comments($page); + +// can add subpage if can edit this page and write to container (such as a group) +if ($page->canEdit() && $container->canWriteToContainer(0, 'object', 'page')) { + $url = "pages/add/$page->guid"; + elgg_register_menu_item('title', array( + 'name' => 'subpage', + 'href' => $url, + 'text' => elgg_echo('pages:newchild'), + 'link_class' => 'elgg-button elgg-button-action', + )); +} + +$body = elgg_view_layout('content', array( + 'filter' => '', + 'content' => $content, + 'title' => $title, + 'sidebar' => elgg_view('pages/sidebar/navigation'), +)); + +echo elgg_view_page($title, $body); |