BxBaseStudioGridNavigation.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  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. 'onChange' => 'javascript:$(this).off(\'keyup focusout\'); ' . $sJsObject . '.onChangeFilter()',
  32. 'onBlur' => 'javascript:' . $sJsObject . '.onChangeFilter()',
  33. ),
  34. 'value' => '',
  35. 'values' => $this->getModules($bShowCustom, $bShowSystem)
  36. );
  37. $aCounter = array();
  38. $this->oDb->$sGetItemsMethod(array('type' => 'counter_by_modules'), $aCounter, false);
  39. foreach($aInputModules['values'] as $sKey => $sValue)
  40. $aInputModules['values'][$sKey] = $aInputModules['values'][$sKey] . " (" . (isset($aCounter[$sKey]) ? $aCounter[$sKey] : "0") . ")";
  41. $aInputModules['values'] = array_merge(array('' => _t('_adm_nav_txt_all_modules')), $aInputModules['values']);
  42. return $oForm->genRow($aInputModules);
  43. }
  44. public function getSearchInput()
  45. {
  46. $oForm = new BxTemplStudioFormView(array());
  47. $aInputSearch = array(
  48. 'type' => 'text',
  49. 'name' => 'keyword',
  50. 'attrs' => array(
  51. 'id' => 'bx-grid-search-' . $this->_sObject,
  52. 'onKeyup' => 'javascript:$(this).off(\'keyup\'); ' . $this->getJsObject() . '.onChangeFilter()'
  53. )
  54. );
  55. return $oForm->genRow($aInputSearch);
  56. }
  57. }
  58. /** @} */