BxDolStudioMenuTop.php 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. <?php defined('BX_DOL') or die('hack attempt');
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup TridentStudio Trident Studio
  7. * @{
  8. */
  9. bx_import('BxDol');
  10. bx_import('BxBaseStudioLauncher');
  11. define('BX_DOL_STUDIO_MT_LEFT', 'left');
  12. define('BX_DOL_STUDIO_MT_CENTER', 'center');
  13. define('BX_DOL_STUDIO_MT_RIGHT', 'right');
  14. define('BX_DOL_STUDIO_MTB_CIRCLE', 'circ');
  15. define('BX_DOL_STUDIO_MTB_RECTANGLE', 'rect');
  16. class BxDolStudioMenuTop extends BxDol
  17. {
  18. protected $aItems;
  19. protected $aVisible;
  20. function __construct()
  21. {
  22. parent::__construct();
  23. $this->aVisible = array(
  24. BX_DOL_STUDIO_MT_LEFT => false,
  25. BX_DOL_STUDIO_MT_CENTER => false,
  26. BX_DOL_STUDIO_MT_RIGHT => false
  27. );
  28. $this->aItems[BX_DOL_STUDIO_MT_LEFT] = array(
  29. 'edit' => array(
  30. 'name' => 'edit',
  31. 'icon' => 'move',
  32. 'onclick' => $this->getJsObject() . '.clickEdit(this);',
  33. 'title' => '_adm_tmi_cpt_edit'
  34. ),
  35. 'favorite' => array(
  36. 'name' => 'favorite',
  37. 'icon' => 'star',
  38. 'onclick' => $this->getJsObject() . '.clickFavorite(this);',
  39. 'title' => '_adm_tmi_cpt_favorite'
  40. ),
  41. 'extensions' => array(
  42. 'name' => 'extensions',
  43. 'icon' => 'plus',
  44. 'link' => BX_DOL_URL_STUDIO . 'store.php?page=goodies',
  45. 'title' => '_adm_tmi_cpt_extensions'
  46. ),
  47. );
  48. $aMatch = array();
  49. $iResult = preg_match("/^(https?:\/\/)?(.*)\/$/", BX_DOL_URL_ROOT, $aMatch);
  50. $this->aItems[BX_DOL_STUDIO_MT_CENTER] = $iResult ? $aMatch[2] : '';
  51. $this->aItems[BX_DOL_STUDIO_MT_RIGHT] = array(
  52. 'site' => array(
  53. 'name' => 'site',
  54. 'icon' => 'home',
  55. 'link' => BX_DOL_URL_ROOT,
  56. 'title' => '_adm_tmi_cpt_site'
  57. ),
  58. 'logout' => array(
  59. 'name' => 'logout',
  60. 'icon' => 'power-off',
  61. 'link' => BX_DOL_URL_ROOT . 'logout.php',
  62. 'onclick' => $this->getJsObject() . ".clickLogout(this);",
  63. 'title' => '_adm_tmi_cpt_logout'
  64. )
  65. );
  66. }
  67. function setVisible($sPosition, $bValue)
  68. {
  69. $this->aVisible[$sPosition] = $bValue;
  70. }
  71. function setVisibleAll()
  72. {
  73. $this->aVisible = array(
  74. BX_DOL_STUDIO_MT_LEFT => true,
  75. BX_DOL_STUDIO_MT_CENTER => true,
  76. BX_DOL_STUDIO_MT_RIGHT => true
  77. );
  78. }
  79. }
  80. /** @} */