BxSpacesTemplate.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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. * @defdroup Spaces Spaces
  7. * @indroup UnaModules
  8. *
  9. * @{
  10. */
  11. /*
  12. * Spaces module representation.
  13. */
  14. class BxSpacesTemplate extends BxBaseModGroupsTemplate
  15. {
  16. function __construct(&$oConfig, &$oDb)
  17. {
  18. $this->MODULE = 'bx_spaces';
  19. parent::__construct($oConfig, $oDb);
  20. }
  21. public function entryChilds($aData)
  22. {
  23. $CNF = $this->_oConfig->CNF;
  24. $aChild = $this->_oModule->_oDb->getChildEntriesIdByProfileId($aData[$CNF['FIELD_ID']]);
  25. if (count($aChild) == 0)
  26. return false;
  27. return $this->parseHtmlByName('entry-childs.html', array('content' => $this->getBrowseQuick($aChild)));
  28. }
  29. public function entryParent($aData)
  30. {
  31. $CNF = $this->_oConfig->CNF;
  32. if ($aData[$CNF['FIELD_PARENT']] == 0)
  33. return false;
  34. return $this->parseHtmlByName('entry-parent.html', array('content' => $this->getBrowseQuick(array($aData[$CNF['FIELD_PARENT']]))));
  35. }
  36. private function getBrowseQuick($aProfiles)
  37. {
  38. $sRv = '';
  39. foreach ($aProfiles as $iProfileId) {
  40. $oProfile = BxDolProfile::getInstance($iProfileId);
  41. if(!$oProfile)
  42. continue;
  43. $sRv .= $oProfile->getUnit(false, array('template' => 'unit_wo_cover'));
  44. }
  45. return $sRv;
  46. }
  47. }
  48. /** @} */