threadednoticelistmoreitem.php 1.4 KB

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