BxShopifyConfig.php 8.0 KB

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