Source for file MenuItemLinkWithAdditionalHtml.class.php

Documentation is available at MenuItemLinkWithAdditionalHtml.class.php

  1. <?php
  2.  
  3. /**
  4. * The <code>MenuItemLink</code> class is an extension of the <code>MenuItem</code>
  5. * interface adding support for attaching extra data like URL, target window, an
  6. * access key (shortcut), a toolTip, etc.
  7. * <br /><br />
  8. * <code>MenuItem</code> is an extension of <code>Component</code>; <code>MenuItems</code>
  9. * have display names and the ability to be added to <code>Menu</code> objects.
  10. *
  11. * @package harmoni.gui.components
  12. *
  13. * @copyright Copyright &copy; 2005, Middlebury College
  14. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  15. *
  16. * @version $Id: MenuItemLinkWithAdditionalHtml.class.php,v 1.2 2007/09/04 20:25:22 adamfranco Exp $
  17. */
  18. class MenuItemLinkWithAdditionalHtml
  19. extends MenuItemLink
  20. /* implements MenuItemInterface */
  21. {
  22. /**
  23. * @var string $_additionalHtml; <##>
  24. * @access private
  25. * @since 1/24/06
  26. */
  27. var $_additionalHtml;
  28. /**
  29. * The constructor.
  30. * @param string displayName The display name of this menu item.
  31. * @param string url The url of this menu item.
  32. * @param boolean selected The selected state of this menu item.
  33. * @param integer index The index of this component. The index has no semantic meaning:
  34. * you can think of the index as 'level' of the component. Alternatively,
  35. * the index could serve as means of distinguishing between components with
  36. * the same type. Most often one would use the index in conjunction with
  37. * the <code>getStylesForComponentType()</code> and
  38. * <code>addStyleForComponentType()</code> methods.
  39. * @param string target The target window of this menu item.
  40. * @param string accessKey The access key (shortcut) of this menu item.
  41. * @param string toolTip The toolTip of this menu item.
  42. * @access public
  43. ***/
  44. function MenuItemLinkWithAdditionalHtml($displayName, $url, $selected,
  45. $index, $target = null, $accessKey = null, $toolTip = null,
  46. $additionalHtml = '')
  47. {
  48. ArgumentValidator::validate($additionalHtml, StringValidatorRule::getRule());
  49. // ** end of parameter validation
  50. $this->_additionalHtml = $additionalHtml;
  51. $this->MenuItemLink($displayName, $url, $selected, $index, $target,
  52. $accessKey, $toolTip);
  53. }
  54.  
  55. /**
  56. * Renders the component on the screen.
  57. * @param ref object theme The Theme object to use in producing the result
  58. * of this method.
  59. * @param string tabs This is a string (normally a bunch of tabs) that will be
  60. * prepended to each text line. This argument is optional but its usage is highly
  61. * recommended in order to produce a nicely formatted HTML output.
  62. * @access public
  63. ***/
  64. function render($theme, $tabs = "") {
  65. echo $tabs."<table width='100%'><tr><td valign='top'>\n";
  66. // pre-html
  67. echo $this->getPreHTML($theme, $tabs);
  68. // the url
  69. echo $tabs."\t<a href=\"$this->_url\"";
  70. // the target window
  71. if (isset($this->_target))
  72. echo " target=\"$this->_target\"";
  73. // the access key (shortcut)
  74. if (isset($this->_accessKey))
  75. echo " accesskey=\"$this->_accessKey\"";
  76. // the tooltip
  77. if (isset($this->_toolTip))
  78. echo " title=\"$this->_toolTip\"";
  79. // any additional attributes
  80. foreach ($this->_attributes as $attribute => $value)
  81. echo " $attribute=\"$value\"";
  82. echo ">";
  83. // the display name
  84. echo $this->_displayName;
  85. echo "</a>\n";
  86. // post-html
  87. echo $this->getPostHTML($theme, $tabs);
  88. echo $tabs."</td><td valign='top'>\n";
  89. echo $tabs."\t".$this->_additionalHtml."\n";
  90. echo $tabs."</td></tr></table>\n";
  91. }
  92. }
  93.  
  94. ?>

Documentation generated on Wed, 19 Sep 2007 10:25:02 -0400 by phpDocumentor 1.3.0RC3