Source for file UnstyledBlock.class.php

Documentation is available at UnstyledBlock.class.php

  1. <?php
  2.  
  3. require_once(HARMONI."GUIManager/Component.class.php");
  4.  
  5. /**
  6. * This is a simple implementation of a Block component. Block components are
  7. * very simple, and in reality do not differ much from the generic component.
  8. * Blocks are capable of storing an arbitrary content (string) and naturally have
  9. * their type set to <code>BLOCK</code>. Unlike the generic component, the content
  10. * of Blocks is required.
  11. * <br /><br />
  12. * <code>Components</code> are the basic units that can be displayed on
  13. * the screen. The main method <code>render()</code> which renders the component
  14. * on the screen.
  15. *
  16. * @package harmoni.gui.components
  17. *
  18. * @copyright Copyright &copy; 2005, Middlebury College
  19. * @license http://www.gnu.org/copyleft/gpl.html GNU General Public License (GPL)
  20. *
  21. * @version $Id: UnstyledBlock.class.php,v 1.1 2005/11/30 21:32:51 adamfranco Exp $
  22. */
  23. class UnstyledBlock extends Component {
  24.  
  25. /**
  26. * The constructor.
  27. * @access public
  28. * @param string content This is an arbitrary string that will be printed,
  29. * whenever the user calls the <code>render()</code> method. The parameter
  30. * is required.
  31. * @param integer index The index of this component. The index has no semantic meaning:
  32. * you can think of the index as 'level' of the component. Alternatively,
  33. * the index could serve as means of distinguishing between components with
  34. * the same type. Most often one would use the index in conjunction with
  35. * the <code>getStylesForComponentType()</code> and
  36. * <code>addStyleForComponentType()</code> methods.
  37. * @param optional object StyleCollections styles,... Zero, one, or more StyleCollection
  38. * objects that will be added to the newly created Component. Warning, this will
  39. * result in copying the objects instead of referencing them as using
  40. * <code>addStyle()</code> would do.
  41. ***/
  42. function UnstyledBlock($content, $index = 1) {
  43. // ** parameter validation
  44. ArgumentValidator::validate($content, StringValidatorRule::getRule(), true);
  45. // ** end of parameter validation
  46.  
  47. $this->Component($content, BLANK, $index);
  48. // if there are style collections to add
  49. if (func_num_args() > 2)
  50. for ($i = 2; $i < func_num_args(); $i++)
  51. $this->addStyle(func_get_arg($i));
  52. }
  53.  
  54. }
  55.  
  56. ?>

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