BxDolStudioMenuTop.php 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <?php
  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. defined('BX_DOL') or die('hack attempt');
  10. bx_import('BxDol');
  11. bx_import('BxBaseStudioLauncher');
  12. define('BX_DOL_STUDIO_MT_LEFT', 'left');
  13. define('BX_DOL_STUDIO_MT_CENTER', 'center');
  14. define('BX_DOL_STUDIO_MT_RIGHT', 'right');
  15. define('BX_DOL_STUDIO_MTB_CIRCLE', 'circ');
  16. define('BX_DOL_STUDIO_MTB_RECTANGLE', 'rect');
  17. class BxDolStudioMenuTop extends BxDol {
  18. protected $aItems;
  19. protected $aVisible;
  20. function BxDolStudioMenuTop() {
  21. parent::BxDol();
  22. $this->aVisible = array(
  23. BX_DOL_STUDIO_MT_LEFT => false,
  24. BX_DOL_STUDIO_MT_CENTER => false,
  25. BX_DOL_STUDIO_MT_RIGHT => false
  26. );
  27. $this->aItems[BX_DOL_STUDIO_MT_LEFT] = array(
  28. 'edit' => array(
  29. 'name' => 'edit',
  30. 'icon' => 'move',
  31. 'onclick' => $this->getJsObject() . '.clickEdit(this);',
  32. 'title' => '_adm_tmi_cpt_edit'
  33. ),
  34. 'favorite' => array(
  35. 'name' => 'favorite',
  36. 'icon' => 'star',
  37. 'onclick' => $this->getJsObject() . '.clickFavorite(this);',
  38. 'title' => '_adm_tmi_cpt_favorite'
  39. ),
  40. );
  41. $aMatch = array();
  42. $iResult = preg_match("/^(https?:\/\/)?(.*)\/$/", BX_DOL_URL_ROOT, $aMatch);
  43. $this->aItems[BX_DOL_STUDIO_MT_CENTER] = $iResult ? $aMatch[2] : '';
  44. $this->aItems[BX_DOL_STUDIO_MT_RIGHT] = array(
  45. 'site' => array(
  46. 'name' => 'site',
  47. 'icon' => 'home',
  48. 'link' => BX_DOL_URL_ROOT,
  49. 'title' => '_adm_tmi_cpt_site'
  50. ),
  51. 'logout' => array(
  52. 'name' => 'logout',
  53. 'icon' => 'off',
  54. 'link' => BX_DOL_URL_ROOT . 'logout.php',
  55. 'onclick' => $this->getJsObject() . ".clickLogout(this);",
  56. 'title' => '_adm_tmi_cpt_logout'
  57. )
  58. );
  59. }
  60. function setVisible($sPosition, $bValue) {
  61. $this->aVisible[$sPosition] = $bValue;
  62. }
  63. function setVisibleAll() {
  64. $this->aVisible = array(
  65. BX_DOL_STUDIO_MT_LEFT => true,
  66. BX_DOL_STUDIO_MT_CENTER => true,
  67. BX_DOL_STUDIO_MT_RIGHT => true
  68. );
  69. }
  70. }
  71. /** @} */