From ab10e3ac5a0b5bbc6cd08c7647a0123364db72f3 Mon Sep 17 00:00:00 2001 From: cash Date: Fri, 3 Dec 2010 02:55:03 +0000 Subject: preview of what the main content area looks like with a module approach git-svn-id: http://code.elgg.org/elgg/trunk@7509 36083f99-b078-4883-b0ff-0f9b5a30f544 --- mod/blog/blog_lib.php | 35 ++++++++++++++++++++++++----------- mod/blog/start.php | 7 ++++++- 2 files changed, 30 insertions(+), 12 deletions(-) (limited to 'mod/blog') diff --git a/mod/blog/blog_lib.php b/mod/blog/blog_lib.php index 593495a0e..adc888ce2 100644 --- a/mod/blog/blog_lib.php +++ b/mod/blog/blog_lib.php @@ -15,25 +15,33 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) { global $CONFIG; + $return = array(); + if ($guid) { $blog = get_entity($guid); if (!elgg_instanceof($blog, 'object', 'blog') || ($blog->status != 'published' && !$blog->canEdit())) { - $content = elgg_echo('blog:error:post_not_found'); + $return['body'] = elgg_echo('blog:error:post_not_found'); } else { elgg_push_breadcrumb($blog->title, $blog->getURL()); - $content = elgg_view_entity($blog, TRUE); + $return['body'] = elgg_view_entity($blog, TRUE); //check to see if comment are on if ($blog->comments_on != 'Off') { - $content .= elgg_view_comments($blog); + $return['body'] .= elgg_view_comments($blog); } } } else { - $content = elgg_view('page_elements/content_header', array( - 'context' => $owner_guid ? 'mine' : 'everyone', + + $params = array( + 'type' => 'blog', + ); + $return['header'] = elgg_view('page_elements/main_header', $params); + + $params = array( 'type' => 'blog', - 'all_link' => "pg/blog" - )); + 'context' => $owner_guid ? 'mine' : 'everyone', + ); + $return['body'] = elgg_view('page_elements/main_nav', $params); $options = array( 'type' => 'object', @@ -42,6 +50,7 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) { //'order_by_metadata' => array('name'=>'publish_date', 'direction'=>'DESC', 'as'=>'int') ); +/* $loggedin_userid = get_loggedin_userid(); if ($owner_guid) { $options['owner_guid'] = $owner_guid; @@ -51,7 +60,10 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) { $content = elgg_view('page_elements/content_header_member', array('type' => 'blog')); } } + * + */ +/* // show all posts for admin or users looking at their own blogs // show only published posts for other users. if (!(isadminloggedin() || (isloggedin() && $owner_guid == $loggedin_userid))) { @@ -60,16 +72,17 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) { //array('name' => 'publish_date', 'operand' => '<', 'value' => time()) ); } +*/ $list = elgg_list_entities_from_metadata($options); if (!$list) { - $content .= elgg_echo('blog:none'); + $return['body'] .= elgg_echo('blog:none'); } else { - $content .= $list; + $return['body'] .= $list; } } - return array('content' => $content); + return $return; } /** @@ -111,7 +124,7 @@ function blog_get_page_content_edit($guid, $revision = NULL) { //$sidebar = elgg_view('blog/sidebar_related'); } - return array('content' => $content, 'sidebar' => $sidebar); + return array('body' => $content, 'sidebar' => $sidebar); } /** diff --git a/mod/blog/start.php b/mod/blog/start.php index 62f963b4b..b279de1a3 100644 --- a/mod/blog/start.php +++ b/mod/blog/start.php @@ -153,7 +153,12 @@ function blog_page_handler($page) { 'page' => isset($page[1]) ? $page[1] : FALSE, )); - $content = elgg_view('navigation/breadcrumbs') . $content_info['content']; + $content = elgg_view('navigation/breadcrumbs'); + $params = array( + 'header' => $content_info['header'], + 'body' => $content_info['body'], + ); + $content .= elgg_view('page_elements/main_module', $params); $params = array( 'content' => $content, -- cgit v1.2.3