AttachmentNoticeSection.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <?php
  2. // This file is part of GNU social - https://www.gnu.org/software/social
  3. //
  4. // GNU social is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Affero General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // GNU social is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Affero General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Affero General Public License
  15. // along with GNU social. If not, see <http://www.gnu.org/licenses/>.
  16. /**
  17. * FIXME
  18. *
  19. * @category Widget
  20. * @package GNUsocial
  21. *
  22. * @author Evan Prodromou <evan@status.net>
  23. * @copyright 2009 StatusNet, Inc.
  24. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  25. */
  26. namespace Plugin\Media\media;
  27. /**
  28. * FIXME
  29. *
  30. * These are the widgets that show interesting data about a person * group, or site.
  31. *
  32. * @category Widget
  33. * @package GNUsocial
  34. *
  35. * @author Evan Prodromou <evan@status.net>
  36. * @copyright 2009 StatusNet, Inc.
  37. * @license https://www.gnu.org/licenses/agpl.html GNU AGPL v3 or later
  38. */
  39. class AttachmentNoticeSection // extends NoticeSection
  40. {
  41. public function showContent()
  42. {
  43. // parent::showContent();
  44. return false;
  45. }
  46. public function getNotices()
  47. {
  48. $notice = new Notice;
  49. $notice->joinAdd(['id', 'file_to_post:post_id']);
  50. $notice->whereAdd(sprintf('file_to_post.file_id = %d', $this->out->attachment->id));
  51. $notice->selectAdd('notice.id');
  52. $notice->orderBy('notice.created DESC, notice.id DESC');
  53. $notice->find();
  54. return $notice;
  55. }
  56. public function title()
  57. {
  58. // TRANS: Title.
  59. return _('Notices where this attachment appears');
  60. }
  61. public function divId()
  62. {
  63. return 'attachment_section';
  64. }
  65. }