1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<?php
/**
* View for page object
*
* @package ElggPages
*/
$full = elgg_get_array_value('full', $vars, FALSE);
$page = elgg_get_array_value('entity', $vars, FALSE);
if (!$page) {
return TRUE;
}
$owner = $page->getOwnerEntity();
$owner_icon = elgg_view('profile/icon', array('entity' => $owner, 'size' => 'tiny'));
$owner_link = elgg_view('output/url', array(
'href' => "pg/pages/owner/$owner->username",
'text' => $owner->name,
));
$author_text = elgg_echo('blog:author_by_line', array($owner_link));
$tags = elgg_view('output/tags', array('tags' => $page->tags));
$date = elgg_view_friendly_time($page->time_created);
$excerpt = elgg_get_excerpt($page->description);
$comments_count = elgg_count_comments($page);
//only display if there are commments
if ($comments_count != 0) {
$text = elgg_echo("comments") . " ($comments_count)";
$comments_link = elgg_view('output/url', array(
'href' => $page->getURL() . '#page-comments',
'text' => $text,
));
} else {
$comments_link = '';
}
$metadata = elgg_view('layout/objects/list/metadata', array(
'entity' => $page,
'handler' => 'pages',
));
$subtitle = "$author_text $date $categories $comments_link";
// do not show the metadata and controls in widget view
if (elgg_in_context('widgets')) {
$metadata = '';
}
if ($full) {
$body = elgg_view('output/longtext', array('value' => $page->description));
$params = array(
'entity' => $page,
'title' => false,
'metadata' => $metadata,
'subtitle' => $subtitle,
'tags' => $tags,
);
$list_body = elgg_view('layout/objects/list/body', $params);
$info = elgg_view_image_block($owner_icon, $list_body);
echo <<<HTML
$info
$body
HTML;
} else {
// brief view
$params = array(
'entity' => $page,
'metadata' => $metadata,
'subtitle' => $subtitle,
'tags' => $tags,
'content' => $excerpt,
);
$list_body = elgg_view('layout/objects/list/body', $params);
echo elgg_view_image_block($owner_icon, $list_body);
}
|