BxForumModule.php 42 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063
  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 Forum Forum
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. class BxForumModule extends BxBaseModTextModule
  12. {
  13. function __construct(&$aModule)
  14. {
  15. parent::__construct($aModule);
  16. }
  17. public function sortParticipants ($aParticipants, $iProfileIdLastComment, $iProfileIdAuthor, $iProfileIdCurrent = 0)
  18. {
  19. if (!$iProfileIdCurrent)
  20. $iProfileIdCurrent = bx_get_logged_profile_id();
  21. $aMoveUp = array($iProfileIdCurrent, $iProfileIdLastComment, $iProfileIdAuthor);
  22. asort($aParticipants, SORT_NUMERIC);
  23. foreach ($aMoveUp as $iProfileId) {
  24. if (!isset($aParticipants[$iProfileId]))
  25. continue;
  26. $a = array($iProfileId => $aParticipants[$iProfileId]);
  27. unset($aParticipants[$iProfileId]);
  28. $aParticipants = $a + $aParticipants;
  29. }
  30. return $aParticipants;
  31. }
  32. /**
  33. * Action methods
  34. */
  35. public function actionUpdateStatus($sAction = '', $iContentId = 0)
  36. {
  37. if(empty($sAction) && bx_get('action') !== false)
  38. $sAction = bx_process_input(bx_get('action'));
  39. if(empty($iContentId) && bx_get('id') !== false)
  40. $iContentId = (int)bx_get('id');
  41. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  42. if(empty($aContentInfo) || !is_array($aContentInfo))
  43. return echoJson(array('code' => 1, 'message' => _t('_bx_forum_err_not_found')));
  44. $sMethodCheck = 'checkAllowed' . bx_gen_method_name($sAction) . 'AnyEntry';
  45. $sResult = $this->$sMethodCheck($aContentInfo);
  46. if($sResult !== CHECK_ACTION_RESULT_ALLOWED)
  47. return echoJson(array('code' => 2, 'message' => $sResult));
  48. bx_audit(
  49. $iContentId,
  50. $this->getName(),
  51. '_sys_audit_action_' . $sAction,
  52. $this->_prepareAuditParams($aContentInfo, false)
  53. );
  54. if(!$this->_oDb->updateStatus($sAction, $aContentInfo))
  55. return echoJson(array('code' => 3, 'message' => _t('_error occured')));
  56. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  57. $this->alertAfterEdit($aContentInfo);
  58. echoJson(array('code' => 0, 'id' => $iContentId, 'reload' => 1));
  59. }
  60. public function actionAjaxGetAuthors()
  61. {
  62. $aResult = BxDolService::call('system', 'profiles_search', array(bx_get('term')), 'TemplServiceProfiles');
  63. header('Content-Type:text/javascript; charset=utf-8');
  64. echo json_encode($aResult);
  65. }
  66. /**
  67. * Service methods
  68. */
  69. public function serviceGetSafeServices()
  70. {
  71. $a = parent::serviceGetSafeServices();
  72. return array_merge($a, array (
  73. 'BrowseNew' => '',
  74. 'BrowseLatest' => '',
  75. 'BrowseTop' => '',
  76. 'BrowsePopular' => '',
  77. 'BrowseUpdated' => '',
  78. 'BrowsePartaken' => '',
  79. 'BrowseIndex' => '',
  80. 'Search' => '',
  81. ));
  82. }
  83. /**
  84. * @page service Service Calls
  85. * @section bx_forum Discussions
  86. * @subsection bx_forum-other Other
  87. * @subsubsection bx_forum-get_searchable_fields get_searchable_fields
  88. *
  89. * @code bx_srv('bx_forum', 'get_searchable_fields', [...]); @endcode
  90. *
  91. * Get searchable fields for Studio settings.
  92. *
  93. * @return an array with key-value pairs to be used in settings dropdown field.
  94. *
  95. * @see BxForumModule::serviceGetSearchableFields
  96. */
  97. /**
  98. * @ref bx_forum-get_searchable_fields "get_searchable_fields"
  99. */
  100. public function serviceGetSearchableFields ($aInputsAdd = array())
  101. {
  102. $CNF = &$this->_oConfig->CNF;
  103. $aResult = parent::serviceGetSearchableFields($aInputsAdd);
  104. $aResult[$CNF['FIELD_TEXT_COMMENTS']] = _t('_bx_forum_form_entry_input_text_comments');
  105. return $aResult;
  106. }
  107. /**
  108. * Service methods
  109. */
  110. /**
  111. * @page service Service Calls
  112. * @section bx_forum Discussions
  113. * @subsection bx_forum-other Other
  114. * @subsubsection bx_forum-get_info get_info
  115. *
  116. * @code bx_srv('bx_forum', 'get_info', [...]); @endcode
  117. *
  118. * Get content info by content ID. Is used in "Content Info Objects" system.
  119. *
  120. * @param $iContentId integer value with content ID.
  121. * @param $bSearchableFieldsOnly (optional) boolean value determining all info or "searchable fields" only will be returned.
  122. * @return an array with content info. Empty array is returned if something is wrong.
  123. *
  124. * @see BxForumModule::serviceGetInfo
  125. */
  126. /**
  127. * @ref bx_forum-get_info "get_info"
  128. */
  129. public function serviceGetInfo ($iContentId, $bSearchableFieldsOnly = true)
  130. {
  131. $aContentInfo = $this->_getFields($iContentId);
  132. if(empty($aContentInfo))
  133. return array();
  134. return $aContentInfo;
  135. }
  136. /**
  137. * @page service Service Calls
  138. * @section bx_forum Discussions
  139. * @subsection bx_forum-page_blocks Page Blocks
  140. * @subsubsection bx_forum-browse_new browse_new
  141. *
  142. * @code bx_srv('bx_forum', 'browse_new', [...]); @endcode
  143. *
  144. * Get page block with a list of items ordered by newness and represented as table.
  145. *
  146. * @param $sUnitView (optional) string with unit view type.
  147. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  148. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  149. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  150. *
  151. * @see BxForumModule::serviceBrowseNew
  152. */
  153. /**
  154. * @ref bx_forum-browse_new "browse_new"
  155. */
  156. public function serviceBrowseNew ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  157. {
  158. $sType = 'new';
  159. if($sUnitView != 'table')
  160. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  161. return $this->_serviceBrowseTable(array(
  162. 'type' => $sType,
  163. 'empty_message' => $bEmptyMessage,
  164. 'ajax_paginate' => $bAjaxPaginate
  165. ), $bShowHeader);
  166. }
  167. /**
  168. * @page service Service Calls
  169. * @section bx_forum Discussions
  170. * @subsection bx_forum-page_blocks Page Blocks
  171. * @subsubsection bx_forum-browse_latest browse_latest
  172. *
  173. * @code bx_srv('bx_forum', 'browse_latest', [...]); @endcode
  174. *
  175. * Get page block with a list of items ordered by Recent Posts in them and represented as table.
  176. *
  177. * @param $sUnitView (optional) string with unit view type.
  178. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  179. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  180. * @param $bShowHeader (optional) boolean value determining whether a resulting table should have Header section or not.
  181. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  182. *
  183. * @see BxForumModule::serviceBrowseNew
  184. */
  185. /**
  186. * @ref bx_forum-browse_latest "browse_latest"
  187. */
  188. public function serviceBrowseLatest($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = true)
  189. {
  190. $sType = 'latest';
  191. if($sUnitView != 'table')
  192. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  193. return $this->_serviceBrowseTable(array(
  194. 'type' => $sType,
  195. 'author' => bx_get_logged_profile_id(),
  196. 'empty_message' => $bEmptyMessage,
  197. 'ajax_paginate' => $bAjaxPaginate
  198. ), $bShowHeader);
  199. }
  200. /**
  201. * @page service Service Calls
  202. * @section bx_forum Discussions
  203. * @subsection bx_forum-page_blocks Page Blocks
  204. * @subsubsection bx_forum-browse_featured browse_featured
  205. *
  206. * @code bx_srv('bx_forum', 'browse_featured', [...]); @endcode
  207. *
  208. * Get page block with a list of featured items represented as table.
  209. *
  210. * @param $sUnitView (optional) string with unit view type.
  211. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  212. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  213. * @param $bShowHeader (optional) boolean value determining whether a resulting table should have Header section or not.
  214. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  215. *
  216. * @see BxForumModule::serviceBrowseFeatured
  217. */
  218. /**
  219. * @ref bx_forum-browse_featured "browse_featured"
  220. */
  221. public function serviceBrowseFeatured($sUnitView = false, $bEmptyMessage = false, $bAjaxPaginate = true, $bShowHeader = false)
  222. {
  223. $CNF = &$this->_oConfig->CNF;
  224. $sType = 'featured';
  225. if($sUnitView != 'table')
  226. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  227. return $this->_serviceBrowseTable(array(
  228. 'type' => $sType,
  229. 'empty_message' => $bEmptyMessage,
  230. 'ajax_paginate' => $bAjaxPaginate
  231. ), $bShowHeader);
  232. }
  233. /**
  234. * @page service Service Calls
  235. * @section bx_forum Discussions
  236. * @subsection bx_forum-page_blocks Page Blocks
  237. * @subsubsection bx_forum-browse_top browse_top
  238. *
  239. * @code bx_srv('bx_forum', 'browse_top', [...]); @endcode
  240. *
  241. * Get page block with a list of items ordered by a number of comments and represented as table.
  242. *
  243. * @param $sUnitView (optional) string with unit view type.
  244. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  245. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  246. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  247. *
  248. * @see BxForumModule::serviceBrowseTop
  249. */
  250. /**
  251. * @ref bx_forum-browse_top "browse_top"
  252. */
  253. public function serviceBrowseTop($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = true)
  254. {
  255. $sType = 'top';
  256. if($sUnitView != 'table')
  257. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  258. return $this->_serviceBrowseTable(array(
  259. 'type' => $sType,
  260. 'empty_message' => $bEmptyMessage,
  261. 'ajax_paginate' => $bAjaxPaginate
  262. ), $bShowHeader);
  263. }
  264. /**
  265. * @page service Service Calls
  266. * @section bx_forum Discussions
  267. * @subsection bx_forum-page_blocks Page Blocks
  268. * @subsubsection bx_forum-browse_popular browse_popular
  269. *
  270. * @code bx_srv('bx_forum', 'browse_popular', [...]); @endcode
  271. *
  272. * Get page block with a list of items ordered by a number of views and represented as table.
  273. *
  274. * @param $sUnitView (optional) string with unit view type.
  275. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  276. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  277. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  278. *
  279. * @see BxForumModule::serviceBrowsePopular
  280. */
  281. /**
  282. * @ref bx_forum-browse_popular "browse_popular"
  283. */
  284. public function serviceBrowsePopular ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  285. {
  286. $sType = 'popular';
  287. if($sUnitView != 'table')
  288. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  289. return $this->_serviceBrowseTable(array(
  290. 'type' => $sType,
  291. 'empty_message' => $bEmptyMessage,
  292. 'ajax_paginate' => $bAjaxPaginate
  293. ), $bShowHeader);
  294. }
  295. /**
  296. * @page service Service Calls
  297. * @section bx_forum Discussions
  298. * @subsection bx_forum-page_blocks Page Blocks
  299. * @subsubsection bx_forum-browse_updated browse_updated
  300. *
  301. * @code bx_srv('bx_forum', 'browse_updated', [...]); @endcode
  302. *
  303. * Get page block with a list of updated items represented as table.
  304. *
  305. * @param $sUnitView (optional) string with unit view type.
  306. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  307. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  308. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  309. *
  310. * @see BxForumModule::serviceBrowseUpdated
  311. */
  312. /**
  313. * @ref bx_forum-browse_updated "browse_updated"
  314. */
  315. public function serviceBrowseUpdated ($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  316. {
  317. $sType = 'updated';
  318. if($sUnitView != 'table')
  319. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  320. return $this->_serviceBrowseTable(array(
  321. 'type' => $sType,
  322. 'empty_message' => $bEmptyMessage,
  323. 'ajax_paginate' => $bAjaxPaginate
  324. ), $bShowHeader);
  325. }
  326. /**
  327. * @page service Service Calls
  328. * @section bx_forum Discussions
  329. * @subsection bx_forum-page_blocks Page Blocks
  330. * @subsubsection bx_forum-browse_partaken browse_partaken
  331. *
  332. * @code bx_srv('bx_forum', 'browse_partaken', [...]); @endcode
  333. *
  334. * Get page block with a list of partaken items represented as table.
  335. *
  336. * @param $sUnitView (optional) string with unit view type.
  337. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  338. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  339. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  340. *
  341. * @see BxForumModule::serviceBrowsePartaken
  342. */
  343. /**
  344. * @ref bx_forum-browse_partaken "browse_partaken"
  345. */
  346. public function serviceBrowsePartaken ($iProfileId = 0, $aParams = [])
  347. {
  348. $sType = 'partaken';
  349. if(!$iProfileId)
  350. $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
  351. if(!$iProfileId)
  352. $iProfileId = bx_get_logged_profile_id();
  353. $bEmptyMessage = true;
  354. if(isset($aParams['empty_message'])) {
  355. $bEmptyMessage = (bool)$aParams['empty_message'];
  356. unset($aParams['empty_message']);
  357. }
  358. $bAjaxPaginate = true;
  359. if(isset($aParams['ajax_paginate'])) {
  360. $bAjaxPaginate = (bool)$aParams['ajax_paginate'];
  361. unset($aParams['ajax_paginate']);
  362. }
  363. $bShowHeader = false;
  364. if(isset($aParams['show_header'])) {
  365. $bShowHeader = (bool)$aParams['show_header'];
  366. unset($aParams['show_header']);
  367. }
  368. if(isset($aParams['unit_view']) && $aParams['unit_view'] != 'table')
  369. return $this->_serviceBrowse($sType, array_merge(['author' => $iProfileId], $aParams), BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  370. return $this->_serviceBrowseTable([
  371. 'type' => $sType,
  372. 'author' => $iProfileId,
  373. 'include_contexts' => isset($aParams['include_contexts']) && $aParams['include_contexts'],
  374. 'empty_message' => $bEmptyMessage,
  375. 'ajax_paginate' => $bAjaxPaginate
  376. ], $bShowHeader);
  377. }
  378. /**
  379. * @page service Service Calls
  380. * @section bx_forum Discussions
  381. * @subsection bx_forum-page_blocks Page Blocks
  382. * @subsubsection bx_forum-browse_index browse_index
  383. *
  384. * @code bx_srv('bx_forum', 'browse_index', [...]); @endcode
  385. *
  386. * Get page block for Site's Home page with a list of items ordered by newness and represented as table.
  387. *
  388. * @param $sUnitView (optional) string with unit view type.
  389. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  390. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  391. * @param $bShowHeader (optional) boolean value determining whether a resulting table should have Header section or not.
  392. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  393. *
  394. * @see BxForumModule::serviceBrowseIndex
  395. */
  396. /**
  397. * @ref bx_forum-browse_index "browse_index"
  398. */
  399. public function serviceBrowseIndex($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  400. {
  401. $sType = 'index';
  402. if($sUnitView != 'table')
  403. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  404. return $this->_serviceBrowseTable(array(
  405. 'type' => $sType,
  406. 'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_index'),
  407. 'empty_message' => $bEmptyMessage,
  408. 'ajax_paginate' => $bAjaxPaginate
  409. ), $bShowHeader);
  410. }
  411. /**
  412. * @page service Service Calls
  413. * @section bx_forum Discussions
  414. * @subsection bx_forum-page_blocks Page Blocks
  415. * @subsubsection bx_forum-browse_author browse_author
  416. *
  417. * @code bx_srv('bx_forum', 'browse_author', [...]); @endcode
  418. *
  419. * Get page block with a list of items filtered by Author and represented as table.
  420. *
  421. * @param $iProfileId (optional) integer value with author ID. If empty value is provided, an attempt to get it from GET/POST arrays will be performed.
  422. * @param $aParams (optional) an array of additional params. It's not used for now.
  423. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  424. *
  425. * @see BxForumModule::serviceBrowseAuthor
  426. */
  427. /**
  428. * @ref bx_forum-browse_author "browse_author"
  429. */
  430. public function serviceBrowseAuthor ($iProfileId = 0, $aParams = array())
  431. {
  432. if(!$iProfileId)
  433. $iProfileId = bx_process_input(bx_get('profile_id'), BX_DATA_INT);
  434. if(!$iProfileId)
  435. return '';
  436. $bEmptyMessage = true;
  437. if(isset($aParams['empty_message'])) {
  438. $bEmptyMessage = (bool)$aParams['empty_message'];
  439. unset($aParams['empty_message']);
  440. }
  441. $bAjaxPaginate = true;
  442. if(isset($aParams['ajax_paginate'])) {
  443. $bAjaxPaginate = (bool)$aParams['ajax_paginate'];
  444. unset($aParams['ajax_paginate']);
  445. }
  446. if(isset($aParams['unit_view']) && $aParams['unit_view'] != 'table')
  447. return $this->_serviceBrowse('author', array_merge(array('author' => $iProfileId), $aParams), BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  448. return $this->_serviceBrowseTable(array(
  449. 'type' => 'author',
  450. 'author' => $iProfileId,
  451. 'where' => array('fld' => 'author', 'val' => $iProfileId, 'opr' => '='),
  452. 'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_profile'),
  453. 'empty_message' => $bEmptyMessage,
  454. 'ajax_paginate' => $bAjaxPaginate
  455. ), false);
  456. }
  457. /**
  458. * @page service Service Calls
  459. * @section bx_forum Discussions
  460. * @subsection bx_forum-page_blocks Page Blocks
  461. * @subsubsection bx_forum-browse_favorite browse_favorite
  462. *
  463. * @code bx_srv('bx_forum', 'browse_favorite', [...]); @endcode
  464. *
  465. * Get page block with a list of favorited items by some profile and represented as table.
  466. *
  467. * @param $iProfileId (optional) integer value with profile ID. If empty value is provided, an attempt to get it from GET/POST arrays will be performed.
  468. * @param $aParams (optional) an array of additional params. It's not used for now.
  469. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  470. *
  471. * @see BxForumModule::serviceBrowseFavorite
  472. */
  473. /**
  474. * @ref bx_forum-browse_favorite "browse_favorite"
  475. */
  476. public function serviceBrowseFavorite ($iProfileId = 0, $aParams = array())
  477. {
  478. $CNF = &$this->_oConfig->CNF;
  479. $bEmptyMessage = false;
  480. if(isset($aParams['empty_message'])) {
  481. $bEmptyMessage = (bool)$aParams['empty_message'];
  482. unset($aParams['empty_message']);
  483. }
  484. $bAjaxPaginate = true;
  485. if(isset($aParams['ajax_paginate'])) {
  486. $bAjaxPaginate = (bool)$aParams['ajax_paginate'];
  487. unset($aParams['ajax_paginate']);
  488. }
  489. return $this->_serviceBrowseTable(array(
  490. 'type' => 'favorite',
  491. 'per_page' => (int)$this->_oDb->getParam('bx_forum_per_page_profile'),
  492. 'empty_message' => $bEmptyMessage,
  493. 'ajax_paginate' => $bAjaxPaginate
  494. ), false);
  495. }
  496. /**
  497. * @page service Service Calls
  498. * @section bx_forum Discussions
  499. * @subsection bx_forum-page_blocks Page Blocks
  500. * @subsubsection bx_forum-browse_category browse_category
  501. *
  502. * @code bx_srv('bx_forum', 'browse_category', [...]); @endcode
  503. *
  504. * Get page block with a list of items filter by some category and represented as table.
  505. *
  506. * @param $sUnitView (optional) string with unit view type.
  507. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  508. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  509. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  510. *
  511. * @see BxForumModule::serviceBrowseCategory
  512. */
  513. /**
  514. * @ref bx_forum-browse_category "browse_category"
  515. */
  516. public function serviceBrowseCategory($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = true)
  517. {
  518. $sType = 'category';
  519. $iCategory = bx_process_input(bx_get('category'), BX_DATA_INT);
  520. $aCategory = $this->_oDb->getCategories(array('type' => 'by_category', 'category' => $iCategory));
  521. if(!empty($aCategory['visible_for_levels']) && !BxDolAcl::getInstance()->isMemberLevelInSet($aCategory['visible_for_levels']))
  522. return $bEmptyMessage ? MsgBox(_t('_sys_txt_access_denied')) : '';
  523. if($sUnitView != 'table') {
  524. $aParams = array('category' => $iCategory);
  525. if ($sUnitView)
  526. $aParams['unit_view'] = $sUnitView;
  527. return $this->_serviceBrowse($sType, $aParams, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  528. }
  529. return $this->_serviceBrowseTable(array(
  530. 'type' => $sType,
  531. 'where' => array('fld' => 'cat', 'val' => $iCategory, 'opr' => '='),
  532. 'empty_message' => $bEmptyMessage,
  533. 'ajax_paginate' => $bAjaxPaginate
  534. ), $bShowHeader);
  535. }
  536. /**
  537. * @page service Service Calls
  538. * @section bx_forum Discussions
  539. * @subsection bx_forum-page_blocks Page Blocks
  540. * @subsubsection bx_forum-browse_keyword browse_keyword
  541. *
  542. * @code bx_srv('bx_forum', 'browse_keyword', [...]); @endcode
  543. *
  544. * Get page block with a list of items filter by some keyword and represented as table.
  545. *
  546. * @param $sUnitView (optional) string with unit view type.
  547. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  548. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  549. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  550. *
  551. * @see BxForumModule::serviceBrowseKeyword
  552. */
  553. /**
  554. * @ref bx_forum-browse_keyword "browse_keyword"
  555. */
  556. public function serviceBrowseKeyword($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true, $bShowHeader = false)
  557. {
  558. $sType = 'keyword';
  559. $sKeyword = bx_process_input(bx_get('keyword'));
  560. if($sUnitView != 'table')
  561. return $this->_serviceBrowse($sType, $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  562. return $this->_serviceBrowseTable(array(
  563. 'type' => $sType,
  564. 'where' => $this->_getSearchKeywordDescriptor('#' . $sKeyword),
  565. 'empty_message' => $bEmptyMessage,
  566. 'ajax_paginate' => $bAjaxPaginate
  567. ), $bShowHeader);
  568. }
  569. /**
  570. * @page service Service Calls
  571. * @section bx_forum Discussions
  572. * @subsection bx_forum-page_blocks Page Blocks
  573. * @subsubsection bx_forum-browse_search_results browse_search_results
  574. *
  575. * @code bx_srv('bx_forum', 'browse_search_results', [...]); @endcode
  576. *
  577. * Get page block with search results by Author(s), Category, Keyword represented as table.
  578. *
  579. * @param $sUnitView (optional) string with unit view type.
  580. * @param $bEmptyMessage (optional) boolean value determining whether an "Empty" message should be returned or not.
  581. * @param $bAjaxPaginate (optional) boolean value determining whether an Ajax based pagination should be used or not.
  582. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  583. *
  584. * @see BxForumModule::serviceBrowseSearchResults
  585. */
  586. /**
  587. * @ref bx_forum-browse_search_results "browse_search_results"
  588. */
  589. public function serviceBrowseSearchResults($sUnitView = false, $bEmptyMessage = true, $bAjaxPaginate = true)
  590. {
  591. $sType = 'search';
  592. $aAuthors = bx_process_input(bx_get('author'));
  593. $iCategory = bx_process_input(bx_get('category'), BX_DATA_INT);
  594. $sKeyword = bx_process_input(bx_get('keyword'));
  595. $aCategory = $this->_oDb->getCategories(array('type' => 'by_category', 'category' => $iCategory));
  596. if(!empty($aCategory['visible_for_levels']) && !BxDolAcl::getInstance()->isMemberLevelInSet($aCategory['visible_for_levels']))
  597. return $bEmptyMessage ? MsgBox(_t('_sys_txt_access_denied')) : '';
  598. if($sUnitView != 'table')
  599. return $this->_serviceBrowse('', $sUnitView ? array('unit_view' => $sUnitView) : false, BX_DB_PADDING_DEF, $bEmptyMessage, $bAjaxPaginate);
  600. $aWhereGroupAnd = array('grp' => true, 'opr' => 'AND', 'cnds' => array());
  601. if(!empty($aAuthors) && is_array($aAuthors))
  602. $aWhereGroupAnd['cnds'][] = $this->_getSearchAuthorDescriptor($aAuthors);
  603. if(!empty($iCategory))
  604. $aWhereGroupAnd['cnds'][] = array('fld' => 'cat', 'val' => $iCategory, 'opr' => '=');
  605. if(!empty($sKeyword))
  606. $aWhereGroupAnd['cnds'][] = $this->_getSearchKeywordDescriptor($sKeyword);
  607. return $this->_serviceBrowseTable(array(
  608. 'type' => $sType,
  609. 'where' => $aWhereGroupAnd,
  610. 'empty_message' => $bEmptyMessage,
  611. 'ajax_paginate' => $bAjaxPaginate
  612. ), false);
  613. }
  614. /**
  615. * @page service Service Calls
  616. * @section bx_forum Discussions
  617. * @subsection bx_forum-other Other
  618. * @subsubsection bx_forum-get_discussions_num get_discussions_num
  619. *
  620. * @code bx_srv('bx_forum', 'get_discussions_num', [...]); @endcode
  621. *
  622. * Get number of discussions for some profile.
  623. *
  624. * @param $iProfileId (optional) profile to get discussions for, if omitted then currently logged in profile is used.
  625. * @return integer value with a number of discussions.
  626. *
  627. * @see BxForumModule::serviceGetDiscussionsNum
  628. */
  629. /**
  630. * @ref bx_forum-get_discussions_num "get_discussions_num"
  631. */
  632. public function serviceGetDiscussionsNum ($iProfileId = 0)
  633. {
  634. if (!$iProfileId)
  635. $iProfileId = bx_get_logged_profile_id();
  636. return $this->_oDb->getEntriesNumByAuthor((int)$iProfileId);
  637. }
  638. /**
  639. * @page service Service Calls
  640. * @section bx_forum Discussions
  641. * @subsection bx_forum-other Other
  642. * @subsubsection bx_forum-get_unreplied_discussions_num get_unreplied_discussions_num
  643. *
  644. * @code bx_srv('bx_forum', 'get_unreplied_discussions_num', [...]); @endcode
  645. *
  646. * Get number of unreplied discussions for some profile.
  647. *
  648. * @param $iProfileId (optional) profile to get unreplied discussions for, if omitted then currently logged is profile is used.
  649. * @return integer value with a number of discussions.
  650. *
  651. * @see BxForumModule::serviceGetUnrepliedDiscussionsNum
  652. */
  653. /**
  654. * @ref bx_forum-get_unreplied_discussions_num "get_unreplied_discussions_num"
  655. */
  656. public function serviceGetUnrepliedDiscussionsNum ($iProfileId = 0)
  657. {
  658. if (!$iProfileId)
  659. $iProfileId = bx_get_logged_profile_id();
  660. return $this->_oDb->getUnrepliedDiscussionsNum((int)$iProfileId);
  661. }
  662. /**
  663. *
  664. */
  665. /**
  666. * @page service Service Calls
  667. * @section bx_forum Discussions
  668. * @subsection bx_forum-other Other
  669. * @subsubsection bx_forum-trigger_comment_post trigger_comment_post
  670. *
  671. * @code bx_srv('bx_forum', 'trigger_comment_post', [...]); @endcode
  672. *
  673. * Update last comment time and author when new comment was added in the discussion.
  674. *
  675. * @param $iContentId integer value with content ID.
  676. * @param $iProfileId integer value with profile ID.
  677. * @param $iCommentId integer value with comment ID.
  678. * @param $iTimestamp (optional) date in UNIX Timestamp format, if omitted then current date is used.
  679. * @param $sCommentText (optional) string value with text of comment.
  680. * @return boolean value determining where the operation is successful or not.
  681. *
  682. * @see BxForumModule::serviceTriggerCommentPost
  683. */
  684. /**
  685. * @ref bx_forum-trigger_comment_post "trigger_comment_post"
  686. */
  687. public function serviceTriggerCommentPost ($iContentId, $iProfileId, $iCommentId, $iTimestamp = 0, $sCommentText = '')
  688. {
  689. $CNF = $this->_oConfig->CNF;
  690. $iContentId = (int)$iContentId;
  691. if(!$iContentId)
  692. return false;
  693. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  694. if(!$aContentInfo)
  695. return false;
  696. $oCmts = BxDolCmts::getObjectInstance($CNF['OBJECT_COMMENTS'], $iContentId);
  697. if(!$oCmts)
  698. return false;
  699. if(!$iTimestamp)
  700. $iTimestamp = time();
  701. if(!$this->_oDb->updateLastCommentTimeProfile((int)$iContentId, (int)$iProfileId, $iCommentId, $iTimestamp))
  702. return false;
  703. // send notification to author
  704. if($iProfileId != $aContentInfo[$CNF['FIELD_AUTHOR']]) {
  705. $oProfile = BxDolProfile::getInstanceMagic($iProfileId);
  706. if($oProfile)
  707. sendMailTemplate('bx_forum_new_reply', 0, $aContentInfo[$CNF['FIELD_AUTHOR']], array(
  708. 'SenderDisplayName' => $oProfile->getDisplayName(),
  709. 'SenderUrl' => $oProfile->getUrl(),
  710. 'PageUrl' => $oCmts->getItemUrl($iCommentId),
  711. 'PageTitle' => $oCmts->getObjectTitle(),
  712. 'Message' => $sCommentText,
  713. ), BX_EMAIL_NOTIFY);
  714. }
  715. return true;
  716. }
  717. /**
  718. * @page service Service Calls
  719. * @section bx_forum Discussions
  720. * @subsection bx_forum-page_blocks Page Blocks
  721. * @subsubsection bx_forum-entity_author entity_author
  722. *
  723. * @code bx_srv('bx_forum', 'entity_author', [...]); @endcode
  724. *
  725. * Get page block with author.
  726. *
  727. * @param $iContentId (optional) content ID. If empty value is provided, an attempt to get it from GET/POST arrays will be performed.
  728. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  729. *
  730. * @see BxForumModule::serviceEntityAuthor
  731. */
  732. /**
  733. * @ref bx_forum-entity_author "entity_author"
  734. */
  735. public function serviceEntityAuthor ($iContentId = 0)
  736. {
  737. if (bx_is_api())
  738. return $this->_serviceTemplateFunc ('entryAuthor', $iContentId);
  739. return bx_srv('system', 'get_block_author', ['bx_forum', $iContentId], 'TemplServices');
  740. }
  741. /**
  742. * @page service Service Calls
  743. * @section bx_forum Discussions
  744. * @subsection bx_forum-page_blocks Page Blocks
  745. * @subsubsection bx_forum-entity_participants entity_participants
  746. *
  747. * @code bx_srv('bx_forum', 'entity_participants', [...]); @endcode
  748. *
  749. * Get page block with discussion's collaborators.
  750. *
  751. * @param $iContentId (optional) content ID. If empty value is provided, an attempt to get it from GET/POST arrays will be performed.
  752. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  753. *
  754. * @see BxForumModule::serviceEntityParticipants
  755. */
  756. /**
  757. * @ref bx_forum-entity_participants "entity_participants"
  758. */
  759. public function serviceEntityParticipants ($iContentId = 0)
  760. {
  761. if (!$iContentId)
  762. $iContentId = bx_process_input(bx_get('id'), BX_DATA_INT);
  763. if (!$iContentId)
  764. return false;
  765. $aContentInfo = $this->_oDb->getContentInfoById($iContentId);
  766. if (!$aContentInfo)
  767. return false;
  768. return $this->_oTemplate->entryParticipants ($aContentInfo, 5, 'right');
  769. }
  770. /**
  771. * @page service Service Calls
  772. * @section bx_forum Discussions
  773. * @subsection bx_forum-page_blocks Page Blocks
  774. * @subsubsection bx_forum-search search
  775. *
  776. * @code bx_srv('bx_forum', 'search', [...]); @endcode
  777. *
  778. * Get page block with search form.
  779. *
  780. * @return HTML string with block content to display on the site or false if something is wrong. All necessary CSS and JS files are automatically added to the HEAD section of the site HTML.
  781. *
  782. * @see BxForumModule::serviceSearch
  783. */
  784. /**
  785. * @ref bx_forum-search "search"
  786. */
  787. public function serviceSearch()
  788. {
  789. $CNF = $this->_oConfig->CNF;
  790. $oForm = BxDolForm::getObjectInstance($CNF['OBJECT_FORM_SEARCH'], $CNF['OBJECT_FORM_SEARCH_DISPLAY_FULL'], $this->_oTemplate);
  791. $oForm->initChecker();
  792. return $oForm->getCode();
  793. }
  794. public function checkAllowedSubscribe(&$aDataEntry, $isPerformAction = false)
  795. {
  796. $CNF = &$this->_oConfig->CNF;
  797. $sMsg = $this->checkAllowedView($aDataEntry);
  798. if($sMsg !== CHECK_ACTION_RESULT_ALLOWED)
  799. return $sMsg;
  800. return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $CNF['OBJECT_CONNECTION_SUBSCRIBERS'], false, false);
  801. }
  802. public function checkAllowedUnsubscribe(&$aDataEntry, $isPerformAction = false)
  803. {
  804. $CNF = &$this->_oConfig->CNF;
  805. return $this->_checkAllowedConnect ($aDataEntry, $isPerformAction, $CNF['OBJECT_CONNECTION_SUBSCRIBERS'], false, true);
  806. }
  807. public function checkAllowedStickAnyEntry($aDataEntry, $isPerformAction = false)
  808. {
  809. $CNF = &$this->_oConfig->CNF;
  810. if((int)$aDataEntry[$CNF['FIELD_STICK']] != 0)
  811. return false;
  812. return $this->_checkAllowedAction('stick any entry', $aDataEntry, $isPerformAction);
  813. }
  814. public function checkAllowedUnstickAnyEntry($aDataEntry, $isPerformAction = false)
  815. {
  816. $CNF = $this->_oConfig->CNF;
  817. if((int)$aDataEntry[$CNF['FIELD_STICK']] != 1)
  818. return false;
  819. return $this->_checkAllowedAction('stick any entry', $aDataEntry, $isPerformAction);
  820. }
  821. public function checkAllowedResolveAnyEntry($aDataEntry, $isPerformAction = false)
  822. {
  823. $CNF = &$this->_oConfig->CNF;
  824. if((int)$aDataEntry[$CNF['FIELD_RESOLVABLE']] != 1 || (int)$aDataEntry[$CNF['FIELD_RESOLVE']] != 0)
  825. return false;
  826. if($aDataEntry[$CNF['FIELD_AUTHOR']] == bx_get_logged_profile_id())
  827. return CHECK_ACTION_RESULT_ALLOWED;
  828. return $this->_checkAllowedAction('resolve any entry', $aDataEntry, $isPerformAction);
  829. }
  830. public function checkAllowedUnresolveAnyEntry($aDataEntry, $isPerformAction = false)
  831. {
  832. $CNF = $this->_oConfig->CNF;
  833. if((int)$aDataEntry[$CNF['FIELD_RESOLVABLE']] != 1 || (int)$aDataEntry[$CNF['FIELD_RESOLVE']] != 1)
  834. return false;
  835. if($aDataEntry[$CNF['FIELD_AUTHOR']] == bx_get_logged_profile_id())
  836. return CHECK_ACTION_RESULT_ALLOWED;
  837. return $this->_checkAllowedAction('resolve any entry', $aDataEntry, $isPerformAction);
  838. }
  839. public function checkAllowedLockAnyEntry($aDataEntry, $isPerformAction = false)
  840. {
  841. $CNF = $this->_oConfig->CNF;
  842. if((int)$aDataEntry[$CNF['FIELD_LOCK']] != 0)
  843. return false;
  844. return $this->_checkAllowedAction('lock any entry', $aDataEntry, $isPerformAction);
  845. }
  846. public function checkAllowedUnlockAnyEntry($aDataEntry, $isPerformAction = false)
  847. {
  848. $CNF = $this->_oConfig->CNF;
  849. if((int)$aDataEntry[$CNF['FIELD_LOCK']] != 1)
  850. return false;
  851. return $this->_checkAllowedAction('lock any entry', $aDataEntry, $isPerformAction);
  852. }
  853. public function checkAllowedHideAnyEntry($aDataEntry, $isPerformAction = false)
  854. {
  855. $CNF = $this->_oConfig->CNF;
  856. if($aDataEntry[$CNF['FIELD_STATUS_ADMIN']] == 'hidden')
  857. return false;
  858. return $this->_checkAllowedAction('hide any entry', $aDataEntry, $isPerformAction);
  859. }
  860. public function checkAllowedUnhideAnyEntry($aDataEntry, $isPerformAction = false)
  861. {
  862. $CNF = &$this->_oConfig->CNF;
  863. if($aDataEntry[$CNF['FIELD_STATUS_ADMIN']] != 'hidden')
  864. return false;
  865. return $this->_checkAllowedAction('hide any entry', $aDataEntry, $isPerformAction);
  866. }
  867. protected function _checkAllowedConnect (&$aDataEntry, $isPerformAction, $sObjConnection, $isMutual, $isInvertResult)
  868. {
  869. $CNF = &$this->_oConfig->CNF;
  870. if(!$this->_iProfileId)
  871. return _t('_sys_txt_access_denied');
  872. $isConnected = BxDolConnection::getObjectInstance($sObjConnection)->isConnected($this->_iProfileId, $aDataEntry[$CNF['FIELD_ID']], $isMutual);
  873. if($isInvertResult)
  874. $isConnected = !$isConnected;
  875. return $isConnected ? _t('_sys_txt_access_denied') : CHECK_ACTION_RESULT_ALLOWED;
  876. }
  877. /**
  878. * @return CHECK_ACTION_RESULT_ALLOWED if access is granted or error message if access is forbidden. So make sure to make strict(===) checking.
  879. */
  880. protected function _checkAllowedAction($sAction, $aDataEntry, $isPerformAction = false)
  881. {
  882. if($this->_isModerator($isPerformAction))
  883. return CHECK_ACTION_RESULT_ALLOWED;
  884. $aCheck = checkActionModule($this->_iProfileId, $sAction, $this->getName(), $isPerformAction);
  885. if($aCheck[CHECK_ACTION_RESULT] === CHECK_ACTION_RESULT_ALLOWED)
  886. return CHECK_ACTION_RESULT_ALLOWED;
  887. return _t('_sys_txt_access_denied');
  888. }
  889. protected function _serviceBrowseTable($aParams, $isDisplayHeader = true)
  890. {
  891. $sGrid = $this->_oConfig->CNF['OBJECT_GRID'];
  892. if(!empty($aParams['grid'])) {
  893. $sGrid = $aParams['grid'];
  894. unset($aParams['grid']);
  895. }
  896. $oGrid = BxDolGrid::getObjectInstance($sGrid);
  897. if(!$oGrid)
  898. return false;
  899. $oGrid->setBrowseParams($aParams);
  900. $this->_oTemplate->addJsTranslation(array('_sys_grid_search'));
  901. $this->_oTemplate->addCss(array('grid_tools.css'));
  902. return $oGrid->getCode($isDisplayHeader);
  903. }
  904. protected function _getSearchAuthorDescriptor($aAutor)
  905. {
  906. return array('grp' => true, 'opr' => 'OR', 'cnds' => array(
  907. array('fld' => 'author', 'val' => $aAutor, 'opr' => 'IN'),
  908. array('fld' => 'author_comment', 'val' => $aAutor, 'opr' => 'IN'),
  909. ));
  910. }
  911. protected function _getSearchKeywordDescriptor($sKeyword)
  912. {
  913. return array('grp' => true, 'opr' => 'OR', 'cnds' => array(
  914. array('fld' => 'title', 'val' => $sKeyword, 'opr' => 'LIKE'),
  915. array('fld' => 'text', 'val' => $sKeyword, 'opr' => 'LIKE'),
  916. array('fld' => 'text_comments', 'val' => $sKeyword, 'opr' => 'LIKE')
  917. ));
  918. }
  919. }
  920. /** @} */