BxBaseCmtsView.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552
  1. <?php
  2. /**
  3. * @package Dolphin Core
  4. * @copyright Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  5. * @license CC-BY - http://creativecommons.org/licenses/by/3.0/
  6. */
  7. defined('BX_DOL') or die('hack attempt');
  8. bx_import('BxDolCmts');
  9. bx_import('BxDolProfile');
  10. bx_import('BxTemplPaginate');
  11. /**
  12. * @see BxDolCmts
  13. */
  14. class BxBaseCmtsView extends BxDolCmts {
  15. var $_sJsObjName;
  16. var $_sStylePrefix;
  17. function BxBaseCmtsView( $sSystem, $iId, $iInit = 1 ) {
  18. BxDolCmts::BxDolCmts( $sSystem, $iId, $iInit );
  19. if(empty($sSystem))
  20. return;
  21. $this->_sJsObjName = 'oCmts' . ucfirst($sSystem) . $iId;
  22. $this->_sStylePrefix = isset($this->_aSystem['root_style_prefix']) ? $this->_aSystem['root_style_prefix'] : 'cmt';
  23. BxDolTemplate::getInstance()->addJsTranslation('_sys_txt_cmt_loading');
  24. }
  25. /**
  26. * Get comments css file string
  27. *
  28. * @return string
  29. */
  30. function getExtraCss ()
  31. {
  32. BxDolTemplate::getInstance()->addCss(array('cmts.css'));
  33. }
  34. /**
  35. * Get comments js file string
  36. *
  37. * @return string
  38. */
  39. function getExtraJs ()
  40. {
  41. BxDolTemplate::getInstance()->addJs(array('common_anim.js', 'BxDolCmts.js'));
  42. }
  43. /**
  44. * Get initialization section of comments box
  45. *
  46. * @return string
  47. */
  48. function getScript()
  49. {
  50. $sToggleAdd = '';
  51. $ret = '';
  52. $ret .= $sToggleAdd . "
  53. <script type=\"text/javascript\">
  54. var " . $this->_sJsObjName . " = new BxDolCmts({
  55. sObjName: '" . $this->_sJsObjName . "',
  56. sBaseUrl: '" . BX_DOL_URL_ROOT . "',
  57. sSystem: '" . $this->getSystemName() . "',
  58. sSystemTable: '" . $this->_aSystem['table_cmts'] . "',
  59. iAuthorId: '" . $this->_getAuthorId() . "',
  60. iObjId: '" . $this->getId () . "',
  61. sPostFormPosition: '" . $this->_aSystem['post_form_position'] . "',
  62. sBrowseType: '" . $this->_sBrowseType . "',
  63. sDisplayType: '" . $this->_sDisplayType . "'});
  64. " . $this->_sJsObjName . ".oCmtElements = {";
  65. for (reset($this->_aCmtElements); list($k,$r) = each ($this->_aCmtElements); ) {
  66. $ret .= "\n'$k' : { 'reg' : '{$r['reg']}', 'msg' : \"". bx_js_string(trim($r['msg'])) . "\" },";
  67. }
  68. $ret = substr($ret, 0, -1);
  69. $ret .= "\n};\n";
  70. $ret .= "</script>";
  71. $this->getExtraJs();
  72. $this->getExtraCss();
  73. BxDolTemplate::getInstance()->addJsTranslation(array(
  74. '_Error occured',
  75. '_Are you sure?'
  76. ));
  77. return $ret;
  78. }
  79. /**
  80. * get full comments block with initializations
  81. */
  82. function getCommentsBlock($iParentId = 0) {
  83. $aBp = array('parent_id' => $iParentId);
  84. $sCmts = $this->getComments($aBp);
  85. return BxDolTemplate::getInstance()->parseHtmlByName('comments_block.html', array(
  86. 'system' => $this->_sSystem,
  87. 'id' => $this->getId(),
  88. 'bx_if:show_empty' => array(
  89. 'condition' => $sCmts == '',
  90. 'content' => array(
  91. 'style_prefix' => $this->_sStylePrefix
  92. )
  93. ),
  94. 'controls' => $this->_getControlsBox(),
  95. 'comments' => $sCmts,
  96. 'post_form_top' => $this->_getPostReplyBox($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_TOP)),
  97. 'post_form_bottom' => $this->_getPostReplyBox($aBp, array('type' => $this->_sDisplayType, 'position' => BX_CMT_PFP_BOTTOM)),
  98. 'script' => $this->getScript()
  99. ));
  100. }
  101. /**
  102. * get comments list for specified parent comment
  103. *
  104. * @param array $aBp - browse params array
  105. * @param array $aDp - display params array
  106. *
  107. */
  108. function getComments($aBp = array(), $aDp = array())
  109. {
  110. $this->_prepareParams($aBp, $aDp);
  111. $aCmts = $this->getCommentsArray($aBp['parent_id'], $aBp['order'], $aBp['start'], $aBp['per_view']);
  112. if(empty($aCmts) || !is_array($aCmts))
  113. return '';
  114. $sCmts = '';
  115. foreach($aCmts as $k => $r)
  116. $sCmts .= $this->getComment($r, $aBp, $aDp);
  117. $sCmts = $this->_getMoreLink($sCmts, $aBp, $aDp);
  118. return $sCmts;
  119. }
  120. /**
  121. * get comment view block with initializations
  122. */
  123. function getCommentBlock($iCmtId = 0)
  124. {
  125. return BxDolTemplate::getInstance()->parseHtmlByName('comment_block.html', array(
  126. 'system' => $this->_sSystem,
  127. 'id' => $this->getId(),
  128. 'comment' => $this->getComment($iCmtId, array(), array('type' => BX_CMT_DISPLAY_THREADED, 'opened' => true)),
  129. 'script' => $this->getScript()
  130. ));
  131. }
  132. /**
  133. * get one just posted comment
  134. *
  135. * @param int $iCmtId - comment id
  136. * @return string
  137. */
  138. function getComment($mixedCmt, $aBp = array(), $aDp = array())
  139. {
  140. $oTemplate = BxDolTemplate::getInstance();
  141. $iUserId = $this->_getAuthorId();
  142. $r = !is_array($mixedCmt) ? $this->getCommentRow((int)$mixedCmt) : $mixedCmt;
  143. list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo($r['cmt_author_id']);
  144. $sClass = $sRet = '';
  145. if($r['cmt_rated'] == -1 || $r['cmt_rate'] < $this->_aSystem['viewing_threshold']) {
  146. $oTemplate->pareseHtmlByName('comment_hidden.html', array(
  147. 'js_object' => $this->_sJsObjName,
  148. 'id' => $r['cmt_id'],
  149. 'title' => bx_process_output(_t('_hidden_comment', $sAuthorName)),
  150. 'bx_if:show_replies' => array(
  151. 'condition' => $r['cmt_replies'] > 0,
  152. 'content' => array(
  153. 'replies' => _t('_Show N replies', $r['cmt_replies'])
  154. )
  155. )
  156. ));
  157. $sClass = ' cmt-hidden';
  158. }
  159. if($r['cmt_author_id'] == $iUserId)
  160. $sClass .= ' cmt-mine';
  161. $sActions = $this->_getActionsBox($r, $aDp);
  162. $sText = bx_process_output($r['cmt_text'], BX_DATA_TEXT_MULTILINE);
  163. $sTextMore = '';
  164. $iMaxLength = (int)$this->_aSystem['chars_display_max'];
  165. if(strlen($sText) > $iMaxLength) {
  166. $iLength = strpos($sText, ' ', $iMaxLength);
  167. $sTextMore = substr($sText, $iLength);
  168. $sText = substr($sText, 0, $iLength);
  169. }
  170. $aTmplReplyTo = array();
  171. if((int)$r['cmt_parent_id'] != 0) {
  172. $aParent = $this->getCommentRow($r['cmt_parent_id']);
  173. list($sParAuthorName, $sParAuthorLink, $sParAuthorIcon) = $this->_getAuthorInfo($aParent['cmt_author_id']);
  174. $aTmplReplyTo = array(
  175. 'style_prefix' => $this->_sStylePrefix,
  176. 'par_cmt_link' => $this->_sHomeUrl. '#' . $this->_sSystem . $r['cmt_parent_id'],
  177. 'par_cmt_author' => $sParAuthorName
  178. );
  179. }
  180. $sReplies = '';
  181. if((int)$r['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED && $aDp['opened'])
  182. $sReplies = $this->getComments(array('parent_id' => $r['cmt_id'], 'type' => $aBp['type']), $aDp);
  183. $bAuthorIcon = !empty($sAuthorIcon);
  184. return $oTemplate->parseHtmlByName('comment.html', array(
  185. 'system' => $this->_sSystem,
  186. 'style_prefix' => $this->_sStylePrefix,
  187. 'id' => $r['cmt_id'],
  188. 'class' => $sClass,
  189. 'margin' => $this->_getLevelGap($r, $aDp),
  190. 'bx_if:show_icon' => array(
  191. 'condition' => $bAuthorIcon,
  192. 'content' => array(
  193. 'author_icon' => $sAuthorIcon
  194. )
  195. ),
  196. 'bx_if:show_icon_empty' => array(
  197. 'condition' => !$bAuthorIcon,
  198. 'content' => array()
  199. ),
  200. 'bx_if:show_author_link' => array(
  201. 'condition' => !empty($sAuthorLink),
  202. 'content' => array(
  203. 'author_link' => $sAuthorLink,
  204. 'author_name' => $sAuthorName
  205. )
  206. ),
  207. 'bx_if:show_author_text' => array(
  208. 'condition' => empty($sAuthorLink),
  209. 'content' => array(
  210. 'author_name' => $sAuthorName
  211. )
  212. ),
  213. 'bx_if:show_reply_to' => array(
  214. 'condition' => !empty($aTmplReplyTo),
  215. 'content' => $aTmplReplyTo
  216. ),
  217. 'text' => $sText,
  218. 'bx_if:show_more' => array(
  219. 'condition' => !empty($sTextMore),
  220. 'content' => array(
  221. 'js_object' => $this->_sJsObjName,
  222. 'text_more' => $sTextMore
  223. )
  224. ),
  225. 'actions' => $sActions,
  226. 'replies' => $sReplies
  227. ));
  228. }
  229. function getFormBox($aBp = array(), $aDp = array())
  230. {
  231. return $this->_getPostReplyBox($aBp, $aDp);
  232. }
  233. function getForm($iCmtParentId, $sText, $sFunction)
  234. {
  235. return $this->_getPostReplyForm($iCmtParentId, $sText, $sFunction);
  236. }
  237. /**
  238. * private functions
  239. */
  240. function _getControlsBox()
  241. {
  242. $oTemplate = BxDolTemplate::getInstance();
  243. $sDisplay = '';
  244. $bDisplay = (int)$this->_aSystem['is_display_switch'] == 1;
  245. if($bDisplay) {
  246. $aDisplayLinks = array(
  247. array('id' => $this->_sSystem . '-flat', 'name' => $this->_sSystem . '-flat', 'class' => '', 'title' => '_cmt_display_flat', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeDisplay(this, \'flat\');'),
  248. array('id' => $this->_sSystem . '-threaded', 'name' => $this->_sSystem . '-threaded', 'class' => '', 'title' => '_cmt_display_threaded', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeDisplay(this, \'threaded\');')
  249. );
  250. bx_import('BxTemplMenuInteractive');
  251. $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive.html', 'menu_id'=> $this->_sSystem . '-display', 'menu_items' => $aDisplayLinks));
  252. $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sDisplayType);
  253. $sDisplay = $oMenu->getCode();
  254. }
  255. $sBrowse = '';
  256. $bBrowse = (int)$this->_aSystem['is_browse_switch'] == 1;
  257. if($bBrowse) {
  258. $aBrowseLinks = array(
  259. array('id' => $this->_sSystem . '-tail', 'name' => $this->_sSystem . '-tail', 'class' => '', 'title' => '_cmt_browse_tail', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'tail\');'),
  260. array('id' => $this->_sSystem . '-head', 'name' => $this->_sSystem . '-head', 'class' => '', 'title' => '_cmt_browse_head', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'head\');'),
  261. array('id' => $this->_sSystem . '-popular', 'name' => $this->_sSystem . '-popular', 'class' => '', 'title' => '_cmt_browse_popular', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'popular\');'),
  262. array('id' => $this->_sSystem . '-connection', 'name' => $this->_sSystem . '-connection', 'class' => '', 'title' => '_cmt_browse_connection', 'target' => '_self', 'onclick' => 'javascript:' . $this->_sJsObjName . '.cmtChangeBrowse(this, \'connection\');')
  263. );
  264. bx_import('BxTemplMenuInteractive');
  265. $oMenu = new BxTemplMenuInteractive(array('template' => 'menu_interactive.html', 'menu_id'=> $this->_sSystem . '-browse', 'menu_items' => $aBrowseLinks));
  266. $oMenu->setSelected('', $this->_sSystem . '-' . $this->_sBrowseType);
  267. $sBrowse = $oMenu->getCode();
  268. }
  269. return $oTemplate->parseHtmlByName('comments_controls.html', array(
  270. 'js_object' => $this->_sJsObjName,
  271. 'style_prefix' => $this->_sStylePrefix,
  272. 'comments_count' => _t('_N_comments', $this->_oQuery->getCommentsCount($this->_iId)),
  273. 'display_switcher' => $bDisplay ? $sDisplay : '',
  274. 'bx_if:is_divider' => array(
  275. 'condition' => $bDisplay && $bBrowse,
  276. 'content' => array(
  277. 'style_prefix' => $this->_sStylePrefix,
  278. )
  279. ),
  280. 'browse_switcher' => $bBrowse ? $sBrowse : '',
  281. ));
  282. }
  283. function _getActionsBox(&$a, $aDp = array())
  284. {
  285. $iUserId = $this->_getAuthorId();
  286. $isEditAllowedPermanently = ($a['cmt_author_id'] == $iUserId && $this->isEditAllowed()) || $this->isEditAllowedAll();
  287. $isRemoveAllowedPermanently = ($a['cmt_author_id'] == $iUserId && $this->isRemoveAllowed()) || $this->isRemoveAllowedAll();
  288. return BxDolTemplate::getInstance()->parseHtmlByName('comment_actions.html', array(
  289. 'id' => $a['cmt_id'],
  290. 'style_prefix' => $this->_sStylePrefix,
  291. 'view_link' => bx_append_url_params($this->_sViewUrl, array(
  292. 'sys' => $this->_sSystem,
  293. 'id' => $this->_iId,
  294. 'cmt_id' => $a['cmt_id']
  295. )),
  296. 'ago' => $a['cmt_ago'],
  297. 'points' => _t($a['cmt_rate'] == 1 || $a['cmt_rate'] == -1 ? '_N_point' : '_N_points', $a['cmt_rate']),
  298. 'bx_if:show_reply' => array(
  299. 'condition' => $this->isPostReplyAllowed(),
  300. 'content' => array(
  301. 'js_object' => $this->_sJsObjName,
  302. 'style_prefix' => $this->_sStylePrefix,
  303. 'id' => $a['cmt_id'],
  304. 'text' => _t(isset($a['cmt_type']) && $a['cmt_type'] == 'comment' ? '_Comment_to_this_comment' : '_Reply_to_this_comment')
  305. )
  306. ),
  307. 'bx_if:show_rate' => array(
  308. 'condition' => $this->isRatable(),
  309. 'content' => array(
  310. 'js_object' => $this->_sJsObjName,
  311. 'style_prefix' => $this->_sStylePrefix,
  312. 'id' => $a['cmt_id']
  313. )
  314. ),
  315. 'bx_if:show_replies' => array(
  316. 'condition' => (int)$a['cmt_replies'] > 0 && !empty($aDp) && $aDp['type'] == BX_CMT_DISPLAY_THREADED && !$aDp['opened'],
  317. 'content' => array(
  318. 'js_object' => $this->_sJsObjName,
  319. 'style_prefix' => $this->_sStylePrefix,
  320. 'id' => $a['cmt_id'],
  321. 'text' => _t((isset($a['cmt_type']) && $a['cmt_type'] == 'comment' ? '_N_comments' : '_N_replies'), $a['cmt_replies'])
  322. )
  323. ),
  324. 'bx_if:show_edit' => array(
  325. 'condition' => $isEditAllowedPermanently,
  326. 'content' => array(
  327. 'js_object' => $this->_sJsObjName,
  328. 'style_prefix' => $this->_sStylePrefix,
  329. 'id' => $a['cmt_id']
  330. )
  331. ),
  332. 'bx_if:show_delete' => array(
  333. 'condition' => $isRemoveAllowedPermanently,
  334. 'content' => array(
  335. 'js_object' => $this->_sJsObjName,
  336. 'style_prefix' => $this->_sStylePrefix,
  337. 'id' => $a['cmt_id']
  338. )
  339. ),
  340. ));
  341. }
  342. function _getPostReplyBox($aBp, $aDp)
  343. {
  344. $iCmtParentId = isset($aBp['parent_id']) ? (int)$aBp['parent_id'] : 0;
  345. $sPosition = isset($aDp['position']) ? $aDp['position'] : '';
  346. if(!$this->isPostReplyAllowed())
  347. return '';
  348. list($sAuthorName, $sAuthorLink, $sAuthorIcon) = $this->_getAuthorInfo();
  349. $sPositionSystem = $this->_aSystem['post_form_position'];
  350. if(!empty($sPosition) && $sPositionSystem != BX_CMT_PFP_BOTH && $sPositionSystem != $sPosition)
  351. return '';
  352. $bAuthorIcon = !empty($sAuthorIcon);
  353. return BxDolTemplate::getInstance()->parseHtmlByName('comment_reply_box.html', array(
  354. 'style_prefix' => $this->_sStylePrefix,
  355. 'margin' => $this->_getLevelGapByParent($iCmtParentId, $aDp),
  356. 'bx_if:show_class' => array(
  357. 'condition' => !empty($sPosition),
  358. 'content' => array(
  359. 'class' => $this->_sStylePrefix . '-reply-' . $sPosition
  360. )
  361. ),
  362. 'bx_if:show_icon' => array(
  363. 'condition' => $bAuthorIcon,
  364. 'content' => array(
  365. 'author_icon' => $sAuthorIcon
  366. )
  367. ),
  368. 'bx_if:show_icon_empty' => array(
  369. 'condition' => !$bAuthorIcon,
  370. 'content' => array()
  371. ),
  372. 'form' => $this->_getPostReplyForm($iCmtParentId)
  373. ));
  374. }
  375. function _getPostReplyForm($iCmtParentId = 0, $sText = "", $sFunction = "cmtSubmit(this)")
  376. {
  377. $aForm = array(
  378. 'form_attrs' => array(
  379. 'name' => 'cmt-post-reply-' . $this->_sSystem,
  380. 'method' => 'post',
  381. 'onsubmit' => $this->_sJsObjName . '.' . $sFunction . '; return false;',
  382. 'class' => 'cmt-post-reply'
  383. ),
  384. 'params' => array (
  385. 'csrf' => array(
  386. 'disable' => true,
  387. )
  388. ),
  389. 'inputs' => array(
  390. 'CmtParent' => array(
  391. 'type' => 'hidden',
  392. 'name' => 'CmtParent',
  393. 'value' => $iCmtParentId
  394. ),
  395. 'CmtType' => array(
  396. 'type' => 'hidden',
  397. 'name' => 'CmtType',
  398. 'value' => 'text'
  399. ),
  400. 'CmtText' => array(
  401. 'type' => 'textarea',
  402. 'name' => 'CmtText',
  403. 'caption' => '',
  404. 'value' => $sText,
  405. 'required' => false,
  406. ),
  407. 'CmtControls' => array(
  408. 'type' => 'input_set',
  409. 0 => array('type' => 'submit', 'name' => 'CmtSubmit', 'value' => _t('_Submit_Comment')),
  410. 1 => array('type' => 'switcher', 'name' => 'CmtSubscribe', 'label' => _t('_cmt_track_replies')),
  411. )
  412. )
  413. );
  414. bx_import('BxTemplFormView');
  415. $oForm = new BxTemplFormView ($aForm);
  416. return $oForm->getCode();
  417. }
  418. function _getMoreLink($sCmts, $aBp = array(), $aDp = array())
  419. {
  420. $iStart = $iPerView = 0;
  421. switch($aBp['type']) {
  422. case BX_CMT_BROWSE_HEAD:
  423. case BX_CMT_BROWSE_POPULAR:
  424. case BX_CMT_BROWSE_CONNECTION:
  425. $iPerView = $aBp['per_view'];
  426. $iStart = $aBp['start'] + $iPerView;
  427. if($iStart >= $aBp['count'])
  428. return $sCmts;
  429. break;
  430. case BX_CMT_BROWSE_TAIL:
  431. $iPerView = $aBp['per_view'];
  432. $iStart = $aBp['start'] - $iPerView;
  433. if($iStart < 0) {
  434. $iPerView += $iStart;
  435. $iStart = 0;
  436. }
  437. if($iStart == 0 && $iPerView == 0)
  438. return $sCmts;
  439. break;
  440. }
  441. $bRoot = (int)$aBp['parent_id'] <= 0;
  442. $sMore = BxDolTemplate::getInstance()->parseHtmlByName('comment_more.html', array(
  443. 'js_object' => $this->_sJsObjName,
  444. 'style_prefix' => $this->_sStylePrefix,
  445. 'bx_if:is_root' => array(
  446. 'condition' => $bRoot,
  447. 'content' => array()
  448. ),
  449. 'margin' => $this->_getLevelGapByParent($aBp['parent_id'], $aDp),
  450. 'bx_if:is_button' => array(
  451. 'condition' => $bRoot,
  452. 'content' => array()
  453. ),
  454. 'parent_id' => $aBp['parent_id'],
  455. 'start' => $iStart,
  456. 'per_view' => $iPerView,
  457. 'title' => _t('_load_more_comments_' . $aBp['type'])
  458. ));
  459. switch($aBp['type']) {
  460. case BX_CMT_BROWSE_HEAD:
  461. case BX_CMT_BROWSE_POPULAR:
  462. case BX_CMT_BROWSE_CONNECTION:
  463. $sCmts .= $sMore;
  464. break;
  465. case BX_CMT_BROWSE_TAIL:
  466. $sCmts = $sMore . $sCmts;
  467. break;
  468. }
  469. return $sCmts;
  470. }
  471. function _getLevelGap($a, $aDp = array())
  472. {
  473. if($aDp['type'] != BX_CMT_DISPLAY_THREADED || !is_array($a) || !isset($a['cmt_level']))
  474. return 0;
  475. return 84 * ((int)$a['cmt_level'] <= $this->_iDpMaxLevel ? (int)$a['cmt_level'] : $this->_iDpMaxLevel);
  476. }
  477. function _getLevelGapByParent($iParentId, $aDp = array()) {
  478. if($aDp['type'] != BX_CMT_DISPLAY_THREADED || (int)$iParentId == 0)
  479. return 0;
  480. $a = $this->getCommentRow($iParentId);
  481. if(isset($a['cmt_level']))
  482. $a['cmt_level'] += 1;
  483. return $this->_getLevelGap($a, $aDp);
  484. }
  485. }