1
0

BxBaseStudioGridNavigation.php 2.1 KB

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