1
0

BxBaseModGeneralMenuViewActions.php 21 KB

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