BxShopifyConfig.php 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205
  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 Shopify Shopify
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxShopifyConfig extends BxBaseModTextConfig
  12. {
  13. protected $_aHtmlIds;
  14. function __construct($aModule)
  15. {
  16. parent::__construct($aModule);
  17. $aMenuItems2Methods = array (
  18. 'approve' => 'checkAllowedApprove',
  19. 'edit-shopify-entry' => 'checkAllowedEdit',
  20. 'delete-shopify-entry' => 'checkAllowedDelete',
  21. );
  22. $this->CNF = array (
  23. // module icon
  24. 'ICON' => 'shopping-cart',
  25. // database tables
  26. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'entries',
  27. 'TABLE_SETTINGS' => $aModule['db_prefix'] . 'settings',
  28. 'TABLE_ENTRIES_FULLTEXT' => 'title_text',
  29. // database fields
  30. 'FIELD_ID' => 'id',
  31. 'FIELD_AUTHOR' => 'author',
  32. 'FIELD_ADDED' => 'added',
  33. 'FIELD_CHANGED' => 'changed',
  34. 'FIELD_CODE' => 'code',
  35. 'FIELD_TITLE' => 'title',
  36. 'FIELD_TEXT' => '',
  37. 'FIELD_TEXT_ID' => 'shopify-entry-text',
  38. 'FIELD_CATEGORY' => 'cat',
  39. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  40. 'FIELD_CF' => 'cf',
  41. 'FIELD_PHOTO' => '',
  42. 'FIELD_THUMB' => '',
  43. 'FIELD_VIEWS' => 'views',
  44. 'FIELD_COMMENTS' => 'comments',
  45. 'FIELD_STATUS' => 'status',
  46. 'FIELD_STATUS_ADMIN' => 'status_admin',
  47. 'FIELD_LOCATION' => 'location',
  48. 'FIELD_LOCATION_PREFIX' => 'location',
  49. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  50. // page URIs
  51. 'URI_VIEW_ENTRY' => 'view-shopify-entry',
  52. 'URI_AUTHOR_ENTRIES' => 'shopify-author',
  53. 'URI_ENTRIES_BY_CONTEXT' => 'shopify-context',
  54. 'URI_ADD_ENTRY' => 'create-shopify-entry',
  55. 'URI_EDIT_ENTRY' => 'edit-shopify-entry',
  56. 'URI_MANAGE_COMMON' => 'shopify-manage',
  57. 'URL_HOME' => 'page.php?i=shopify-home',
  58. 'URL_POPULAR' => 'page.php?i=shopify-popular',
  59. 'URL_UPDATED' => 'page.php?i=shopify-updated',
  60. 'URL_MANAGE_COMMON' => 'page.php?i=shopify-manage',
  61. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=shopify-administration',
  62. 'URL_SETTINGS' => 'page.php?i=shopify-settings',
  63. // some params
  64. 'PARAM_AUTO_APPROVE' => 'bx_shopify_enable_auto_approve',
  65. 'PARAM_CHARS_SUMMARY' => 'bx_shopify_summary_chars',
  66. 'PARAM_CHARS_SUMMARY_PLAIN' => 'bx_shopify_plain_summary_chars',
  67. 'PARAM_NUM_RSS' => 'bx_shopify_rss_num',
  68. 'PARAM_SEARCHABLE_FIELDS' => 'bx_shopify_searchable_fields',
  69. 'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_shopify_per_page_browse_showcase',
  70. // objects
  71. 'OBJECT_STORAGE' => 'bx_shopify_files',
  72. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_shopify_preview',
  73. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_shopify_gallery',
  74. 'OBJECT_VIDEOS_TRANSCODERS' => array(),
  75. 'OBJECT_REPORTS' => 'bx_shopify',
  76. 'OBJECT_VIEWS' => 'bx_shopify',
  77. 'OBJECT_VOTES' => 'bx_shopify',
  78. 'OBJECT_REACTIONS' => 'bx_shopify_reactions',
  79. 'OBJECT_SCORES' => 'bx_shopify',
  80. 'OBJECT_FAVORITES' => 'bx_shopify',
  81. 'OBJECT_FEATURED' => 'bx_shopify',
  82. 'OBJECT_METATAGS' => 'bx_shopify',
  83. 'OBJECT_COMMENTS' => 'bx_shopify',
  84. 'OBJECT_NOTES' => 'bx_shopify_notes',
  85. 'OBJECT_CATEGORY' => 'bx_shopify_cats',
  86. 'OBJECT_PRIVACY_VIEW' => 'bx_shopify_allow_view_to',
  87. 'OBJECT_FORM_ENTRY' => 'bx_shopify',
  88. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_shopify_entry_view',
  89. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_shopify_entry_add',
  90. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_shopify_entry_edit',
  91. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_shopify_entry_delete',
  92. 'OBJECT_FORM_SETTINGS' => 'bx_shopify_settings',
  93. 'OBJECT_FORM_SETTINGS_DISPLAY_EDIT' => 'bx_shopify_settings_edit',
  94. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_shopify_view', // actions menu on view entry page
  95. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_shopify_view_actions', // all actions menu on view entry page
  96. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_shopify_my', // actions menu on my entries page
  97. 'OBJECT_MENU_SUBMENU' => 'bx_shopify_submenu', // main module submenu
  98. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_shopify_view_submenu', // view entry submenu
  99. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'shopify-home', // first item in view entry submenu from main module submenu
  100. 'OBJECT_MENU_SNIPPET_META' => 'bx_shopify_snippet_meta', // menu for snippet meta info
  101. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_shopify_menu_manage_tools', //manage menu in content administration tools
  102. 'OBJECT_GRID_ADMINISTRATION' => 'bx_shopify_administration',
  103. 'OBJECT_GRID_COMMON' => 'bx_shopify_common',
  104. 'OBJECT_UPLOADERS' => array('sys_html5'),
  105. // menu items which visibility depends on custom visibility checking
  106. 'MENU_ITEM_TO_METHOD' => array (
  107. 'bx_shopify_my' => array (
  108. 'create-shopify-entry' => 'checkAllowedAdd',
  109. ),
  110. 'bx_shopify_view' => $aMenuItems2Methods,
  111. ),
  112. // informer messages
  113. 'INFORMERS' => array (
  114. 'approving' => array (
  115. 'name' => 'bx-shopify-approving',
  116. 'map' => array (
  117. 'pending' => array('msg' => '_bx_shopify_txt_msg_status_pending', 'type' => BX_INFORMER_ALERT),
  118. 'hidden' => array('msg' => '_bx_shopify_txt_msg_status_hidden', 'type' => BX_INFORMER_ERROR),
  119. ),
  120. ),
  121. ),
  122. // some language keys
  123. 'T' => array (
  124. 'txt_sample_single' => '_bx_shopify_txt_sample_single',
  125. 'txt_sample_single_with_article' => '_bx_shopify_txt_sample_single_with_article',
  126. 'txt_sample_comment_single' => '_bx_shopify_txt_sample_comment_single',
  127. 'txt_sample_vote_single' => '_bx_shopify_txt_sample_vote_single',
  128. 'txt_sample_reaction_single' => '_bx_shopify_txt_sample_reaction_single',
  129. 'txt_sample_score_up_single' => '_bx_shopify_txt_sample_score_up_single',
  130. 'txt_sample_score_down_single' => '_bx_shopify_txt_sample_score_down_single',
  131. 'form_field_author' => '_bx_shopify_form_entry_input_author',
  132. 'grid_action_err_delete' => '_bx_shopify_grid_action_err_delete',
  133. 'grid_txt_account_manager' => '_bx_shopify_grid_txt_account_manager',
  134. 'filter_item_active' => '_bx_shopify_grid_filter_item_title_adm_active',
  135. 'filter_item_hidden' => '_bx_shopify_grid_filter_item_title_adm_hidden',
  136. 'filter_item_pending' => '_bx_shopify_grid_filter_item_title_adm_pending',
  137. 'filter_item_select_one_filter1' => '_bx_shopify_grid_filter_item_title_adm_select_one_filter1',
  138. 'filter_item_select_one_filter2' => '_bx_shopify_grid_filter_item_title_adm_select_one_filter2',
  139. 'menu_item_manage_my' => '_bx_shopify_menu_item_title_manage_my',
  140. 'menu_item_manage_all' => '_bx_shopify_menu_item_title_manage_all',
  141. 'txt_all_entries_by' => '_bx_shopify_txt_all_entries_by',
  142. 'txt_all_entries_in' => '_bx_shopify_txt_all_entries_in',
  143. 'txt_all_entries_by_author' => '_bx_shopify_page_title_browse_by_author',
  144. 'txt_all_entries_by_context' => '_bx_shopify_page_title_browse_by_context',
  145. 'txt_pict_use_as_thumb' => '_bx_shopify_form_entry_input_picture_use_as_thumb'
  146. ),
  147. );
  148. $this->_aJsClasses = array(
  149. 'shop' => 'BxShopifyShop',
  150. 'manage_tools' => 'BxShopifyManageTools'
  151. );
  152. $this->_aJsObjects = array(
  153. 'shop' => 'oBxShopifyShop{profile_id}',
  154. 'manage_tools' => 'oBxShopifyManageTools'
  155. );
  156. $this->_aGridObjects = array(
  157. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  158. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  159. );
  160. $sHtmlPrefix = str_replace('_', '-', $this->_sName);
  161. $this->_aHtmlIds = array(
  162. 'entry_buy' => $sHtmlPrefix . '-entry-buy',
  163. 'entry_content' => $sHtmlPrefix . '-entry-content',
  164. 'entry_attachments' => $sHtmlPrefix . '-entry-attachments',
  165. 'entry_attachment_sample' => $sHtmlPrefix . '-entry-attachment-sample',
  166. 'unit' => $sHtmlPrefix . '-unit-',
  167. );
  168. }
  169. public function getHtmlIds($sKey = '')
  170. {
  171. if(empty($sKey))
  172. return $this->_aHtmlIds;
  173. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  174. }
  175. public function getJsObjectShop($iProfileId)
  176. {
  177. return bx_replace_markers($this->getJsObject('shop'), array(
  178. 'profile_id' => $iProfileId
  179. ));
  180. }
  181. }
  182. /** @} */