entity.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <?php
  2. /**
  3. * Elgg Entity export.
  4. * Displays an entity using the current view.
  5. *
  6. * @package Elgg
  7. * @subpackage Core
  8. * @deprecated 1.9
  9. */
  10. $entity = $vars['entity'];
  11. if (!$entity) {
  12. throw new InvalidParameterException("No entity found, it either doesn't exist or you don't have access to it.");
  13. }
  14. $options = array(
  15. 'guid' => $entity->guid,
  16. 'limit' => 0
  17. );
  18. $metadata = elgg_get_metadata($options);
  19. $annotations = elgg_get_annotations($options);
  20. $relationships = get_entity_relationships($entity->guid);
  21. $exportable_values = $entity->getExportableValues();
  22. ?>
  23. <div>
  24. <?php // do not change localization string since this is deprecated view ?>
  25. <h2><?php echo elgg_echo('Entity'); ?></h2>
  26. <?php
  27. foreach ($entity as $k => $v) {
  28. if ((in_array($k, $exportable_values)) || (elgg_is_admin_logged_in())) {
  29. ?>
  30. <p class="margin-none"><b><?php echo $k; ?>: </b><?php echo strip_tags($v); ?></p>
  31. <?php
  32. }
  33. }
  34. ?>
  35. </div>
  36. <?php if ($metadata) { ?>
  37. <div id="metadata" class="mtm">
  38. <h2><?php echo elgg_echo('metadata'); ?></h2>
  39. <?php
  40. foreach ($metadata as $m) {
  41. ?>
  42. <p class="margin-none"><b><?php echo $m->name; ?>: </b><?php echo $m->value; ?></p>
  43. <?php
  44. }
  45. ?>
  46. </div>
  47. <?php } ?>
  48. <?php if ($annotations) { ?>
  49. <div id="annotations" class="mtm">
  50. <h2><?php echo elgg_echo('annotations'); ?></h2>
  51. <?php
  52. foreach ($annotations as $a) {
  53. ?>
  54. <table>
  55. <p class="margin-none"><b><?php echo $a->name; ?>: </b><?php echo $a->value; ?></p>
  56. </table>
  57. <?php
  58. }
  59. ?>
  60. </div>
  61. <?php } ?>
  62. <?php if ($relationships) { ?>
  63. <div id="relationship" class="mtm">
  64. <h2><?php echo elgg_echo('relationships'); ?></h2>
  65. <?php
  66. foreach ($relationships as $r) {
  67. ?>
  68. <table>
  69. <p class="margin-none"><b><?php echo $r->relationship; ?>: </b><?php echo $r->guid_two; ?></p>
  70. </table>
  71. <?php
  72. }
  73. ?>
  74. </div>
  75. <?php }