profile.class.php 1.9 KB

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