BxBaseStudioGridNavigation.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinView Dolphin Studio Representation classes
  7. * @ingroup DolphinStudio
  8. * @{
  9. */
  10. bx_import('BxTemplStudioGrid');
  11. class BxBaseStudioGridNavigation extends BxTemplStudioGrid
  12. {
  13. function __construct($aOptions, $oTemplate = false)
  14. {
  15. parent::__construct($aOptions, $oTemplate);
  16. }
  17. public function getModulesSelectAll($sGetItemsMethod, $bShowCustom = true, $bShowSystem = true)
  18. {
  19. if(empty($sGetItemsMethod))
  20. return '';
  21. bx_import('BxTemplStudioFormView');
  22. $oForm = new BxTemplStudioFormView(array());
  23. $aInputModules = array(
  24. 'type' => 'select',
  25. 'name' => 'module',
  26. 'attrs' => array(
  27. 'id' => 'bx-grid-module-' . $this->_sObject,
  28. 'onChange' => 'javascript:' . $this->getJsObject() . '.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. bx_import('BxTemplStudioFormView');
  43. $oForm = new BxTemplStudioFormView(array());
  44. $aInputSearch = array(
  45. 'type' => 'text',
  46. 'name' => 'keyword',
  47. 'attrs' => array(
  48. 'id' => 'bx-grid-search-' . $this->_sObject,
  49. 'onKeyup' => 'javascript:$(this).off(\'keyup\'); ' . $this->getJsObject() . '.onChangeFilter()'
  50. )
  51. );
  52. return $oForm->genRow($aInputSearch);
  53. }
  54. }
  55. /** @} */