BxPhotosConfig.php 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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 Photos Photos
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxPhotosConfig extends BxBaseModTextConfig
  12. {
  13. protected $_aHtmlIds;
  14. function __construct($aModule)
  15. {
  16. parent::__construct($aModule);
  17. $aMenuItems2Methods = array (
  18. 'edit-photo' => 'checkAllowedEdit',
  19. 'delete-photo' => 'checkAllowedDelete',
  20. );
  21. $this->CNF = array (
  22. // module icon
  23. 'ICON' => 'camera-retro col-blue1',
  24. // database tables
  25. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'entries',
  26. 'TABLE_ENTRIES_FULLTEXT' => 'title_text',
  27. 'TABLE_FILES' => $aModule['db_prefix'] . 'photos',
  28. // database fields
  29. 'FIELD_ID' => 'id',
  30. 'FIELD_AUTHOR' => 'author',
  31. 'FIELD_ADDED' => 'added',
  32. 'FIELD_CHANGED' => 'changed',
  33. 'FIELD_TITLE' => 'title',
  34. 'FIELD_TEXT' => 'text',
  35. 'FIELD_TEXT_ID' => 'photo-text',
  36. 'FIELD_CATEGORY' => 'cat',
  37. 'FIELD_DURATION' => 'duration',
  38. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  39. 'FIELD_PHOTO' => 'pictures',
  40. 'FIELD_THUMB' => 'thumb',
  41. 'FIELD_FOR_STORING_FILE_ID' => 'thumb',
  42. 'FIELD_VIEWS' => 'views',
  43. 'FIELD_COMMENTS' => 'comments',
  44. 'FIELD_STATUS' => 'status',
  45. 'FIELD_STATUS_ADMIN' => 'status_admin',
  46. 'FIELD_LABELS' => 'labels',
  47. 'FIELD_LOCATION_PREFIX' => 'location',
  48. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  49. // page URIs
  50. 'URI_VIEW_ENTRY' => 'view-photo',
  51. 'URI_AUTHOR_ENTRIES' => 'photos-author',
  52. 'URI_ENTRIES_BY_CONTEXT' => 'photos-context',
  53. 'URI_ADD_ENTRY' => 'create-photo',
  54. 'URI_EDIT_ENTRY' => 'edit-photo',
  55. 'URI_MANAGE_COMMON' => 'photos-manage',
  56. 'URL_HOME' => 'page.php?i=photos-home',
  57. 'URL_POPULAR' => 'page.php?i=photos-popular',
  58. 'URL_UPDATED' => 'page.php?i=photos-updated',
  59. 'URL_MANAGE_COMMON' => 'page.php?i=photos-manage',
  60. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=photos-administration',
  61. // some params
  62. 'PARAM_CHARS_SUMMARY' => 'bx_photos_summary_chars',
  63. 'PARAM_CHARS_SUMMARY_PLAIN' => 'bx_photos_plain_summary_chars',
  64. 'PARAM_NUM_RSS' => 'bx_photos_rss_num',
  65. 'PARAM_SEARCHABLE_FIELDS' => 'bx_photos_searchable_fields',
  66. // objects
  67. 'OBJECT_STORAGE' => 'bx_photos_photos',
  68. 'OBJECT_IMAGES_TRANSCODER_PREVIEW' => 'bx_photos_preview',
  69. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_photos_gallery',
  70. 'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_photos_cover',
  71. 'OBJECT_REPORTS' => 'bx_photos',
  72. 'OBJECT_VIEWS' => 'bx_photos',
  73. 'OBJECT_VOTES' => 'bx_photos',
  74. 'OBJECT_VOTES_STARS' => 'bx_photos_stars',
  75. 'OBJECT_SCORES' => 'bx_photos',
  76. 'OBJECT_FAVORITES' => 'bx_photos',
  77. 'OBJECT_FEATURED' => 'bx_photos',
  78. 'OBJECT_METATAGS' => 'bx_photos',
  79. 'OBJECT_COMMENTS' => 'bx_photos',
  80. 'OBJECT_CATEGORY' => 'bx_photos_cats',
  81. 'OBJECT_PRIVACY_VIEW' => 'bx_photos_allow_view_to',
  82. 'OBJECT_FORM_ENTRY' => 'bx_photos',
  83. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_photos_entry_view',
  84. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_photos_entry_edit',
  85. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_photos_entry_edit',
  86. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_photos_entry_delete',
  87. 'OBJECT_PAGE_VIEW_ENTRY_BRIEF' => 'bx_photos_view_entry_brief', // brief view page
  88. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_photos_view', // actions menu on view entry page
  89. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_photos_view_actions', // all actions menu on view entry page
  90. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_photos_my', // actions menu on my entries page
  91. 'OBJECT_MENU_SUBMENU' => 'bx_photos_submenu', // main module submenu
  92. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_photos_view_submenu', // view entry submenu
  93. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'photos-home', // first item in view entry submenu from main module submenu
  94. 'OBJECT_MENU_SNIPPET_META' => 'bx_photos_snippet_meta', // menu for snippet meta info
  95. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_photos_menu_manage_tools', //manage menu in content administration tools
  96. 'OBJECT_GRID_ADMINISTRATION' => 'bx_photos_administration',
  97. 'OBJECT_GRID_COMMON' => 'bx_photos_common',
  98. 'OBJECT_UPLOADERS' => array('sys_simple', 'sys_html5'),
  99. // menu items which visibility depends on custom visibility checking
  100. 'MENU_ITEM_TO_METHOD' => array (
  101. 'bx_photos_my' => array (
  102. 'create-photo' => 'checkAllowedAdd',
  103. ),
  104. 'bx_photos_view' => $aMenuItems2Methods,
  105. ),
  106. // some language keys
  107. 'T' => array (
  108. 'txt_sample_single' => '_bx_photos_txt_sample_single',
  109. 'txt_sample_single_with_article' => '_bx_photos_txt_sample_single_with_article',
  110. 'txt_sample_comment_single' => '_bx_photos_txt_sample_comment_single',
  111. 'txt_sample_vote_single' => '_bx_photos_txt_sample_vote_single',
  112. 'form_field_author' => '_bx_photos_form_entry_input_author',
  113. 'form_entry_upload_single_for_update' => '_bx_photos_form_entry_input_pictures_upload',
  114. 'grid_action_err_delete' => '_bx_photos_grid_action_err_delete',
  115. 'grid_txt_account_manager' => '_bx_photos_grid_txt_account_manager',
  116. 'filter_item_active' => '_bx_photos_grid_filter_item_title_adm_active',
  117. 'filter_item_hidden' => '_bx_photos_grid_filter_item_title_adm_hidden',
  118. 'filter_item_select_one_filter1' => '_bx_photos_grid_filter_item_title_adm_select_one_filter1',
  119. 'menu_item_manage_my' => '_bx_photos_menu_item_title_manage_my',
  120. 'menu_item_manage_all' => '_bx_photos_menu_item_title_manage_all',
  121. 'txt_all_entries_by' => '_bx_photos_txt_all_entries_by',
  122. 'txt_all_entries_in' => '_bx_photos_txt_all_entries_in',
  123. 'txt_all_entries_by_author' => '_bx_photos_page_title_browse_by_author',
  124. 'txt_all_entries_by_context' => '_bx_photos_page_title_browse_by_context',
  125. 'txt_pict_use_as_thumb' => '_bx_photos_form_entry_input_picture_use_as_thumb'
  126. ),
  127. );
  128. $this->_aJsClasses = array(
  129. 'main' => 'BxPhotosMain',
  130. 'manage_tools' => 'BxPhotosManageTools'
  131. );
  132. $this->_aJsObjects = array(
  133. 'main' => 'oBxPhotosMain',
  134. 'manage_tools' => 'oBxPhotosManageTools'
  135. );
  136. $this->_aGridObjects = array(
  137. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  138. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION']
  139. );
  140. $sHtmlPrefix = str_replace('_', '-', $this->_sName);
  141. $this->_aHtmlIds = array(
  142. 'view_entry_brief_popup' => $sHtmlPrefix . '-view-entry-brief-popup'
  143. );
  144. }
  145. public function getHtmlIds($sKey = '')
  146. {
  147. if(empty($sKey))
  148. return $this->_aHtmlIds;
  149. return isset($this->_aHtmlIds[$sKey]) ? $this->_aHtmlIds[$sKey] : '';
  150. }
  151. }
  152. /** @} */