BxBaseLiveUpdates.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * @see BxDolLiveUpdates
  11. */
  12. class BxBaseLiveUpdates extends BxDolLiveUpdates
  13. {
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. }
  18. public function init($aParams = array())
  19. {
  20. if(!$this->_iProfileId)
  21. return '';
  22. $aCached = $this->_getCachedData();
  23. $aParams = array_merge(array(
  24. 'sActionsUrl' => BX_DOL_URL_ROOT . 'live_updates.php',
  25. 'sObjName' => $this->_sJsObject,
  26. 'iInterval' => $this->_iInterval,
  27. 'aSystemsActive' => array_intersect_key($aCached, array_flip($this->_aSystemsActive)),
  28. 'bServerRequesting' => !empty($this->_aSystems)
  29. ), $aParams);
  30. $sContent = "var " . $this->_sJsObject . " = new " . $this->_sJsClass . "(" . json_encode($aParams) . ");";
  31. $oTemplate = BxDolTemplate::getInstance();
  32. $oTemplate->addJs(array('BxDolLiveUpdates.js'));
  33. return $oTemplate->_wrapInTagJsCode($sContent);
  34. }
  35. }
  36. /** @} */