BxDolStudioModules.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 UnaStudio UNA Studio
  7. * @{
  8. */
  9. class BxDolStudioModules extends BxDol implements iBxDolSingleton
  10. {
  11. protected $sLangPrefix;
  12. protected $sParamPrefix;
  13. protected $sActionUri;
  14. protected $sJsClass;
  15. protected $sJsObject;
  16. protected $_oDb;
  17. public function __construct()
  18. {
  19. parent::__construct();
  20. $this->sLangPrefix = 'mod';
  21. $this->sParamPrefix = 'mod';
  22. $this->sActionUri = 'module.php';
  23. $this->sJsClass = 'BxDolStudioModule';
  24. $this->sJsObject = 'oBxDolStudioModule';
  25. $this->_oDb = new BxDolStudioModulesQuery();
  26. }
  27. public static function getInstance()
  28. {
  29. $sClass = get_called_class();
  30. $sParent = str_replace('Templ', 'Dol', $sClass);
  31. if(!isset($GLOBALS['bxDolClasses'][$sParent]))
  32. $GLOBALS['bxDolClasses'][$sParent] = new $sClass();
  33. return $GLOBALS['bxDolClasses'][$sParent];
  34. }
  35. public function serviceGetActions($aWidget)
  36. {
  37. $sJsObject = $this->getJsObject();
  38. $aResult = array(
  39. array (
  40. 'name' => 'settings',
  41. 'caption' => _t('_adm_txt_settings'),
  42. 'link' => '',
  43. 'click' => $sJsObject . ".settings('" . $aWidget['page_name'] . "', " . $aWidget['id'] . ")",
  44. 'icon' => 'wi-act-settings.svg',
  45. 'check_func' => ''
  46. )
  47. );
  48. if(!BxDolModuleQuery::getInstance()->isEnabledByName($aWidget['module']))
  49. $aResult[] = array (
  50. 'name' => 'uninstall',
  51. 'caption' => _t('_adm_txt_uninstall'),
  52. 'link' => '',
  53. 'click' => $sJsObject . ".uninstall('" . $aWidget['page_name'] . "', " . $aWidget['id'] . ", 0)",
  54. 'icon' => 'wi-act-uninstall.svg',
  55. 'check_func' => 'is_disabled'
  56. );
  57. return $aResult;
  58. }
  59. }
  60. /** @} */