profile.class.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <?php
  2. /*
  3. * This file is part of MODX Revolution.
  4. *
  5. * Copyright (c) MODX, LLC. All Rights Reserved.
  6. *
  7. * For complete copyright and license information, see the COPYRIGHT and LICENSE
  8. * files found in the top-level directory of this distribution.
  9. */
  10. /**
  11. * Loads the profile page
  12. *
  13. * @package modx
  14. * @subpackage manager.controllers
  15. */
  16. class SecurityProfileManagerController extends modManagerController {
  17. /**
  18. * Check for any permissions or requirements to load page
  19. * @return bool
  20. */
  21. public function checkPermissions() {
  22. return $this->modx->hasPermission('change_profile');
  23. }
  24. /**
  25. * Register custom CSS/JS for the page
  26. * @return void
  27. */
  28. public function loadCustomCssJs() {
  29. $mgrUrl = $this->modx->getOption('manager_url',null,MODX_MANAGER_URL);
  30. $this->addJavascript($mgrUrl.'assets/modext/widgets/security/modx.grid.user.recent.resource.js');
  31. $this->addJavascript($mgrUrl.'assets/modext/sections/security/profile/update.js');
  32. $this->addHtml('
  33. <script type="text/javascript">
  34. // <![CDATA[
  35. Ext.onReady(function() {
  36. MODx.load({
  37. xtype: "modx-page-profile"
  38. ,user: "'.$this->modx->user->get('id').'"
  39. });
  40. });
  41. MODx.perm.change_password = '.(int)$this->modx->hasPermission('change_password').';
  42. MODx.perm.view_document = '.(int)$this->modx->hasPermission('view_document').';
  43. // ]]>
  44. </script>');
  45. }
  46. /**
  47. * Custom logic code here for setting placeholders, etc
  48. * @param array $scriptProperties
  49. * @return mixed
  50. */
  51. public function process(array $scriptProperties = array()) {}
  52. /**
  53. * Return the pagetitle
  54. *
  55. * @return string
  56. */
  57. public function getPageTitle() {
  58. return $this->modx->lexicon('profile');
  59. }
  60. /**
  61. * Return the location of the template file
  62. * @return string
  63. */
  64. public function getTemplateFile() {
  65. return '';
  66. }
  67. /**
  68. * Specify the language topics to load
  69. * @return array
  70. */
  71. public function getLanguageTopics() {
  72. return array('access','user');
  73. }
  74. }