BxAdsConfig.php 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  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 Ads Ads
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolInformer');
  12. class BxAdsConfig extends BxBaseModTextConfig
  13. {
  14. function __construct($aModule)
  15. {
  16. parent::__construct($aModule);
  17. $aMenuItems2Methods = array (
  18. 'edit-ad' => 'checkAllowedEdit',
  19. 'delete-ad' => 'checkAllowedDelete',
  20. );
  21. $this->CNF = array_merge($this->CNF, array (
  22. // module icon
  23. 'ICON' => 'ad col-green2',
  24. // database tables
  25. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'entries',
  26. 'TABLE_ENTRIES_FULLTEXT' => 'title_text',
  27. 'TABLE_CATEGORIES' => $aModule['db_prefix'] . 'categories',
  28. 'TABLE_CATEGORIES_TYPES' => $aModule['db_prefix'] . 'categories_types',
  29. 'TABLE_INTERESTED_TRACK' => $aModule['db_prefix'] . 'interested_track',
  30. // database fields
  31. 'FIELD_ID' => 'id',
  32. 'FIELD_AUTHOR' => 'author',
  33. 'FIELD_ADDED' => 'added',
  34. 'FIELD_CHANGED' => 'changed',
  35. 'FIELD_TITLE' => 'title',
  36. 'FIELD_TEXT' => 'text',
  37. 'FIELD_TEXT_ID' => 'ad-text',
  38. 'FIELD_CATEGORY' => 'category',
  39. 'FIELD_CATEGORY_VIEW' => 'category_view',
  40. 'FIELD_CATEGORY_SELECT' => 'category_select',
  41. 'FIELD_PRICE' => 'price',
  42. 'FIELD_YEAR' => 'year',
  43. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  44. 'FIELD_COVER' => 'covers',
  45. 'FIELD_PHOTO' => 'pictures',
  46. 'FIELD_VIDEO' => 'videos',
  47. 'FIELD_FILE' => 'files',
  48. 'FIELD_POLL' => 'polls',
  49. 'FIELD_THUMB' => 'thumb',
  50. 'FIELD_ATTACHMENTS' => 'attachments',
  51. 'FIELD_VIEWS' => 'views',
  52. 'FIELD_COMMENTS' => 'comments',
  53. 'FIELD_STATUS' => 'status',
  54. 'FIELD_STATUS_ADMIN' => 'status_admin',
  55. 'FIELD_LOCATION' => 'location',
  56. 'FIELD_LOCATION_PREFIX' => 'location',
  57. 'FIELD_LABELS' => 'labels',
  58. 'FIELD_ANONYMOUS' => 'anonymous',
  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. // page URIs
  62. 'URI_VIEW_ENTRY' => 'view-ad',
  63. 'URI_AUTHOR_ENTRIES' => 'ads-author',
  64. 'URI_ENTRIES_BY_CONTEXT' => 'ads-context',
  65. 'URI_ADD_ENTRY' => 'create-ad',
  66. 'URI_EDIT_ENTRY' => 'edit-ad',
  67. 'URI_MANAGE_COMMON' => 'ads-manage',
  68. 'URL_HOME' => 'page.php?i=ads-home',
  69. 'URL_POPULAR' => 'page.php?i=ads-popular',
  70. 'URL_UPDATED' => 'page.php?i=ads-updated',
  71. 'URL_CATEGORIES' => 'page.php?i=ads-categories',
  72. 'URL_MANAGE_COMMON' => 'page.php?i=ads-manage',
  73. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=ads-administration',
  74. 'GET_PARAM_CATEGORY' => 'category',
  75. // some params
  76. 'PARAM_CHARS_SUMMARY' => 'bx_ads_summary_chars',
  77. 'PARAM_CHARS_SUMMARY_PLAIN' => 'bx_ads_plain_summary_chars',
  78. 'PARAM_NUM_RSS' => 'bx_ads_rss_num',
  79. 'PARAM_SEARCHABLE_FIELDS' => 'bx_ads_searchable_fields',
  80. 'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_ads_per_page_browse_showcase',
  81. 'PARAM_LIFETIME' => 'bx_ads_lifetime',
  82. 'PARAM_USE_IIN' => 'bx_ads_internal_interested_notification',
  83. 'PARAM_CATEGORY_LEVEL_MAX' => 1,
  84. // objects
  85. 'OBJECT_STORAGE' => 'bx_ads_covers',
  86. 'OBJECT_STORAGE_FILES' => 'bx_ads_files',
  87. 'OBJECT_STORAGE_PHOTOS' => 'bx_ads_photos',
  88. 'OBJECT_STORAGE_VIDEOS' => 'bx_ads_videos',
  89. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_ads_preview',
  90. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_ads_gallery',
  91. 'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_ads_cover',
  92. 'OBJECT_IMAGES_TRANSCODER_PREVIEW_FILES' => 'bx_ads_preview_files',
  93. 'OBJECT_IMAGES_TRANSCODER_GALLERY_FILES' => 'bx_ads_gallery_files',
  94. 'OBJECT_IMAGES_TRANSCODER_PREVIEW_PHOTOS' => 'bx_ads_preview_photos',
  95. 'OBJECT_IMAGES_TRANSCODER_GALLERY_PHOTOS' => 'bx_ads_gallery_photos',
  96. 'OBJECT_VIDEOS_TRANSCODERS' => array(
  97. 'poster' => 'bx_ads_videos_poster',
  98. 'poster_preview' => 'bx_ads_videos_poster_preview',
  99. 'mp4' => 'bx_ads_videos_mp4',
  100. 'mp4_hd' => 'bx_ads_videos_mp4_hd'
  101. ),
  102. 'OBJECT_VIDEO_TRANSCODER_HEIGHT' => '480px',
  103. 'OBJECT_REPORTS' => 'bx_ads',
  104. 'OBJECT_VIEWS' => 'bx_ads',
  105. 'OBJECT_VOTES' => 'bx_ads',
  106. 'OBJECT_REACTIONS' => 'bx_ads_reactions',
  107. 'OBJECT_SCORES' => 'bx_ads',
  108. 'OBJECT_FAVORITES' => 'bx_ads',
  109. 'OBJECT_FEATURED' => 'bx_ads',
  110. 'OBJECT_METATAGS' => 'bx_ads',
  111. 'OBJECT_COMMENTS' => 'bx_ads',
  112. 'OBJECT_REVIEWS' => 'bx_ads_reviews',
  113. 'OBJECT_CATEGORY' => '',
  114. 'OBJECT_PRIVACY_VIEW' => 'bx_ads_allow_view_to',
  115. 'OBJECT_FORM_CATEGORY' => 'bx_ads_category',
  116. 'OBJECT_FORM_CATEGORY_DISPLAY_ADD' => 'bx_ads_category_add',
  117. 'OBJECT_FORM_CATEGORY_DISPLAY_EDIT' => 'bx_ads_category_edit',
  118. 'OBJECT_FORM_CATEGORY_DISPLAY_DELETE' => 'bx_ads_category_delete',
  119. 'OBJECT_FORM_ENTRY' => 'bx_ads',
  120. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => '',
  121. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_ads_entry_add',
  122. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => '',
  123. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_ads_entry_delete',
  124. 'OBJECT_FORM_POLL' => 'bx_ads_poll',
  125. 'OBJECT_FORM_POLL_DISPLAY_ADD' => 'bx_ads_poll_add',
  126. 'OBJECT_MENU_ENTRY_ATTACHMENTS' => 'bx_ads_entry_attachments', // attachments menu in create/edit forms
  127. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_ads_view', // actions menu on view entry page
  128. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_ads_view_actions', // all actions menu on view entry page
  129. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_ads_my', // actions menu on my entries page
  130. 'OBJECT_MENU_SUBMENU' => 'bx_ads_submenu', // main module submenu
  131. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_ads_view_submenu', // view entry submenu
  132. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'ads-home', // first item in view entry submenu from main module submenu
  133. 'OBJECT_MENU_SNIPPET_META' => 'bx_ads_snippet_meta', // menu for snippet meta info
  134. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_ads_menu_manage_tools', //manage menu in content administration tools
  135. 'OBJECT_GRID_CATEGORIES' => 'bx_ads_categories',
  136. 'OBJECT_GRID_ADMINISTRATION' => 'bx_ads_administration',
  137. 'OBJECT_GRID_COMMON' => 'bx_ads_common',
  138. 'OBJECT_UPLOADERS' => array('bx_ads_simple', 'bx_ads_html5'),
  139. // menu items which visibility depends on custom visibility checking
  140. 'MENU_ITEM_TO_METHOD' => array (
  141. 'bx_ads_my' => array (
  142. 'create-ad' => 'checkAllowedAdd',
  143. ),
  144. 'bx_ads_view' => $aMenuItems2Methods,
  145. ),
  146. // informer messages
  147. 'INFORMERS' => array (
  148. 'processing' => array (
  149. 'name' => 'bx-ads-processing',
  150. 'map' => array (
  151. 'awaiting' => array('msg' => '_bx_ads_txt_processing_awaiting', 'type' => BX_INFORMER_ALERT),
  152. 'failed' => array('msg' => '_bx_ads_txt_processing_failed', 'type' => BX_INFORMER_ERROR)
  153. ),
  154. )
  155. ),
  156. // email templates
  157. 'ETEMPLATE_INTERESTED' => 'bx_ads_interested',
  158. // some language keys
  159. 'T' => array (
  160. 'txt_sample_single' => '_bx_ads_txt_sample_single',
  161. 'txt_sample_single_with_article' => '_bx_ads_txt_sample_single_with_article',
  162. 'txt_sample_comment_single' => '_bx_ads_txt_sample_comment_single',
  163. 'txt_sample_vote_single' => '_bx_ads_txt_sample_vote_single',
  164. 'txt_sample_reaction_single' => '_bx_ads_txt_sample_reaction_single',
  165. 'txt_sample_score_up_single' => '_bx_ads_txt_sample_score_up_single',
  166. 'txt_sample_score_down_single' => '_bx_ads_txt_sample_score_down_single',
  167. 'txt_sample_interest_single' => '_bx_ads_txt_sample_interest_single',
  168. 'form_field_author' => '_bx_ads_form_entry_input_author',
  169. 'grid_action_err_delete' => '_bx_ads_grid_action_err_delete',
  170. 'grid_txt_account_manager' => '_bx_ads_grid_txt_account_manager',
  171. 'filter_item_active' => '_bx_ads_grid_filter_item_title_adm_active',
  172. 'filter_item_hidden' => '_bx_ads_grid_filter_item_title_adm_hidden',
  173. 'filter_item_select_one_filter1' => '_bx_ads_grid_filter_item_title_adm_select_one_filter1',
  174. 'menu_item_manage_my' => '_bx_ads_menu_item_title_manage_my',
  175. 'menu_item_manage_all' => '_bx_ads_menu_item_title_manage_all',
  176. 'txt_all_entries_by' => '_bx_ads_txt_all_entries_by',
  177. 'txt_all_entries_in' => '_bx_ads_txt_all_entries_in',
  178. 'txt_all_entries_by_author' => '_bx_ads_page_title_browse_by_author',
  179. 'txt_all_entries_by_context' => '_bx_ads_page_title_browse_by_context',
  180. 'txt_err_cannot_perform_action' => '_bx_ads_txt_err_cannot_perform_action',
  181. 'txt_poll_form_answers_add' => '_bx_ads_form_poll_input_answers_add',
  182. 'txt_poll_menu_view_answers' => '_bx_ads_txt_poll_view_answers',
  183. 'txt_poll_menu_view_results' => '_bx_ads_txt_poll_view_results',
  184. 'txt_poll_answer_vote_do_by' => '_bx_ads_txt_poll_answer_vote_do_by',
  185. 'txt_poll_answer_vote_counter' => '_bx_ads_txt_poll_answer_vote_counter',
  186. 'txt_poll_answer_vote_percent' => '_bx_ads_txt_poll_answer_vote_percent',
  187. 'txt_display_add' => '_bx_ads_txt_display_title_add',
  188. 'txt_display_edit' => '_bx_ads_txt_display_title_edit',
  189. 'txt_display_view' => '_bx_ads_txt_display_title_view',
  190. ),
  191. ));
  192. $this->_aJsClasses = array_merge($this->_aJsClasses, array(
  193. 'manage_tools' => 'BxAdsManageTools',
  194. 'studio' => 'BxAdsStudio',
  195. 'entry' => 'BxAdsEntry'
  196. ));
  197. $this->_aJsObjects = array_merge($this->_aJsObjects, array(
  198. 'manage_tools' => 'oBxAdsManageTools',
  199. 'studio' => 'oBxAdsStudio',
  200. 'entry' => 'oBxAdsEntry'
  201. ));
  202. $this->_aGridObjects = array(
  203. 'categories' => $this->CNF['OBJECT_GRID_CATEGORIES'],
  204. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  205. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  206. );
  207. $this->_bAttachmentsInTimeline = true;
  208. }
  209. }
  210. /** @} */