BxBaseStudioRoles.php 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) UNA, Inc - https://una.io
  4. * MIT License - https://opensource.org/licenses/MIT
  5. *
  6. * @defgroup UnaView UNA Studio Representation classes
  7. * @ingroup UnaStudio
  8. * @{
  9. */
  10. class BxBaseStudioRoles extends BxDolStudioRoles
  11. {
  12. protected $sSubpageUrl;
  13. function __construct($sPage = '')
  14. {
  15. parent::__construct($sPage);
  16. $this->sSubpageUrl = BX_DOL_URL_STUDIO . 'builder_roles.php?page=';
  17. }
  18. function getPageCss()
  19. {
  20. return array_merge(parent::getPageCss(), array('forms.css', 'paginate.css', 'roles.css'));
  21. }
  22. function getPageJs()
  23. {
  24. return array_merge(parent::getPageJs(), array('roles.js'));
  25. }
  26. function getPageJsObject()
  27. {
  28. return 'oBxDolStudioRoles';
  29. }
  30. function getPageMenu($aMenu = array(), $aMarkers = array())
  31. {
  32. $sJsObject = $this->getPageJsObject();
  33. $aMenu = array();
  34. $aMenuItems = array(
  35. BX_DOL_STUDIO_RL_TYPE_LEVELS => array('icon' => 'mi-rls-levels.svg'),
  36. BX_DOL_STUDIO_RL_TYPE_ACTIONS => array('icon' => 'mi-rls-actions.svg')
  37. );
  38. foreach($aMenuItems as $sMenuItem => $aItem)
  39. $aMenu[] = array(
  40. 'name' => $sMenuItem,
  41. 'icon' => $aItem['icon'],
  42. 'icon_bg' => true,
  43. 'link' => $this->sSubpageUrl . $sMenuItem,
  44. 'title' => _t('_adm_lmi_cpt_' . $sMenuItem),
  45. 'selected' => $sMenuItem == $this->sPage
  46. );
  47. return parent::getPageMenu($aMenu);
  48. }
  49. protected function getRlevels()
  50. {
  51. return $this->getGrid('sys_studio_roles');
  52. }
  53. protected function getRactions()
  54. {
  55. return $this->getGrid('sys_studio_roles_actions');
  56. }
  57. protected function getGrid($sObjectName)
  58. {
  59. $oGrid = BxDolGrid::getObjectInstance($sObjectName);
  60. if(!$oGrid)
  61. return '';
  62. return BxDolStudioTemplate::getInstance()->parseHtmlByName('roles.html', array(
  63. 'js_object' => $this->getPageJsObject(),
  64. 'content' => $oGrid->getCode()
  65. ));
  66. }
  67. }
  68. /** @} */