BxBaseModTextConfig.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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 BaseText Base classes for text modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxBaseModTextConfig extends BxBaseModGeneralConfig
  12. {
  13. protected $_aHtmlIds;
  14. /**
  15. * Determine whether Timeline post will use common content (header image + text)
  16. * or content received from attachments (header image + text + images + videos + polls).
  17. * By default the first variant is used.
  18. * Note. The variable can be removed in future, when all Text Based modules
  19. * implement 'attachments' related parameters.
  20. */
  21. protected $_bAttachmentsInTimeline;
  22. function __construct($aModule)
  23. {
  24. parent::__construct($aModule);
  25. $this->CNF = array(
  26. // modules icon
  27. 'ICON_POLLS_ANSWERS' => 'vote-yea',
  28. 'ICON_POLLS_RESULTS' => 'poll-h',
  29. // database tables
  30. 'TABLE_POLLS' => $aModule['db_prefix'] . 'polls',
  31. 'TABLE_POLLS_ANSWERS' => $aModule['db_prefix'] . 'polls_answers',
  32. 'TABLE_POLLS_ANSWERS_VOTES' => $aModule['db_prefix'] . 'polls_answers_votes',
  33. 'TABLE_POLLS_ANSWERS_VOTES_TRACK' => $aModule['db_prefix'] . 'polls_answers_votes_track',
  34. // database fields
  35. 'FIELD_POLL_ID' => 'id',
  36. 'FIELD_POLL_AUTHOR_ID' => 'author_id',
  37. 'FIELD_POLL_CONTENT_ID' => 'content_id',
  38. 'FIELD_POLL_TEXT' => 'text',
  39. 'FIELD_POLL_ANSWERS' => 'answers',
  40. // some params
  41. 'PARAM_POLL_ENABLED' => true,
  42. 'PARAM_POLL_HIDDEN_RESULTS' => false,
  43. 'PARAM_POLL_ANONYMOUS_VOTING' => true,
  44. // objects
  45. 'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',
  46. // styles
  47. 'STYLES_POLLS_EMBED_CLASS' => 'body.bx-page-iframe.bx-def-color-bg-page',
  48. 'STYLES_POLLS_EMBED_CONTENT' => array(
  49. 'background-color' => '#ffffff'
  50. ),
  51. );
  52. $this->_aJsClasses = array(
  53. 'poll' => $this->_sClassPrefix . 'Polls'
  54. );
  55. $this->_aJsObjects = array(
  56. 'poll' => 'o' . $this->_sClassPrefix . 'Polls'
  57. );
  58. $sPrefix = str_replace('_', '-', $this->_sName);
  59. $this->_aHtmlIds = array(
  60. 'add_poll_popup' => $sPrefix . '-add-poll-popup',
  61. 'add_poll_form_field' => $sPrefix . '-add-poll-form-field',
  62. 'polls_showcase' => $sPrefix . '-polls-showcase-',
  63. 'poll' => $sPrefix . '-poll-',
  64. 'poll_content' => $sPrefix . '-poll-content-',
  65. 'poll_view_menu' => $sPrefix . '-poll-view-menu',
  66. 'poll_view_link_answers' => $sPrefix . '-poll-view-answers-',
  67. 'poll_view_link_results' => $sPrefix . '-poll-view-results-',
  68. );
  69. $this->_bAttachmentsInTimeline = false;
  70. }
  71. public function isAttachmentsInTimeline()
  72. {
  73. return $this->_bAttachmentsInTimeline;
  74. }
  75. public function getHtmlIds($sKey = '')
  76. {
  77. if(empty($sKey))
  78. return $this->_aHtmlIds;
  79. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  80. }
  81. }
  82. /** @} */