BxBaseModProfileMenuManageTools.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup BaseProfile Base classes for profile modules
  7. * @ingroup TridentModules
  8. *
  9. * @{
  10. */
  11. bx_import('BxBaseModGeneralMenuManageTools');
  12. /**
  13. * Manage tools submenu
  14. */
  15. class BxBaseModProfileMenuManageTools extends BxBaseModGeneralMenuManageTools
  16. {
  17. public function __construct($aObject, $oTemplate = false)
  18. {
  19. parent::__construct($aObject, $oTemplate);
  20. }
  21. /**
  22. * Check if menu items is visible.
  23. * @param $a menu item array
  24. * @return boolean
  25. */
  26. protected function _isVisible ($a)
  27. {
  28. if(!parent::_isVisible($a))
  29. return false;
  30. if(empty($this->_aContentInfo) || !is_array($this->_aContentInfo))
  31. return false;
  32. $sCheckFuncName = '';
  33. switch ($a['name']) {
  34. case 'delete':
  35. case 'delete-with-content':
  36. if($this->_oModule->checkMyself($this->_iContentId))
  37. return false;
  38. $sCheckFuncName = 'checkAllowedDelete';
  39. break;
  40. }
  41. if(!$sCheckFuncName || !method_exists($this->_oModule, $sCheckFuncName))
  42. return true;
  43. return $this->_oModule->{$sCheckFuncName}($this->_aContentInfo) === CHECK_ACTION_RESULT_ALLOWED;
  44. }
  45. }
  46. /** @} */