Elgg  Version 2.3
comment.php
Go to the documentation of this file.
1 <?php
9 $full_view = elgg_extract('full_view', $vars, true);
10 
11 $comment = $vars['entity'];
12 /* @var ElggComment $comment */
13 
14 $entity = get_entity($comment->container_guid);
15 $commenter = get_user($comment->owner_guid);
16 if (!$entity || !$commenter) {
17  return true;
18 }
19 
21 
23 $commenter_link = "<a href=\"{$commenter->getURL()}\">$commenter->name</a>";
24 
25 $entity_title = $entity->title ? $entity->title : elgg_echo('untitled');
26 $entity_link = "<a href=\"{$entity->getURL()}\">$entity_title</a>";
27 
28 if ($full_view) {
29  $anchor = "<a name=\"comment-{$comment->getGUID()}\"></a>";
30 
31  $menu = elgg_view_menu('entity', array(
32  'entity' => $comment,
33  'handler' => 'comment',
34  'sort_by' => 'priority',
35  'class' => 'elgg-menu-hz float-alt',
36  ));
37 
38  if (elgg_in_context('activity')) {
39 
40  $comment_text = '<div class="elgg-output elgg-inner" data-role="comment-text">';
41  $comment_text .= elgg_view('output/text', array(
42  'value' => elgg_get_excerpt($comment->description),
43  ));
44  $comment_text .= '</div>';
45 
46  $time_link = elgg_view('output/url', [
47  'href' => $comment->getURL(),
48  'text' => $friendlytime,
49  'is_trusted' => true,
50  ]);
51 
52  } else {
53  $comment_text = elgg_view('output/longtext', array(
54  'value' => $comment->description,
55  'class' => 'elgg-inner',
56  'data-role' => 'comment-text',
57  ));
58 
59  $time_link = elgg_view('output/url', [
60  'href' => $comment->getURL(),
61  'text' => $friendlytime,
62  'is_trusted' => true,
63  ]);
64  }
65  $body = <<<HTML
66 $anchor
67 <div class="mbn">
68  $menu
70  <span class="elgg-subtext">
71  $time_link
72  </span>
74 </div>
75 HTML;
76 
78 
79 } else {
80  // brief view
81 
82  $excerpt = elgg_get_excerpt($comment->description, 80);
83  $posted = elgg_echo('generic_comment:on', array($commenter_link, $entity_link));
84 
85  $body = <<<HTML
86 <span class="elgg-subtext">
88 </span>
89 HTML;
90 
92 }
$comment_text
Definition: save.php:11
$commenter_link
Definition: comment.php:23
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
$commenter_icon
Definition: comment.php:22
$full_view
Elgg comment view.
Definition: comment.php:9
$commenter
Definition: comment.php:15
ui datepicker td span
Definition: admin.css.php:680
$vars['entity']
$entity
Definition: comment.php:14
elgg_view_image_block($image, $body, $vars=array())
Wrapper function for the image block display pattern.
Definition: views.php:1229
get_user($guid)
Get a user object from a GUID.
Definition: users.php:87
fieldset div
Definition: admin.css.php:485
elgg_in_context($context)
Check if this context exists anywhere in the stack.
Definition: pageowner.php:241
elgg echo
Translates a string.
Definition: languages.js:48
elgg_view($view, $vars=array(), $ignore1=false, $ignore2=false, $viewtype= '')
Return a parsed view.
Definition: views.php:336
elgg_extract($key, $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1375
$posted
Definition: comment.php:83
elgg_view_menu($menu, array $vars=array())
Render a menu.
Definition: views.php:775
$entity_title
Definition: comment.php:25
$entity_link
Definition: comment.php:26
elgg_get_excerpt($text, $num_chars=250)
Returns an excerpt.
Definition: output.php:62
$body
Definition: comment.php:85
elgg_view_entity_icon(\ElggEntity $entity, $size= 'medium', $vars=array())
View the icon of an entity.
Definition: views.php:936
$menu
Definition: default.php:19
$comment
Definition: comment.php:11
if(!$entity||!$commenter) $friendlytime
Definition: comment.php:20
elgg_view_friendly_time($time)
Displays a UNIX timestamp in a friendly way.
Definition: views.php:1176
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:204
if($string_length<=$num_chars) $excerpt
Definition: excerpt.php:24