aboutsummaryrefslogtreecommitdiff
path: root/mod/file/views/default/object/file.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/file/views/default/object/file.php')
-rw-r--r--mod/file/views/default/object/file.php72
1 files changed, 27 insertions, 45 deletions
diff --git a/mod/file/views/default/object/file.php b/mod/file/views/default/object/file.php
index 1d3aa7140..64f19c483 100644
--- a/mod/file/views/default/object/file.php
+++ b/mod/file/views/default/object/file.php
@@ -5,8 +5,8 @@
* @package ElggFile
*/
-$full = elgg_get_array_value('full', $vars, FALSE);
-$file = elgg_get_array_value('entity', $vars, FALSE);
+$full = elgg_extract('full_view', $vars, FALSE);
+$file = elgg_extract('entity', $vars, FALSE);
if (!$file) {
return TRUE;
@@ -14,51 +14,43 @@ if (!$file) {
$owner = $file->getOwnerEntity();
$container = $file->getContainerEntity();
-$categories = elgg_view('categories/view', $vars);
+$categories = elgg_view('output/categories', $vars);
$excerpt = elgg_get_excerpt($file->description);
$mime = $file->mimetype;
$base_type = substr($mime, 0, strpos($mime,'/'));
-$body = elgg_view('output/longtext', array('value' => $file->description));
-
$owner_link = elgg_view('output/url', array(
- 'href' => "pg/file/owner/$owner->username",
+ 'href' => "file/owner/$owner->username",
'text' => $owner->name,
+ 'is_trusted' => true,
));
-$author_text = elgg_echo('blog:author_by_line', array($owner_link));
+$author_text = elgg_echo('byline', array($owner_link));
-$file_icon = elgg_view('file/icon', array(
- 'mimetype' => $mime,
- 'thumbnail' => $file->thumbnail,
- 'file_guid' => $file->guid,
- 'size' => 'small'
-));
+$file_icon = elgg_view_entity_icon($file, 'small');
-if ($file->tags) {
- $tags = "<p class=\"elgg-tags\">" . elgg_view('output/tags', array('tags' => $file->tags)) . "</p>";
-} else {
- $tags = "";
-}
$date = elgg_view_friendly_time($file->time_created);
-$comments_count = elgg_count_comments($file);
+$comments_count = $file->countComments();
//only display if there are commments
if ($comments_count != 0) {
$text = elgg_echo("comments") . " ($comments_count)";
$comments_link = elgg_view('output/url', array(
'href' => $file->getURL() . '#file-comments',
'text' => $text,
+ 'is_trusted' => true,
));
} else {
$comments_link = '';
}
-$metadata = elgg_view('layout/objects/list/metadata', array(
- 'entity' => $file,
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
'handler' => 'file',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
));
-$subtitle = "$author_text $date $categories $comments_link";
+$subtitle = "$author_text $date $comments_link $categories";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
@@ -74,39 +66,29 @@ if ($full && !elgg_in_context('gallery')) {
$extra = elgg_view("file/specialcontent/$base_type/default", $vars);
}
- $download = elgg_view('output/url', array(
- 'href' => "mod/file/download.php?file_guid=$file->guid",
- 'text' => elgg_echo("file:download"),
- 'class' => 'elgg-action-button',
- ));
-
- $header = elgg_view_title($file->title);
-
$params = array(
'entity' => $file,
'title' => false,
'metadata' => $metadata,
'subtitle' => $subtitle,
- 'tags' => $tags,
);
- $list_body = elgg_view('layout/objects/list/body', $params);
+ $params = $params + $vars;
+ $summary = elgg_view('object/elements/summary', $params);
- $file_info = elgg_view_image_block($file_icon, $list_body);
+ $text = elgg_view('output/longtext', array('value' => $file->description));
+ $body = "$text $extra";
- echo <<<HTML
-$header
-$file_info
-<div class="file elgg-content">
- $body
- $extra
- <p>$download</p>
-</div>
-HTML;
+ echo elgg_view('object/elements/full', array(
+ 'entity' => $file,
+ 'icon' => $file_icon,
+ 'summary' => $summary,
+ 'body' => $body,
+ ));
} elseif (elgg_in_context('gallery')) {
echo '<div class="file-gallery-item">';
echo "<h3>" . $file->title . "</h3>";
- echo "<a href=\"{$file->getURL()}\"><img src=\"".elgg_get_site_url()."mod/file/thumbnail.php?size=medium&file_guid={$vars['entity']->getGUID()}\" /></a>";
+ echo elgg_view_entity_icon($file, 'medium');
echo "<p class='subtitle'>$owner_link $date</p>";
echo '</div>';
} else {
@@ -116,10 +98,10 @@ HTML;
'entity' => $file,
'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($file_icon, $list_body);
}