BxTimelineFormRepost.php 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  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 Timeline Timeline
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxTimelineFormRepost extends BxTemplFormView
  12. {
  13. protected $_sModule;
  14. protected $_oModule;
  15. protected $_aReposted;
  16. public function __construct($aInfo, $oTemplate = false)
  17. {
  18. $this->_sModule = 'bx_timeline';
  19. $this->_oModule = BxDolModule::getInstance($this->_sModule);
  20. parent::__construct($aInfo, $oTemplate);
  21. $sAction = trim(str_replace($this->_sModule, '', $this->aParams['display']), "_");
  22. $this->aFormAttrs['action'] = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . $sAction . '/';
  23. $this->_aReposted = [];
  24. }
  25. public function getReposted()
  26. {
  27. return $this->_aReposted;
  28. }
  29. public function initChecker($aValues = [], $aSpecificValues = [])
  30. {
  31. if(isset($aValues['type'], $aValues['action'], $aValues['object_id']))
  32. $this->_aReposted = $this->_oModule->_oDb->getReposted($aValues['type'], $aValues['action'], $aValues['object_id']);
  33. return parent::initChecker($aValues, $aSpecificValues);
  34. }
  35. protected function genCustomInputReposted($aInput)
  36. {
  37. return $this->_oModule->_oTemplate->getRepostWithFieldReposted($this, $aInput);
  38. }
  39. protected function genCustomInputSearch($aInput)
  40. {
  41. $aInput['ajax_get_suggestions'] = BX_DOL_URL_ROOT . $this->_oModule->_oConfig->getBaseUri() . 'get_contexts';
  42. return $this->genCustomInputUsernamesSuggestions($aInput);
  43. }
  44. protected function genCustomInputList($aInput)
  45. {
  46. return $this->_oModule->_oTemplate->getRepostToFieldList($this, $aInput);
  47. }
  48. }
  49. /** @} */