BxDolStudioMenuTop.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  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 UnaStudio UNA Studio
  7. * @{
  8. */
  9. define('BX_DOL_STUDIO_MT_LEFT', 'left');
  10. define('BX_DOL_STUDIO_MT_CENTER', 'center');
  11. define('BX_DOL_STUDIO_MT_RIGHT', 'right');
  12. define('BX_DOL_STUDIO_MTB_CIRCLE', 'circ');
  13. define('BX_DOL_STUDIO_MTB_RECTANGLE', 'rect');
  14. class BxDolStudioMenuTop extends BxDol
  15. {
  16. protected $aItems;
  17. protected $aVisible;
  18. function __construct()
  19. {
  20. parent::__construct();
  21. $this->aVisible = array(
  22. BX_DOL_STUDIO_MT_LEFT => false,
  23. BX_DOL_STUDIO_MT_CENTER => false,
  24. BX_DOL_STUDIO_MT_RIGHT => false
  25. );
  26. $this->aItems[BX_DOL_STUDIO_MT_LEFT] = array(
  27. 'edit' => array(
  28. 'name' => 'edit',
  29. 'icon' => 'move',
  30. 'onclick' => $this->getJsObject() . '.clickEdit(this);',
  31. 'title' => '_adm_tmi_cpt_edit'
  32. ),
  33. 'favorite' => array(
  34. 'name' => 'favorite',
  35. 'icon' => 'star',
  36. 'onclick' => $this->getJsObject() . '.clickFavorite(this);',
  37. 'title' => '_adm_tmi_cpt_favorite'
  38. ),
  39. 'extensions' => array(
  40. 'name' => 'extensions',
  41. 'icon' => 'plus',
  42. 'link' => BX_DOL_URL_STUDIO . 'store.php?page=goodies',
  43. 'title' => '_adm_tmi_cpt_extensions'
  44. ),
  45. );
  46. $aMatch = array();
  47. $iResult = preg_match("/^(https?:\/\/)?(.*)\/$/", BX_DOL_URL_ROOT, $aMatch);
  48. $this->aItems[BX_DOL_STUDIO_MT_CENTER] = $iResult ? $aMatch[2] : '';
  49. $this->aItems[BX_DOL_STUDIO_MT_RIGHT] = array(
  50. 'tour' => array(
  51. 'name' => 'tour',
  52. 'icon' => 'question',
  53. 'link' => 'javascript:void(0);',
  54. 'onclick' => 'glTour.start()',
  55. 'title' => '_adm_tmi_cpt_tour'
  56. ),
  57. 'site' => array(
  58. 'name' => 'site',
  59. 'icon' => 'home',
  60. 'link' => BX_DOL_URL_ROOT,
  61. 'title' => '_adm_tmi_cpt_site'
  62. ),
  63. 'logout' => array(
  64. 'name' => 'logout',
  65. 'icon' => 'power-off',
  66. 'link' => BX_DOL_URL_ROOT . 'logout.php',
  67. 'onclick' => $this->getJsObject() . ".clickLogout(this);",
  68. 'title' => '_adm_tmi_cpt_logout'
  69. )
  70. );
  71. }
  72. function setVisible($sPosition, $bValue)
  73. {
  74. $this->aVisible[$sPosition] = $bValue;
  75. }
  76. function setVisibleAll()
  77. {
  78. $this->aVisible = array(
  79. BX_DOL_STUDIO_MT_LEFT => true,
  80. BX_DOL_STUDIO_MT_CENTER => true,
  81. BX_DOL_STUDIO_MT_RIGHT => true
  82. );
  83. }
  84. }
  85. /** @} */