BxDolStudioMenuTop.php 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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 DolphinStudio Dolphin 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. );
  42. $aMatch = array();
  43. $iResult = preg_match("/^(https?:\/\/)?(.*)\/$/", BX_DOL_URL_ROOT, $aMatch);
  44. $this->aItems[BX_DOL_STUDIO_MT_CENTER] = $iResult ? $aMatch[2] : '';
  45. $this->aItems[BX_DOL_STUDIO_MT_RIGHT] = array(
  46. 'site' => array(
  47. 'name' => 'site',
  48. 'icon' => 'home',
  49. 'link' => BX_DOL_URL_ROOT,
  50. 'title' => '_adm_tmi_cpt_site'
  51. ),
  52. 'logout' => array(
  53. 'name' => 'logout',
  54. 'icon' => 'power-off',
  55. 'link' => BX_DOL_URL_ROOT . 'logout.php',
  56. 'onclick' => $this->getJsObject() . ".clickLogout(this);",
  57. 'title' => '_adm_tmi_cpt_logout'
  58. )
  59. );
  60. }
  61. function setVisible($sPosition, $bValue)
  62. {
  63. $this->aVisible[$sPosition] = $bValue;
  64. }
  65. function setVisibleAll()
  66. {
  67. $this->aVisible = array(
  68. BX_DOL_STUDIO_MT_LEFT => true,
  69. BX_DOL_STUDIO_MT_CENTER => true,
  70. BX_DOL_STUDIO_MT_RIGHT => true
  71. );
  72. }
  73. }
  74. /** @} */