BxBaseMenuDashboardManageTools.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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. $this->_bDisplayAddons = true;
  19. }
  20. protected function _getMenuIcon ($a)
  21. {
  22. $aTmp = parent::_getMenuIcon ($a);
  23. if (trim($aTmp[0]) == '')
  24. $aTmp[0] = 'user-cog';
  25. return $aTmp;
  26. }
  27. protected function _getTmplVarsAddon($mixedAddon, $aMenuItem)
  28. {
  29. $aValues = array(
  30. 'counter1_value' => 0, 'counter1_caption' => _t('_sys_menu_dashboard_manage_tools_addon_counter1_caption_default'),
  31. 'counter2_value' => 0, 'counter2_caption' => _t('_sys_menu_dashboard_manage_tools_addon_counter2_caption_default'),
  32. 'counter3_value' => 0, 'counter3_caption' => ''
  33. );
  34. if (is_array($mixedAddon)){
  35. $aValues = array_merge($aValues, $mixedAddon);
  36. }
  37. else{
  38. $aValues['counter1_value'] = $mixedAddon;
  39. }
  40. $aTmp = array(
  41. 'bx_if:counter1' => array(
  42. 'condition' => $aValues['counter1_value'] > 0,
  43. 'content' => array(
  44. 'value' => $aValues['counter1_value'],
  45. 'caption' => $aValues['counter1_caption']
  46. )
  47. ),
  48. 'bx_if:counter2' => array(
  49. 'condition' => $aValues['counter2_value'] > 0,
  50. 'content' => array(
  51. 'value' => $aValues['counter2_value'],
  52. 'caption' => $aValues['counter2_caption']
  53. )
  54. ),
  55. 'bx_if:counter3' => array(
  56. 'condition' => $aValues['counter3_value'] > 0,
  57. 'content' => array(
  58. 'total_value' => $aValues['counter3_value'],
  59. 'total_caption' => $aValues['counter3_caption']
  60. )
  61. ),
  62. );
  63. return array(
  64. 'addon' => (trim($aValues['counter1_value']) != '' || trim($aValues['counter2_value']) != ''),
  65. 'addonf' => $this->_oTemplate->parseHtmlByName('menu_item_dashboard_manage_tools_addon.html', $aTmp)
  66. );
  67. }
  68. }
  69. /** @} */