1
0

BxBaseStudioStorages.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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 BxBaseStudioStorages extends BxDolStudioStorages
  11. {
  12. protected $aStorages;
  13. protected $sSubpageUrl;
  14. function __construct($sPage = '')
  15. {
  16. parent::__construct($sPage);
  17. $this->aStorages = array(
  18. BX_DOL_STUDIO_STRG_TYPE_FILES => array('icon' => 'far file'),
  19. BX_DOL_STUDIO_STRG_TYPE_IMAGES => array('icon' => 'far file-image')
  20. );
  21. $this->sSubpageUrl = BX_DOL_URL_STUDIO . 'storages.php?page=';
  22. }
  23. function getPageCss()
  24. {
  25. return array_merge(parent::getPageCss(), array());
  26. }
  27. function getPageJs()
  28. {
  29. return array_merge(parent::getPageJs(), array());
  30. }
  31. function getPageJsObject()
  32. {
  33. return '';
  34. }
  35. function getPageMenu($aMenu = array(), $aMarkers = array())
  36. {
  37. $aMenu = array();
  38. foreach($this->aStorages as $sName => $aStorage)
  39. $aMenu[] = array(
  40. 'name' => $sName,
  41. 'icon' => $aStorage['icon'],
  42. 'link' => $this->sSubpageUrl . $sName,
  43. 'title' => _t('_adm_lmi_cpt_' . $sName),
  44. 'selected' => $sName == $this->sPage
  45. );
  46. return parent::getPageMenu($aMenu);
  47. }
  48. protected function getFiles()
  49. {
  50. return $this->getGrid(BX_DOL_STUDIO_STRG_TYPE_FILES);
  51. }
  52. protected function getImages()
  53. {
  54. return $this->getGrid(BX_DOL_STUDIO_STRG_TYPE_IMAGES);
  55. }
  56. protected function getGrid($sName)
  57. {
  58. $oGrid = BxDolGrid::getObjectInstance('sys_studio_strg_' . $sName);
  59. if(!$oGrid)
  60. return '';
  61. return BxDolStudioTemplate::getInstance()->parseHtmlByName('storages.html', array(
  62. 'js_object' => $this->getPageJsObject(),
  63. 'content' => $oGrid->getCode()
  64. ));
  65. }
  66. }
  67. /** @} */