BxBaseModTextConfig.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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 (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_HIDDEN_RESULTS' => false,
  37. 'PARAM_POLL_ANONYMOUS_VOTING' => true,
  38. // objects
  39. 'OBJECT_VOTES_POLL_ANSWERS' => $this->_sName . '_poll_answers',
  40. );
  41. $this->_aJsClasses = array(
  42. 'poll' => $this->_sClassPrefix . 'Polls'
  43. );
  44. $this->_aJsObjects = array(
  45. 'poll' => 'o' . $this->_sClassPrefix . 'Polls'
  46. );
  47. $sPrefix = str_replace('_', '-', $this->_sName);
  48. $this->_aHtmlIds = array(
  49. 'add_poll_popup' => $sPrefix . '-add-poll-popup',
  50. 'add_poll_form_field' => $sPrefix . '-add-poll-form-field',
  51. 'poll' => $sPrefix . '-poll-',
  52. 'poll_content' => $sPrefix . '-poll-content-',
  53. 'poll_view_menu' => $sPrefix . '-poll-view-menu',
  54. 'poll_view_link_answers' => $sPrefix . '-poll-view-answers-',
  55. 'poll_view_link_results' => $sPrefix . '-poll-view-results-',
  56. );
  57. $this->_bAttachmentsInTimeline = false;
  58. }
  59. public function isAttachmentsInTimeline()
  60. {
  61. return $this->_bAttachmentsInTimeline;
  62. }
  63. public function getHtmlIds($sKey = '')
  64. {
  65. if(empty($sKey))
  66. return $this->_aHtmlIds;
  67. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  68. }
  69. }
  70. /** @} */