BxBaseFavorite.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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 UnaBaseView UNA Base Representation Classes
  7. * @{
  8. */
  9. /**
  10. * @see BxDolFavorite
  11. */
  12. class BxBaseFavorite extends BxDolFavorite
  13. {
  14. protected $_bCssJsAdded;
  15. protected $_sJsObjClass;
  16. protected $_sJsObjName;
  17. protected $_sStylePrefix;
  18. protected $_aHtmlIds;
  19. public function __construct($sSystem, $iId, $iInit = 1, $oTemplate = false)
  20. {
  21. parent::__construct($sSystem, $iId, $iInit, $oTemplate);
  22. $this->_bCssJsAdded = false;
  23. $this->_sJsObjClass = 'BxDolFavorite';
  24. $this->_sJsObjName = 'oFavorite' . bx_gen_method_name($sSystem, ['_' , '-']) . $iId;
  25. $this->_sStylePrefix = 'bx-favorite';
  26. $sHtmlId = str_replace(['_' , ' '], ['-', '-'], $sSystem) . '-' . $iId;
  27. $this->_aHtmlIds = [
  28. 'main' => 'bx-favorite-' . $sHtmlId,
  29. 'counter' => 'bx-favorite-counter-' . $sHtmlId,
  30. 'do_link' => 'bx-favorite-do-link-' . $sHtmlId,
  31. 'by_popup' => 'bx-favorite-by-popup-' . $sHtmlId,
  32. 'do_popup' => 'bx-favorite-do-popup-' . $sHtmlId,
  33. 'do_form' => 'bx-favorite-do-form-' . $sHtmlId,
  34. ];
  35. $this->_aElementDefaults = [
  36. 'show_do_favorite_as_button' => false,
  37. 'show_do_favorite_as_button_small' => false,
  38. 'show_do_favorite_icon' => true,
  39. 'show_do_favorite_label' => false,
  40. 'show_counter' => true,
  41. 'show_counter_only' => true
  42. ];
  43. $this->_aElementDefaultsApi = array_merge($this->_aElementDefaults, [
  44. 'show_do_feature_as_button' => true,
  45. ]);
  46. $this->_aElementParamsApi = ['is_favorited'];
  47. $this->_sTmplContentElementBlock = $this->_oTemplate->getHtml('favorite_element_block.html');
  48. $this->_sTmplContentElementInline = $this->_oTemplate->getHtml('favorite_element_inline.html');
  49. $this->_sTmplContentDoActionLabel = $this->_oTemplate->getHtml('favorite_do_favorite_label.html');
  50. }
  51. public function getJsObjectName()
  52. {
  53. return $this->_sJsObjName;
  54. }
  55. public function getJsScript($bDynamicMode = false)
  56. {
  57. $aParams = array(
  58. 'sObjName' => $this->_sJsObjName,
  59. 'sSystem' => $this->getSystemName(),
  60. 'iAuthorId' => $this->_getAuthorId(),
  61. 'iObjId' => $this->getId(),
  62. 'sRootUrl' => BX_DOL_URL_ROOT,
  63. 'sStylePrefix' => $this->_sStylePrefix,
  64. 'aHtmlIds' => $this->_aHtmlIds
  65. );
  66. $sCode = "var " . $this->_sJsObjName . " = new " . $this->_sJsObjClass . "(" . json_encode($aParams) . ");";
  67. return $this->_oTemplate->_wrapInTagJsCode($sCode);
  68. }
  69. public function getJsClick()
  70. {
  71. return $this->getJsObjectName() . '.favorite(this)';
  72. }
  73. public function getCounter($aParams = [])
  74. {
  75. $aParams = array_merge($this->_aElementDefaults, $aParams);
  76. $bShowDoFavoriteAsButtonSmall = isset($aParams['show_do_favorite_as_button_small']) && $aParams['show_do_favorite_as_button_small'] == true;
  77. $bShowDoFavoriteAsButton = !$bShowDoFavoriteAsButtonSmall && isset($aParams['show_do_favorite_as_button']) && $aParams['show_do_favorite_as_button'] == true;
  78. $aFavorite = $this->_getFavorite();
  79. $sClass = 'sys-action-counter';
  80. if(isset($aParams['show_counter_only']) && (bool)$aParams['show_counter_only'] === true)
  81. $sClass .= ' sys-ac-only';
  82. $sClass .= ' ' . $this->_sStylePrefix . '-counter';
  83. if($bShowDoFavoriteAsButtonSmall)
  84. $sClass .= ' bx-btn-small-height';
  85. if($bShowDoFavoriteAsButton)
  86. $sClass .= ' bx-btn-height';
  87. return $this->_oTemplate->parseLink('javascript:void(0)', (int)$aFavorite['count'] > 0 ? $this->_getCounterLabel($aFavorite['count']) : '', array(
  88. 'title' => _t('_favorite_do_favorite_by'),
  89. 'id' => $this->_aHtmlIds['counter'],
  90. 'class' => $sClass,
  91. 'onclick' => 'javascript:' . $this->getJsObjectName() . '.toggleByPopup(this)'
  92. ));
  93. }
  94. public function getCounterAPI($aParams = [])
  95. {
  96. $aParams = array_merge($this->_aElementDefaultsApi, $aParams);
  97. return $this->_getFavorite();
  98. }
  99. public function getElementBlock($aParams = array())
  100. {
  101. $aParams['usage'] = BX_DOL_FAVORITE_USAGE_BLOCK;
  102. return $this->getElement($aParams);
  103. }
  104. public function getElementInline($aParams = array())
  105. {
  106. $aParams['usage'] = BX_DOL_FAVORITE_USAGE_INLINE;
  107. return $this->getElement($aParams);
  108. }
  109. public function getElement($aParams = array())
  110. {
  111. $aParams = array_merge($this->_aElementDefaults, $aParams);
  112. $bDynamicMode = isset($aParams['dynamic_mode']) && $aParams['dynamic_mode'] === true;
  113. $bShowDoFavoriteAsButtonSmall = isset($aParams['show_do_favorite_as_button_small']) && $aParams['show_do_favorite_as_button_small'] == true;
  114. $bShowDoFavoriteAsButton = !$bShowDoFavoriteAsButtonSmall && isset($aParams['show_do_favorite_as_button']) && $aParams['show_do_favorite_as_button'] == true;
  115. $bShowCounter = isset($aParams['show_counter']) && $aParams['show_counter'] === true && $this->isAllowedFavoriteView();
  116. $iObjectId = $this->getId();
  117. $iAuthorId = $this->_getAuthorId();
  118. $aFavorite = $this->_oQuery->getFavorite($iObjectId);
  119. $bCount = (int)$aFavorite['count'] != 0;
  120. $bAllowedFavorite = $this->isAllowedFavorite();
  121. if(!$bAllowedFavorite && (!$this->isAllowedFavoriteView() || !$bCount))
  122. return '';
  123. $aParams['is_favorited'] = $this->isPerformed($iObjectId, $iAuthorId) ? true : false;
  124. $sTmplName = $this->{'_getTmplContentElement' . bx_gen_method_name(!empty($aParams['usage']) ? $aParams['usage'] : BX_DOL_FAVORITE_USAGE_DEFAULT)}();
  125. return $this->_oTemplate->parseHtmlByContent($sTmplName, array(
  126. 'style_prefix' => $this->_sStylePrefix,
  127. 'html_id' => $this->_aHtmlIds['main'],
  128. 'class' => $this->_sStylePrefix . ($bShowDoFavoriteAsButton ? '-button' : '-link') . ($bShowDoFavoriteAsButtonSmall ? '-button-small' : ''),
  129. 'count' => $aFavorite['count'],
  130. 'do_favorite' => $this->_getDoFavorite($aParams, $bAllowedFavorite),
  131. 'bx_if:show_counter' => array(
  132. 'condition' => $bShowCounter,
  133. 'content' => array(
  134. 'style_prefix' => $this->_sStylePrefix,
  135. 'bx_if:show_hidden' => array(
  136. 'condition' => !$bCount,
  137. 'content' => array()
  138. ),
  139. 'counter' => $this->getCounter(array_merge($aParams, [
  140. 'show_counter_only' => false
  141. ]))
  142. )
  143. ),
  144. 'script' => $this->getJsScript($bDynamicMode)
  145. ));
  146. }
  147. public function getElementAPI($aParams = [])
  148. {
  149. if(!($this->_bIsApi = bx_is_api()))
  150. return;
  151. if(!$this->isEnabled())
  152. return bx_api_get_msg('_favorite_err_not_enabled');
  153. $aParams = array_merge($this->_aElementDefaultsApi, $aParams);
  154. $iObjectId = $this->getId();
  155. $iAuthorId = $this->_getAuthorId();
  156. $aFavorite = $this->_oQuery->getFavorite($iObjectId);
  157. $bCount = (int)$aFavorite['count'] != 0;
  158. $isAllowedFavorite = $this->isAllowedFavorite();
  159. $isAllowedFavoriteView = $this->isAllowedFavoriteView();
  160. $aParams['is_favorited'] = $this->isPerformed($iObjectId, $iAuthorId) ? true : false;
  161. //--- Do Favorite
  162. $bDoFavorite = $this->_isShowDoFavorite($aParams, $isAllowedFavorite, $bCount);
  163. $aDoFavorite = $bDoFavorite ? $this->_getDoFavorite($aParams, $isAllowedFavorite) : [];
  164. //--- Counter
  165. $bCounter = $this->_isShowCounter($aParams, $isAllowedFavorite, $isAllowedFavoriteView, $bCount);
  166. $aCounter = $bCounter ? $this->getCounterAPI(array_merge($aParams, [
  167. 'show_counter_only' => false,
  168. 'show_script' => false
  169. ])) : [];
  170. if(!$bDoFavorite && !$bCounter)
  171. return bx_api_get_msg('');
  172. return [
  173. 'type' => $this->_sType,
  174. 'system' => $this->_sSystem,
  175. 'object_id' => $this->_iId,
  176. 'ts' => microtime(true),
  177. 'params' => array_intersect_key($aParams, array_flip($this->_aElementParamsApi)),
  178. 'action' => $aDoFavorite,
  179. 'counter' => $aCounter
  180. ];
  181. }
  182. public function getPerformedByAPI($aParams = [])
  183. {
  184. $aValues = $this->_oQuery->getPerformedBy($this->getId());
  185. $aTmplUsers = [];
  186. foreach($aValues as $mValue) {
  187. $mValue = is_array($mValue) ? $mValue : ['author_id' => (int)$mValue, 'reaction' => ''];
  188. $aTmplUsers[] = BxDolProfile::getData($mValue['author_id']);
  189. }
  190. return [
  191. 'performed_by' => $aTmplUsers
  192. ];
  193. }
  194. protected function _getDoFavorite($aParams = array(), $bAllowedFavorite = true)
  195. {
  196. $bFavorited = isset($aParams['is_favorited']) && $aParams['is_favorited'] === true;
  197. $bShowDoFavoriteAsButtonSmall = isset($aParams['show_do_favorite_as_button_small']) && $aParams['show_do_favorite_as_button_small'] == true;
  198. $bShowDoFavoriteAsButton = !$bShowDoFavoriteAsButtonSmall && isset($aParams['show_do_favorite_as_button']) && $aParams['show_do_favorite_as_button'] == true;
  199. $bDisabled = !$bAllowedFavorite || ($bFavorited && !$this->isUndo());
  200. $sClass = '';
  201. if($bShowDoFavoriteAsButton)
  202. $sClass = 'bx-btn';
  203. else if ($bShowDoFavoriteAsButtonSmall)
  204. $sClass = 'bx-btn bx-btn-small';
  205. if($bDisabled)
  206. $sClass .= $bShowDoFavoriteAsButton || $bShowDoFavoriteAsButtonSmall ? ' bx-btn-disabled' : 'bx-favorite-disabled';
  207. if($this->_bIsApi)
  208. return [
  209. 'is_undo' => $this->isUndo(),
  210. 'is_favorited' => $bFavorited,
  211. 'is_disabled' => $bDisabled,
  212. 'title' => _t($this->_getTitleDoFavorite($bFavorited)),
  213. ];
  214. return $this->_oTemplate->parseLink('javascript:void(0)', $this->_getLabelDoFavorite($aParams), [
  215. 'id' => $this->_aHtmlIds['do_link'],
  216. 'class' => $this->_sStylePrefix . '-do-favorite ' . $sClass,
  217. 'title' => _t($this->_getTitleDoFavorite($bFavorited)),
  218. 'onclick' => !$bDisabled ? $this->getJsClick() : ''
  219. ]);
  220. }
  221. protected function _getCounterLabel($iCount)
  222. {
  223. return _t('_favorite_counter', $iCount);
  224. }
  225. protected function _getLabelDoFavorite($aParams = array())
  226. {
  227. $bFavorited = isset($aParams['is_favorited']) && $aParams['is_favorited'] === true;
  228. return $this->_oTemplate->parseHtmlByContent($this->_getTmplContentDoActionLabel(), array(
  229. 'style_prefix' => $this->_sStylePrefix,
  230. 'bx_if:show_icon' => array(
  231. 'condition' => isset($aParams['show_do_favorite_icon']) && $aParams['show_do_favorite_icon'] == true,
  232. 'content' => array(
  233. 'style_prefix' => $this->_sStylePrefix,
  234. 'icon' => $this->_oTemplate->getImageAuto($this->_getIconDoFavorite($bFavorited))
  235. )
  236. ),
  237. 'bx_if:show_text' => array(
  238. 'condition' => isset($aParams['show_do_favorite_label']) && $aParams['show_do_favorite_label'] == true,
  239. 'content' => array(
  240. 'style_prefix' => $this->_sStylePrefix,
  241. 'text' => _t($this->_getTitleDoFavorite($bFavorited))
  242. )
  243. )
  244. ));
  245. }
  246. public function favorite()
  247. {
  248. if(!$this->isEnabled())
  249. return array('code' => 1, 'message' => _t('_favorite_err_not_enabled'));
  250. $iAuthorId = $this->_getAuthorId();
  251. $iObjectId = $this->getId();
  252. $iObjectAuthorId = $this->_oQuery->getObjectAuthorId($iObjectId);
  253. if(!isset($this->_aSystem['table_lists']) || $this->_aSystem['table_lists'] == '')
  254. return $this->doFavorite();
  255. $oForm = $this->_getFormObject($this->_sFormDisplayAdd);
  256. $oForm->setId($this->_aHtmlIds['do_form']);
  257. $oForm->setName($this->_aHtmlIds['do_form']);
  258. $oForm->aParams['db']['table'] = $this->_aSystem['table_track'];
  259. $oForm->aInputs['sys']['value'] = $this->_sSystem;
  260. $oForm->aInputs['object_id']['value'] = $iObjectId;
  261. $oForm->aInputs['action']['value'] = 'Favorite';
  262. $aListsValues = [];
  263. $aLists = $this->_oQuery->getList(array('type' => 'all', 'author_id' => $iAuthorId, 'need_default' => true));
  264. foreach($aLists as $aList)
  265. $aListsValues[$aList['id']] = $this->_oTemplate->parseHtmlByName('favorite_do_favorite_privacy_item.html', [
  266. 'title' => $aList['title'],
  267. 'icon' => BxDolPrivacy::getIcon($aList['allow_view_favorite_list_to'])
  268. ]);
  269. $oForm->aInputs['list']['values'] = $aListsValues;
  270. $oForm->aInputs['list']['value'] = $this->_oQuery->getList(array('type' => 'object_and_author', 'object_id' => $iObjectId, 'author_id' => $iAuthorId));
  271. $oForm->aInputs['list']['label_as_html'] = true;
  272. $oModule = BxDolModule::getInstance($this->_aSystem["name"]);
  273. $CNF = $oModule->_oConfig->CNF;
  274. $oPrivacy = BxDolPrivacy::getObjectInstance($CNF["OBJECT_PRIVACY_LIST_VIEW"]);
  275. if (!$oPrivacy)
  276. return array('code' => 5, 'message' => _t('_favorite_err_cannot_perform_action'));
  277. $aSave = array('db' => array('pass' => 'Xss'));
  278. $aGroupChooser = $oPrivacy->getGroupChooser($CNF["OBJECT_PRIVACY_LIST_VIEW"]);
  279. $oForm->aInputs["allow_view_favorite_list_to"] = array_merge($oForm->aInputs["allow_view_favorite_list_to"], $aGroupChooser, $aSave);
  280. if ($oForm->isSubmittedAndValid()) {
  281. $mList = $oForm->getCleanValue('list');
  282. $aList = is_array($mList) ? $mList : array();
  283. $sTitle = $oForm->getCleanValue('title');
  284. if ($sTitle) {
  285. $sAllowViewTo = $oForm->getCleanValue('allow_view_favorite_list_to');
  286. $iAddList = $this->_oQuery->addList($iAuthorId, $sTitle, $sAllowViewTo);
  287. array_push($aList, $iAddList);
  288. }
  289. $this->_oQuery->clearFavorite($iObjectId, $iAuthorId);
  290. foreach ($aList as $iList) {
  291. $this->_oQuery->doFavorite($iObjectId, $iAuthorId, $iList);
  292. }
  293. $this->_trigger();
  294. bx_alert($this->_sSystem, 'favorite', $iObjectId, $iAuthorId, array('favorite_author_id' => $iAuthorId, 'object_author_id' => $iObjectAuthorId, 'list_ids' => $aList));
  295. /**
  296. * @hooks
  297. * @hookdef hook-report-do 'favorite', 'favorite' - hook on add new object to favorites lists
  298. * - $unit_name - equals `favorite`
  299. * - $action - equals `favorite`
  300. * - $object_id - favorited object id
  301. * - $sender_id - profile_id for favorite's author
  302. * - $extra_params - array of additional params with the following array keys:
  303. * - `object_system` - [string] system name, ex: bx_posts
  304. * - `object_id` - [int] reported object id
  305. * - `object_author_id` - [int] author's profile_id for reported object_id
  306. * - `list_ids` - [array] array of id's list
  307. * @hook @ref hook-favorite-do
  308. */
  309. bx_alert('favorite', 'do', 0, $iAuthorId, array('object_system' => $this->_sSystem, 'object_id' => $iObjectId, 'object_author_id' => $iObjectAuthorId, 'list_ids' => $aList));
  310. $bPerformed = count($aList) > 0;
  311. $aFavorite = $this->_oQuery->getFavorite($iObjectId);
  312. return array(
  313. 'eval' => $this->getJsObjectName() . '.onFavorite(oData, oElement)',
  314. 'code' => 0,
  315. 'count' => $aFavorite['count'],
  316. 'countf' => (int)$aFavorite['count'] > 0 ? $this->_getCounterLabel($aFavorite['count']) : '',
  317. 'label_icon' => $this->_getIconDoFavorite($bPerformed),
  318. 'label_title' => _t($this->_getTitleDoFavorite($bPerformed)),
  319. 'disabled' => false
  320. );
  321. }
  322. $sPopupId = $this->_aHtmlIds['do_popup'];
  323. $sPopupContent = BxTemplFunctions::getInstance()->transBox($sPopupId, $this->_oTemplate->parseHtmlByName('favorite_do_favorite_popup.html', array(
  324. 'style_prefix' => $this->_sStylePrefix,
  325. 'js_object' => $this->getJsObjectName(),
  326. 'form' => str_replace('{js_object}', $this->getJsObjectName(), $oForm->getCode()),
  327. 'form_id' => $oForm->id,
  328. )));
  329. return array('popup' => $sPopupContent, 'popup_id' => $sPopupId);
  330. }
  331. protected function _getEditList($aData)
  332. {
  333. if (!$this->isEnabled())
  334. return array('code' => 1, 'message' => _t('_favorite_err_not_enabled'));
  335. $oForm = $this->_getFormObject($this->_sFormDisplayListEdit);
  336. $oForm->setId($this->_aHtmlIds['do_form']);
  337. $oForm->setName($this->_aHtmlIds['do_form']);
  338. $oForm->aParams['db']['table'] = $this->_aSystem['table_track'];
  339. $oForm->aInputs['sys']['value'] = $this->_sSystem;
  340. $oForm->aInputs['list_id']['value'] = $aData['id'];
  341. $oForm->aInputs['object_id']['value'] = 0;
  342. $oForm->aInputs['action']['value'] = 'EditList';
  343. $oModule = BxDolModule::getInstance($this->_aSystem["name"]);
  344. $CNF = $oModule->_oConfig->CNF;
  345. $oPrivacy = BxDolPrivacy::getObjectInstance($CNF["OBJECT_PRIVACY_LIST_VIEW"]);
  346. if(!$oPrivacy)
  347. return;
  348. $aSave = array('db' => array('pass' => 'Xss'));
  349. $aGroupChooser = $oPrivacy->getGroupChooser($CNF["OBJECT_PRIVACY_LIST_VIEW"]);
  350. $oForm->aInputs["allow_view_favorite_list_to"] = array_merge($oForm->aInputs["allow_view_favorite_list_to"], $aGroupChooser, $aSave);
  351. $oForm->aInputs['title']['value'] = $aData['title'];
  352. $oForm->aInputs['allow_view_favorite_list_to']['value'] = $aData['allow_view_favorite_list_to'];
  353. if($oForm->isSubmittedAndValid()) {
  354. $sTitle = $oForm->getCleanValue('title');
  355. if ($sTitle){
  356. $sAllowViewTo = $oForm->getCleanValue('allow_view_favorite_list_to');
  357. $this->_oQuery->editList($aData['id'], $sTitle, $sAllowViewTo);
  358. }
  359. return array(
  360. 'eval' => $this->getJsObjectName() . '.onEditFavoriteList(oData, oElement)',
  361. 'code' => 0,
  362. );
  363. }
  364. $sPopupId = $this->_aHtmlIds['do_popup'];
  365. $sPopupContent = BxTemplFunctions::getInstance()->transBox($sPopupId, $this->_oTemplate->parseHtmlByName('favorite_edit_favorite_list.html', array(
  366. 'style_prefix' => $this->_sStylePrefix,
  367. 'js_object' => $this->getJsObjectName(),
  368. 'form' => str_replace('{js_object}', $this->getJsObjectName(), $oForm->getCode()),
  369. 'form_id' => $oForm->id,
  370. )));
  371. return array('popup' => $sPopupContent, 'popup_id' => $sPopupId);
  372. }
  373. protected function _getFavoritedBy()
  374. {
  375. $aTmplFavorites = array();
  376. $aFavorites = $this->_oQuery->getPerformedBy($this->getId());
  377. foreach($aFavorites as $aFavorite) {
  378. list($sUserName, $sUserUrl, $sUserIcon, $sUserUnit) = $this->_getAuthorInfo($aFavorite['author_id']);
  379. $aTmplFavorites[] = array(
  380. 'style_prefix' => $this->_sStylePrefix,
  381. 'user_unit' => $sUserUnit,
  382. );
  383. }
  384. if(empty($aTmplFavorites))
  385. $aTmplFavorites = MsgBox(_t('_Empty'));
  386. return $this->_oTemplate->parseHtmlByName('favorite_by_list.html', array(
  387. 'style_prefix' => $this->_sStylePrefix,
  388. 'bx_repeat:list' => $aTmplFavorites
  389. ));
  390. }
  391. protected function _isShowDoFavorite($aParams, $isAllowedFavorite, $bCount)
  392. {
  393. return (!isset($aParams['show_do_favorite']) || (bool)$aParams['show_do_favorite'] === true) && $isAllowedFavorite;
  394. }
  395. protected function _isShowCounter($aParams, $isAllowedFavorite, $isAllowedFavoriteView, $bCount)
  396. {
  397. return isset($aParams['show_counter']) && (bool)$aParams['show_counter'] === true && $isAllowedFavoriteView && ($isAllowedFavorite || $bCount);
  398. }
  399. }
  400. /** @} */