peopletagsforusersection.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. <?php
  2. /**
  3. * StatusNet, the distributed open-source microblogging tool
  4. *
  5. * Lists a user is in
  6. *
  7. * PHP version 5
  8. *
  9. * LICENCE: This program is free software: you can redistribute it and/or modify
  10. * it under the terms of the GNU Affero General Public License as published by
  11. * the Free Software Foundation, either version 3 of the License, or
  12. * (at your option) any later version.
  13. *
  14. * This program is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  17. * GNU Affero General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Affero General Public License
  20. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  21. *
  22. * @category Widget
  23. * @package StatusNet
  24. * @author Shashi Gowda <connect2shashi@gmail.com>
  25. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  26. * @link http://status.net/
  27. */
  28. if (!defined('STATUSNET') && !defined('LACONICA')) {
  29. exit(1);
  30. }
  31. /**
  32. * List a user has is in
  33. *
  34. * @category Widget
  35. * @package StatusNet
  36. * @author Shashi Gowda <connect2shashi@gmail.com>
  37. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  38. * @link http://status.net/
  39. */
  40. class PeopletagsForUserSection extends PeopletagSection
  41. {
  42. var $profile=null;
  43. function __construct($out, Profile $profile)
  44. {
  45. parent::__construct($out);
  46. $this->profile = $profile;
  47. }
  48. function getPeopletags()
  49. {
  50. $limit = PEOPLETAGS_PER_SECTION+1;
  51. $offset = 0;
  52. $ptags = $this->profile->getOtherTags(Profile::current(), $offset, $limit);
  53. return $ptags;
  54. }
  55. function title()
  56. {
  57. $user = common_current_user();
  58. if (!empty($user) && $this->profile->id == $user->id) {
  59. // TRANS: Title for page that displays which lists current user is part of.
  60. return sprintf(_('Lists with you'));
  61. }
  62. // TRANS: Title for page that displays which lists a user is part of.
  63. // TRANS: %s is a profile name.
  64. return sprintf(_('Lists with %s'), $this->profile->getBestName());
  65. }
  66. function link()
  67. {
  68. return common_local_url('peopletagsforuser',
  69. array('nickname' => $this->profile->nickname));
  70. }
  71. function moreUrl()
  72. {
  73. return $this->link();
  74. }
  75. function divId()
  76. {
  77. return 'peopletag_subscriptions';
  78. }
  79. }