bio.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <?php
  2. /**
  3. * GNU Social
  4. * Copyright (C) 2010, Free Software Foundation, Inc.
  5. *
  6. * PHP version 5
  7. *
  8. * LICENCE:
  9. * 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 GNU Social
  24. * @author Max Shinn <trombonechamp@gmail.com>
  25. * @copyright 2011 Free Software Foundation, Inc.
  26. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html AGPL 3.0
  27. */
  28. if (!defined('STATUSNET')) {
  29. exit(1);
  30. }
  31. require_once INSTALLDIR . '/lib/personalgroupnav.php';
  32. require_once INSTALLDIR . '/classes/Profile.php';
  33. require_once INSTALLDIR . '/lib/profilelist.php';
  34. class BioAction extends Action
  35. {
  36. var $user = null;
  37. function prepare($args)
  38. {
  39. parent::prepare($args);
  40. $args = $this->returnToArgs();
  41. $this->profile = Profile::getKV('nickname', $args[1]['nickname']);
  42. //die(print_r($this->profile));
  43. gnusocial_profile_merge($this->profile);
  44. return true;
  45. }
  46. function handle($args)
  47. {
  48. parent::handle($args);
  49. $this->showPage();
  50. }
  51. function title()
  52. {
  53. return sprintf(_m("%s's Bio."), $this->profile->nickname);
  54. }
  55. function showLocalNav()
  56. {
  57. $nav = new PersonalGroupNav($this);
  58. $nav->show();
  59. }
  60. function showContent()
  61. {
  62. if(empty($this->profile)) {
  63. return;
  64. }
  65. $profilelistitem = new ProfileListItem($this->profile, $this);
  66. $profilelistitem->show();
  67. $this->elementStart('ul');
  68. $fields = GNUsocialProfileExtensionField::allFields();
  69. foreach ($fields as $field) {
  70. $fieldname = $field->systemname;
  71. if (!empty($this->profile->$fieldname)) {
  72. $this->elementStart('li', array('class' => 'biolistitem'));
  73. $this->elementStart('div', array('class' => 'biolistitemcontainer'));
  74. if ($field->type == 'text') {
  75. $this->element('h3', array(), $field->title);
  76. $this->element('p', array('class' => 'biovalue'), $this->profile->$fieldname);
  77. }
  78. else {
  79. $this->element('span', array('class' => 'biotitle'), $field->title);
  80. $this->text(' ');
  81. $this->element('span', array('class' => 'biovalue'), $this->profile->$fieldname);
  82. }
  83. $this->elementEnd('div');
  84. $this->elementEnd('li');
  85. }
  86. }
  87. $this->elementEnd('ul');
  88. }
  89. }