PageRenderTime 50ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/accountsettingsaction.php

https://github.com/Br3nda/laconica
PHP | 137 lines | 56 code | 14 blank | 67 comment | 1 complexity | 804e6641c2bafb4b4d8f4d4c172c3392 MD5 | raw file
Possible License(s): AGPL-3.0
  1. <?php
  2. /**
  3. * Laconica, the distributed open-source microblogging tool
  4. *
  5. * Base class for account settings actions
  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 Settings
  23. * @package Laconica
  24. * @author Evan Prodromou <evan@controlyourself.ca>
  25. * @copyright 2008-2009 Control Yourself, Inc.
  26. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  27. * @link http://laconi.ca/
  28. */
  29. if (!defined('LACONICA')) {
  30. exit(1);
  31. }
  32. require_once INSTALLDIR.'/lib/settingsaction.php';
  33. /**
  34. * Base class for account settings actions
  35. *
  36. * @category Settings
  37. * @package Laconica
  38. * @author Evan Prodromou <evan@controlyourself.ca>
  39. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  40. * @link http://laconi.ca/
  41. *
  42. * @see Widget
  43. */
  44. class AccountSettingsAction extends SettingsAction
  45. {
  46. /**
  47. * Show the local navigation menu
  48. *
  49. * This is the same for all settings, so we show it here.
  50. *
  51. * @return void
  52. */
  53. function showLocalNav()
  54. {
  55. $menu = new AccountSettingsNav($this);
  56. $menu->show();
  57. }
  58. }
  59. /**
  60. * A widget for showing the settings group local nav menu
  61. *
  62. * @category Widget
  63. * @package Laconica
  64. * @author Evan Prodromou <evan@controlyourself.ca>
  65. * @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
  66. * @link http://laconi.ca/
  67. *
  68. * @see HTMLOutputter
  69. */
  70. class AccountSettingsNav extends Widget
  71. {
  72. var $action = null;
  73. /**
  74. * Construction
  75. *
  76. * @param Action $action current action, used for output
  77. */
  78. function __construct($action=null)
  79. {
  80. parent::__construct($action);
  81. $this->action = $action;
  82. }
  83. /**
  84. * Show the menu
  85. *
  86. * @return void
  87. */
  88. function show()
  89. {
  90. # action => array('prompt', 'title')
  91. $menu =
  92. array('profilesettings' =>
  93. array(_('Profile'),
  94. _('Change your profile settings')),
  95. 'avatarsettings' =>
  96. array(_('Avatar'),
  97. _('Upload an avatar')),
  98. 'passwordsettings' =>
  99. array(_('Password'),
  100. _('Change your password')),
  101. 'emailsettings' =>
  102. array(_('Email'),
  103. _('Change email handling')),
  104. 'openidsettings' =>
  105. array(_('OpenID'),
  106. _('Add or remove OpenIDs')),
  107. 'userdesignsettings' =>
  108. array(_('Design'),
  109. _('Design your profile')),
  110. 'othersettings' =>
  111. array(_('Other'),
  112. _('Other options')));
  113. $action_name = $this->action->trimmed('action');
  114. $this->action->elementStart('ul', array('class' => 'nav'));
  115. foreach ($menu as $menuaction => $menudesc) {
  116. $this->action->menuItem(common_local_url($menuaction),
  117. $menudesc[0],
  118. $menudesc[1],
  119. $action_name === $menuaction);
  120. }
  121. $this->action->elementEnd('ul');
  122. }
  123. }