BxRemindersTemplate.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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 Reminders Reminders
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxRemindersTemplate extends BxBaseModGeneralTemplate
  12. {
  13. function __construct(&$oConfig, &$oDb)
  14. {
  15. $this->MODULE = 'bx_reminders';
  16. parent::__construct($oConfig, $oDb);
  17. }
  18. public function getBlockView($iProfileId)
  19. {
  20. $oProfile = BxDolProfile::getInstance($iProfileId);
  21. $aEntries = $this->_oDb->getEntry(array('type' => 'rmd_pid', 'rmd_pid' => $iProfileId, 'visible' => true, 'full' => true));
  22. if(empty($aEntries) || !is_array($aEntries))
  23. return MsgBox(_t('_Empty'));
  24. $aTmplVarsItems = array();
  25. foreach($aEntries as $aEntry) {
  26. $aParams = unserialize($aEntry['params']);
  27. $aTmplVarsItems[] = array(
  28. 'id' => $aEntry['id'],
  29. 'link' => $this->_oModule->getEntryUrl($aEntry),
  30. 'content' => bx_replace_markers(_t($aEntry['text']), $aParams)
  31. );
  32. }
  33. $this->addCss(array('view.css'));
  34. return $this->parseHtmlByName('block_view.html', array(
  35. 'bx_repeat:items' => $aTmplVarsItems
  36. ));
  37. }
  38. }
  39. /** @} */