aboutsummaryrefslogtreecommitdiff
path: root/mod/blog/views/default/object
diff options
context:
space:
mode:
Diffstat (limited to 'mod/blog/views/default/object')
-rw-r--r--mod/blog/views/default/object/blog.php139
1 files changed, 57 insertions, 82 deletions
diff --git a/mod/blog/views/default/object/blog.php b/mod/blog/views/default/object/blog.php
index 08e174063..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,82 +47,53 @@ if ($blog->comments_on != 'Off') {
$comments_link = '';
}
-// access is always shown.
-$edit = elgg_view('output/access', array('entity' => $vars['entity']));
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'blog',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
-// links to delete or edit.
-if ($blog->canEdit()) {
- $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>';
-
- $delete_url = "action/blog/delete?guid={$blog->getGUID()}";
- $delete_link = "<span class='delete-button'>" . elgg_view('output/confirmlink', array(
- 'href' => $delete_url,
- 'text' => elgg_echo('delete'),
- 'confirm' => elgg_echo('deleteconfirm')
- )) . "</span>";
-
- $status = '';
- if ($blog->status != 'published') {
- $status_text = elgg_echo("blog:status:{$blog->status}");
- $status = "<span class='blog_status'>$status_text</span>";
- }
+$subtitle = "$author_text $date $comments_link $categories";
- $edit .= "$status $edit_link $delete_link";
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
}
-// include a view for plugins to extend
-$edit = elgg_view("blogs/options", array("object_type" => 'blog', 'entity' => $blog)) .
- elgg_view_likes($blog) . $edit;
-
if ($full) {
+ $body = elgg_view('output/longtext', array(
+ 'value' => $blog->description,
+ 'class' => 'blog-post',
+ ));
+
$params = array(
- 'title' => $blog->title,
- 'buttons' => '',
+ 'entity' => $blog,
+ 'title' => false,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
);
- $header = elgg_view('content/header', $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_media($owner_icon, $info);
-
- 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
- $body = <<<HTML
- <div class="entity-listing-info">
- <div class="elgg-metadata">$edit</div>
- <p class="entity-title">$linked_title</p>
- <p class="entity-subtext">
- $author_text
- $date
- $categories
- $comments_link
- </p>
- $tags
- <p>$excerpt</p>
- </div>
-HTML;
+ $params = array(
+ 'entity' => $blog,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'content' => $excerpt,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
- echo elgg_view_media($owner_icon, $body);
+ echo elgg_view_image_block($owner_icon, $list_body);
}