BxBaseMenuDashboardManageTools.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. * Menu representation.
  11. * @see BxDolMenu
  12. */
  13. class BxBaseMenuDashboardManageTools extends BxTemplMenu
  14. {
  15. public function __construct ($aObject, $oTemplate)
  16. {
  17. parent::__construct ($aObject, $oTemplate);
  18. }
  19. protected function _getMenuIcon ($a)
  20. {
  21. $aTmp = parent::_getMenuIcon ($a);
  22. if (trim($aTmp[0]) == '')
  23. $aTmp[0] = 'user-cog';
  24. return $aTmp;
  25. }
  26. protected function _getTmplVarsAddon($mixedAddon, $aMenuItem)
  27. {
  28. $aValues = array('counter1_value' => 0, 'counter1_caption' => _t('_sys_menu_dashboard_manage_tools_addon_counter1_caption_default'), 'counter2_value' => 0, 'counter2_caption' => _t('_sys_menu_dashboard_manage_tools_addon_counter2_caption_default'));
  29. if (is_array($mixedAddon)){
  30. $aValues = array_merge($aValues, $mixedAddon);
  31. }
  32. else{
  33. $aValues['counter1_value'] = $mixedAddon;
  34. }
  35. $aTmp = array(
  36. 'bx_if:counter1' => array(
  37. 'condition' => $aValues['counter1_value'] > 0,
  38. 'content' => array(
  39. 'value' => $aValues['counter1_value'],
  40. 'caption' => $aValues['counter1_caption']
  41. )
  42. ),
  43. 'bx_if:counter2' => array(
  44. 'condition' => $aValues['counter2_value'] > 0,
  45. 'content' => array(
  46. 'value' => $aValues['counter2_value'],
  47. 'caption' => $aValues['counter2_caption']
  48. )
  49. ),
  50. 'bx_if:counter1and2' => array(
  51. 'condition' => ($aValues['counter1_value'] > 0 && $aValues['counter2_value'] > 0),
  52. 'content' => array()
  53. )
  54. );
  55. return array(
  56. 'addon' => (trim($aValues['counter1_value']) != '' || trim($aValues['counter2_value']) != ''),
  57. 'addonf' => $this->_oTemplate->parseHtmlByTemplateName('menu_item_dashboard_manage_tools_addon', $aTmp)
  58. );
  59. }
  60. }
  61. /** @} */