1
0

BxBaseStudioGridNavigation.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 BxBaseStudioGridNavigation extends BxTemplStudioGrid
  11. {
  12. protected $_sFilter;
  13. function __construct($aOptions, $oTemplate = false)
  14. {
  15. parent::__construct($aOptions, $oTemplate);
  16. $this->_sFilter = '';
  17. if(($sFilter = $this->_getFilterValue()))
  18. $this->_sFilter = $sFilter;
  19. }
  20. public function getModulesSelectAll($sGetItemsMethod, $bShowCustom = true, $bShowSystem = true)
  21. {
  22. if(empty($sGetItemsMethod))
  23. return '';
  24. $sJsObject = $this->getJsObject();
  25. $oForm = new BxTemplStudioFormView(array());
  26. $aInputModules = array(
  27. 'type' => 'select',
  28. 'name' => 'module',
  29. 'attrs' => array(
  30. 'id' => 'bx-grid-module-' . $this->_sObject,
  31. 'aria-label' => _t('_adm_grid_lbl_module'),
  32. 'onChange' => 'javascript:$(this).off(\'keyup focusout\'); ' . $sJsObject . '.onChangeFilter()',
  33. 'onBlur' => 'javascript:' . $sJsObject . '.onChangeFilter()',
  34. ),
  35. 'value' => '',
  36. 'values' => $this->getModules($bShowCustom, $bShowSystem)
  37. );
  38. $aCounter = array();
  39. $this->oDb->$sGetItemsMethod(array('type' => 'counter_by_modules'), $aCounter, false);
  40. foreach($aInputModules['values'] as $sKey => $sValue)
  41. $aInputModules['values'][$sKey] = $aInputModules['values'][$sKey] . " (" . (isset($aCounter[$sKey]) ? $aCounter[$sKey] : "0") . ")";
  42. $aInputModules['values'] = array_merge(array('' => _t('_adm_nav_txt_all_modules')), $aInputModules['values']);
  43. return $oForm->genRow($aInputModules);
  44. }
  45. }
  46. /** @} */