aboutsummaryrefslogtreecommitdiff
path: root/mod/blog
diff options
context:
space:
mode:
Diffstat (limited to 'mod/blog')
-rw-r--r--mod/blog/blog_lib.php62
-rw-r--r--mod/blog/start.php35
2 files changed, 42 insertions, 55 deletions
diff --git a/mod/blog/blog_lib.php b/mod/blog/blog_lib.php
index adc888ce2..4db3effde 100644
--- a/mod/blog/blog_lib.php
+++ b/mod/blog/blog_lib.php
@@ -20,28 +20,23 @@ function blog_get_page_content_read($owner_guid = NULL, $guid = NULL) {
if ($guid) {
$blog = get_entity($guid);
+ // no header or tabs for viewing an individual blog
+ $return['filter'] = '';
+ $return['header'] = '';
+
if (!elgg_instanceof($blog, 'object', 'blog') || ($blog->status != 'published' && !$blog->canEdit())) {
- $return['body'] = elgg_echo('blog:error:post_not_found');
+ $return['content'] = elgg_echo('blog:error:post_not_found');
} else {
elgg_push_breadcrumb($blog->title, $blog->getURL());
- $return['body'] = elgg_view_entity($blog, TRUE);
+ $return['content'] = elgg_view_entity($blog, TRUE);
//check to see if comment are on
if ($blog->comments_on != 'Off') {
- $return['body'] .= elgg_view_comments($blog);
+ $return['content'] .= elgg_view_comments($blog);
}
}
} else {
- $params = array(
- 'type' => 'blog',
- );
- $return['header'] = elgg_view('page_elements/main_header', $params);
-
- $params = array(
- 'type' => 'blog',
- 'context' => $owner_guid ? 'mine' : 'everyone',
- );
- $return['body'] = elgg_view('page_elements/main_nav', $params);
+ $return['filter_context'] = $owner_guid ? 'mine' : 'everyone';
$options = array(
'type' => 'object',
@@ -50,20 +45,18 @@ 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;
-
+/*
if ($owner_guid != $loggedin_userid) {
// do not show content header when viewing other users' posts
$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))) {
@@ -72,13 +65,12 @@ 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) {
- $return['body'] .= elgg_echo('blog:none');
+ $return['content'] = elgg_echo('blog:none');
} else {
- $return['body'] .= $list;
+ $return['content'] = $list;
}
}
@@ -124,7 +116,12 @@ function blog_get_page_content_edit($guid, $revision = NULL) {
//$sidebar = elgg_view('blog/sidebar_related');
}
- return array('body' => $content, 'sidebar' => $sidebar);
+ return array(
+ 'content' => $content,
+ 'sidebar' => $sidebar,
+ 'header' => '',
+ 'filter' => '',
+ );
}
/**
@@ -197,7 +194,9 @@ function blog_get_page_content_archive($owner_guid, $lower=0, $upper=0) {
}
return array(
- 'content' => $content
+ 'content' => $content,
+ 'filter' => '',
+ 'header' => '',
);
}
@@ -212,14 +211,13 @@ function blog_get_page_content_friends($user_guid) {
elgg_push_breadcrumb(elgg_echo('friends'));
- $content = elgg_view('page_elements/content_header', array(
- 'context' => 'friends',
- 'type' => 'blog',
- 'all_link' => "pg/blog"
- ));
+ $return = array();
+
+ $return['filter_context'] = 'friends';
if (!$friends = get_user_friends($user_guid, ELGG_ENTITIES_ANY_VALUE, 0)) {
- $content .= elgg_echo('friends:none:you');
+ $return['content'] .= elgg_echo('friends:none:you');
+ return $return;
} else {
$options = array(
'type' => 'object',
@@ -246,13 +244,13 @@ function blog_get_page_content_friends($user_guid) {
$list = elgg_list_entities_from_metadata($options);
if (!$list) {
- $content .= elgg_echo('blog:none');
+ $return['content'] = elgg_echo('blog:none');
} else {
- $content .= $list;
+ $return['content'] = $list;
}
}
- return array('content' => $content);
+ return $return;
}
/**
diff --git a/mod/blog/start.php b/mod/blog/start.php
index b279de1a3..0d0c58ac8 100644
--- a/mod/blog/start.php
+++ b/mod/blog/start.php
@@ -92,13 +92,13 @@ function blog_runonce() {
function blog_page_handler($page) {
global $CONFIG;
+ // push breadcrumb
+ elgg_push_breadcrumb(elgg_echo('blog:blogs'), "pg/blog");
+
// see if we're showing all or just a user's
if (isset($page[0]) && !empty($page[0])) {
$username = $page[0];
- // push breadcrumb
- elgg_push_breadcrumb(elgg_echo('blog:blogs'), "pg/blog");
-
// forward away if invalid user.
if (!$user = get_user_by_username($username)) {
register_error('blog:error:unknown_username');
@@ -118,24 +118,24 @@ function blog_page_handler($page) {
switch ($action) {
case 'read':
$title = elgg_echo('blog:title:user_blogs', array($user->name));
- $content_info = blog_get_page_content_read($user->getGUID(), $page2);
+ $params = blog_get_page_content_read($user->getGUID(), $page2);
break;
case 'new':
case 'edit':
gatekeeper();
$title = elgg_echo('blog:edit');
- $content_info = blog_get_page_content_edit($page2, $page3);
+ $params = blog_get_page_content_edit($page2, $page3);
break;
case 'archive':
$title = elgg_echo('blog:archives');
- $content_info = blog_get_page_content_archive($user->getGUID(), $page2, $page3);
+ $params = blog_get_page_content_archive($user->getGUID(), $page2, $page3);
break;
case 'friends':
$title = elgg_echo('blog:title:friends');
- $content_info = blog_get_page_content_friends($user->getGUID());
+ $params = blog_get_page_content_friends($user->getGUID());
break;
default:
@@ -144,27 +144,16 @@ function blog_page_handler($page) {
}
} else {
$title = elgg_echo('blog:title:all_blogs');
- $content_info = blog_get_page_content_read();
+ $params = blog_get_page_content_read();
}
- $sidebar = isset($content_info['sidebar']) ? $content_info['sidebar'] : '';
-
- $sidebar .= elgg_view('blog/sidebar_menu', array(
+ $sidebar_menu = elgg_view('blog/sidebar_menu', array(
'page' => isset($page[1]) ? $page[1] : FALSE,
));
- $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,
- 'sidebar' => $sidebar,
- );
- $body = elgg_view_layout('one_column_with_sidebar', $params);
+ $params['sidebar'] .= $sidebar_menu;
+
+ $body = elgg_view_layout('main_content', $params);
echo elgg_view_page($title, $body);
}