BxBaseModTextConfig.php 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. 'PARAM_MULTICAT_ENABLED' => false,
  45. // objects
  46. 'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',
  47. // styles
  48. 'STYLES_POLLS_EMBED_CLASS' => 'body.bx-page-iframe.bx-def-color-bg-page',
  49. 'STYLES_POLLS_EMBED_CONTENT' => array(
  50. 'background-color' => '#ffffff'
  51. ),
  52. );
  53. $this->_aJsClasses = array(
  54. 'poll' => $this->_sClassPrefix . 'Polls',
  55. 'categories' => $this->_sClassPrefix . 'Categories'
  56. );
  57. $this->_aJsObjects = array(
  58. 'poll' => 'o' . $this->_sClassPrefix . 'Polls',
  59. 'categories' => 'o' . $this->_sClassPrefix . 'Categories'
  60. );
  61. $sPrefix = str_replace('_', '-', $this->_sName);
  62. $this->_aHtmlIds = array(
  63. 'add_poll_popup' => $sPrefix . '-add-poll-popup',
  64. 'add_poll_form_field' => $sPrefix . '-add-poll-form-field',
  65. 'polls_showcase' => $sPrefix . '-polls-showcase-',
  66. 'poll' => $sPrefix . '-poll-',
  67. 'poll_content' => $sPrefix . '-poll-content-',
  68. 'poll_view_menu' => $sPrefix . '-poll-view-menu',
  69. 'poll_view_link_answers' => $sPrefix . '-poll-view-answers-',
  70. 'poll_view_link_results' => $sPrefix . '-poll-view-results-',
  71. );
  72. $this->_bAttachmentsInTimeline = false;
  73. }
  74. public function isAttachmentsInTimeline()
  75. {
  76. return $this->_bAttachmentsInTimeline;
  77. }
  78. public function getHtmlIds($sKey = '')
  79. {
  80. if(empty($sKey))
  81. return $this->_aHtmlIds;
  82. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  83. }
  84. }
  85. /** @} */