BxSEMigTransfers.php 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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 SocialEngineMigration SocialEngine Migration
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxSEMigTransfers extends BxTemplGrid
  12. {
  13. public function __construct ($aOptions, $oTemplate = false)
  14. {
  15. $this -> MODULE = 'bx_se_migration';
  16. $this -> _oModule = BxDolModule::getInstance('bx_se_migration');
  17. $this -> _aConfirmMessages['run'] = _t('_bx_se_migration_start_transfer_confirmation');
  18. parent::__construct ($aOptions, $oTemplate);
  19. }
  20. protected function _getCellStatusText($mixedValue, $sKey, $aField, $aRow) {
  21. $sAttr = $this->_convertAttrs($aField, 'attr_cell', false, isset($aField['width']) ? 'width:' . $aField['width'] : false);
  22. if ($aRow['status'] != 'finished') $mixedValue = _t('_bx_se_migration_status_' . $aRow['status']);
  23. return '<td ' . $sAttr . '><span class="' . ($aRow['status'] == 'finished' ? 'bx-se-migrate-not-finished' : ($aRow['status'] == 'error' ? 'bx-se-migrate-error' : '')) . '">' . $mixedValue . '</span></td>';
  24. }
  25. protected function _getCellModule($mixedValue, $sKey, $aField, $aRow) {
  26. return '<td>' . _t('_bx_se_migration_data_' . $mixedValue) . '</td>';
  27. }
  28. public function performActionRun() {
  29. $aElements = bx_get('ids');
  30. echoJson(array(
  31. 'msg' => $this-> _oModule -> actionStartTransfer($aElements),
  32. 'grid' => $this -> getCode(false),
  33. 'blink' => $aElements,
  34. ));
  35. }
  36. protected function _getFilterControls() {
  37. $aForm = array(
  38. 'form_attrs' => array(),
  39. 'inputs' => array (
  40. 'path' => array(
  41. 'type' => 'text',
  42. 'name' => 'se_migration_location',
  43. 'caption' => $this -> _oModule -> _oDb -> isConfigInstalled() ? _t('_bx_se_migration_se_defined_path') : _t('_bx_se_migration_cpt_put_path'),
  44. 'value' => $this -> _oModule -> _oDb -> getExtraParam('root'),
  45. 'attrs_wrap'
  46. ),
  47. 'save' => array (
  48. 'type' => 'submit',
  49. 'name' => 'save',
  50. 'value' => _t('_bx_se_migration_cpt_' . ($this -> _oModule -> _oDb -> getExtraParam('root') ? 'update' : 'save'))
  51. )
  52. )
  53. );
  54. if ($this -> _oModule -> _oDb -> isConfigInstalled())
  55. $aForm['inputs']['save']['attrs'] = array('onclick' => "javascript:return confirm('" . bx_js_string(_t('_bx_se_migration_reupload_data')) . "');");
  56. $oForm = new BxTemplStudioFormView($aForm);
  57. return $oForm -> getCode();
  58. }
  59. }
  60. /** @} */