basic.php 571 B

1234567891011121314151617181920212223
  1. <?php
  2. /**
  3. * Demonstrates adding an annotation through an action
  4. *
  5. * This action adds a rating annotation to an entity. If this was coming from
  6. * a five-star rating tool, the rating would be a number between 0 and 5. The
  7. * GUID of the entity being rating is also submitted to the action.
  8. */
  9. $rating = get_input('rating');
  10. $guid = get_input('guid');
  11. $entity = get_entity($guid);
  12. if (!$entity) {
  13. register_error(elgg_echo('rating:failure'));
  14. forward(REFERER);
  15. }
  16. $entity->annotate('rating', $rating);
  17. system_message(elgg_echo('rating:success'));
  18. forward(REFERER);