BxReviewsConfig.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270
  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 Reviews Reviews
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxReviewsConfig extends BxBaseModTextConfig
  12. {
  13. function __construct($aModule)
  14. {
  15. parent::__construct($aModule);
  16. $aMenuItems2Methods = array (
  17. 'approve' => 'checkAllowedApprove',
  18. 'edit-review' => 'checkAllowedEdit',
  19. 'delete-review' => 'checkAllowedDelete',
  20. );
  21. $this->CNF = array_merge($this->CNF, array (
  22. // module icon
  23. 'ICON' => 'address-card',
  24. // database tables
  25. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'reviews',
  26. 'TABLE_ENTRIES_FULLTEXT' => 'title_text',
  27. // database fields
  28. 'FIELD_ID' => 'id',
  29. 'FIELD_AUTHOR' => 'author',
  30. 'FIELD_ADDED' => 'added',
  31. 'FIELD_CHANGED' => 'changed',
  32. 'FIELD_TITLE' => 'title',
  33. 'FIELD_PRODUCT' => 'product',
  34. 'FIELD_TEXT' => 'text',
  35. 'FIELD_TEXT_ID' => 'review-text',
  36. 'FIELD_VOTING_OPTIONS' => 'voting_options',
  37. 'FIELD_VOTING_AVG' => 'voting_avg',
  38. 'FIELD_CATEGORY' => 'cat',
  39. 'FIELD_MULTICAT' => 'multicat',
  40. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  41. 'FIELD_CF' => 'cf',
  42. 'FIELD_REVIEWED_PROFILE' => 'reviewed_profile',
  43. 'FIELD_COVER' => 'covers',
  44. 'FIELD_PHOTO' => 'pictures',
  45. 'FIELD_VIDEO' => 'videos',
  46. 'FIELD_FILE' => 'files',
  47. 'FIELD_POLL' => 'polls',
  48. 'FIELD_THUMB' => 'thumb',
  49. 'FIELD_ATTACHMENTS' => 'attachments',
  50. 'FIELD_VIEWS' => 'views',
  51. 'FIELD_COMMENTS' => 'comments',
  52. 'FIELD_STATUS' => 'status',
  53. 'FIELD_STATUS_ADMIN' => 'status_admin',
  54. 'FIELD_LOCATION' => 'location',
  55. 'FIELD_LOCATION_PREFIX' => 'location',
  56. 'FIELD_LABELS' => 'labels',
  57. 'FIELD_ANONYMOUS' => 'anonymous',
  58. 'FIELD_ALLOW_COMMENTS' => 'allow_comments',
  59. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  60. 'FIELDS_DELAYED_PROCESSING' => 'videos', // can be array of fields or comma separated string of field names
  61. // some params
  62. 'PARAM_MULTICAT_ENABLED' => true,
  63. 'PARAM_MULTICAT_AUTO_ACTIVATION_FOR_CATEGORIES' => 'bx_reviews_auto_activation_for_categories',
  64. 'PARAM_PER_PAGE_FOR_FAVORITES_LISTS' => 'bx_reviews_per_page_for_favorites_lists',
  65. // page URIs
  66. 'URI_VIEW_ENTRY' => 'view-review',
  67. 'URI_AUTHOR_ENTRIES' => 'reviews-author',
  68. 'URI_ENTRIES_BY_CONTEXT' => 'reviews-context',
  69. 'URI_ADD_ENTRY' => 'create-review',
  70. 'URI_EDIT_ENTRY' => 'edit-review',
  71. 'URI_MANAGE_COMMON' => 'reviews-manage',
  72. 'URL_HOME' => 'page.php?i=reviews-home',
  73. 'URL_POPULAR' => 'page.php?i=reviews-popular',
  74. 'URL_TOP' => 'page.php?i=reviews-top',
  75. 'URL_UPDATED' => 'page.php?i=reviews-updated',
  76. 'URL_MANAGE_COMMON' => 'page.php?i=reviews-manage',
  77. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=reviews-administration',
  78. 'URI_FAVORITES_LIST' => 'reviews-favorites',
  79. 'URI_SEARCH_PRODUCT' => 'searchKeyword.php?section=bx_reviews_products',
  80. // some params
  81. 'PARAM_AUTO_APPROVE' => 'bx_reviews_enable_auto_approve',
  82. 'PARAM_CHARS_SUMMARY' => 'bx_reviews_summary_chars',
  83. 'PARAM_CHARS_SUMMARY_PLAIN' => 'bx_reviews_plain_summary_chars',
  84. 'PARAM_CHARS_SUMMARY_PLAIN_SHORT' => 'bx_reviews_plain_summary_chars_with_thumb',
  85. 'PARAM_NUM_RSS' => 'bx_reviews_rss_num',
  86. 'PARAM_SEARCHABLE_FIELDS' => 'bx_reviews_searchable_fields',
  87. 'PARAM_USE_GALERY_AS_COVER' => 'bx_reviews_use_galery_as_cover',
  88. 'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_reviews_per_page_browse_showcase',
  89. 'PARAM_PER_PAGE_BROWSE' => 'bx_reviews_per_page_browse',
  90. 'PARAM_MAX_STARS' => 'bx_reviews_voting_max_stars',
  91. 'PARAM_CONTEXT_CONTROL_ENABLE' => 'bx_reviews_custom_context_chooser',
  92. 'PARAM_CONTEXT_MODULES_AVAILABLE' => 'bx_reviews_custom_context_chooser_options',
  93. // objects
  94. 'OBJECT_STORAGE' => 'bx_reviews_covers',
  95. 'OBJECT_STORAGE_FILES' => 'bx_reviews_files',
  96. 'OBJECT_STORAGE_PHOTOS' => 'bx_reviews_photos',
  97. 'OBJECT_STORAGE_VIDEOS' => 'bx_reviews_videos',
  98. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_reviews_preview',
  99. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_reviews_gallery',
  100. 'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_reviews_cover',
  101. 'OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES' => 'bx_reviews_preview_files',
  102. 'OBJECT_IMAGES_TRANSCODER_GALLERY_FILES' => 'bx_reviews_gallery_files',
  103. 'OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS' => 'bx_reviews_preview_photos',
  104. 'OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS' => 'bx_reviews_gallery_photos',
  105. 'OBJECT_VIDEOS_TRANSCODERS' => array(
  106. 'poster' => 'bx_reviews_videos_poster',
  107. 'poster_preview' => 'bx_reviews_videos_poster_preview',
  108. 'mp4' => 'bx_reviews_videos_mp4',
  109. 'mp4_hd' => 'bx_reviews_videos_mp4_hd'
  110. ),
  111. 'OBJECT_VIDEO_TRANSCODER_HEIGHT' => '480px',
  112. 'OBJECT_REPORTS' => 'bx_reviews',
  113. 'OBJECT_VIEWS' => 'bx_reviews',
  114. 'OBJECT_VOTES' => 'bx_reviews',
  115. 'OBJECT_VOTES_STARS' => 'bx_reviews_stars',
  116. 'OBJECT_REACTIONS' => 'bx_reviews_reactions',
  117. 'OBJECT_SCORES' => 'bx_reviews',
  118. 'OBJECT_FAVORITES' => 'bx_reviews',
  119. 'OBJECT_FEATURED' => 'bx_reviews',
  120. 'OBJECT_METATAGS' => 'bx_reviews',
  121. 'OBJECT_COMMENTS' => 'bx_reviews',
  122. 'OBJECT_NOTES' => 'bx_reviews_notes',
  123. 'OBJECT_CATEGORY' => 'bx_reviews_cats',
  124. 'OBJECT_PRIVACY_VIEW' => 'bx_reviews_allow_view_to',
  125. 'OBJECT_PRIVACY_LIST_VIEW' => 'bx_reviews_allow_view_favorite_list',
  126. 'OBJECT_FORM_ENTRY' => 'bx_reviews',
  127. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_reviews_entry_view',
  128. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_reviews_entry_add',
  129. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_reviews_entry_edit',
  130. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_reviews_entry_delete',
  131. 'OBJECT_FORM_POLL' => 'bx_reviews_poll',
  132. 'OBJECT_FORM_POLL_DISPLAY_ADD' => 'bx_reviews_poll_add',
  133. 'OBJECT_MENU_ENTRY_ATTACHMENTS' => 'bx_reviews_entry_attachments', // attachments menu in create/edit forms
  134. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_reviews_view', // actions menu on view entry page
  135. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_reviews_view_actions', // all actions menu on view entry page
  136. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_reviews_my', // actions menu on my entries page
  137. 'OBJECT_MENU_SUBMENU' => 'bx_reviews_submenu', // main module submenu
  138. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_reviews_view_submenu', // view entry submenu
  139. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'reviews-home', // first item in view entry submenu from main module submenu
  140. 'OBJECT_MENU_SNIPPET_META' => 'bx_reviews_snippet_meta', // menu for snippet meta info
  141. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_reviews_menu_manage_tools', //manage menu in content administration tools
  142. 'OBJECT_GRID_ADMINISTRATION' => 'bx_reviews_administration',
  143. 'OBJECT_GRID_COMMON' => 'bx_reviews_common',
  144. 'OBJECT_GRID_CATEGORIES' => 'bx_reviews_categories',
  145. 'OBJECT_UPLOADERS' => array('bx_reviews_simple', 'bx_reviews_html5'),
  146. 'OBJECT_CONTENT_INFO' => 'bx_reviews',
  147. 'OBJECT_CMTS_CONTENT_INFO' => 'bx_reviews_cmts',
  148. 'BADGES_AVALIABLE' => true,
  149. // menu items which visibility depends on custom visibility checking
  150. 'MENU_ITEM_TO_METHOD' => array (
  151. 'bx_reviews_my' => array (
  152. 'create-review' => 'checkAllowedAdd',
  153. ),
  154. 'bx_reviews_view' => $aMenuItems2Methods,
  155. ),
  156. // informer messages
  157. 'INFORMERS' => array (
  158. 'approving' => array (
  159. 'name' => 'bx-reviews-approving',
  160. 'map' => array (
  161. 'pending' => array('msg' => '_bx_reviews_txt_msg_status_pending', 'type' => BX_INFORMER_ALERT),
  162. 'hidden' => array('msg' => '_bx_reviews_txt_msg_status_hidden', 'type' => BX_INFORMER_ERROR),
  163. ),
  164. ),
  165. 'processing' => array (
  166. 'name' => 'bx-reviews-processing',
  167. 'map' => array (
  168. 'awaiting' => array('msg' => '_bx_reviews_txt_processing_awaiting', 'type' => BX_INFORMER_ALERT),
  169. 'failed' => array('msg' => '_bx_reviews_txt_processing_failed', 'type' => BX_INFORMER_ERROR)
  170. ),
  171. ),
  172. 'scheduled' => array (
  173. 'name' => 'bx-reviews-scheduled',
  174. 'map' => array (
  175. 'awaiting' => array('msg' => '_bx_reviews_txt_scheduled_awaiting', 'type' => BX_INFORMER_ALERT),
  176. ),
  177. ),
  178. ),
  179. // some language keys
  180. 'T' => array (
  181. 'txt_sample_single' => '_bx_reviews_txt_sample_single',
  182. 'txt_sample_single_with_article' => '_bx_reviews_txt_sample_single_with_article',
  183. 'txt_sample_comment_single' => '_bx_reviews_txt_sample_comment_single',
  184. 'txt_sample_vote_single' => '_bx_reviews_txt_sample_vote_single',
  185. 'txt_sample_reaction_single' => '_bx_reviews_txt_sample_reaction_single',
  186. 'txt_sample_score_up_single' => '_bx_reviews_txt_sample_score_up_single',
  187. 'txt_sample_score_down_single' => '_bx_reviews_txt_sample_score_down_single',
  188. 'form_field_author' => '_bx_reviews_form_entry_input_author',
  189. 'form_field_covers_uploader_simple' => '_bx_reviews_form_entry_input_covers_uploader_simple_title',
  190. 'form_field_covers_uploader_html5' => '_bx_reviews_form_entry_input_covers_uploader_html5_title',
  191. 'grid_action_err_delete' => '_bx_reviews_grid_action_err_delete',
  192. 'grid_txt_account_manager' => '_bx_reviews_grid_txt_account_manager',
  193. 'filter_item_active' => '_bx_reviews_grid_filter_item_title_adm_active',
  194. 'filter_item_hidden' => '_bx_reviews_grid_filter_item_title_adm_hidden',
  195. 'filter_item_pending' => '_bx_reviews_grid_filter_item_title_adm_pending',
  196. 'filter_item_select_one_filter1' => '_bx_reviews_grid_filter_item_title_adm_select_one_filter1',
  197. 'filter_item_select_one_filter2' => '_bx_reviews_grid_filter_item_title_adm_select_one_filter2',
  198. 'menu_item_manage_my' => '_bx_reviews_menu_item_title_manage_my',
  199. 'menu_item_manage_all' => '_bx_reviews_menu_item_title_manage_all',
  200. 'txt_all_entries_by' => '_bx_reviews_txt_all_entries_by',
  201. 'txt_all_entries_in' => '_bx_reviews_txt_all_entries_in',
  202. 'txt_all_entries_by_author' => '_bx_reviews_page_title_browse_by_author',
  203. 'txt_all_entries_by_context' => '_bx_reviews_page_title_browse_by_context',
  204. 'txt_err_cannot_perform_action' => '_bx_reviews_txt_err_cannot_perform_action',
  205. 'txt_poll_form_answers_add' => '_bx_reviews_form_poll_input_answers_add',
  206. 'txt_poll_menu_view_answers' => '_bx_reviews_txt_poll_view_answers',
  207. 'txt_poll_menu_view_results' => '_bx_reviews_txt_poll_view_results',
  208. 'txt_poll_menu_view_' => '_bx_reviews_txt_poll_view_',
  209. 'txt_poll_answer_vote_do_by' => '_bx_reviews_txt_poll_answer_vote_do_by',
  210. 'txt_poll_answer_vote_counter' => '_bx_reviews_txt_poll_answer_vote_counter',
  211. 'txt_poll_answer_vote_percent' => '_bx_reviews_txt_poll_answer_vote_percent'
  212. ),
  213. ));
  214. $this->_aJsClasses = array_merge($this->_aJsClasses, array(
  215. 'manage_tools' => 'BxReviewsManageTools',
  216. 'categories' => 'BxDolCategories',
  217. 'multi_voting' => 'BxReviewsVoteStars',
  218. ));
  219. $this->_aJsObjects = array_merge($this->_aJsObjects, array(
  220. 'manage_tools' => 'oBxReviewsManageTools',
  221. 'categories' => 'oBxDolCategories',
  222. 'multi_voting' => 'oBxReviewsVoteStars',
  223. ));
  224. $this->_aGridObjects = array(
  225. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  226. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  227. );
  228. $this->_bAttachmentsInTimeline = true;
  229. }
  230. public function getJsClass($mixedType)
  231. {
  232. if (is_array($mixedType)) {
  233. return parent::getJsClass($mixedType['type']);
  234. } else {
  235. return parent::getJsClass($mixedType);
  236. }
  237. }
  238. public function getJsObject($mixedType)
  239. {
  240. if (is_array($mixedType)) {
  241. return parent::getJsObject($mixedType['type']).$mixedType['id'];
  242. } else {
  243. return parent::getJsObject($mixedType);
  244. }
  245. }
  246. }
  247. /** @} */