BxBaseModGeneralMenuViewActions.php 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611
  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 BaseGeneral Base classes for modules
  7. * @ingroup UnaModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxDolPrivacy');
  12. /**
  13. * View entry social actions menu
  14. */
  15. class BxBaseModGeneralMenuViewActions extends BxTemplMenuCustom
  16. {
  17. protected $_sModule;
  18. protected $_oModule;
  19. protected $_oMenuActions;
  20. protected $_oMenuActionsMore;
  21. protected $_oMenuSocialSharing;
  22. protected $_iContentId;
  23. protected $_aContentInfo;
  24. protected $_bDynamicMode;
  25. protected $_bShowAsButton;
  26. protected $_bShowTitle;
  27. protected $_sClassMiSa; // Separate class for Social Actions (View, Vote, Comment, Report, etc) menu items.
  28. public function __construct($aObject, $oTemplate = false)
  29. {
  30. parent::__construct($aObject, $oTemplate);
  31. $this->_oModule = BxDolModule::getInstance($this->_sModule);
  32. $this->setContentId(bx_process_input(bx_get('id'), BX_DATA_INT));
  33. $this->_oMenuActions = null;
  34. $this->_oMenuActionsMore = null;
  35. $this->_oMenuSocialSharing = null;
  36. $this->_sTmplContent = $this->_oTemplate->getHtml($this->getTemplateName('menu_custom_actions.html'));
  37. $this->_sTmplContentItem = $this->_oTemplate->getHtml($this->getTemplateNameItem('menu_custom_item_actions.html'));
  38. $this->_bShowAsButton = true;
  39. $this->_bShowTitle = true;
  40. $this->_sClassMiSa = 'bx-base-general-ea-sa';
  41. $this->addMarkers(array(
  42. 'module' => $this->_oModule->_oConfig->getName(),
  43. 'module_uri' => $this->_oModule->_oConfig->getUri(),
  44. ));
  45. }
  46. public function addMarkers($a)
  47. {
  48. $bResult = parent::addMarkers($a);
  49. if($bResult) {
  50. if(empty($this->_oMenuSocialSharing))
  51. $this->_initMenuSocialSharing();
  52. //it still may be false in case the sys_social_sharing menu is turned off
  53. if (!empty($this->_oMenuSocialSharing)) {
  54. $this->_oMenuSocialSharing->addMarkers($a);
  55. parent::addMarkers($this->_oMenuSocialSharing->getMarkers());
  56. }
  57. }
  58. return $bResult;
  59. }
  60. public function setContentId($iContentId)
  61. {
  62. $this->_iContentId = (int)$iContentId;
  63. $this->_aContentInfo = $this->_oModule->_oDb->getContentInfoById($this->_iContentId);
  64. if($this->_aContentInfo)
  65. $this->addMarkers(array('content_id' => (int)$this->_iContentId));
  66. }
  67. public function setShowAsButton($bShowAsButton)
  68. {
  69. $this->_bShowAsButton = $bShowAsButton;
  70. }
  71. /**
  72. * Check if menu items is visible with extended checking linked to "allow*" method of particular module
  73. * Associated "allow*" method with particular menu item is stored in module config in MENU_ITEM_TO_METHOD array.
  74. * @param $a menu item array
  75. * @return boolean
  76. */
  77. protected function _isVisible($a)
  78. {
  79. if(!parent::_isVisible($a))
  80. return false;
  81. return $this->_oModule->isMenuItemVisible($this->_sObject, $a, $this->_aContentInfo);
  82. }
  83. protected function _isContentPublic($iContentId)
  84. {
  85. $CNF = &$this->_oModule->_oConfig->CNF;
  86. if(empty($CNF['FIELD_ALLOW_VIEW_TO']))
  87. return true;
  88. $aContentInfo = $iContentId == $this->_iContentId ? $this->_aContentInfo : $this->_oModule->_oDb->getContentInfoById($iContentId);
  89. if(!isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]))
  90. return true;
  91. return in_array($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']], array(BX_DOL_PG_ALL, BX_DOL_PG_MEMBERS));
  92. }
  93. protected function _initMenuSocialSharing()
  94. {
  95. $this->_oMenuSocialSharing = BxDolMenu::getObjectInstance('sys_social_sharing');
  96. if(!$this->_oMenuSocialSharing)
  97. return false;
  98. /**
  99. * Adding current markers to social sharing menu object to force it to generate its own markers.
  100. * Getting generated social sharing markers back and adding all of them to current menu object. So, now these markers can be parsed for any menu item.
  101. */
  102. $this->_oMenuSocialSharing->addMarkers($this->_aMarkers);
  103. $this->addMarkers($this->_oMenuSocialSharing->getMarkers());
  104. return true;
  105. }
  106. protected function _getMenuItemDefault($aItem)
  107. {
  108. if(empty($this->_oMenuSocialSharing))
  109. $this->_initMenuSocialSharing();
  110. $aItem['class_wrp'] = 'bx-base-general-entity-action' . (!empty($aItem['class_wrp']) ? ' ' . $aItem['class_wrp'] : '');
  111. if($this->_bShowAsButton)
  112. $aItem['class_link'] = 'bx-btn' . (isset($aItem['primary']) && (int)$aItem['primary'] == 1 ? ' bx-btn-primary' : '') . (!empty($aItem['class_link']) ? ' ' . $aItem['class_link'] : '');
  113. if(!$this->_bShowTitle)
  114. $aItem['bx_if:title']['condition'] = false;
  115. if($this->_bIsApi)
  116. return $aItem;
  117. else
  118. return parent::_getMenuItemDefault ($aItem);
  119. }
  120. protected function _getMenuItemView($aItem, $aParams = array())
  121. {
  122. $CNF = &$this->_oModule->_oConfig->CNF;
  123. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  124. if(empty($sObject) && !empty($CNF['OBJECT_VIEWS']))
  125. $sObject = $CNF['OBJECT_VIEWS'];
  126. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  127. if(empty($iId))
  128. $iId = $this->_iContentId;
  129. $oObject = !empty($sObject) ? BxDolView::getObjectInstance($sObject, $iId) : false;
  130. if(!$oObject || !$oObject->isEnabled())
  131. return '';
  132. $aObjectOptions = array(
  133. 'dynamic_mode' => $this->_bDynamicMode,
  134. 'show_do_view_as_button' => $this->_bShowAsButton,
  135. 'show_do_view_label' => $this->_bShowTitle
  136. );
  137. if(!empty($aParams['object_options']) && is_array($aParams['object_options']))
  138. $aObjectOptions = array_merge($aObjectOptions, $aParams['object_options']);
  139. if($this->_bIsApi)
  140. return $oObject->getElementApi($aObjectOptions);
  141. $sResult = $oObject->getElementBlock($aObjectOptions);
  142. if(empty($sResult))
  143. return '';
  144. return array($sResult, $this->_sClassMiSa);
  145. }
  146. protected function _getMenuItemComment($aItem, $aParams = array())
  147. {
  148. $CNF = &$this->_oModule->_oConfig->CNF;
  149. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  150. if(empty($sObject) && !empty($CNF['OBJECT_COMMENTS']))
  151. $sObject = $CNF['OBJECT_COMMENTS'];
  152. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  153. if(empty($iId))
  154. $iId = $this->_iContentId;
  155. $oObject = !empty($sObject) ? BxTemplCmts::getObjectInstance($sObject, $iId) : false;
  156. if(!$oObject || !$oObject->isEnabled())
  157. return '';
  158. $aObjectOptions = array(
  159. 'dynamic_mode' => $this->_bDynamicMode,
  160. 'show_do_comment_as_button' => $this->_bShowAsButton,
  161. 'show_do_comment_label' => $this->_bShowTitle,
  162. 'show_counter' => false
  163. );
  164. if(!empty($aParams['object_options']) && is_array($aParams['object_options']))
  165. $aObjectOptions = array_merge($aObjectOptions, $aParams['object_options']);
  166. if($this->_bIsApi)
  167. return $oObject->getElementApi($aObjectOptions);
  168. $sResult = $oObject->getElementBlock($aObjectOptions);
  169. if(empty($sResult))
  170. return '';
  171. return array($sResult, $this->_sClassMiSa);
  172. }
  173. protected function _getMenuItemVote($aItem, $aParams = array())
  174. {
  175. $CNF = &$this->_oModule->_oConfig->CNF;
  176. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  177. if(empty($sObject) && !empty($CNF['OBJECT_VOTES']))
  178. $sObject = $CNF['OBJECT_VOTES'];
  179. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  180. if(empty($iId))
  181. $iId = $this->_iContentId;
  182. $oObject = !empty($sObject) ? BxDolVote::getObjectInstance($sObject, $iId) : false;
  183. if(!$oObject || !$oObject->isEnabled())
  184. return '';
  185. $aObjectOptions = array(
  186. 'dynamic_mode' => $this->_bDynamicMode,
  187. 'show_do_vote_as_button' => $this->_bShowAsButton,
  188. 'show_do_vote_label' => $this->_bShowTitle
  189. );
  190. if(!empty($aParams['object_options']) && is_array($aParams['object_options']))
  191. $aObjectOptions = array_merge($aObjectOptions, $aParams['object_options']);
  192. if($this->_bIsApi)
  193. return [
  194. 'id' => $aItem['id'],
  195. 'name' => $aItem['name'],
  196. 'display_type' => 'element',
  197. 'data' => $oObject->getElementApi($aObjectOptions)
  198. ];
  199. $sResult = $oObject->getElementBlock($aObjectOptions);
  200. if(empty($sResult))
  201. return '';
  202. return array($sResult, $this->_sClassMiSa);
  203. }
  204. protected function _getMenuItemReaction($aItem, $aParams = array())
  205. {
  206. $CNF = &$this->_oModule->_oConfig->CNF;
  207. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  208. if(empty($sObject) && !empty($CNF['OBJECT_REACTIONS']))
  209. $sObject = $CNF['OBJECT_REACTIONS'];
  210. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  211. if(empty($iId))
  212. $iId = $this->_iContentId;
  213. $oObject = !empty($sObject) ? BxDolVote::getObjectInstance($sObject, $iId) : false;
  214. if(!$oObject || !$oObject->isEnabled())
  215. return '';
  216. $aObjectOptions = array(
  217. 'dynamic_mode' => $this->_bDynamicMode,
  218. 'show_do_vote_as_button' => $this->_bShowAsButton,
  219. 'show_do_vote_label' => $this->_bShowTitle
  220. );
  221. if(!empty($aParams['object_options']) && is_array($aParams['object_options']))
  222. $aObjectOptions = array_merge($aObjectOptions, $aParams['object_options']);
  223. if($this->_bIsApi)
  224. return [
  225. 'id' => $aItem['id'],
  226. 'name' => $aItem['name'],
  227. 'display_type' => 'element',
  228. 'data' => $oObject->getElementApi($aObjectOptions)
  229. ];
  230. $sResult = $oObject->getElementBlock($aObjectOptions);
  231. if(empty($sResult))
  232. return '';
  233. return array($sResult, $this->_sClassMiSa);
  234. }
  235. protected function _getMenuItemScore($aItem, $aParams = array())
  236. {
  237. $CNF = &$this->_oModule->_oConfig->CNF;
  238. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  239. if(empty($sObject) && !empty($CNF['OBJECT_SCORES']))
  240. $sObject = $CNF['OBJECT_SCORES'];
  241. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  242. if(empty($iId))
  243. $iId = $this->_iContentId;
  244. $oObject = !empty($sObject) ? BxDolScore::getObjectInstance($sObject, $iId) : false;
  245. if(!$oObject || !$oObject->isEnabled())
  246. return '';
  247. $aObjectOptions = array(
  248. 'dynamic_mode' => $this->_bDynamicMode,
  249. 'show_do_vote_as_button' => $this->_bShowAsButton,
  250. 'show_do_vote_label' => $this->_bShowTitle
  251. );
  252. if(!empty($aParams['object_options']) && is_array($aParams['object_options']))
  253. $aObjectOptions = array_merge($aObjectOptions, $aParams['object_options']);
  254. if($this->_bIsApi)
  255. return [
  256. 'id' => $aItem['id'],
  257. 'name' => $aItem['name'],
  258. 'display_type' => 'element',
  259. 'data' => $oObject->getElementApi($aObjectOptions)
  260. ];
  261. $sResult = $oObject->getElementBlock($aObjectOptions);
  262. if(empty($sResult))
  263. return '';
  264. return array($sResult, $this->_sClassMiSa);
  265. }
  266. protected function _getMenuItemFavorite($aItem, $aParams = array())
  267. {
  268. $CNF = &$this->_oModule->_oConfig->CNF;
  269. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  270. if(empty($sObject) && !empty($CNF['OBJECT_FAVORITES']))
  271. $sObject = $CNF['OBJECT_FAVORITES'];
  272. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  273. if(empty($iId))
  274. $iId = $this->_iContentId;
  275. $oObject = !empty($sObject) ? BxDolFavorite::getObjectInstance($sObject, $iId) : false;
  276. if(!$oObject || !$oObject->isEnabled())
  277. return '';
  278. $aObjectOptions = array(
  279. 'dynamic_mode' => $this->_bDynamicMode,
  280. 'show_do_favorite_as_button' => $this->_bShowAsButton,
  281. 'show_do_favorite_label' => $this->_bShowTitle
  282. );
  283. if(!empty($aParams['object_options']) && is_array($aParams['object_options']))
  284. $aObjectOptions = array_merge($aObjectOptions, $aParams['object_options']);
  285. if($this->_bIsApi)
  286. return $oObject->getElementApi($aObjectOptions);
  287. $sResult = $oObject->getElementBlock($aObjectOptions);
  288. if(empty($sResult))
  289. return '';
  290. return array($sResult, $this->_sClassMiSa);
  291. }
  292. protected function _getMenuItemFeature($aItem, $aParams = array())
  293. {
  294. $CNF = &$this->_oModule->_oConfig->CNF;
  295. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  296. if(empty($sObject) && !empty($CNF['OBJECT_FEATURED']))
  297. $sObject = $CNF['OBJECT_FEATURED'];
  298. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  299. if(empty($iId))
  300. $iId = $this->_iContentId;
  301. if(!$this->_isContentPublic($iId))
  302. return '';
  303. $oObject = !empty($sObject) ? BxDolFeature::getObjectInstance($sObject, $iId) : false;
  304. if(!$oObject || !$oObject->isEnabled())
  305. return '';
  306. $aObjectOptions = array(
  307. 'dynamic_mode' => $this->_bDynamicMode,
  308. 'show_do_feature_as_button' => $this->_bShowAsButton,
  309. 'show_do_feature_label' => $this->_bShowTitle
  310. );
  311. if(!empty($aParams['object_options']) && is_array($aParams['object_options']))
  312. $aObjectOptions = array_merge($aObjectOptions, $aParams['object_options']);
  313. if($this->_bIsApi)
  314. return $oObject->getElementApi($aObjectOptions);
  315. $sResult = $oObject->getElementBlock($aObjectOptions);
  316. if(empty($sResult))
  317. return '';
  318. return array($sResult, $this->_sClassMiSa);
  319. }
  320. protected function _getMenuItemRepost($aItem, $aParams = array())
  321. {
  322. $CNF = &$this->_oModule->_oConfig->CNF;
  323. $sAction = !empty($aParams['action']) ? $aParams['action'] : '';
  324. if(empty($sAction))
  325. $sAction = 'added';
  326. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  327. if(empty($iId))
  328. $iId = $this->_iContentId;
  329. $aContentInfo = $this->_oModule->_oDb->getContentInfoById($iId);
  330. if(!empty($CNF['FIELD_PUBLISHED']) && isset($aContentInfo[$CNF['FIELD_PUBLISHED']]) && (int)$aContentInfo[$CNF['FIELD_PUBLISHED']] > time())
  331. return '';
  332. if(!empty($CNF['FIELD_ALLOW_VIEW_TO']) && isset($aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']]) && (int)$aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']] > 0 && !in_array((int)$aContentInfo[$CNF['FIELD_ALLOW_VIEW_TO']], array(BX_DOL_PG_ALL, BX_DOL_PG_MEMBERS)))
  333. return '';
  334. $sStatus = 'active';
  335. if(!empty($CNF['FIELD_STATUS']) && isset($aContentInfo[$CNF['FIELD_STATUS']]) && $aContentInfo[$CNF['FIELD_STATUS']] != $sStatus)
  336. return '';
  337. if(!empty($CNF['FIELD_STATUS_ADMIN']) && isset($aContentInfo[$CNF['FIELD_STATUS_ADMIN']]) && $aContentInfo[$CNF['FIELD_STATUS_ADMIN']] != $sStatus)
  338. return '';
  339. $aSrvParams = [bx_get_logged_profile_id(), $this->_oModule->_oConfig->getName(), $sAction, $iId, [
  340. 'do' => !empty($aParams['do']) ? $aParams['do'] : 'repost',
  341. 'show_do_repost_as_button' => $this->_bShowAsButton,
  342. 'show_do_repost_text' => $this->_bShowTitle
  343. ]];
  344. if($this->_bIsApi && BxDolRequest::serviceExists('bx_timeline', 'get_repost_element_block_api'))
  345. return bx_srv('bx_timeline', 'get_repost_element_block_api', $aSrvParams);
  346. if(!BxDolRequest::serviceExists('bx_timeline', 'get_repost_element_block'))
  347. return '';
  348. $sResult = bx_srv('bx_timeline', 'get_repost_element_block', $aSrvParams);
  349. if(empty($sResult))
  350. return '';
  351. return array($sResult, $this->_sClassMiSa);
  352. }
  353. protected function _getMenuItemRepostWithText($aItem, $aParams = [])
  354. {
  355. return $this->_getMenuItemRepost($aItem, array_merge($aParams, [
  356. 'do' => 'repost_with'
  357. ]));
  358. }
  359. protected function _getMenuItemRepostToContext($aItem, $aParams = [])
  360. {
  361. return $this->_getMenuItemRepost($aItem, array_merge($aParams, [
  362. 'do' => 'repost_to'
  363. ]));
  364. }
  365. protected function _getMenuItemReport($aItem, $aParams = array())
  366. {
  367. $CNF = &$this->_oModule->_oConfig->CNF;
  368. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  369. if(empty($sObject) && !empty($CNF['OBJECT_REPORTS']))
  370. $sObject = $CNF['OBJECT_REPORTS'];
  371. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  372. if(empty($iId))
  373. $iId = $this->_iContentId;
  374. $oObject = !empty($sObject) ? BxDolReport::getObjectInstance($sObject, $iId) : false;
  375. if(!$oObject || !$oObject->isEnabled())
  376. return '';
  377. $aObjectOptions = array(
  378. 'dynamic_mode' => $this->_bDynamicMode,
  379. 'show_do_report_as_button' => $this->_bShowAsButton,
  380. 'show_do_report_label' => $this->_bShowTitle
  381. );
  382. if(!empty($aParams['object_options']) && is_array($aParams['object_options']))
  383. $aObjectOptions = array_merge($aObjectOptions, $aParams['object_options']);
  384. if($this->_bIsApi)
  385. return [
  386. 'id' => $aItem['id'],
  387. 'name' => $aItem['name'],
  388. 'display_type' => 'element',
  389. 'data' => $oObject->getElementApi($aObjectOptions)
  390. ];
  391. $sResult = $oObject->getElementBlock($aObjectOptions);
  392. if(empty($sResult))
  393. return '';
  394. return array($sResult, $this->_sClassMiSa);
  395. }
  396. protected function _getMenuItemNotes($aItem, $aParams = array())
  397. {
  398. $CNF = &$this->_oModule->_oConfig->CNF;
  399. $sObject = !empty($aParams['object']) ? $aParams['object'] : '';
  400. if(empty($sObject) && !empty($CNF['OBJECT_NOTES']))
  401. $sObject = $CNF['OBJECT_NOTES'];
  402. $iId = !empty($aParams['id']) ? (int)$aParams['id'] : '';
  403. if(empty($iId))
  404. $iId = $this->_iContentId;
  405. if(!$this->_oModule->_isModerator())
  406. return false;
  407. $this->addMarkers(array(
  408. 'content_id' => $iId
  409. ));
  410. return true;
  411. }
  412. protected function _getMenuItemByNameActions($aItem, $aParams = array())
  413. {
  414. $CNF = &$this->_oModule->_oConfig->CNF;
  415. if(empty($this->_oMenuActions)) {
  416. $sObjectMenu = !empty($aParams['object_menu']) ? $aParams['object_menu'] : '';
  417. if(empty($sObjectMenu) && !empty($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY']))
  418. $sObjectMenu = $CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY'];
  419. if(empty($sObjectMenu))
  420. return '';
  421. $this->_oMenuActions = BxDolMenu::getObjectInstance($sObjectMenu);
  422. if(!$this->_oMenuActions)
  423. return '';
  424. $this->_oMenuActions->setContentId($this->_iContentId);
  425. $this->addMarkers($this->_oMenuActions->getMarkers());
  426. }
  427. $aItem = $this->_oMenuActions->getMenuItem($aItem['name']);
  428. if(empty($aItem) || !is_array($aItem))
  429. return false;
  430. if($this->_bIsApi)
  431. return $aItem;
  432. else
  433. return $this->_getMenuItemDefault($aItem);
  434. }
  435. protected function _getMenuItemByNameSocialSharing($aItem, $aParams = array())
  436. {
  437. if(empty($this->_oMenuSocialSharing) && !$this->_initMenuSocialSharing())
  438. return false;
  439. $aItem = $this->_oMenuSocialSharing->getMenuItem($aItem['name']);
  440. if(empty($aItem) || !is_array($aItem))
  441. return false;
  442. if($this->_bIsApi)
  443. return $aItem;
  444. else
  445. return $this->_getMenuItemDefault($aItem);
  446. }
  447. protected function _getMenuItemByNameActionDelete($aItem)
  448. {
  449. $oProfile = $this->_oModule->getProfileObject(($this->_iContentId));
  450. if (!$this->_oModule->isAllowDeleteOrDisable(bx_get_logged_profile_id(), $oProfile->id()))
  451. return false;
  452. return $this->_getMenuItemByNameActionsMore($aItem);
  453. }
  454. protected function _getMenuItemByNameActionsMore($aItem)
  455. {
  456. $CNF = &$this->_oModule->_oConfig->CNF;
  457. if(empty($this->_oMenuActionsMore)) {
  458. if(empty($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']))
  459. return '';
  460. $this->_oMenuActionsMore = BxDolMenu::getObjectInstance($CNF['OBJECT_MENU_ACTIONS_VIEW_ENTRY_MORE']);
  461. if(!$this->_oMenuActionsMore)
  462. return '';
  463. $this->_oMenuActionsMore->setContentId($this->_iContentId);
  464. $this->addMarkers($this->_oMenuActionsMore->getMarkers());
  465. }
  466. $aItem = $this->_oMenuActionsMore->getMenuItem($aItem['name']);
  467. if(empty($aItem) || !is_array($aItem))
  468. return false;
  469. if($this->_bIsApi)
  470. return $aItem;
  471. else
  472. return $this->_getMenuItemDefault($aItem);
  473. }
  474. }
  475. /** @} */