aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views/default/object/blog.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/blog/views/default/object/blog.php')
-rw-r--r--mod/blog/views/default/object/blog.php131
1 files changed, 46 insertions, 85 deletions
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index f296caa69..4403a6006 100644
--- a/mod/blog/views/default/object/blog.php
+++ b/mod/blog/views/default/object/blog.php
@@ -5,37 +5,41 @@
* @package Blog
*/
-$full = elgg_get_array_value('full', $vars, FALSE);
-$blog = elgg_get_array_value('entity', $vars, FALSE);
+$full = elgg_extract('full_view', $vars, FALSE);
+$blog = elgg_extract('entity', $vars, FALSE);
if (!$blog) {
return TRUE;
}
-$owner = get_entity($blog->owner_guid);
-$container = get_entity($blog->container_guid);
-$linked_title = "<a href=\"{$blog->getURL()}\" title=\"" . htmlentities($blog->title) . "\">{$blog->title}</a>";
-$categories = elgg_view('categories/view', $vars);
+$owner = $blog->getOwnerEntity();
+$container = $blog->getContainerEntity();
+$categories = elgg_view('output/categories', $vars);
$excerpt = $blog->excerpt;
-
-$body = autop($blog->description);
-$owner_icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny'));
-$owner_blog_link = "<a href=\"" . elgg_get_site_url() . "pg/blog/owner/$owner->username\">{$owner->name}</a>";
-$author_text = elgg_echo('blog:author_by_line', array($owner_blog_link));
-if ($blog->tags) {
- $tags = "<p class=\"elgg-tags\">" . elgg_view('output/tags', array('tags' => $blog->tags)) . "</p>";
-} else {
- $tags = "";
+if (!$excerpt) {
+ $excerpt = elgg_get_excerpt($blog->description);
}
-$date = elgg_view_friendly_time($blog->publish_date);
+
+$owner_icon = elgg_view_entity_icon($owner, 'tiny');
+$owner_link = elgg_view('output/url', array(
+ 'href' => "blog/owner/$owner->username",
+ 'text' => $owner->name,
+ 'is_trusted' => true,
+));
+$author_text = elgg_echo('byline', array($owner_link));
+$date = elgg_view_friendly_time($blog->time_created);
// The "on" status changes for comments, so best to check for !Off
if ($blog->comments_on != 'Off') {
- $comments_count = elgg_count_comments($blog);
+ $comments_count = $blog->countComments();
//only display if there are commments
if ($comments_count != 0) {
$text = elgg_echo("comments") . " ($comments_count)";
- $comments_link = "<a href=\"{$blog->getURL()}#annotations\">$text</a>";
+ $comments_link = elgg_view('output/url', array(
+ 'href' => $blog->getURL() . '#blog-comments',
+ 'text' => $text,
+ 'is_trusted' => true,
+ ));
} else {
$comments_link = '';
}
@@ -43,84 +47,41 @@ if ($blog->comments_on != 'Off') {
$comments_link = '';
}
-// access is always shown.
-$metadata = '<ul class="elgg-list-metadata">';
-$metadata .= '<li>' . elgg_view('output/access', array('entity' => $vars['entity'])) . '</li>';
-
-if (isloggedin() && $blog->getOwnerGUID() != get_loggedin_userid()) {
- $likes = elgg_view_likes($blog);
- $metadata .= "<li>$likes</li>";
-}
-
-// pass <li>your data</li> back from the view
-$metadata .= elgg_view("entity/metadata", array('entity' => $blog));
-
-// links to delete or edit.
-if ($blog->canEdit()) {
-
- $status = '';
- if ($blog->status != 'published') {
- $status_text = elgg_echo("blog:status:{$blog->status}");
- $metadata .= "<li>$status_text</li>";
- }
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'blog',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
- $edit_url = elgg_get_site_url()."pg/blog/edit/{$owner->username}/{$blog->getGUID()}/";
- $edit_link = "<span class='entity-edit'><a href=\"$edit_url\">" . elgg_echo('edit') . '</a></span>';
- $metadata .= "<li>$edit_link</li>";
+$subtitle = "$author_text $date $comments_link $categories";
- $delete_url = "action/blog/delete?guid={$blog->getGUID()}";
- $delete_link = elgg_view('output/confirmlink', array(
- 'href' => $delete_url,
- 'text' => '<span class="elgg-icon elgg-icon-delete"></span>',
- 'title' => elgg_echo('delete'),
- 'confirm' => elgg_echo('deleteconfirm'),
- 'encode' => false,
- ));
- $metadata .= "<li>$delete_link</li>";
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
}
-$metadata .= '</ul>';
-
-$subtitle = "$author_text $date $categories $comments_link";
-
if ($full) {
- $params = array(
- 'title' => $blog->title,
- 'buttons' => '',
- );
- $header = elgg_view('content/header', $params);
+ $body = elgg_view('output/longtext', array(
+ 'value' => $blog->description,
+ 'class' => 'blog-post',
+ ));
$params = array(
'entity' => $blog,
+ 'title' => false,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
);
- $list_body = elgg_view('layout/objects/list/body', $params);
-
- $info = <<<HTML
-<div class="entity-listing-info clearfix">
- <div class="entity-metadata">$edit</div>
- <p class="entity-subtext">
- $author_text
- $date
- $categories
- $comments_link
- </p>
- $tags
-</div>
-HTML;
+ $params = $params + $vars;
+ $summary = elgg_view('object/elements/summary', $params);
- $blog_info = elgg_view_image_block($owner_icon, $list_body);
-
- echo <<<HTML
-$header
-$blog_info
-<div class="blog_post elgg-content">
- $body
-</div>
-HTML;
+ echo elgg_view('object/elements/full', array(
+ 'summary' => $summary,
+ 'icon' => $owner_icon,
+ 'body' => $body,
+ ));
} else {
// brief view
@@ -129,10 +90,10 @@ HTML;
'entity' => $blog,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
'content' => $excerpt,
);
- $list_body = elgg_view('layout/objects/list/body', $params);
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
echo elgg_view_image_block($owner_icon, $list_body);
}