1
0

BxBaseModTextConfig.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 + images + videos + polls + text).
  17. * By default the first variant is used.
  18. */
  19. protected $_bAttachmentsInTimeline;
  20. function __construct($aModule)
  21. {
  22. parent::__construct($aModule);
  23. $this->CNF = array(
  24. // database tables
  25. 'TABLE_POLLS' => $aModule['db_prefix'] . 'polls',
  26. 'TABLE_POLLS_ANSWERS' => $aModule['db_prefix'] . 'polls_answers',
  27. 'TABLE_POLLS_ANSWERS_VOTES' => $aModule['db_prefix'] . 'polls_answers_votes',
  28. 'TABLE_POLLS_ANSWERS_VOTES_TRACK' => $aModule['db_prefix'] . 'polls_answers_votes_track',
  29. // database fields
  30. 'FIELD_POLL_ID' => 'id',
  31. 'FIELD_POLL_AUTHOR_ID' => 'author_id',
  32. 'FIELD_POLL_CONTENT_ID' => 'content_id',
  33. 'FIELD_POLL_TEXT' => 'text',
  34. 'FIELD_POLL_ANSWERS' => 'answers',
  35. // some params
  36. 'PARAM_POLL_ENABLED' => true,
  37. 'PARAM_POLL_HIDDEN_RESULTS' => false,
  38. 'PARAM_POLL_ANONYMOUS_VOTING' => true,
  39. // objects
  40. 'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',
  41. );
  42. $this->_aJsClasses = array(
  43. 'poll' => $this->_sClassPrefix . 'Polls'
  44. );
  45. $this->_aJsObjects = array(
  46. 'poll' => 'o' . $this->_sClassPrefix . 'Polls'
  47. );
  48. $sPrefix = str_replace('_', '-', $this->_sName);
  49. $this->_aHtmlIds = array(
  50. 'add_poll_popup' => $sPrefix . '-add-poll-popup',
  51. 'add_poll_form_field' => $sPrefix . '-add-poll-form-field',
  52. 'polls_showcase' => $sPrefix . '-polls-showcase-',
  53. 'poll' => $sPrefix . '-poll-',
  54. 'poll_content' => $sPrefix . '-poll-content-',
  55. 'poll_view_menu' => $sPrefix . '-poll-view-menu',
  56. 'poll_view_link_answers' => $sPrefix . '-poll-view-answers-',
  57. 'poll_view_link_results' => $sPrefix . '-poll-view-results-',
  58. );
  59. $this->_bAttachmentsInTimeline = false;
  60. }
  61. public function isAttachmentsInTimeline()
  62. {
  63. return $this->_bAttachmentsInTimeline;
  64. }
  65. public function getHtmlIds($sKey = '')
  66. {
  67. if(empty($sKey))
  68. return $this->_aHtmlIds;
  69. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  70. }
  71. }
  72. /** @} */