Elgg  Version 1.9
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 
13 $entity = get_entity($comment->container_guid);
14 $commenter = get_user($comment->owner_guid);
15 if (!$entity || !$commenter) {
16  return true;
17 }
18 
20 
22 $commenter_link = "<a href=\"{$commenter->getURL()}\">$commenter->name</a>";
23 
24 $entity_title = $entity->title ? $entity->title : elgg_echo('untitled');
25 $entity_link = "<a href=\"{$entity->getURL()}\">$entity_title</a>";
26 
27 if ($full_view) {
28  $anchor = "<a name=\"comment-{$comment->getGUID()}\"></a>";
29 
30  $menu = elgg_view_menu('entity', array(
31  'entity' => $comment,
32  'handler' => 'comment',
33  'sort_by' => 'priority',
34  'class' => 'elgg-menu-hz float-alt',
35  ));
36 
37  $comment_text = elgg_view("output/longtext", array(
38  'value' => $comment->description,
39  'class' => 'elgg-inner',
40  'data-role' => 'comment-text',
41  ));
42 
43  $body = <<<HTML
44 $anchor
45 <div class="mbn">
46  $menu
48  <span class="elgg-subtext">
50  </span>
52 </div>
53 HTML;
54 
56 
57 } else {
58  // brief view
59 
60  $excerpt = elgg_get_excerpt($comment->description, 80);
61  $posted = elgg_echo('generic_comment:on', array($commenter_link, $entity_link));
62 
63  $body = <<<HTML
64 <span class="elgg-subtext">
65  $posted ($friendlytime): $excerpt
66 </span>
67 HTML;
68 
70 }
$comment_text
Definition: save.php:11
$commenter_link
Definition: comment.php:22
$commenter_icon
Definition: comment.php:21
$full_view
Elgg comment view.
Definition: comment.php:9
$commenter
Definition: comment.php:14
elgg_extract($key, array $array, $default=null, $strict=true)
Checks for $array[$key] and returns its value if it exists, else returns $default.
Definition: elgglib.php:1464
fieldset div
Definition: admin.php:462
$entity
Definition: comment.php:13
elgg_view_menu($menu_name, array $vars=array())
Render a menu.
Definition: views.php:687
elgg_view_entity_icon(ElggEntity $entity, $size= 'medium', $vars=array())
View the icon of an entity.
Definition: views.php:862
elgg_echo($message_key, $args=array(), $language="")
Given a message key, returns an appropriately translated full-text string.
Definition: languages.php:21
elgg_view_friendly_time($time)
Displays a UNIX timestamp in a friendly way.
Definition: views.php:1126
get_user($guid)
Get a user object from a GUID.
Definition: users.php:222
elgg_view_image_block($image, $body, $vars=array())
Wrapper function for the image block display pattern.
Definition: views.php:1176
elgg echo
Translates a string.
Definition: languages.js:43
elgg_view($view, $vars=array(), $bypass=false, $ignored=false, $viewtype= '')
Return a parsed view.
Definition: views.php:354
ui datepicker td span
Definition: admin.php:610
$posted
Definition: comment.php:61
$entity_title
Definition: comment.php:24
$entity_link
Definition: comment.php:25
elgg_get_excerpt($text, $num_chars=250)
Returns an excerpt.
Definition: output.php:72
$body
Definition: comment.php:63
$menu
Definition: default.php:19
$comment
Definition: comment.php:11
if(!$entity||!$commenter) $friendlytime
Definition: comment.php:19
get_entity($guid)
Loads and returns an entity object from a guid.
Definition: entities.php:604
if(file_exists($welcome)) $vars
Definition: upgrade.php:93