1
0

BxBaseStudioSettings.php 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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 BxBaseStudioSettings extends BxDolStudioSettings
  11. {
  12. public function __construct($sType = '', $mixedCategory = '')
  13. {
  14. parent::__construct($sType, $mixedCategory);
  15. }
  16. public function getPageCss()
  17. {
  18. return array_merge(parent::getPageCss(), $this->oOptions->getCss());
  19. }
  20. public function getPageJs()
  21. {
  22. return array_merge(parent::getPageJs(), $this->oOptions->getJs());
  23. }
  24. public function getPageJsObject()
  25. {
  26. return 'oBxDolStudioSettings';
  27. }
  28. public function getPageMenu($aMenu = array(), $aMarkers = array())
  29. {
  30. $sType = $this->oOptions->getType();
  31. $aTypes = $aMenu = array();
  32. if($this->oDb->getTypes(array('type' => 'all', 'not_in_group' => array(BX_DOL_STUDIO_STG_GROUP_TEMPLATES)), $aTypes) > 0 ) {
  33. $aTypesGrouped = array();
  34. foreach($aTypes as $aType)
  35. $aTypesGrouped[$aType['group']][] = $aType;
  36. foreach($aTypesGrouped as $sGroup => $aTypes)
  37. foreach($aTypes as $aType)
  38. $aMenu[] = array(
  39. 'name' => $aType['name'],
  40. 'icon' => $this->getMenuIcon($sGroup, $aType),
  41. 'link' => BX_DOL_URL_STUDIO . 'settings.php?page=' . $aType['name'],
  42. 'title' => $aType['caption'],
  43. 'selected' => $aType['name'] == $sType
  44. );
  45. }
  46. return parent::getPageMenu($aMenu);
  47. }
  48. public function getPageCode($sPage = '', $bWrap = true)
  49. {
  50. $sResult = parent::getPageCode($sPage, $bWrap);
  51. if($sResult === false)
  52. return false;
  53. return $sResult . $this->getBlockCode(array(
  54. 'content' => $this->oOptions->getCode()
  55. ));
  56. }
  57. protected function getMenuIcon($sGroup, &$aType)
  58. {
  59. if(empty($aType['icon']) || ($sUrl = BxDolStudioTemplate::getInstance()->getIconUrl($aType['icon'])) == "")
  60. switch($sGroup) {
  61. case BX_DOL_STUDIO_STG_GROUP_MODULES:
  62. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_MODULE);
  63. break;
  64. case BX_DOL_STUDIO_STG_GROUP_LANGUAGES:
  65. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_LANGUAGE);
  66. break;
  67. case BX_DOL_STUDIO_STG_GROUP_TEMPLATES:
  68. $aType['icon'] = BxDolStudioUtils::getIconDefault(BX_DOL_MODULE_TYPE_TEMPLATE);
  69. break;
  70. }
  71. return $aType['icon'];
  72. }
  73. }
  74. /** @} */