BxEventsTemplate.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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 Events Events
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. /*
  12. * Groups module representation.
  13. */
  14. class BxEventsTemplate extends BxBaseModGroupsTemplate
  15. {
  16. function __construct(&$oConfig, &$oDb)
  17. {
  18. $this->MODULE = 'bx_events';
  19. parent::__construct($oConfig, $oDb);
  20. }
  21. function unitVars ($aData, $isCheckPrivateContent = true, $sTemplateName = 'unit.html')
  22. {
  23. $aVars = parent::unitVars ($aData, $isCheckPrivateContent, $sTemplateName);
  24. $CNF = &$this->_oConfig->CNF;
  25. $oPrivacy = BxDolPrivacy::getObjectInstance($CNF['OBJECT_PRIVACY_VIEW']);
  26. $isPublic = CHECK_ACTION_RESULT_ALLOWED === $this->getModule()->checkAllowedView($aData) || $oPrivacy->isPartiallyVisible($aData[$CNF['FIELD_ALLOW_VIEW_TO']]);
  27. if ($isPublic) {
  28. $aContentInfo = $this->getModule()->_oDb->getContentInfoById($aData[$CNF['FIELD_ID']]);
  29. $oDateStart = date_create('@' . $aContentInfo['date_start'], new DateTimeZone($aContentInfo['timezone']));
  30. $aVars['bx_if:info']['content']['members'] = $oDateStart->format(getParam('bx_events_short_date_format'));
  31. }
  32. return $aVars;
  33. }
  34. }
  35. /** @} */