BxDolStudioMenuTop.php 2.4 KB

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