Source for file navigation.php

Documentation is available at navigation.php

  1. <?php
  2.  
  3. /* NAP code, called by the "nap" interface class */
  4.  
  5. class midgard_admin_sitewizard_navigation {
  6.  
  7. var $_object;
  8. var $_l10n;
  9. var $_l10n_midcom;
  10.  
  11. function midgard_admin_sitewizard_navigation() {
  12. $this->_object = null;
  13. $i18n =& $GLOBALS["midcom"]->get_service("i18n");
  14. $this->_l10n = $i18n->get_l10n("midgard.admin.sitewizard");
  15. $this->_l10n_midcom = $i18n->get_l10n("midcom");
  16. }
  17.  
  18.  
  19. function is_internal() {
  20. // return true if the current topic should not be displayed by NAP
  21. return false;
  22. }
  23.  
  24. function get_leaves() {
  25.  
  26. $topic = &$this->_object;
  27. $leaves = array ();
  28. $hosts = mgd_list_hosts();
  29. if ($hosts) {
  30. while ($hosts->fetch ()) {
  31. if ($GLOBALS["midgard"]->sitegroup != 0 && $hosts->sitegroup != $GLOBALS["midgard"]->sitegroup) {
  32. // If we're in SG, display only hosts in same SG(s)
  33. $visible = false;
  34. } elseif ($hosts->id == $GLOBALS["midgard"]->host) {
  35. // Hide the host we're in
  36. $visible = false;
  37. } elseif (substr($hosts->prefix,0,12) == "/attachment/") {
  38. // Hide Aegir attachment hosts
  39. $visible = false;
  40. } elseif (substr($hosts->prefix,0,6) == "/aegir") {
  41. // Hide Aegir hosts
  42. $visible = false;
  43. } elseif (substr($hosts->prefix,0,13) == "/spider-admin") {
  44. // Hide SpiderAdmin hosts
  45. $visible = false;
  46. } elseif (substr($hosts->prefix,0,7) == "/asgard") {
  47. // Hide Asgard hosts
  48. $visible = false;
  49. } else {
  50. $visible = true;
  51. }
  52. $leaves[$hosts->id] = array (
  53. MIDCOM_NAV_SITE => Array (
  54. MIDCOM_NAV_URL => $hosts->sitegroup."/".$hosts->id.".html",
  55. MIDCOM_NAV_NAME => $hosts->hostname
  56. ),
  57. MIDCOM_NAV_ADMIN => Array (
  58. MIDCOM_NAV_URL => "",
  59. MIDCOM_NAV_NAME => $hosts->hostname
  60. ),
  61. MIDCOM_NAV_GUID => $hosts->guid(),
  62. MIDCOM_NAV_TOOLBAR => array(),
  63. MIDCOM_NAV_VISIBLE => $visible,
  64. MIDCOM_META_CREATOR => null,
  65. MIDCOM_META_EDITOR => null,
  66. MIDCOM_META_CREATED => null,
  67. MIDCOM_META_EDITED => null
  68. );
  69. }
  70. }
  71. return $leaves;
  72. }
  73.  
  74.  
  75. function get_node() {
  76.  
  77. // information about the current node (topic)
  78. $topic = &$this->_object;
  79. $toolbar[0] = Array(
  80. MIDCOM_TOOLBAR_URL => 'create.html',
  81. MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('create'),
  82. MIDCOM_TOOLBAR_HELPTEXT => null,
  83. MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new.png',
  84. MIDCOM_TOOLBAR_ENABLED => true
  85. );
  86. $toolbar[100] = Array(
  87. MIDCOM_TOOLBAR_URL => '',
  88. MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('component configuration'),
  89. MIDCOM_TOOLBAR_HELPTEXT => $this->_l10n_midcom->get('component configuration helptext'),
  90. MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png',
  91. MIDCOM_TOOLBAR_ENABLED => true
  92. );
  93. return array (
  94. MIDCOM_NAV_URL => "",
  95. MIDCOM_NAV_NAME => $topic->extra,
  96. MIDCOM_NAV_VISIBLE => true,
  97. MIDCOM_NAV_TOOLBAR => $toolbar,
  98. MIDCOM_META_CREATOR => $topic->creator,
  99. MIDCOM_META_EDITOR => $topic->revisor,
  100. MIDCOM_META_CREATED => $topic->created,
  101. MIDCOM_META_EDITED => $topic->revised
  102. );
  103. }
  104.  
  105.  
  106. function set_object($object) {
  107.  
  108. debug_add ("Component: setting NAP Element to " . $object->name ." [" . $object->id . "]");
  109. $this->_object = $object;
  110. return true;
  111.  
  112. }
  113.  
  114. function get_current_leaf() {
  115. return $GLOBALS["midgard_admin_sitewizard_nap_activeid"];
  116. }
  117.  
  118. }
  119.  
  120. ?>

Documentation generated on Mon, 21 Nov 2005 18:20:23 +0100 by phpDocumentor 1.3.0RC3