BxBaseModTextConfig.php 3.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. // database tables
  27. 'TABLE_POLLS' => $aModule['db_prefix'] . 'polls',
  28. 'TABLE_POLLS_ANSWERS' => $aModule['db_prefix'] . 'polls_answers',
  29. 'TABLE_POLLS_ANSWERS_VOTES' => $aModule['db_prefix'] . 'polls_answers_votes',
  30. 'TABLE_POLLS_ANSWERS_VOTES_TRACK' => $aModule['db_prefix'] . 'polls_answers_votes_track',
  31. // database fields
  32. 'FIELD_POLL_ID' => 'id',
  33. 'FIELD_POLL_AUTHOR_ID' => 'author_id',
  34. 'FIELD_POLL_CONTENT_ID' => 'content_id',
  35. 'FIELD_POLL_TEXT' => 'text',
  36. 'FIELD_POLL_ANSWERS' => 'answers',
  37. // some params
  38. 'PARAM_POLL_ENABLED' => true,
  39. 'PARAM_POLL_HIDDEN_RESULTS' => false,
  40. 'PARAM_POLL_ANONYMOUS_VOTING' => true,
  41. // objects
  42. 'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',
  43. // styles
  44. 'STYLES_POLLS_EMBED_CLASS' => 'body.bx-page-iframe.bx-def-color-bg-page',
  45. 'STYLES_POLLS_EMBED_CONTENT' => array(
  46. 'background-color' => '#ffffff'
  47. ),
  48. );
  49. $this->_aJsClasses = array(
  50. 'poll' => $this->_sClassPrefix . 'Polls'
  51. );
  52. $this->_aJsObjects = array(
  53. 'poll' => 'o' . $this->_sClassPrefix . 'Polls'
  54. );
  55. $sPrefix = str_replace('_', '-', $this->_sName);
  56. $this->_aHtmlIds = array(
  57. 'add_poll_popup' => $sPrefix . '-add-poll-popup',
  58. 'add_poll_form_field' => $sPrefix . '-add-poll-form-field',
  59. 'polls_showcase' => $sPrefix . '-polls-showcase-',
  60. 'poll' => $sPrefix . '-poll-',
  61. 'poll_content' => $sPrefix . '-poll-content-',
  62. 'poll_view_menu' => $sPrefix . '-poll-view-menu',
  63. 'poll_view_link_answers' => $sPrefix . '-poll-view-answers-',
  64. 'poll_view_link_results' => $sPrefix . '-poll-view-results-',
  65. );
  66. $this->_bAttachmentsInTimeline = false;
  67. }
  68. public function isAttachmentsInTimeline()
  69. {
  70. return $this->_bAttachmentsInTimeline;
  71. }
  72. public function getHtmlIds($sKey = '')
  73. {
  74. if(empty($sKey))
  75. return $this->_aHtmlIds;
  76. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  77. }
  78. }
  79. /** @} */