BxBaseStudioGridNavigation.php 2.1 KB

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