votes.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /**
  3. * Elgg default annotation view
  4. *
  5. * @note To add or remove from the annotation menu, register handlers for the menu:annotation hook.
  6. *
  7. * @uses $vars['annotation']
  8. */
  9. $annotation = $vars['annotation'];
  10. $owner = get_entity($annotation->owner_guid);
  11. if (!$owner) {
  12. return true;
  13. }
  14. $icon = elgg_view_entity_icon($owner, 'tiny');
  15. $owner_link = "<a href=\"{$owner->getURL()}\">$owner->name</a>";
  16. $menu = elgg_view_menu('annotation', array(
  17. 'annotation' => $annotation,
  18. 'sort_by' => 'priority',
  19. 'class' => 'elgg-menu-hz float-alt',
  20. ));
  21. $text = elgg_view("output/longtext", array("value" => elgg_echo('proposals:votes:'.$annotation->value)));
  22. $friendlytime = elgg_view_friendly_time($annotation->time_created);
  23. $options = array('guid' => $annotation->entity_guid, 'metastring_owner_guid' => $annotation->owner_guid, 'annotation_name' => 'vote_comments');
  24. $comments = elgg_get_annotations($options);
  25. $total_comments = count($comments);
  26. if ($total_comments)
  27. $comments_text = elgg_view_annotation_list($comments);
  28. $body = <<<HTML
  29. <div class="mbn">
  30. $menu
  31. $owner_link
  32. <span class="elgg-subtext">
  33. $friendlytime
  34. </span>
  35. $text
  36. $comments_text
  37. </div>
  38. HTML;
  39. echo elgg_view_image_block($icon, $body);