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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
|
<?php
/**
* Elgg bookmark view
*
* @package ElggBookmarks
*/
$full = elgg_get_array_value('full', $vars, FALSE);
$bookmark = elgg_get_array_value('entity', $vars, FALSE);
if (!$bookmark) {
return;
}
$owner = $bookmark->getOwnerEntity();
$container = $bookmark->getContainerEntity();
$categories = elgg_view('categories/view', $vars);
$link = filter_tags(elgg_view('output/url', array('href' => $bookmark->address)));
$description = elgg_view('output/longtext', array('value' => $bookmark->description, 'class' => 'pbl'));
$owner_link = elgg_view('output/url', array(
'href' => "pg/file/owner/$owner->username",
'text' => $owner->name,
));
$author_text = elgg_echo('blog:author_by_line', array($owner_link));
$tags = elgg_view('output/tags', array('tags' => $bookmark->tags));
$date = elgg_view_friendly_time($bookmark->time_created);
$comments_count = elgg_count_comments($bookmark);
//only display if there are commments
if ($comments_count != 0) {
$text = elgg_echo("comments") . " ($comments_count)";
$comments_link = elgg_view('output/url', array(
'href' => $bookmark->getURL() . '#comments',
'text' => $text,
));
} else {
$comments_link = '';
}
$metadata = elgg_view('layout/objects/list/metadata', array(
'entity' => $bookmark,
'handler' => 'bookmarks',
));
$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 && !elgg_in_context('gallery')) {
$header = elgg_view_title($bookmark->title);
$params = array(
'entity' => $bookmark,
'title' => false,
'metadata' => $metadata,
'subtitle' => $subtitle,
'tags' => $tags,
);
$bookmark_info = elgg_view('layout/objects/list/body', $params);
echo <<<HTML
$header
$bookmark_info
<div class="bookmark elgg-content">
<span class="elgg-icon elgg-icon-following"></span><h3 class="pbl">$link</h3>
$description
</div>
HTML;
} elseif (elgg_in_context('gallery')) {
echo '<div class="bookmarks-gallery-item">';
echo "<h3>" . $bookmark->title . "</h3>";
echo "<p class='subtitle'>$owner_link $date</p>";
echo '</div>';
} else {
// brief view
$url = $bookmark->address;
$display_text = $url;
$excerpt = elgg_get_excerpt($bookmark->description);
if (strlen($url) > 25) {
$bits = parse_url($url);
if (isset($bits['host'])) {
$display_text = $bits['host'];
} else {
$display_text = elgg_get_excerpt($url, 100);
}
}
$link = filter_tags(elgg_view('output/url', array(
'href' => $bookmark->address,
'text' => $display_text
)));
$content = "<span class=\"elgg-icon elgg-icon-following\"></span>$link - $excerpt";
$params = array(
'entity' => $bookmark,
'metadata' => $metadata,
'subtitle' => $subtitle,
'tags' => $tags,
'content' => $content,
);
echo elgg_view('layout/objects/list/body', $params);
}
|