BxCoursesConfig.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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 Courses Courses
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxCoursesConfig extends BxBaseModGroupsConfig
  12. {
  13. protected $_aPerPageDefault;
  14. function __construct($aModule)
  15. {
  16. parent::__construct($aModule);
  17. $this->_aMenuItems2MethodsActions = array_merge($this->_aMenuItems2MethodsActions, array(
  18. 'view-course-profile' => 'checkAllowedView',
  19. 'edit-course-profile' => 'checkAllowedEdit',
  20. 'hide-course-profile' => 'checkAllowedHide',
  21. 'unhide-course-profile' => 'checkAllowedUnhide',
  22. 'edit-course-cover' => 'checkAllowedChangeCover',
  23. 'invite-to-course' => 'checkAllowedInvite',
  24. 'delete-course-profile' => 'checkAllowedDelete',
  25. 'approve-course-profile' => 'checkAllowedApprove',
  26. ));
  27. $this->CNF = array (
  28. // module icon
  29. 'ICON' => 'book-reader col-blue3-dark',
  30. // database tables
  31. 'TABLE_ENTRIES' => $aModule['db_prefix'] . 'data',
  32. 'TABLE_ENTRIES_FULLTEXT' => 'search_fields',
  33. 'TABLE_ADMINS' => $aModule['db_prefix'] . 'admins',
  34. 'TABLE_INVITES' => $aModule['db_prefix'] . 'invites',
  35. 'TABLE_PRICES' => $aModule['db_prefix'] . 'prices',
  36. 'TABLE_CNT_STRUCTURE' => $aModule['db_prefix'] . 'content_structure',
  37. 'TABLE_CNT_NODES' => $aModule['db_prefix'] . 'content_nodes',
  38. 'TABLE_CNT_NODES2USERS' => $aModule['db_prefix'] . 'content_nodes2users',
  39. 'TABLE_CNT_DATA' => $aModule['db_prefix'] . 'content_data',
  40. 'TABLE_CNT_DATA2USERS' => $aModule['db_prefix'] . 'content_data2users',
  41. // database fields
  42. 'FIELD_ID' => 'id',
  43. 'FIELD_AUTHOR' => 'author',
  44. 'FIELD_ADDED' => 'added',
  45. 'FIELD_CHANGED' => 'changed',
  46. 'FIELD_NAME' => 'name',
  47. 'FIELD_TITLE' => 'name',
  48. 'FIELD_TEXT' => 'desc',
  49. 'FIELD_CATEGORY' => 'cat',
  50. 'FIELD_PICTURE' => 'picture',
  51. 'FIELD_COVER' => 'cover',
  52. 'FIELD_COVER_POSITION' => 'cover_data',
  53. 'FIELD_JOIN_CONFIRMATION' => 'join_confirmation',
  54. 'FIELD_ALLOW_VIEW_TO' => 'allow_view_to',
  55. 'FIELD_ALLOW_POST_TO' => 'allow_post_to',
  56. 'FIELD_CF' => 'cf',
  57. 'FIELD_VIEWS' => 'views',
  58. 'FIELD_VOTES' => 'votes',
  59. 'FIELD_REACTIONS' => 'rvotes',
  60. 'FIELD_SCORE' => 'score',
  61. 'FIELD_SCORE_UP' => 'sc_up',
  62. 'FIELD_SCORE_DOWN' => 'sc_down',
  63. 'FIELD_COMMENTS' => 'comments',
  64. 'FIELD_REPORTS' => 'reports',
  65. 'FIELD_STATUS' => 'status',
  66. 'FIELD_STATUS_ADMIN' => 'status_admin',
  67. 'FIELDS_QUICK_SEARCH' => array('name'),
  68. 'FIELD_LOCATION' => 'location',
  69. 'FIELD_LOCATION_PREFIX' => 'location',
  70. 'FIELD_LABELS' => 'labels',
  71. 'FIELDS_WITH_KEYWORDS' => 'auto', // can be 'auto', array of fields or comma separated string of field names, works only when OBJECT_METATAGS is specified
  72. 'FIELD_PRICE_ROLE_ID' => 'role_id',
  73. 'FIELD_PRICE_NAME' => 'name',
  74. // page URIs
  75. 'URI_VIEW_ENTRY' => 'view-course-profile',
  76. 'URI_VIEW_ENTRY_NODE' => 'view-course-profile-node',
  77. 'URI_ADD_ENTRY' => 'create-course-profile',
  78. 'URI_EDIT_ENTRY' => 'edit-course-profile',
  79. 'URI_EDIT_ENTRY_CONTENT' => 'edit-course-content',
  80. 'URI_ENTRIES_BY_CONTEXT' => 'courses-context',
  81. 'URI_JOIN_ENTRY' => 'join-course-profile',
  82. 'URI_JOINED_ENTRIES' => 'joined-courses',
  83. 'URI_MANAGE_COMMON' => 'courses-manage',
  84. 'URI_FAVORITES_LIST' => 'courses-favorites',
  85. 'URL_HOME' => 'page.php?i=courses-home',
  86. 'URL_ENTRY_FANS' => 'page.php?i=course-fans',
  87. 'URL_MANAGE_STRUCTURE' => 'page.php?i=edit-course-content',
  88. 'URL_MANAGE_COMMON' => 'page.php?i=courses-manage',
  89. 'URL_MANAGE_ADMINISTRATION' => 'page.php?i=courses-administration',
  90. 'PARAM_AUTO_APPROVE' => 'bx_courses_enable_auto_approve',
  91. 'PARAM_NUM_RSS' => 'bx_courses_num_rss',
  92. 'PARAM_NUM_CONNECTIONS_QUICK' => 'bx_courses_num_connections_quick',
  93. 'PARAM_SEARCHABLE_FIELDS' => 'bx_courses_searchable_fields',
  94. 'PARAM_PER_PAGE_BROWSE_SHOWCASE' => 'bx_courses_per_page_browse_showcase',
  95. 'PARAM_PER_PAGE_BROWSE_RECOMMENDED' => 'bx_courses_per_page_browse_recommended',
  96. 'PARAM_MMODE' => 'bx_courses_members_mode',
  97. 'PARAM_PAID_JOIN_ENABLED' => true,
  98. 'PARAM_RECURRING_RESERVE' => 3, // 3 days for recurring payment to be registered
  99. 'PARAM_PER_PAGE_FOR_FAVORITES_LISTS' => 'bx_courses_per_page_for_favorites_lists',
  100. 'PARAM_USE_IN' => 'bx_courses_internal_notifications',
  101. 'PARAM_CONTENT' => 'bx_courses_enable_content',
  102. 'PARAM_CONTENT_LEVEL_MAX' => 'bx_courses_content_level_max',
  103. 'PARAM_CONTENT_MODULES_ST' => 'bx_courses_content_modules_st',
  104. 'PARAM_CONTENT_MODULES_AT' => 'bx_courses_content_modules_at',
  105. // objects
  106. 'OBJECT_STORAGE' => 'bx_courses_pics',
  107. 'OBJECT_STORAGE_COVER' => 'bx_courses_pics',
  108. 'OBJECT_IMAGES_TRANSCODER_THUMB' => 'bx_courses_thumb',
  109. 'OBJECT_IMAGES_TRANSCODER_ICON' => 'bx_courses_icon',
  110. 'OBJECT_IMAGES_TRANSCODER_AVATAR' => 'bx_courses_avatar',
  111. 'OBJECT_IMAGES_TRANSCODER_AVATAR_BIG' => 'bx_courses_avatar_big',
  112. 'OBJECT_IMAGES_TRANSCODER_PICTURE' => 'bx_courses_picture',
  113. 'OBJECT_IMAGES_TRANSCODER_COVER' => 'bx_courses_cover',
  114. 'OBJECT_IMAGES_TRANSCODER_COVER_THUMB' => 'bx_courses_cover_thumb',
  115. 'OBJECT_IMAGES_TRANSCODER_GALLERY' => 'bx_courses_gallery',
  116. 'OBJECT_VIEWS' => 'bx_courses',
  117. 'OBJECT_VOTES' => 'bx_courses',
  118. 'OBJECT_REACTIONS' => 'bx_courses_reactions',
  119. 'OBJECT_SCORES' => 'bx_courses',
  120. 'OBJECT_FAVORITES' => 'bx_courses',
  121. 'OBJECT_FEATURED' => 'bx_courses',
  122. 'OBJECT_COMMENTS' => 'bx_courses',
  123. 'OBJECT_NOTES' => 'bx_courses_notes',
  124. 'OBJECT_REPORTS' => 'bx_courses',
  125. 'OBJECT_METATAGS' => 'bx_courses',
  126. 'OBJECT_CATEGORY' => 'bx_courses_cats',
  127. 'OBJECT_FORM_ENTRY' => 'bx_course',
  128. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW' => 'bx_course_view',
  129. 'OBJECT_FORM_ENTRY_DISPLAY_VIEW_FULL' => 'bx_course_view_full', // for "info" tab on view course page
  130. 'OBJECT_FORM_ENTRY_DISPLAY_ADD' => 'bx_course_add',
  131. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT' => 'bx_course_edit',
  132. 'OBJECT_FORM_ENTRY_DISPLAY_EDIT_COVER' => 'bx_course_edit_cover',
  133. 'OBJECT_FORM_ENTRY_DISPLAY_DELETE' => 'bx_course_delete',
  134. 'OBJECT_FORM_ENTRY_DISPLAY_INVITE' => 'bx_course_invite',
  135. 'OBJECT_FORM_PRICE' => 'bx_courses_price',
  136. 'OBJECT_FORM_PRICE_DISPLAY_ADD' => 'bx_courses_price_add',
  137. 'OBJECT_FORM_PRICE_DISPLAY_EDIT' => 'bx_courses_price_edit',
  138. 'OBJECT_FORM_CNT_NODE' => 'bx_courses_content_node',
  139. 'OBJECT_FORM_CNT_NODE_DISPLAY_ADD' => 'bx_courses_content_node_add',
  140. 'OBJECT_FORM_CNT_NODE_DISPLAY_EDIT' => 'bx_courses_content_node_edit',
  141. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY' => 'bx_courses_view_actions', // actions menu on view entry page
  142. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE' => 'bx_courses_view_actions_more', // actions menu on view entry page for "more" popup
  143. 'OBJECT_MENU_ACTIONS_VIEW_ENTRY_ALL' => 'bx_courses_view_actions_all', // all actions menu on view entry page
  144. 'OBJECT_MENU_ACTIONS_MY_ENTRIES' => 'bx_courses_my', // actions menu on profile entries page
  145. 'OBJECT_MENU_SUBMENU' => 'bx_courses_submenu', // main module submenu
  146. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY' => 'bx_courses_view_submenu', // view entry submenu
  147. 'OBJECT_MENU_SUBMENU_VIEW_ENTRY_MAIN_SELECTION' => 'courses-home', // first item in view entry submenu from main module submenu
  148. 'OBJECT_MENU_MANAGE_VIEW_ENTRY' => '',
  149. 'OBJECT_MENU_VIEW_ENTRY_META' => 'bx_courses_view_meta', // meta menu on view entry page
  150. 'OBJECT_MENU_SNIPPET_META' => 'bx_courses_snippet_meta', // menu for snippet meta info
  151. 'OBJECT_MENU_MANAGE_TOOLS' => 'bx_courses_menu_manage_tools', //manage menu in content administration tools
  152. 'OBJECT_MENU_CONTENT_ADD' => 'bx_courses_content_add',
  153. 'OBJECT_PAGE_VIEW_ENTRY' => 'bx_courses_view_profile',
  154. 'OBJECT_PAGE_VIEW_ENTRY_CLOSED' => 'bx_courses_view_profile_closed',
  155. 'OBJECT_PAGE_JOINED_ENTRY' => 'bx_courses_join_profile',
  156. 'OBJECT_PRIVACY_VIEW' => 'bx_courses_allow_view_to',
  157. 'OBJECT_PRIVACY_LIST_VIEW' => 'bx_courses_allow_view_favorite_list',
  158. 'OBJECT_PRIVACY_VIEW_NOTIFICATION_EVENT' => 'bx_courses_allow_view_notification_to',
  159. 'OBJECT_PRIVACY_POST' => 'bx_courses_allow_post_to',
  160. 'OBJECT_GRID_ADMINISTRATION' => 'bx_courses_administration',
  161. 'OBJECT_GRID_COMMON' => 'bx_courses_common',
  162. 'OBJECT_GRID_CONNECTIONS' => 'bx_courses_fans',
  163. 'OBJECT_GRID_INVITES' => 'bx_courses_invites',
  164. 'OBJECT_GRID_PRICES_MANAGE' => 'bx_courses_prices_manage',
  165. 'OBJECT_GRID_PRICES_VIEW' => 'bx_courses_prices_view',
  166. 'OBJECT_GRID_CNT_STRUCTURE_MANAGE' => 'bx_courses_cnt_structure_manage',
  167. 'OBJECT_GRID_CNT_DATA_MANAGE' => 'bx_courses_cnt_data_manage',
  168. 'OBJECT_CONNECTIONS' => 'bx_courses_fans',
  169. 'OBJECT_UPLOADERS_COVER' => array('bx_courses_cover_crop'),
  170. 'OBJECT_UPLOADERS_PICTURE' => array('bx_courses_picture_crop'),
  171. 'OBJECT_PRE_LIST_ROLES' => 'bx_courses_roles',
  172. 'OBJECT_PRE_LIST_PERIOD_UNITS' => 'bx_courses_period_units',
  173. 'BADGES_AVALIABLE' => true,
  174. 'INVITES_KEYS_LIFETIME' => 86400,
  175. 'ENABLE_FOR_CONTEXT_IN_MODULES' => ['bx_spaces'],
  176. 'EMAIL_INVITATION' => 'bx_courses_invitation',
  177. 'EMAIL_JOIN_REQUEST' => 'bx_courses_join_request',
  178. 'EMAIL_JOIN_CONFIRM' => 'bx_courses_join_confirm',
  179. 'EMAIL_FAN_BECOME_ADMIN' => 'bx_courses_fan_become_admin',
  180. 'EMAIL_ADMIN_BECOME_FAN' => 'bx_courses_admin_become_fan',
  181. 'EMAIL_FAN_REMOVE' => 'bx_courses_fan_remove',
  182. 'EMAIL_FAN_SET_ROLE' => 'bx_courses_set_role',
  183. 'EMAIL_JOIN_REJECT' => 'bx_courses_join_reject',
  184. 'TRIGGER_MENU_PROFILE_VIEW_SUBMENU' => 'trigger_group_view_submenu',
  185. 'TRIGGER_MENU_PROFILE_SNIPPET_META' => 'trigger_group_snippet_meta',
  186. 'TRIGGER_MENU_PROFILE_VIEW_ACTIONS' => 'trigger_group_view_actions',
  187. 'TRIGGER_PAGE_VIEW_ENTRY' => 'trigger_page_group_view_entry',
  188. // menu items which visibility depends on custom visibility checking
  189. 'MENU_ITEM_TO_METHOD' => array (
  190. 'bx_courses_view_actions' => $this->_aMenuItems2MethodsActions,
  191. 'bx_courses_view_actions_more' => $this->_aMenuItems2MethodsActions,
  192. 'bx_courses_view_actions_all' => $this->_aMenuItems2MethodsActions,
  193. ),
  194. // informer messages
  195. 'INFORMERS' => array (
  196. 'status' => array (
  197. 'name' => 'bx-courses-status-not-active',
  198. 'map' => array (
  199. 'hidden' => '_bx_courses_txt_status_hidden',
  200. BX_PROFILE_STATUS_PENDING => '_bx_courses_txt_account_pending',
  201. BX_PROFILE_STATUS_SUSPENDED => '_bx_courses_txt_account_suspended',
  202. ),
  203. ),
  204. 'approving' => array (
  205. 'name' => 'bx-groups-approving',
  206. 'map' => array (
  207. 'pending' => array('msg' => '_bx_courses_txt_account_pending', 'type' => BX_INFORMER_ALERT),
  208. 'hidden' => array('msg' => '_bx_courses_txt_status_hidden', 'type' => BX_INFORMER_ERROR),
  209. ),
  210. ),
  211. ),
  212. // some language keys
  213. 'T' => array (
  214. 'txt_sample_single' => '_bx_courses_txt_sample_single',
  215. 'txt_sample_single_with_article' => '_bx_courses_txt_sample_single_with_article',
  216. 'txt_sample_comment_single' => '_bx_courses_txt_sample_comment_single',
  217. 'txt_sample_vote_single' => '_bx_courses_txt_sample_vote_single',
  218. 'txt_sample_score_up_single' => '_bx_courses_txt_sample_score_up_single',
  219. 'txt_sample_score_down_single' => '_bx_courses_txt_sample_score_down_single',
  220. 'txt_private_group' => '_bx_courses_txt_private_entry',
  221. 'txt_N_fans' => '_bx_courses_txt_N_fans',
  222. 'txt_ntfs_join_invitation' => '_bx_courses_txt_ntfs_join_invitation',
  223. 'txt_ntfs_join_request' => '_bx_courses_txt_ntfs_join_request',
  224. 'txt_ntfs_fan_added' => '_bx_courses_txt_ntfs_fan_added',
  225. 'txt_ntfs_timeline_post_common' => '_bx_courses_txt_ntfs_timeline_post_common',
  226. 'option_members_mode_multi_roles' => '_bx_courses_option_members_mode_multi_roles',
  227. 'form_field_author' => '_bx_courses_form_entry_input_author',
  228. 'menu_item_title_befriend_sent' => '_bx_courses_menu_item_title_befriend_sent',
  229. 'menu_item_title_unfriend_cancel_request' => '_bx_courses_menu_item_title_unfriend_cancel_request',
  230. 'menu_item_title_befriend_confirm' => '_bx_courses_menu_item_title_befriend_confirm',
  231. 'menu_item_title_unfriend_reject_request' => '_bx_courses_menu_item_title_unfriend_reject_request',
  232. 'menu_item_title_befriend' => '_bx_courses_menu_item_title_befriend',
  233. 'menu_item_title_unfriend' => '_bx_courses_menu_item_title_unfriend',
  234. 'menu_item_title_hide' => '_bx_courses_menu_item_title_hide_profile',
  235. 'menu_item_title_unhide' => '_bx_courses_menu_item_title_unhide_profile',
  236. 'grid_action_err_delete' => '_bx_courses_grid_action_err_delete',
  237. 'grid_txt_account_manager' => '_bx_courses_grid_txt_account_manager',
  238. 'filter_item_active' => '_bx_courses_grid_filter_item_title_adm_active',
  239. 'filter_item_hidden' => '_bx_courses_grid_filter_item_title_adm_hidden',
  240. 'filter_item_pending' => '_bx_courses_grid_filter_item_title_adm_pending',
  241. 'filter_item_suspended' => '_bx_courses_grid_filter_item_title_adm_suspended',
  242. 'filter_item_select_one_filter1' => '_bx_courses_grid_filter_item_title_adm_select_one_filter1',
  243. 'filter_item_select_one_filter2' => '_bx_courses_grid_filter_item_title_adm_select_one_filter2',
  244. 'menu_item_manage_my' => '_bx_courses_menu_item_title_manage_my',
  245. 'menu_item_manage_all' => '_bx_courses_menu_item_title_manage_all',
  246. 'menu_item_title_sm_join' => '_bx_courses_menu_item_title_sm_join',
  247. 'menu_item_title_sm_join_paid' => '_bx_courses_menu_item_title_sm_join_paid',
  248. 'menu_item_title_sm_join_requested' => '_bx_courses_menu_item_title_become_fan_sent',
  249. 'menu_item_title_sm_join_confirm' => '_bx_courses_menu_item_title_sm_join_confirm',
  250. 'menu_item_title_sm_leave' => '_bx_courses_menu_item_title_sm_leave',
  251. 'menu_item_title_sm_leave_cancel' => '_bx_courses_menu_item_title_sm_leave_cancel',
  252. 'menu_item_title_sm_leave_reject' => '_bx_courses_menu_item_title_sm_leave_reject',
  253. 'txt_all_entries_by_author' => '_bx_courses_page_title_browse_by_author',
  254. 'txt_all_entries_by_context' => '_bx_courses_page_title_browse_by_context',
  255. 'txt_all_entries_in' => '_bx_courses_txt_all_entries_in',
  256. 'txt_invitation_popup_title' => '_bx_courses_txt_invite_popup_title',
  257. 'txt_invitation_popup_text' => '_bx_courses_txt_invite_popup_text',
  258. 'txt_invitation_popup_accept_button' => '_bx_courses_txt_invite_popup_button_accept',
  259. 'txt_invitation_popup_decline_button' => '_bx_courses_txt_invite_popup_button_decline',
  260. 'txt_invitation_popup_error_invitation_absent' => '_bx_courses_txt_invite_popup_error_invitation_absent',
  261. 'txt_invitation_popup_error_wrong_user' => '_bx_courses_txt_invite_popup_error_invitation_wrong_user',
  262. 'txt_n_unit' => '_bx_courses_txt_n_unit',
  263. 'txt_buy_title' => '_bx_courses_grid_action_title_buy_title',
  264. 'txt_cart_item_title' => '_bx_courses_txt_cart_item_title',
  265. 'txt_cart_item_title_lifetime' => '_bx_courses_txt_cart_item_title_lifetime',
  266. 'txt_subscribe_title' => '_bx_courses_grid_action_title_subscribe_title',
  267. 'msg_performed' => '_bx_courses_msg_performed',
  268. 'popup_title_price_add' => '_bx_courses_popup_title_price_add',
  269. 'popup_title_price_edit' => '_bx_courses_popup_title_price_edit',
  270. 'popup_title_content_node_add' => '_bx_courses_popup_title_cnt_add',
  271. 'popup_title_content_node_edit' => '_bx_courses_popup_title_cnt_edit',
  272. 'err_period_unit' => '_bx_courses_form_price_input_err_period_unit',
  273. 'err_price_duplicate' => '_bx_courses_err_price_duplicate',
  274. 'err_cannot_perform' => '_bx_courses_err_cannot_perform',
  275. ),
  276. );
  277. $this->_aJsClasses = [
  278. 'main' => 'BxCoursesMain',
  279. 'entry' => 'BxCoursesEntry',
  280. 'manage_tools' => 'BxCoursesManageTools',
  281. 'invite_popup' => 'BxCoursesInvitePopup',
  282. 'prices' => 'BxCoursesPrices'
  283. ];
  284. $this->_aJsObjects = [
  285. 'main' => 'oBxCoursesMain',
  286. 'entry' => 'oBxCoursesEntry',
  287. 'manage_tools' => 'oBxCoursesManageTools',
  288. 'invite_popup' => 'oBxCoursesInvitePopup',
  289. 'prices' => 'oBxCoursesPrices'
  290. ];
  291. $this->_aGridObjects = [
  292. 'common' => $this->CNF['OBJECT_GRID_COMMON'],
  293. 'administration' => $this->CNF['OBJECT_GRID_ADMINISTRATION'],
  294. ];
  295. $sHtmlPrefix = str_replace('_', '-', $this->_sName);
  296. $this->_aHtmlIds = [
  297. 'popup_content_node' => $sHtmlPrefix . '-popup-content-node',
  298. 'popup_content_data' => $sHtmlPrefix . '-popup-content-data',
  299. ];
  300. $this->_aPerPageDefault = [
  301. 'default' => 12,
  302. 'structure_l1' => !$this->_bIsApi ? 2 : 9999
  303. ];
  304. }
  305. public function getPerPageDefault($sType)
  306. {
  307. if(!isset($this->_aPerPageDefault[$sType]))
  308. $sType = 'default';
  309. return (int)$this->_aPerPageDefault[$sType];
  310. }
  311. public function isContent()
  312. {
  313. return getParam($this->CNF['PARAM_CONTENT']) == 'on';
  314. }
  315. public function getContentModules($iUsage)
  316. {
  317. return explode(',', getParam($this->CNF['PARAM_CONTENT_MODULES_' . $this->getUsageI2S($iUsage, false)]));
  318. }
  319. public function getContentLevelMax()
  320. {
  321. return (int)getParam($this->CNF['PARAM_CONTENT_LEVEL_MAX']);
  322. }
  323. public function getContentLevel2Node($bSingle = true)
  324. {
  325. $aResult = [];
  326. $sPostfix = $bSingle ? 'single' : 'plural';
  327. switch($this->getContentLevelMax()) {
  328. case 1:
  329. $aResult = [
  330. 1 => _t('_bx_courses_txt_sample_l3_' . $sPostfix)
  331. ];
  332. break;
  333. case 2:
  334. $aResult = [
  335. 1 => _t('_bx_courses_txt_sample_l1_' . $sPostfix),
  336. 2 => _t('_bx_courses_txt_sample_l3_' . $sPostfix)
  337. ];
  338. break;
  339. case 3:
  340. $aResult = [
  341. 1 => _t('_bx_courses_txt_sample_l1_' . $sPostfix),
  342. 2 => _t('_bx_courses_txt_sample_l2_' . $sPostfix),
  343. 3 => _t('_bx_courses_txt_sample_l3_' . $sPostfix)
  344. ];
  345. break;
  346. }
  347. return $aResult;
  348. }
  349. public function getContentNodeTitle($iLevel, $bSingle = true)
  350. {
  351. $aLevelToNode = $this->getContentLevel2Node($bSingle);
  352. return isset($aLevelToNode[$iLevel]) ? $aLevelToNode[$iLevel] : _t('_undefined');
  353. }
  354. public function getUsageI2S($iUsage, $bLowerCase = true)
  355. {
  356. $a = [
  357. BX_COURSES_CND_USAGE_ST => 'st',
  358. BX_COURSES_CND_USAGE_AT => 'at'
  359. ];
  360. if(!isset($a[$iUsage]))
  361. $iUsage = BX_COURSES_CND_USAGE_ST;
  362. return $bLowerCase ? $a[$iUsage] : strtoupper($a[$iUsage]);
  363. }
  364. }
  365. /** @} */