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 net_nemein_downloads_navigation {
  6.  
  7. var $_object;
  8. var $_l10n;
  9. var $_l10n_midcom;
  10.  
  11. function net_nemein_downloads_navigation() {
  12. $this->_object = null;
  13. $i18n =& $GLOBALS["midcom"]->get_service("i18n");
  14. $this->_l10n = $i18n->get_l10n("net.nemein.downloads");
  15. $this->_l10n_midcom = $i18n->get_l10n("midcom");
  16. }
  17.  
  18.  
  19. function is_internal() {
  20.  
  21. // return true if the current topic should not be displayed by NAP
  22. return false;
  23. }
  24.  
  25.  
  26. function get_leaves() {
  27.  
  28. // list leaves under the current topic. for example:
  29.  
  30. $topic = &$this->_object;
  31. $leaves = array ();
  32. if ($articles = mgd_list_topic_articles($topic->id, "reverse created")) {
  33. // Prep toolbar
  34. $toolbar[50] = Array(
  35. MIDCOM_TOOLBAR_URL => '',
  36. MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('edit'),
  37. MIDCOM_TOOLBAR_HELPTEXT => null,
  38. MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/edit.png',
  39. MIDCOM_TOOLBAR_ENABLED => true
  40. );
  41. $toolbar[51] = Array(
  42. MIDCOM_TOOLBAR_URL => '',
  43. MIDCOM_TOOLBAR_LABEL => $this->_l10n_midcom->get('delete'),
  44. MIDCOM_TOOLBAR_HELPTEXT => null,
  45. MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/trash.png',
  46. MIDCOM_TOOLBAR_ENABLED => true
  47. );
  48. while ($articles->fetch ()) {
  49. // Match the toolbar to the correct URL.
  50. $toolbar[50][MIDCOM_TOOLBAR_URL] = "edit/{$articles->id}.html";
  51. $toolbar[51][MIDCOM_TOOLBAR_URL] = "delete/{$articles->id}.html";
  52. $leaves[$articles->id] = array (
  53. MIDCOM_NAV_SITE => Array (
  54. MIDCOM_NAV_URL => $articles->name.".html",
  55. MIDCOM_NAV_NAME => $articles->title),
  56. MIDCOM_NAV_ADMIN => Array (
  57. MIDCOM_NAV_URL => "view/" . $articles->id,
  58. MIDCOM_NAV_NAME => $articles->title),
  59. MIDCOM_NAV_GUID => $articles->guid(),
  60. MIDCOM_NAV_TOOLBAR => $toolbar,
  61. MIDCOM_META_CREATOR => $articles->creator,
  62. MIDCOM_META_EDITOR => $articles->revisor,
  63. MIDCOM_META_CREATED => $articles->created,
  64. MIDCOM_META_EDITED => $articles->revised
  65. );
  66. }
  67. }
  68. return $leaves;
  69. }
  70.  
  71.  
  72. function get_node() {
  73.  
  74. // information about the current node (topic)
  75. $topic = &$this->_object;
  76. // Create Toolbar
  77. $toolbar[100] = Array
  78. (
  79. MIDCOM_TOOLBAR_URL => '',
  80. MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('set current release'),
  81. MIDCOM_TOOLBAR_HELPTEXT => null,
  82. MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_folder-properties.png',
  83. MIDCOM_TOOLBAR_ENABLED => true
  84. );
  85. $toolbar[0] = Array(
  86. MIDCOM_TOOLBAR_URL => '',
  87. MIDCOM_TOOLBAR_LABEL => $this->_l10n->get('create new release'),
  88. MIDCOM_TOOLBAR_HELPTEXT => null,
  89. MIDCOM_TOOLBAR_ICON => 'stock-icons/16x16/stock_new.png',
  90. MIDCOM_TOOLBAR_ENABLED => true
  91. );
  92. return array (
  93. MIDCOM_NAV_URL => "",
  94. MIDCOM_NAV_NAME => $topic->extra,
  95. MIDCOM_NAV_TOOLBAR => $toolbar,
  96. MIDCOM_META_CREATOR => $topic->creator,
  97. MIDCOM_META_EDITOR => $topic->revisor,
  98. MIDCOM_META_CREATED => $topic->created,
  99. MIDCOM_META_EDITED => $topic->revised
  100. );
  101. }
  102.  
  103.  
  104. function set_object($object) {
  105.  
  106. debug_add ("Component: setting NAP Element to " . $object->name ." [" . $object->id . "]");
  107. $this->_object = $object;
  108. return true;
  109. }
  110.  
  111.  
  112. function get_current_leaf() {
  113. return $GLOBALS["net_nemein_downloads_nap_activeid"];
  114. }
  115.  
  116. } // navigation
  117.  
  118. ?>

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