BxBaseModGeneralGridAdministration.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 BaseGeneral Base classes for modules
  7. * @ingroup DolphinModules
  8. * @{
  9. */
  10. bx_import('BxDolModule');
  11. bx_import('BxTemplGrid');
  12. class BxBaseModGeneralGridAdministration extends BxTemplGrid
  13. {
  14. protected $MODULE;
  15. protected $_oModule;
  16. protected $_sManageType;
  17. protected $_sParamsDivider;
  18. public function __construct ($aOptions, $oTemplate = false)
  19. {
  20. parent::__construct ($aOptions, $oTemplate);
  21. $this->_oModule = BxDolModule::getInstance($this->MODULE);
  22. $this->_sManageType = 'administration';
  23. $this->_sParamsDivider = '#-#';
  24. }
  25. public function _getFilterSelectOne($sFilterName, $aFilterValues)
  26. {
  27. if(empty($sFilterName) || empty($aFilterValues))
  28. return '';
  29. $sName = $this->_oModule->_oConfig->getName();
  30. $sJsObject = $this->_oModule->_oConfig->getJsObject('manage_tools');
  31. $sFilterField = '_s' . str_replace(' ', '', ucwords(str_replace('_', ' ', $sFilterName)));
  32. foreach($aFilterValues as $sKey => $sValue)
  33. $aFilterValues[$sKey] = _t($sValue);
  34. $aInputModules = array(
  35. 'type' => 'select',
  36. 'name' => $sFilterName,
  37. 'attrs' => array(
  38. 'id' => 'bx-grid-' . $sFilterName . '-' . $this->_sObject,
  39. 'onChange' => 'javascript:' . $sJsObject . '.onChangeFilter(this)'
  40. ),
  41. 'value' => $this->$sFilterField,
  42. 'values' => array_merge(array('' => _t('_' . $sName . '_grid_filter_item_title_adm_select_one')), $aFilterValues)
  43. );
  44. bx_import('BxTemplFormView');
  45. $oForm = new BxTemplFormView(array());
  46. return $oForm->genRow($aInputModules);
  47. }
  48. protected function _getSearchInput()
  49. {
  50. $sJsObject = $this->_oModule->_oConfig->getJsObject('manage_tools');
  51. $aInputSearch = array(
  52. 'type' => 'text',
  53. 'name' => 'search',
  54. 'attrs' => array(
  55. 'id' => 'bx-grid-search-' . $this->_sObject,
  56. 'onKeyup' => 'javascript:$(this).off(\'keyup\'); ' . $sJsObject . '.onChangeFilter(this)'
  57. )
  58. );
  59. bx_import('BxTemplFormView');
  60. $oForm = new BxTemplFormView(array());
  61. return $oForm->genRow($aInputSearch);
  62. }
  63. }
  64. /** @} */