BxBaseTemplateServices.php 1.4 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 UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * System services related to Templates.
  11. */
  12. class BxBaseTemplateServices extends BxDol
  13. {
  14. public function __construct()
  15. {
  16. parent::__construct();
  17. }
  18. public function serviceGetPageTypes()
  19. {
  20. $aTypes = BxDolPageQuery::getPageTypes();
  21. $aResult = [];
  22. foreach($aTypes as $aType)
  23. if($aType['id'] != BX_PAGE_TYPE_DEFAULT)
  24. $aResult[] = [
  25. 'key' => $aType['id'],
  26. 'value' => _t($aType['title'])
  27. ];
  28. return $aResult;
  29. }
  30. public function serviceGetTemplates($bEnabledOnly = true, $bShortInfo = true)
  31. {
  32. $aValues = get_templates_array($bEnabledOnly, $bShortInfo);
  33. $aResult = array();
  34. foreach($aValues as $sKey => $sValue)
  35. $aResult[] = array(
  36. 'key' => $sKey,
  37. 'value' => $sValue
  38. );
  39. return $aResult;
  40. }
  41. public function serviceGetInjection($sName)
  42. {
  43. $sResult = '';
  44. switch($sName) {
  45. case 'body_class':
  46. $sResult = 'bx-user-' . (isLogged() ? '' : 'un') . 'authorized';
  47. break;
  48. }
  49. return $sResult;
  50. }
  51. }
  52. /** @} */