threadednoticelistmoreitem.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. if (!defined('GNUSOCIAL')) { exit(1); }
  3. /**
  4. * Placeholder for loading more replies...
  5. */
  6. class ThreadedNoticeListMoreItem extends NoticeListItem
  7. {
  8. protected $cnt;
  9. function __construct(Notice $notice, Action $out, $cnt)
  10. {
  11. parent::__construct($notice, $out);
  12. $this->cnt = $cnt;
  13. }
  14. /**
  15. * recipe function for displaying a single notice.
  16. *
  17. * This uses all the other methods to correctly display a notice. Override
  18. * it or one of the others to fine-tune the output.
  19. *
  20. * @return void
  21. */
  22. function show()
  23. {
  24. $this->showStart();
  25. $this->showMiniForm();
  26. $this->showEnd();
  27. }
  28. /**
  29. * start a single notice.
  30. *
  31. * @return void
  32. */
  33. function showStart()
  34. {
  35. $this->out->elementStart('li', array('class' => 'notice-reply-comments'));
  36. }
  37. function showEnd()
  38. {
  39. $this->out->elementEnd('li');
  40. }
  41. function showMiniForm()
  42. {
  43. $id = $this->notice->conversation;
  44. $url = common_local_url('conversation', array('id' => $id));
  45. $n = Conversation::noticeCount($id) - 1;
  46. // TRANS: Link to show replies for a notice.
  47. // TRANS: %d is the number of replies to a notice and used for plural.
  48. $msg = sprintf(_m('Show reply', 'Show all %d replies', $n), $n);
  49. $this->out->element('a', array('href' => $url), $msg);
  50. }
  51. }