BxElsFormManage.php 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 ElasticSearch ElasticSearch
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /**
  12. * Search form
  13. */
  14. class BxElsFormManage extends BxTemplFormView
  15. {
  16. protected $_sModule;
  17. protected $_oModule;
  18. public function __construct($aInfo, $oTemplate = false)
  19. {
  20. $this->_sModule = 'bx_elasticsearch';
  21. $this->_oModule = BxDolModule::getInstance($this->_sModule);
  22. parent::__construct($aInfo, $oTemplate);
  23. $CNF = &$this->_oModule->_oConfig->CNF;
  24. if(isset($this->aInputs['index'])) {
  25. $this->aInputs['index']['value'] = $this->_oModule->_oConfig->getIndex();
  26. }
  27. if(isset($this->aInputs['type'])) {
  28. $aObjects = BxDolContentInfo::getSystems();
  29. ksort($aObjects);
  30. $aTypes = array(
  31. array('key' => '', 'value' => _t('_bx_elasticsearch_form_manage_input_type_value_all'))
  32. );
  33. foreach ($aObjects as $sObject => $aObject)
  34. $aTypes[] = array('key' => $sObject, 'value' => _t($aObject['title']));
  35. $this->aInputs['type']['values'] = $aTypes;
  36. }
  37. }
  38. public function getCode($bDynamicMode = false)
  39. {
  40. return $this->oTemplate->getJsCode('manage') . $this->oTemplate->parseHtmlByName('manage_form.html', array(
  41. 'form_id' => $this->getId(),
  42. 'form' => parent::getCode($bDynamicMode)
  43. ));
  44. }
  45. }
  46. /** @} */