BxBaseMenuDashboardManageTools.php 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. 'link' => $aMenuItem['link'] . '?order_field=reports&order_dir=desc'
  54. )
  55. ),
  56. 'bx_if:counter3' => array(
  57. 'condition' => $aValues['counter3_value'] > 0,
  58. 'content' => array(
  59. 'total_value' => $aValues['counter3_value'],
  60. 'total_caption' => $aValues['counter3_caption']
  61. )
  62. ),
  63. );
  64. return array(
  65. 'addon' => (trim($aValues['counter1_value']) != '' || trim($aValues['counter2_value']) != ''),
  66. 'addonf' => $this->_oTemplate->parseHtmlByName('menu_item_dashboard_manage_tools_addon.html', $aTmp)
  67. );
  68. }
  69. }
  70. /** @} */