BxShopifyConfig.php 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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_MY_ENTRIES' => 'bx_shopify_my', // actions menu on my entries page
  89. 'OBJECT_MENU_SUBMENU' => 'bx_shopify_submenu', // main module submenu
  90. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_shopify_view_submenu', // view entry submenu
  91. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'shopify-home', // first item in view entry submenu from main module submenu
  92. 'OBJECT_MENU_SNIPPET_META' => 'bx_shopify_snippet_meta', // menu for snippet meta info
  93. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_shopify_menu_manage_tools', //manage menu in content administration tools
  94. 'OBJECT_GRID_ADMINISTRATION' => 'bx_shopify_administration',
  95. 'OBJECT_GRID_COMMON' => 'bx_shopify_common',
  96. 'OBJECT_UPLOADERS' => array('sys_simple', 'sys_html5'),
  97. // menu items which visibility depends on custom visibility checking
  98. 'MENU_ITEM_TO_METHOD' => array (
  99. 'bx_shopify_my' => array (
  100. 'create-shopify-entry' => 'checkAllowedAdd',
  101. ),
  102. 'bx_shopify_view' => $aMenuItems2Methods,
  103. ),
  104. // some language keys
  105. 'T' => array (
  106. 'txt_sample_single' => '_bx_shopify_txt_sample_single',
  107. 'txt_sample_single_with_article' => '_bx_shopify_txt_sample_single_with_article',
  108. 'txt_sample_comment_single' => '_bx_shopify_txt_sample_comment_single',
  109. 'txt_sample_vote_single' => '_bx_shopify_txt_sample_vote_single',
  110. 'form_field_author' => '_bx_shopify_form_entry_input_author',
  111. 'grid_action_err_delete' => '_bx_shopify_grid_action_err_delete',
  112. 'grid_txt_account_manager' => '_bx_shopify_grid_txt_account_manager',
  113. 'filter_item_active' => '_bx_shopify_grid_filter_item_title_adm_active',
  114. 'filter_item_hidden' => '_bx_shopify_grid_filter_item_title_adm_hidden',
  115. 'filter_item_select_one_filter1' => '_bx_shopify_grid_filter_item_title_adm_select_one_filter1',
  116. 'menu_item_manage_my' => '_bx_shopify_menu_item_title_manage_my',
  117. 'menu_item_manage_all' => '_bx_shopify_menu_item_title_manage_all',
  118. 'txt_all_entries_by' => '_bx_shopify_txt_all_entries_by',
  119. 'txt_all_entries_in' => '_bx_shopify_txt_all_entries_in',
  120. 'txt_all_entries_by_author' => '_bx_shopify_page_title_browse_by_author',
  121. 'txt_all_entries_by_context' => '_bx_shopify_page_title_browse_by_context',
  122. 'txt_pict_use_as_thumb' => '_bx_shopify_form_entry_input_picture_use_as_thumb'
  123. ),
  124. );
  125. $this->_aJsClasses = array(
  126. 'shop' => 'BxShopifyShop',
  127. 'manage_tools' => 'BxShopifyManageTools'
  128. );
  129. $this->_aJsObjects = array(
  130. 'shop' => 'oBxShopifyShop{profile_id}',
  131. 'manage_tools' => 'oBxShopifyManageTools'
  132. );
  133. $this->_aGridObjects = array(
  134. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  135. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  136. );
  137. $sHtmlPrefix = str_replace('_', '-', $this->_sName);
  138. $this->_aHtmlIds = array(
  139. 'entry_buy' => $sHtmlPrefix . '-entry-buy',
  140. 'entry_content' => $sHtmlPrefix . '-entry-content',
  141. 'entry_attachments' => $sHtmlPrefix . '-entry-attachments',
  142. 'entry_attachment_sample' => $sHtmlPrefix . '-entry-attachment-sample',
  143. 'unit' => $sHtmlPrefix . '-unit-',
  144. );
  145. }
  146. public function getHtmlIds($sKey = '')
  147. {
  148. if(empty($sKey))
  149. return $this->_aHtmlIds;
  150. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  151. }
  152. public function getJsObjectShop($iProfileId)
  153. {
  154. return bx_replace_markers($this->getJsObject('shop'), array(
  155. 'profile_id' => $iProfileId
  156. ));
  157. }
  158. }
  159. /** @} */