BxBaseMenuDashboardManageTools.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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(
  29. 'counter1_value' => 0, 'counter1_caption' => _t('_sys_menu_dashboard_manage_tools_addon_counter1_caption_default'),
  30. 'counter2_value' => 0, 'counter2_caption' => _t('_sys_menu_dashboard_manage_tools_addon_counter2_caption_default'),
  31. 'counter3_value' => 0, 'counter3_caption' => ''
  32. );
  33. if (is_array($mixedAddon)){
  34. $aValues = array_merge($aValues, $mixedAddon);
  35. }
  36. else{
  37. $aValues['counter1_value'] = $mixedAddon;
  38. }
  39. $aTmp = array(
  40. 'bx_if:counter1' => array(
  41. 'condition' => $aValues['counter1_value'] > 0,
  42. 'content' => array(
  43. 'value' => $aValues['counter1_value'],
  44. 'caption' => $aValues['counter1_caption']
  45. )
  46. ),
  47. 'bx_if:counter2' => array(
  48. 'condition' => $aValues['counter2_value'] > 0,
  49. 'content' => array(
  50. 'value' => $aValues['counter2_value'],
  51. 'caption' => $aValues['counter2_caption']
  52. )
  53. ),
  54. 'total_value' => $aValues['counter3_value'],
  55. 'total_caption' => $aValues['counter3_caption']
  56. );
  57. return array(
  58. 'addon' => (trim($aValues['counter1_value']) != '' || trim($aValues['counter2_value']) != ''),
  59. 'addonf' => $this->_oTemplate->parseHtmlByName('menu_item_dashboard_manage_tools_addon.html', $aTmp)
  60. );
  61. }
  62. }
  63. /** @} */